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

Unified Diff: url/url_canon_icu.cc

Issue 250233002: Remove url::ReadUTFChar's dependency on icu. Use base instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix include order Created 6 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
« no previous file with comments | « no previous file | url/url_canon_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_canon_icu.cc
===================================================================
--- url/url_canon_icu.cc (revision 266896)
+++ url/url_canon_icu.cc (working copy)
@@ -184,47 +184,4 @@
}
}
-bool ReadUTFChar(const char* str, int* begin, int length,
- unsigned* code_point_out) {
- int code_point; // Avoids warning when U8_NEXT writes -1 to it.
- U8_NEXT(str, *begin, length, code_point);
- *code_point_out = static_cast<unsigned>(code_point);
-
- // The ICU macro above moves to the next char, we want to point to the last
- // char consumed.
- (*begin)--;
-
- // Validate the decoded value.
- if (U_IS_UNICODE_CHAR(code_point))
- return true;
- *code_point_out = kUnicodeReplacementCharacter;
- return false;
-}
-
-bool ReadUTFChar(const base::char16* str, int* begin, int length,
- unsigned* code_point) {
- if (U16_IS_SURROGATE(str[*begin])) {
- if (!U16_IS_SURROGATE_LEAD(str[*begin]) || *begin + 1 >= length ||
- !U16_IS_TRAIL(str[*begin + 1])) {
- // Invalid surrogate pair.
- *code_point = kUnicodeReplacementCharacter;
- return false;
- } else {
- // Valid surrogate pair.
- *code_point = U16_GET_SUPPLEMENTARY(str[*begin], str[*begin + 1]);
- (*begin)++;
- }
- } else {
- // Not a surrogate, just one 16-bit word.
- *code_point = str[*begin];
- }
-
- if (U_IS_UNICODE_CHAR(*code_point))
- return true;
-
- // Invalid code point.
- *code_point = kUnicodeReplacementCharacter;
- return false;
-}
-
} // namespace url
« no previous file with comments | « no previous file | url/url_canon_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698