summaryrefslogtreecommitdiffstats
path: root/base/json
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 19:28:44 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 19:28:44 +0000
commit528c56de01bbbd38788ed6cf8d2eea4c56cbe19e (patch)
treeac4f7a001affd772c4ab89701d3d46109b5f9e19 /base/json
parent5c86ada8d84f6e67d17b027d347052ef451241c4 (diff)
downloadchromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.zip
chromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.tar.gz
chromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.tar.bz2
Move the number conversions from string_util to a new file.
Use the base namespace in the new file. Update callers. I removed all wstring variants and also the string->number ones that ignore the return value. That encourages people to write code and forget about error handling. TEST=included unit tests BUG=none Review URL: http://codereview.chromium.org/3056029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json')
-rw-r--r--base/json/json_reader.cc5
-rw-r--r--base/json/json_writer.cc1
2 files changed, 4 insertions, 2 deletions
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index cf9ce02..1255ac5 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -7,6 +7,7 @@
#include "base/float_util.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
+#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -401,11 +402,11 @@ Value* JSONReader::DecodeNumber(const Token& token) {
const std::wstring num_string(token.begin, token.length);
int num_int;
- if (StringToInt(WideToUTF16Hack(num_string), &num_int))
+ if (StringToInt(WideToUTF8(num_string), &num_int))
return Value::CreateIntegerValue(num_int);
double num_double;
- if (StringToDouble(WideToUTF16Hack(num_string), &num_double) &&
+ if (StringToDouble(WideToUTF8(num_string), &num_double) &&
base::IsFinite(num_double))
return Value::CreateRealValue(num_double);
diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc
index ffdad76..fa43953 100644
--- a/base/json/json_writer.cc
+++ b/base/json/json_writer.cc
@@ -7,6 +7,7 @@
#include "base/json/string_escape.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/string_number_conversions.h"
#include "base/values.h"
#include "base/utf_string_conversions.h"