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

Unified Diff: base/string_util.cc

Issue 10035042: Rewrite base::JSONReader to be 35-40% faster, depending on the input string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments/fix Win Created 8 years, 8 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
Index: base/string_util.cc
diff --git a/base/string_util.cc b/base/string_util.cc
index 2b9e1bcda47743f7a823954442799e7d9b345af7..0c7701c25edc58ffc74c1b9d25d186b399c6f4ef 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -475,8 +475,15 @@ bool IsStringUTF8(const std::string& str) {
while (char_index < src_len) {
int32 code_point;
CBU8_NEXT(src, char_index, src_len, code_point);
- if (!base::IsValidCharacter(code_point))
- return false;
+ if (!base::IsValidCharacter(code_point)) {
+ for (size_t i = 0; i < str.length(); ++i) {
Mark Mentovai 2012/05/08 20:19:41 Dump the debugging code.
Robert Sesek 2012/05/15 16:57:51 Done.
+ printf("0x%x ", str[i]);
+ }
+ printf("\n");
+ LOG(INFO) << "STRING = <<<" << str << ">>>";
+ LOG(INFO) << "**** char_index = " << char_index << " // " << code_point;
+ return false;
+ }
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698