Skip to content
Snippets Groups Projects
Commit 348a6a7e authored by DarkGod's avatar DarkGod
Browse files

fs:readLine() correctly consumes \r\n

parent b4c8256f
No related branches found
No related tags found
No related merge requests found
......@@ -166,8 +166,11 @@ static int lua_file_readline(lua_State *L)
bufsize--; /* allow for null terminating char */
while ((total < bufsize) && (PHYSFS_read(*f, ptr, 1, 1) == 1))
{
if ((*ptr == '\r') || (*ptr == '\n'))
if (*ptr == '\n')
{
if ((total > 0) && (*(ptr-1) == '\r')) *(ptr-1) = '\0';
break;
}
ptr++;
total++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment