Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1238)

Unified Diff: base/json/json_parser.cc

Issue 12026035: Recognize "\r\n" line endings in base::JSONParser to report correct line numbers in errors (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | base/json/json_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser.cc
===================================================================
--- base/json/json_parser.cc (revision 180607)
+++ base/json/json_parser.cc (working copy)
@@ -404,7 +404,9 @@
case '\r':
case '\n':
index_last_line_ = index_;
- ++line_number_;
+ // Don't increment line_number_ twice for "\r\n".
+ if (!(*pos_ == '\n' && pos_ > start_pos_ && *(pos_ - 1) == '\r'))
+ ++line_number_;
// Fall through.
case ' ':
case '\t':
« no previous file with comments | « AUTHORS ('k') | base/json/json_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698