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

Unified Diff: url/url_canon_internal.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 | « url/url_canon_internal.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_canon_internal.cc
===================================================================
--- url/url_canon_internal.cc (revision 266896)
+++ url/url_canon_internal.cc (working copy)
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "url/url_canon_internal.h"
+
#include <errno.h>
#include <stdlib.h>
#include <cstdio>
#include <string>
-#include "url/url_canon_internal.h"
+#include "base/strings/utf_string_conversion_utils.h"
namespace url {
@@ -245,6 +247,32 @@
source, length, type, output);
}
+bool ReadUTFChar(const char* str, int* begin, int length,
+ unsigned* code_point_out) {
+ // This depends on ints and int32s being the same thing. If they're not, it
+ // will fail to compile.
+ // TODO(mmenke): This should probably be fixed.
+ if (!base::ReadUnicodeCharacter(str, length, begin, code_point_out) ||
+ !base::IsValidCharacter(*code_point_out)) {
+ *code_point_out = kUnicodeReplacementCharacter;
+ return false;
+ }
+ return true;
+}
+
+bool ReadUTFChar(const base::char16* str, int* begin, int length,
+ unsigned* code_point_out) {
+ // This depends on ints and int32s being the same thing. If they're not, it
+ // will fail to compile.
+ // TODO(mmenke): This should probably be fixed.
+ if (!base::ReadUnicodeCharacter(str, length, begin, code_point_out) ||
+ !base::IsValidCharacter(*code_point_out)) {
+ *code_point_out = kUnicodeReplacementCharacter;
+ return false;
+ }
+ return true;
+}
+
void AppendInvalidNarrowString(const char* spec, int begin, int end,
CanonOutput* output) {
DoAppendInvalidNarrowString<char, unsigned char>(spec, begin, end, output);
« no previous file with comments | « url/url_canon_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698