1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
|
Description: use the system ICU UTF functions
We already depend on ICU, so it is useless to copy these functions here.
I checked the history of that directory, and other than the renames I am
undoing, there were no modifications at all.
Author: Kevin, Kofler
Origin: Fedora, https://src.fedoraproject.org/rpms/qt5-qtwebengine/blob/master/f/qtwebengine-everywhere-src-5.10.0-system-icu-utf.patch
Forwarded: not-needed
Reviewed-by: Sandro Knauß <hefee@debian.org>
Last-Update: 2018-07-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/3rdparty/chromium/base/BUILD.gn
+++ b/src/3rdparty/chromium/base/BUILD.gn
@@ -875,8 +875,6 @@ jumbo_component("base") {
"third_party/dmg_fp/dmg_fp.h",
"third_party/dmg_fp/dtoa_wrapper.cc",
"third_party/dmg_fp/g_fmt.cc",
- "third_party/icu/icu_utf.cc",
- "third_party/icu/icu_utf.h",
"third_party/superfasthash/superfasthash.c",
"threading/platform_thread.h",
"threading/platform_thread_android.cc",
@@ -1145,6 +1143,7 @@ jumbo_component("base") {
"//base/allocator:features",
"//base/third_party/dynamic_annotations",
"//third_party/modp_b64",
+ "//third_party/icu:icuuc",
]
public_deps = [
--- a/src/3rdparty/chromium/base/files/file_path.cc
+++ b/src/3rdparty/chromium/base/files/file_path.cc
@@ -18,7 +18,7 @@
#if defined(OS_MACOSX)
#include "base/mac/scoped_cftyperef.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
#endif
#if defined(OS_WIN)
@@ -1149,9 +1149,9 @@ inline int HFSReadNextNonIgnorableCodepo
int* index) {
int codepoint = 0;
while (*index < length && codepoint == 0) {
- // CBU8_NEXT returns a value < 0 in error cases. For purposes of string
+ // U8_NEXT returns a value < 0 in error cases. For purposes of string
// comparison, we just use that value and flag it with DCHECK.
- CBU8_NEXT(string, *index, length, codepoint);
+ U8_NEXT(string, *index, length, codepoint);
DCHECK_GT(codepoint, 0);
if (codepoint > 0) {
// Check if there is a subtable for this upper byte.
--- a/src/3rdparty/chromium/base/json/json_parser.cc
+++ b/src/3rdparty/chromium/base/json/json_parser.cc
@@ -17,7 +17,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
#include "base/values.h"
namespace base {
@@ -483,14 +483,14 @@ bool JSONParser::ConsumeStringRaw(String
// string character and the terminating closing quote.
while (CanConsume(2)) {
int start_index = index_;
- pos_ = start_pos_ + index_; // CBU8_NEXT is postcrement.
- CBU8_NEXT(start_pos_, index_, length, next_char);
+ pos_ = start_pos_ + index_; // U8_NEXT is postcrement.
+ U8_NEXT(start_pos_, index_, length, next_char);
if (next_char < 0 || !IsValidCharacter(next_char)) {
if ((options_ & JSON_REPLACE_INVALID_CHARACTERS) == 0) {
ReportError(JSONReader::JSON_UNSUPPORTED_ENCODING, 1);
return false;
}
- CBU8_NEXT(start_pos_, start_index, length, next_char);
+ U8_NEXT(start_pos_, start_index, length, next_char);
string.Convert();
string.AppendString(kUnicodeReplacementString,
arraysize(kUnicodeReplacementString) - 1);
@@ -498,7 +498,7 @@ bool JSONParser::ConsumeStringRaw(String
}
if (next_char == '"') {
- --index_; // Rewind by one because of CBU8_NEXT.
+ --index_; // Rewind by one because of U8_NEXT.
*out = std::move(string);
return true;
}
@@ -634,10 +634,10 @@ bool JSONParser::DecodeUTF16(std::string
// If this is a high surrogate, consume the next code unit to get the
// low surrogate.
- if (CBU16_IS_SURROGATE(code_unit16_high)) {
+ if (U16_IS_SURROGATE(code_unit16_high)) {
// Make sure this is the high surrogate. If not, it's an encoding
// error.
- if (!CBU16_IS_SURROGATE_LEAD(code_unit16_high))
+ if (!U16_IS_SURROGATE_LEAD(code_unit16_high))
return false;
// Make sure that the token has more characters to consume the
@@ -654,20 +654,20 @@ bool JSONParser::DecodeUTF16(std::string
NextNChars(3);
- if (!CBU16_IS_TRAIL(code_unit16_low)) {
+ if (!U16_IS_TRAIL(code_unit16_low)) {
return false;
}
uint32_t code_point =
- CBU16_GET_SUPPLEMENTARY(code_unit16_high, code_unit16_low);
+ U16_GET_SUPPLEMENTARY(code_unit16_high, code_unit16_low);
if (!IsValidCharacter(code_point))
return false;
offset = 0;
- CBU8_APPEND_UNSAFE(code_unit8, offset, code_point);
+ U8_APPEND_UNSAFE(code_unit8, offset, code_point);
} else {
// Not a surrogate.
- DCHECK(CBU16_IS_SINGLE(code_unit16_high));
+ DCHECK(U16_IS_SINGLE(code_unit16_high));
if (!IsValidCharacter(code_unit16_high)) {
if ((options_ & JSON_REPLACE_INVALID_CHARACTERS) == 0) {
return false;
@@ -676,7 +676,7 @@ bool JSONParser::DecodeUTF16(std::string
return true;
}
- CBU8_APPEND_UNSAFE(code_unit8, offset, code_unit16_high);
+ U8_APPEND_UNSAFE(code_unit8, offset, code_unit16_high);
}
dest_string->append(code_unit8, offset);
@@ -693,9 +693,9 @@ void JSONParser::DecodeUTF8(const int32_
} else {
char utf8_units[4] = { 0 };
int offset = 0;
- CBU8_APPEND_UNSAFE(utf8_units, offset, point);
+ U8_APPEND_UNSAFE(utf8_units, offset, point);
dest->Convert();
- // CBU8_APPEND_UNSAFE can overwrite up to 4 bytes, so utf8_units may not be
+ // U8_APPEND_UNSAFE can overwrite up to 4 bytes, so utf8_units may not be
// zero terminated at this point. |offset| contains the correct length.
dest->AppendString(utf8_units, offset);
}
--- a/src/3rdparty/chromium/base/json/string_escape.cc
+++ b/src/3rdparty/chromium/base/json/string_escape.cc
@@ -14,7 +14,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace base {
@@ -92,7 +92,7 @@ bool EscapeJSONStringImpl(const S& str,
for (int32_t i = 0; i < length; ++i) {
uint32_t code_point;
if (!ReadUnicodeCharacter(str.data(), length, &i, &code_point) ||
- code_point == static_cast<decltype(code_point)>(CBU_SENTINEL) ||
+ code_point == static_cast<decltype(code_point)>(U_SENTINEL) ||
!IsValidCharacter(code_point)) {
code_point = kReplacementCodePoint;
did_replacement = true;
--- a/src/3rdparty/chromium/base/strings/pattern.cc
+++ b/src/3rdparty/chromium/base/strings/pattern.cc
@@ -4,13 +4,13 @@
#include "base/strings/pattern.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace base {
namespace {
-static bool IsWildcard(base_icu::UChar32 character) {
+static bool IsWildcard(UChar32 character) {
return character == '*' || character == '?';
}
@@ -37,9 +37,9 @@ static void EatSameChars(const CHAR** pa
// Check if the chars match, if so, increment the ptrs.
const CHAR* pattern_next = *pattern;
const CHAR* string_next = *string;
- base_icu::UChar32 pattern_char = next(&pattern_next, pattern_end);
+ UChar32 pattern_char = next(&pattern_next, pattern_end);
if (pattern_char == next(&string_next, string_end) &&
- pattern_char != CBU_SENTINEL) {
+ pattern_char != U_SENTINEL) {
*pattern = pattern_next;
*string = string_next;
} else {
@@ -133,20 +133,20 @@ static bool MatchPatternT(const CHAR* ev
}
struct NextCharUTF8 {
- base_icu::UChar32 operator()(const char** p, const char* end) {
- base_icu::UChar32 c;
+ UChar32 operator()(const char** p, const char* end) {
+ UChar32 c;
int offset = 0;
- CBU8_NEXT(*p, offset, end - *p, c);
+ U8_NEXT(*p, offset, end - *p, c);
*p += offset;
return c;
}
};
struct NextCharUTF16 {
- base_icu::UChar32 operator()(const char16** p, const char16* end) {
- base_icu::UChar32 c;
+ UChar32 operator()(const char16** p, const char16* end) {
+ UChar32 c;
int offset = 0;
- CBU16_NEXT(*p, offset, end - *p, c);
+ U16_NEXT(*p, offset, end - *p, c);
*p += offset;
return c;
}
--- a/src/3rdparty/chromium/base/strings/string_split.cc
+++ b/src/3rdparty/chromium/base/strings/string_split.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace base {
--- a/src/3rdparty/chromium/base/strings/string_util.cc
+++ b/src/3rdparty/chromium/base/strings/string_util.cc
@@ -25,7 +25,7 @@
#include "base/memory/singleton.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
#include "build/build_config.h"
namespace base {
@@ -359,19 +359,19 @@ void TruncateUTF8ToByteSize(const std::s
}
DCHECK_LE(byte_size,
static_cast<uint32_t>(std::numeric_limits<int32_t>::max()));
- // Note: This cast is necessary because CBU8_NEXT uses int32_ts.
+ // Note: This cast is necessary because U8_NEXT uses int32_ts.
int32_t truncation_length = static_cast<int32_t>(byte_size);
int32_t char_index = truncation_length - 1;
const char* data = input.data();
- // Using CBU8, we will move backwards from the truncation point
+ // Using U8, we will move backwards from the truncation point
// to the beginning of the string looking for a valid UTF8
// character. Once a full UTF8 character is found, we will
// truncate the string to the end of that character.
while (char_index >= 0) {
int32_t prev = char_index;
- base_icu::UChar32 code_point = 0;
- CBU8_NEXT(data, char_index, truncation_length, code_point);
+ UChar32 code_point = 0;
+ U8_NEXT(data, char_index, truncation_length, code_point);
if (!IsValidCharacter(code_point) ||
!IsValidCodepoint(code_point)) {
char_index = prev - 1;
@@ -522,7 +522,7 @@ bool IsStringUTF8(StringPiece str) {
while (char_index < src_len) {
int32_t code_point;
- CBU8_NEXT(src, char_index, src_len, code_point);
+ U8_NEXT(src, char_index, src_len, code_point);
if (!IsValidCharacter(code_point))
return false;
}
--- a/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc
+++ b/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc
@@ -4,7 +4,7 @@
#include "base/strings/utf_string_conversion_utils.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace base {
@@ -18,7 +18,7 @@ bool ReadUnicodeCharacter(const char* sr
// use a signed type for code_point. But this function returns false
// on error anyway, so code_point_out is unsigned.
int32_t code_point;
- CBU8_NEXT(src, *char_index, src_len, code_point);
+ U8_NEXT(src, *char_index, src_len, code_point);
*code_point_out = static_cast<uint32_t>(code_point);
// The ICU macro above moves to the next char, we want to point to the last
@@ -33,16 +33,16 @@ bool ReadUnicodeCharacter(const char16*
int32_t src_len,
int32_t* char_index,
uint32_t* code_point) {
- if (CBU16_IS_SURROGATE(src[*char_index])) {
- if (!CBU16_IS_SURROGATE_LEAD(src[*char_index]) ||
+ if (U16_IS_SURROGATE(src[*char_index])) {
+ if (!U16_IS_SURROGATE_LEAD(src[*char_index]) ||
*char_index + 1 >= src_len ||
- !CBU16_IS_TRAIL(src[*char_index + 1])) {
+ !U16_IS_TRAIL(src[*char_index + 1])) {
// Invalid surrogate pair.
return false;
}
// Valid surrogate pair.
- *code_point = CBU16_GET_SUPPLEMENTARY(src[*char_index],
+ *code_point = U16_GET_SUPPLEMENTARY(src[*char_index],
src[*char_index + 1]);
(*char_index)++;
} else {
@@ -76,30 +76,30 @@ size_t WriteUnicodeCharacter(uint32_t co
}
- // CBU8_APPEND_UNSAFE can append up to 4 bytes.
+ // U8_APPEND_UNSAFE can append up to 4 bytes.
size_t char_offset = output->length();
size_t original_char_offset = char_offset;
- output->resize(char_offset + CBU8_MAX_LENGTH);
+ output->resize(char_offset + U8_MAX_LENGTH);
- CBU8_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
+ U8_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
- // CBU8_APPEND_UNSAFE will advance our pointer past the inserted character, so
+ // U8_APPEND_UNSAFE will advance our pointer past the inserted character, so
// it will represent the new length of the string.
output->resize(char_offset);
return char_offset - original_char_offset;
}
size_t WriteUnicodeCharacter(uint32_t code_point, string16* output) {
- if (CBU16_LENGTH(code_point) == 1) {
+ if (U16_LENGTH(code_point) == 1) {
// Thie code point is in the Basic Multilingual Plane (BMP).
output->push_back(static_cast<char16>(code_point));
return 1;
}
// Non-BMP characters use a double-character encoding.
size_t char_offset = output->length();
- output->resize(char_offset + CBU16_MAX_LENGTH);
- CBU16_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
- return CBU16_MAX_LENGTH;
+ output->resize(char_offset + U16_MAX_LENGTH);
+ U16_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
+ return U16_MAX_LENGTH;
}
// Generalized Unicode converter -----------------------------------------------
--- a/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
+++ b/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
@@ -566,7 +566,6 @@ def write_gn_ninja(path, root_gen_dir, o
'base/task_scheduler/task_traits.cc',
'base/third_party/dmg_fp/dtoa_wrapper.cc',
'base/third_party/dmg_fp/g_fmt.cc',
- 'base/third_party/icu/icu_utf.cc',
'base/threading/post_task_and_reply_impl.cc',
'base/threading/scoped_blocking_call.cc',
'base/threading/sequence_local_storage_map.cc',
@@ -713,7 +712,7 @@ def write_gn_ninja(path, root_gen_dir, o
'base/allocator/allocator_shim.cc',
'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
])
- libs.extend(['-lrt', '-lnspr4'])
+ libs.extend(['-lrt', '-lnspr4', '-licuuc'])
static_libraries['libevent']['include_dirs'].extend([
os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
])
--- a/src/3rdparty/chromium/tools/gn/BUILD.gn
+++ b/src/3rdparty/chromium/tools/gn/BUILD.gn
@@ -279,6 +279,7 @@ executable("gn") {
libs = [
"nspr4",
+ "icuuc",
]
}
--- a/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc
+++ b/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc
@@ -5,13 +5,13 @@
#include "ui/gfx/utf16_indexing.h"
#include "base/logging.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace gfx {
bool IsValidCodePointIndex(const base::string16& s, size_t index) {
return index == 0 || index == s.length() ||
- !(CBU16_IS_TRAIL(s[index]) && CBU16_IS_LEAD(s[index - 1]));
+ !(U16_IS_TRAIL(s[index]) && U16_IS_LEAD(s[index - 1]));
}
ptrdiff_t UTF16IndexToOffset(const base::string16& s, size_t base, size_t pos) {
--- a/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn
+++ b/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn
@@ -53,6 +53,9 @@ source_set("transport_security_state_gen
"//testing/gtest",
"//third_party/boringssl",
]
+ libs = [
+ "icuuc",
+ ]
}
executable("transport_security_state_generator") {
--- a/src/3rdparty/chromium/content/browser/devtools/devtools_io_context.cc
+++ b/src/3rdparty/chromium/content/browser/devtools/devtools_io_context.cc
@@ -15,7 +15,7 @@
#include "base/strings/string_util.h"
#include "base/task_scheduler/lazy_task_runner.h"
#include "base/task_scheduler/post_task.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
#include "base/threading/thread_restrictions.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/public/browser/browser_thread.h"
@@ -146,7 +146,7 @@ void TempFileStream::ReadOnFileSequence(
} else {
// Provided client has requested sufficient large block, make their
// life easier by not truncating in the middle of a UTF-8 character.
- if (size_got > 6 && !CBU8_IS_SINGLE(buffer[size_got - 1])) {
+ if (size_got > 6 && !U8_IS_SINGLE(buffer[size_got - 1])) {
base::TruncateUTF8ToByteSize(buffer, size_got, &buffer);
size_got = buffer.size();
} else {
--- a/src/3rdparty/chromium/net/cert/internal/parse_name.cc
+++ b/src/3rdparty/chromium/net/cert/internal/parse_name.cc
@@ -9,7 +9,7 @@
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
namespace net {
@@ -34,7 +34,7 @@ bool ConvertBmpStringValue(const der::In
// BMPString only supports codepoints in the Basic Multilingual Plane;
// surrogates are not allowed.
- if (CBU_IS_SURROGATE(c))
+ if (U_IS_SURROGATE(c))
return false;
}
return base::UTF16ToUTF8(in_16bit.data(), in_16bit.size(), out);
@@ -54,7 +54,7 @@ bool ConvertUniversalStringValue(const d
for (const uint32_t c : in_32bit) {
// UniversalString is UCS-4 in big-endian order.
uint32_t codepoint = base::NetToHost32(c);
- if (!CBU_IS_UNICODE_CHAR(codepoint))
+ if (!U_IS_UNICODE_CHAR(codepoint))
return false;
base::WriteUnicodeCharacter(codepoint, out);
--- a/src/3rdparty/chromium/ui/base/ime/input_method_chromeos.cc
+++ b/src/3rdparty/chromium/ui/base/ime/input_method_chromeos.cc
@@ -18,7 +18,6 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
#include "chromeos/system/devicemode.h"
#include "ui/base/ime/chromeos/ime_keyboard.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
|