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

Side by Side Diff: base/json/json_parser.cc

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/json/json_writer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 } 925 }
926 case 'n': { 926 case 'n': {
927 const char kNullLiteral[] = "null"; 927 const char kNullLiteral[] = "null";
928 const int kNullLen = static_cast<int>(strlen(kNullLiteral)); 928 const int kNullLen = static_cast<int>(strlen(kNullLiteral));
929 if (!CanConsume(kNullLen - 1) || 929 if (!CanConsume(kNullLen - 1) ||
930 !StringsAreEqual(pos_, kNullLiteral, kNullLen)) { 930 !StringsAreEqual(pos_, kNullLiteral, kNullLen)) {
931 ReportError(JSONReader::JSON_SYNTAX_ERROR, 1); 931 ReportError(JSONReader::JSON_SYNTAX_ERROR, 1);
932 return NULL; 932 return NULL;
933 } 933 }
934 NextNChars(kNullLen - 1); 934 NextNChars(kNullLen - 1);
935 return Value::CreateNullValue(); 935 return Value::CreateNullValue().release();
936 } 936 }
937 default: 937 default:
938 ReportError(JSONReader::JSON_UNEXPECTED_TOKEN, 1); 938 ReportError(JSONReader::JSON_UNEXPECTED_TOKEN, 1);
939 return NULL; 939 return NULL;
940 } 940 }
941 } 941 }
942 942
943 // static 943 // static
944 bool JSONParser::StringsAreEqual(const char* one, const char* two, size_t len) { 944 bool JSONParser::StringsAreEqual(const char* one, const char* two, size_t len) {
945 return strncmp(one, two, len) == 0; 945 return strncmp(one, two, len) == 0;
(...skipping 11 matching lines...) Expand all
957 const std::string& description) { 957 const std::string& description) {
958 if (line || column) { 958 if (line || column) {
959 return StringPrintf("Line: %i, column: %i, %s", 959 return StringPrintf("Line: %i, column: %i, %s",
960 line, column, description.c_str()); 960 line, column, description.c_str());
961 } 961 }
962 return description; 962 return description;
963 } 963 }
964 964
965 } // namespace internal 965 } // namespace internal
966 } // namespace base 966 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/json/json_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698