diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 15:58:31 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 15:58:31 +0000 |
commit | 15f2283fa979bebfef4312a2d10bb951e64fc864 (patch) | |
tree | e4cb4ee765541b0e384ce3baedcb5fd718b2005c /url/url_canon_icu.cc | |
parent | bc80973ac4906e1a04851b086f0a96863d0fec78 (diff) | |
download | chromium_src-15f2283fa979bebfef4312a2d10bb951e64fc864.zip chromium_src-15f2283fa979bebfef4312a2d10bb951e64fc864.tar.gz chromium_src-15f2283fa979bebfef4312a2d10bb951e64fc864.tar.bz2 |
Remove url::ReadUTFChar's dependency on icu. Use base instead.
BUG=362608
Review URL: https://codereview.chromium.org/250233002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267800 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url/url_canon_icu.cc')
-rw-r--r-- | url/url_canon_icu.cc | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/url/url_canon_icu.cc b/url/url_canon_icu.cc index d53d7cc..741bed2 100644 --- a/url/url_canon_icu.cc +++ b/url/url_canon_icu.cc @@ -184,47 +184,4 @@ bool IDNToASCII(const base::char16* src, int src_len, CanonOutputW* output) { } } -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 |