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

Side by Side Diff: base/json/json_reader.cc

Issue 441008: Many changes to DictionaryValues:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/json/json_reader_unittest.cc » ('j') | base/values.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 6
7 #include "base/float_util.h" 7 #include "base/float_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 json_pos_ += token.length; 274 json_pos_ += token.length;
275 token = ParseToken(); 275 token = ParseToken();
276 if (token.type != Token::OBJECT_PAIR_SEPARATOR) 276 if (token.type != Token::OBJECT_PAIR_SEPARATOR)
277 return NULL; 277 return NULL;
278 278
279 json_pos_ += token.length; 279 json_pos_ += token.length;
280 token = ParseToken(); 280 token = ParseToken();
281 Value* dict_value = BuildValue(false); 281 Value* dict_value = BuildValue(false);
282 if (!dict_value) 282 if (!dict_value)
283 return NULL; 283 return NULL;
284 static_cast<DictionaryValue*>(node.get())->Set(dict_key, dict_value); 284 static_cast<DictionaryValue*>(node.get())->SetWithoutPathExpansion(
285 dict_key, dict_value);
285 286
286 // After a key/value pair, we expect a comma or the end of the 287 // After a key/value pair, we expect a comma or the end of the
287 // object. 288 // object.
288 token = ParseToken(); 289 token = ParseToken();
289 if (token.type == Token::LIST_SEPARATOR) { 290 if (token.type == Token::LIST_SEPARATOR) {
290 json_pos_ += token.length; 291 json_pos_ += token.length;
291 token = ParseToken(); 292 token = ParseToken();
292 // Trailing commas are invalid according to the JSON RFC, but some 293 // Trailing commas are invalid according to the JSON RFC, but some
293 // consumers need the parsing leniency, so handle accordingly. 294 // consumers need the parsing leniency, so handle accordingly.
294 if (token.type == Token::OBJECT_END) { 295 if (token.type == Token::OBJECT_END) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 column_number = 1; 634 column_number = 1;
634 } else { 635 } else {
635 ++column_number; 636 ++column_number;
636 } 637 }
637 } 638 }
638 639
639 error_message_ = FormatErrorMessage(line_number, column_number, description); 640 error_message_ = FormatErrorMessage(line_number, column_number, description);
640 } 641 }
641 642
642 } // namespace base 643 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/json/json_reader_unittest.cc » ('j') | base/values.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698