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

Unified Diff: base/json/json_parser.cc

Issue 632103004: Cleanup: Better constify some strings in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad refactoring Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser.cc
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index a74da5f275dba50c0db278486447247eed29ddc5..5e59a468b3f9222ed4a93200c1987c3062dc8b77 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -901,7 +901,7 @@ bool JSONParser::ReadInt(bool allow_leading_zeros) {
Value* JSONParser::ConsumeLiteral() {
switch (*pos_) {
case 't': {
- const char* kTrueLiteral = "true";
+ const char kTrueLiteral[] = "true";
const int kTrueLen = static_cast<int>(strlen(kTrueLiteral));
if (!CanConsume(kTrueLen - 1) ||
!StringsAreEqual(pos_, kTrueLiteral, kTrueLen)) {
@@ -912,7 +912,7 @@ Value* JSONParser::ConsumeLiteral() {
return new FundamentalValue(true);
}
case 'f': {
- const char* kFalseLiteral = "false";
+ const char kFalseLiteral[] = "false";
const int kFalseLen = static_cast<int>(strlen(kFalseLiteral));
if (!CanConsume(kFalseLen - 1) ||
!StringsAreEqual(pos_, kFalseLiteral, kFalseLen)) {
@@ -923,7 +923,7 @@ Value* JSONParser::ConsumeLiteral() {
return new FundamentalValue(false);
}
case 'n': {
- const char* kNullLiteral = "null";
+ const char kNullLiteral[] = "null";
const int kNullLen = static_cast<int>(strlen(kNullLiteral));
if (!CanConsume(kNullLen - 1) ||
!StringsAreEqual(pos_, kNullLiteral, kNullLen)) {
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698