diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index cf105bbc3a..d345338bfe 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -107,7 +107,9 @@ static char *getaline(RFILE *file) newline = newline_tmp; } - newline[idx++] = in; + /* ignore MS line endings */ + if (in != '\r') + newline[idx++] = in; in = filestream_getc(file); } newline[idx] = '\0'; diff --git a/playlist.c b/playlist.c index 7406e75df0..1911fb799e 100644 --- a/playlist.c +++ b/playlist.c @@ -519,10 +519,10 @@ static bool playlist_read_file( /* Read playlist entry and terminate string with NUL character * regardless of Windows or Unix line endings */ - if((last = strrchr(buf[i], '\r'))) - *last = '\0'; - else if((last = strrchr(buf[i], '\n'))) - *last = '\0'; + if((last = strrchr(buf[i], '\r'))) + *last = '\0'; + else if((last = strrchr(buf[i], '\n'))) + *last = '\0'; } entry = &playlist->entries[playlist->size];