Merge pull request #152 from Liuchang0812/master

fix: Consider Windows-style LRLF in flag parsing
This commit is contained in:
Andreas Schuh 2016-06-28 12:15:02 +01:00 committed by GitHub
commit 546819b1d9

View file

@ -1278,7 +1278,11 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
for (; line_end; flagfile_contents = line_end + 1) {
while (*flagfile_contents && isspace(*flagfile_contents))
++flagfile_contents;
line_end = strchr(flagfile_contents, '\n');
// Windows uses "\r\n"
line_end = strchr(flagfile_contents, '\r');
if (line_end == NULL)
line_end = strchr(flagfile_contents, '\n');
size_t len = line_end ? line_end - flagfile_contents
: strlen(flagfile_contents);
string line(flagfile_contents, len);