Commit 0064b01a authored by topjohnwu's avatar topjohnwu

Trim out \r from string

Fix #3490
parent 1469b82a
...@@ -340,7 +340,7 @@ void file_readline(bool trim, const char *file, const function<bool(string_view) ...@@ -340,7 +340,7 @@ void file_readline(bool trim, const char *file, const function<bool(string_view)
while ((read = getline(&buf, &len, fp)) >= 0) { while ((read = getline(&buf, &len, fp)) >= 0) {
start = buf; start = buf;
if (trim) { if (trim) {
while (read && (buf[read - 1] == '\n' || buf[read - 1] == ' ')) while (read && "\n\r "sv.find(buf[read - 1]) != string::npos)
--read; --read;
buf[read] = '\0'; buf[read] = '\0';
while (*start == ' ') while (*start == ' ')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment