summaryrefslogtreecommitdiffstats
path: root/base/json
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 07:44:09 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 07:44:09 +0000
commitfb0777a30c7ea5962628f4f1b61feead00f5292f (patch)
tree4dc906371f6a9f76d7871099c1ad7079bf19018a /base/json
parentf3c4110306e43edd8102f5f39763d46166753577 (diff)
downloadchromium_src-fb0777a30c7ea5962628f4f1b61feead00f5292f.zip
chromium_src-fb0777a30c7ea5962628f4f1b61feead00f5292f.tar.gz
chromium_src-fb0777a30c7ea5962628f4f1b61feead00f5292f.tar.bz2
Clarify the interface of JSONStringValueSerializer::Deserialize which can only return JSONParseError codes as an error_code.
Also make sure JsonParseError codes do not go beyond JsonFileError codes which are used in conjunction for JSONFileValueSerializer. Review URL: https://codereview.chromium.org/71653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json')
-rw-r--r--base/json/json_reader.cc4
-rw-r--r--base/json/json_reader.h1
-rw-r--r--base/json/json_string_value_serializer.h2
3 files changed, 6 insertions, 1 deletions
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index 593273e..cbf6c99 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -9,6 +9,10 @@
namespace base {
+// Values 1000 and above are used by JSONFileValueSerializer::JsonFileError.
+COMPILE_ASSERT(JSONReader::JSON_PARSE_ERROR_COUNT < 1000,
+ json_reader_error_out_of_bounds);
+
const char* JSONReader::kInvalidEscape =
"Invalid escape sequence.";
const char* JSONReader::kSyntaxError =
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index e602846..9b30687 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -73,6 +73,7 @@ class BASE_EXPORT JSONReader {
JSON_UNEXPECTED_DATA_AFTER_ROOT,
JSON_UNSUPPORTED_ENCODING,
JSON_UNQUOTED_DICTIONARY_KEY,
+ JSON_PARSE_ERROR_COUNT
};
// String versions of parse error codes.
diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h
index 8aa3f95..014ef9f 100644
--- a/base/json/json_string_value_serializer.h
+++ b/base/json/json_string_value_serializer.h
@@ -47,7 +47,7 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer {
// Attempt to deserialize the data structure encoded in the string passed
// in to the constructor into a structure of Value objects. If the return
// value is NULL, and if |error_code| is non-null, |error_code| will
- // contain an integer error code (either JsonFileError or JsonParseError).
+ // contain an integer error code (a JsonParseError in this case).
// If |error_message| is non-null, it will be filled in with a formatted
// error message including the location of the error if appropriate.
// The caller takes ownership of the returned value.