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

Side by Side Diff: base/json_reader.cc

Issue 11423: Remove the locale parameter from the StringToDouble and (Closed)
Patch Set: more comments 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
« no previous file with comments | « no previous file | base/json_reader_unittest.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 (base::StringToDouble(num_string, &num_double, base::LOCALE_INDEPENDENT) && 332 if (StringToDouble(num_string, &num_double) && base::IsFinite(num_double)) {
333 base::IsFinite(num_double)) {
334 *node = Value::CreateRealValue(num_double); 333 *node = Value::CreateRealValue(num_double);
335 return true; 334 return true;
336 } 335 }
337 336
338 return false; 337 return false;
339 } 338 }
340 339
341 JSONReader::Token JSONReader::ParseStringToken() { 340 JSONReader::Token JSONReader::ParseStringToken() {
342 Token token(Token::STRING, json_pos_, 1); 341 Token token(Token::STRING, json_pos_, 1);
343 wchar_t c = token.NextChar(); 342 wchar_t c = token.NextChar();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 default: 575 default:
577 ++json_pos_; 576 ++json_pos_;
578 } 577 }
579 } 578 }
580 } else { 579 } else {
581 return false; 580 return false;
582 } 581 }
583 return true; 582 return true;
584 } 583 }
585 584
OLDNEW
« no previous file with comments | « no previous file | base/json_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698