| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |