IniFile: don't lose last character if the file doesn't end with \r\n

This commit is contained in:
Kevin Smyth 2018-12-20 09:19:04 -06:00 committed by Stanislav Motylkov
parent 326551985f
commit a5c64a4331

View File

@ -127,7 +127,12 @@ DWORD INI_FILE::GetFileStringFromNum(DWORD StringNumber, char *RetString, DWORD
for (DWORD i = FileStringsMap[StringNumber]; i < FileSize; i++) for (DWORD i = FileStringsMap[StringNumber]; i < FileSize; i++)
{ {
if ((FileRaw[i] == '\r' && FileRaw[i + 1] == '\n') || i == (FileSize - 1)) if (i == (FileSize - 1))
{
EndStringPos = FileSize;
break;
}
if (FileRaw[i] == '\r' && FileRaw[i + 1] == '\n')
{ {
EndStringPos = i; EndStringPos = i;
break; break;