| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_parser.h" | 5 #include "base/json/json_parser.h" |
| 6 | 6 |
| 7 #include "base/float_util.h" | 7 #include <cmath> |
| 8 |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversion_utils.h" | 15 #include "base/strings/utf_string_conversion_utils.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/third_party/icu/icu_utf.h" | 17 #include "base/third_party/icu/icu_utf.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 index_ = exit_index; | 866 index_ = exit_index; |
| 866 | 867 |
| 867 StringPiece num_string(num_start, end_index - start_index); | 868 StringPiece num_string(num_start, end_index - start_index); |
| 868 | 869 |
| 869 int num_int; | 870 int num_int; |
| 870 if (StringToInt(num_string, &num_int)) | 871 if (StringToInt(num_string, &num_int)) |
| 871 return new FundamentalValue(num_int); | 872 return new FundamentalValue(num_int); |
| 872 | 873 |
| 873 double num_double; | 874 double num_double; |
| 874 if (base::StringToDouble(num_string.as_string(), &num_double) && | 875 if (base::StringToDouble(num_string.as_string(), &num_double) && |
| 875 IsFinite(num_double)) { | 876 std::isfinite(num_double)) { |
| 876 return new FundamentalValue(num_double); | 877 return new FundamentalValue(num_double); |
| 877 } | 878 } |
| 878 | 879 |
| 879 return NULL; | 880 return NULL; |
| 880 } | 881 } |
| 881 | 882 |
| 882 bool JSONParser::ReadInt(bool allow_leading_zeros) { | 883 bool JSONParser::ReadInt(bool allow_leading_zeros) { |
| 883 char first = *pos_; | 884 char first = *pos_; |
| 884 int len = 0; | 885 int len = 0; |
| 885 | 886 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 const std::string& description) { | 957 const std::string& description) { |
| 957 if (line || column) { | 958 if (line || column) { |
| 958 return StringPrintf("Line: %i, column: %i, %s", | 959 return StringPrintf("Line: %i, column: %i, %s", |
| 959 line, column, description.c_str()); | 960 line, column, description.c_str()); |
| 960 } | 961 } |
| 961 return description; | 962 return description; |
| 962 } | 963 } |
| 963 | 964 |
| 964 } // namespace internal | 965 } // namespace internal |
| 965 } // namespace base | 966 } // namespace base |
| OLD | NEW |