From df2404b6a55737aa85e469386b676bcea16e995e Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 20 Nov 2018 11:29:17 +0100 Subject: [PATCH] VmaReplay: Added support for Windows end of lines. --- src/VmaReplay/Common.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/VmaReplay/Common.cpp b/src/VmaReplay/Common.cpp index c324245..515c1ce 100644 --- a/src/VmaReplay/Common.cpp +++ b/src/VmaReplay/Common.cpp @@ -12,6 +12,11 @@ bool LineSplit::GetNextLine(StrRange& out) while(currLineEnd < m_NumBytes && m_Data[currLineEnd] != '\n') ++currLineEnd; out.end = m_Data + currLineEnd; + // Ignore trailing '\r' to support Windows end of line. + if(out.end > out.beg && *(out.end - 1) == '\r') + { + --out.end; + } m_NextLineBeg = currLineEnd + 1; // Past '\n' ++m_NextLineIndex; return true;