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

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

Issue 6997006: iwyu: Include stringprintf.h where appropriate, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_reader.h" 5 #include "base/json/json_reader.h"
6 6
7 #include "base/float_util.h" 7 #include "base/float_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stringprintf.h"
10 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 15
15 namespace base { 16 namespace base {
16 17
17 static const JSONReader::Token kInvalidToken(JSONReader::Token::INVALID_TOKEN, 18 static const JSONReader::Token kInvalidToken(JSONReader::Token::INVALID_TOKEN,
18 0, 0); 19 0, 0);
19 static const int kStackLimit = 100; 20 static const int kStackLimit = 100;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (error_code_ == 0) 183 if (error_code_ == 0)
183 SetErrorCode(JSON_SYNTAX_ERROR, json_pos_); 184 SetErrorCode(JSON_SYNTAX_ERROR, json_pos_);
184 185
185 return NULL; 186 return NULL;
186 } 187 }
187 188
188 /* static */ 189 /* static */
189 std::string JSONReader::FormatErrorMessage(int line, int column, 190 std::string JSONReader::FormatErrorMessage(int line, int column,
190 const std::string& description) { 191 const std::string& description) {
191 if (line || column) { 192 if (line || column) {
192 return StringPrintf("Line: %i, column: %i, %s", 193 return base::StringPrintf(
193 line, column, description.c_str()); 194 "Line: %i, column: %i, %s", line, column, description.c_str());
194 } 195 }
195 return description; 196 return description;
196 } 197 }
197 198
198 Value* JSONReader::BuildValue(bool is_root) { 199 Value* JSONReader::BuildValue(bool is_root) {
199 ++stack_depth_; 200 ++stack_depth_;
200 if (stack_depth_ > kStackLimit) { 201 if (stack_depth_ > kStackLimit) {
201 SetErrorCode(JSON_TOO_MUCH_NESTING, json_pos_); 202 SetErrorCode(JSON_TOO_MUCH_NESTING, json_pos_);
202 return NULL; 203 return NULL;
203 } 204 }
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 ++column_number; 665 ++column_number;
665 } 666 }
666 } 667 }
667 668
668 error_line_ = line_number; 669 error_line_ = line_number;
669 error_col_ = column_number; 670 error_col_ = column_number;
670 error_code_ = error; 671 error_code_ = error;
671 } 672 }
672 673
673 } // namespace base 674 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698