summaryrefslogtreecommitdiff
path: root/base/json/json_reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/json/json_reader.cc')
-rw-r--r--base/json/json_reader.cc30
1 files changed, 9 insertions, 21 deletions
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index ad3ea98b31..3ab5f754b7 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -11,8 +11,8 @@
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);
+static_assert(JSONReader::JSON_PARSE_ERROR_COUNT < 1000,
+ "JSONReader error out of bounds");
const char JSONReader::kInvalidEscape[] =
"Invalid escape sequence.";
@@ -43,41 +43,25 @@ JSONReader::~JSONReader() {
}
// static
-Value* JSONReader::DeprecatedRead(const StringPiece& json) {
- return Read(json).release();
-}
-
-// static
scoped_ptr<Value> JSONReader::Read(const StringPiece& json) {
internal::JSONParser parser(JSON_PARSE_RFC);
return make_scoped_ptr(parser.Parse(json));
}
// static
-Value* JSONReader::DeprecatedRead(const StringPiece& json, int options) {
- return Read(json, options).release();
-}
-
-// static
scoped_ptr<Value> JSONReader::Read(const StringPiece& json, int options) {
internal::JSONParser parser(options);
return make_scoped_ptr(parser.Parse(json));
}
-// static
-Value* JSONReader::DeprecatedReadAndReturnError(const StringPiece& json,
- int options,
- int* error_code_out,
- std::string* error_msg_out) {
- return ReadAndReturnError(json, options, error_code_out, error_msg_out)
- .release();
-}
// static
scoped_ptr<Value> JSONReader::ReadAndReturnError(const StringPiece& json,
int options,
int* error_code_out,
- std::string* error_msg_out) {
+ std::string* error_msg_out,
+ int* error_line_out,
+ int* error_column_out) {
internal::JSONParser parser(options);
scoped_ptr<Value> root(parser.Parse(json));
if (!root) {
@@ -85,6 +69,10 @@ scoped_ptr<Value> JSONReader::ReadAndReturnError(const StringPiece& json,
*error_code_out = parser.error_code();
if (error_msg_out)
*error_msg_out = parser.GetErrorMessage();
+ if (error_line_out)
+ *error_line_out = parser.error_line();
+ if (error_column_out)
+ *error_column_out = parser.error_column();
}
return root;