Skip to content

Commit

Permalink
Improved buffer utilisation when File.Read() reaches end of buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexikos committed Nov 20, 2016
1 parent 333990e commit 5e5b6b0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/TextIO.cpp
Expand Up @@ -336,7 +336,14 @@ DWORD TextStream::Read(LPTSTR aBuf, DWORD aBufLen, int aNumLines)
aBuf[target_used++] = INVALID_CHAR;
}
} // end for-loop which processes buffered data.
mPos = src;
if (src == src_end)
{
// Reset the buffer so that Read() can read a full block.
mLength = 0;
mPos = NULL;
}
else
mPos = src;
} // end for-loop which repopulates the buffer.
if (target_used < aBufLen)
aBuf[target_used] = '\0';
Expand Down

0 comments on commit 5e5b6b0

Please sign in to comment.