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

Unified Diff: base/json/json_reader.cc

Issue 8962042: Add TYPE_INTEGER64 type to base::Value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/json/json_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.cc
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index bbaf5fb349bcf396d9fa26f6ba0269faac0d9315..c7f62bb6bf5752b3b423baa333386ecbe9f73f3a 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -4,6 +4,7 @@
#include "base/json/json_reader.h"
+#include "base/basictypes.h"
#include "base/float_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -390,14 +391,19 @@ JSONReader::Token JSONReader::ParseNumberToken() {
}
Value* JSONReader::DecodeNumber(const Token& token) {
- const std::wstring num_string(token.begin, token.length);
+ const std::wstring num_wstring(token.begin, token.length);
+ const std::string& num_string(WideToUTF8(num_wstring));
int num_int;
- if (StringToInt(WideToUTF8(num_string), &num_int))
+ if (StringToInt(num_string, &num_int))
return Value::CreateIntegerValue(num_int);
+ int64 num_int64;
+ if (StringToInt64(num_string, &num_int64))
+ return Value::CreateInteger64Value(num_int64);
+
double num_double;
- if (StringToDouble(WideToUTF8(num_string), &num_double) &&
+ if (StringToDouble(num_string, &num_double) &&
base::IsFinite(num_double))
return Value::CreateDoubleValue(num_double);
« no previous file with comments | « no previous file | base/json/json_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698