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

Side by Side Diff: url/url_canon_icu.cc

Issue 1230093002: Get a descriptive error name from ICU Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « net/base/net_util_icu.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // ICU integration functions. 5 // ICU integration functions.
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "third_party/icu/source/common/unicode/ucnv.h" 12 #include "third_party/icu/source/common/unicode/ucnv.h"
13 #include "third_party/icu/source/common/unicode/ucnv_cb.h" 13 #include "third_party/icu/source/common/unicode/ucnv_cb.h"
14 #include "third_party/icu/source/common/unicode/uidna.h" 14 #include "third_party/icu/source/common/unicode/uidna.h"
15 #include "third_party/icu/source/common/unicode/utypes.h"
15 #include "url/url_canon_icu.h" 16 #include "url/url_canon_icu.h"
16 #include "url/url_canon_internal.h" // for _itoa_s 17 #include "url/url_canon_internal.h" // for _itoa_s
17 18
18 namespace url { 19 namespace url {
19 20
20 namespace { 21 namespace {
21 22
22 // Called when converting a character that can not be represented, this will 23 // Called when converting a character that can not be represented, this will
23 // append an escaped version of the numerical character reference for that code 24 // append an escaped version of the numerical character reference for that code
24 // point. It is of the form "&#1234;" and we will escape the non-digits to 25 // point. It is of the form "&#1234;" and we will escape the non-digits to
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // http://goo.gl/3XBhqw ). 94 // http://goo.gl/3XBhqw ).
94 // See http://http://unicode.org/reports/tr46/ and references therein 95 // See http://http://unicode.org/reports/tr46/ and references therein
95 // for more details. 96 // for more details.
96 struct UIDNAWrapper { 97 struct UIDNAWrapper {
97 UIDNAWrapper() { 98 UIDNAWrapper() {
98 UErrorCode err = U_ZERO_ERROR; 99 UErrorCode err = U_ZERO_ERROR;
99 // TODO(jungshik): Change options as different parties (browsers, 100 // TODO(jungshik): Change options as different parties (browsers,
100 // registrars, search engines) converge toward a consensus. 101 // registrars, search engines) converge toward a consensus.
101 value = uidna_openUTS46(UIDNA_CHECK_BIDI, &err); 102 value = uidna_openUTS46(UIDNA_CHECK_BIDI, &err);
102 if (U_FAILURE(err)) { 103 if (U_FAILURE(err)) {
103 CHECK(false) << "failed to open UTS46 data with error: " << err; 104 CHECK(false) << "failed to open UTS46 data with error: "
105 << u_errorName(err);
104 value = NULL; 106 value = NULL;
105 } 107 }
106 } 108 }
107 109
108 UIDNA* value; 110 UIDNA* value;
109 }; 111 };
110 112
111 } // namespace 113 } // namespace
112 114
113 ICUCharsetConverter::ICUCharsetConverter(UConverter* converter) 115 ICUCharsetConverter::ICUCharsetConverter(UConverter* converter)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // if necessary. 182 // if necessary.
181 if (err != U_BUFFER_OVERFLOW_ERROR || info.errors != 0) 183 if (err != U_BUFFER_OVERFLOW_ERROR || info.errors != 0)
182 return false; // Unknown error, give up. 184 return false; // Unknown error, give up.
183 185
184 // Not enough room in our buffer, expand. 186 // Not enough room in our buffer, expand.
185 output->Resize(output_length); 187 output->Resize(output_length);
186 } 188 }
187 } 189 }
188 190
189 } // namespace url 191 } // namespace url
OLDNEW
« no previous file with comments | « net/base/net_util_icu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698