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

Side by Side Diff: base/json_reader.cc

Issue 9509: Make unit_tests pass with pt_BR.UTF-8 locale. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « base/base_lib.scons ('k') | base/json_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_reader.h" 5 #include "base/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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool JSONReader::DecodeNumber(const Token& token, Value** node) { 322 bool JSONReader::DecodeNumber(const Token& token, Value** node) {
323 const std::wstring num_string(token.begin, token.length); 323 const std::wstring num_string(token.begin, token.length);
324 324
325 int num_int; 325 int num_int;
326 if (StringToInt(num_string, &num_int)) { 326 if (StringToInt(num_string, &num_int)) {
327 *node = Value::CreateIntegerValue(num_int); 327 *node = Value::CreateIntegerValue(num_int);
328 return true; 328 return true;
329 } 329 }
330 330
331 double num_double; 331 double num_double;
332 if (StringToDouble(num_string, &num_double) && base::IsFinite(num_double)) { 332 if (StringToDouble(num_string, &num_double, LOCALE_INDEPENDENT) &&
333 base::IsFinite(num_double)) {
333 *node = Value::CreateRealValue(num_double); 334 *node = Value::CreateRealValue(num_double);
334 return true; 335 return true;
335 } 336 }
336 337
337 return false; 338 return false;
338 } 339 }
339 340
340 JSONReader::Token JSONReader::ParseStringToken() { 341 JSONReader::Token JSONReader::ParseStringToken() {
341 Token token(Token::STRING, json_pos_, 1); 342 Token token(Token::STRING, json_pos_, 1);
342 wchar_t c = token.NextChar(); 343 wchar_t c = token.NextChar();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 default: 576 default:
576 ++json_pos_; 577 ++json_pos_;
577 } 578 }
578 } 579 }
579 } else { 580 } else {
580 return false; 581 return false;
581 } 582 }
582 return true; 583 return true;
583 } 584 }
584 585
OLDNEW
« no previous file with comments | « base/base_lib.scons ('k') | base/json_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698