From a8d6962ac2fbf5075ee5f58877d488eb74ed32df Mon Sep 17 00:00:00 2001 From: Mormegil Date: Tue, 14 Apr 2015 18:09:08 +0200 Subject: [PATCH] Tolerate DOS-style EOL in IDL line comments If an IDL file uses DOS-style EOLs (CR+LF), line comments need to ignore the second linebreak character, otherwise, as is currently the case, the parsed documentation comment includes a trailing `\r` character, which is then output verbatim into the output source code by flatc. Change-Id: I39591631995a980622d20a4a32315178b33f18f6 --- src/idl_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index f520c765a..9cc99d623 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -186,7 +186,7 @@ void Parser::Next() { case '/': if (*cursor_ == '/') { const char *start = ++cursor_; - while (*cursor_ && *cursor_ != '\n') cursor_++; + while (*cursor_ && *cursor_ != '\n' && *cursor_ != '\r') cursor_++; if (*start == '/') { // documentation comment if (cursor_ != source_ && !seen_newline) Error("a documentation comment should be on a line on its own");