summaryrefslogtreecommitdiff
path: root/www-client/chromium/files/chromium-87-icu68.patch
blob: dfea967dbaa9a06df9f92b7964f2f1d1c6e4ff15 (plain)
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
From 4d16e52a5e6771c4aa5f892e14486bf0e87027d1 Mon Sep 17 00:00:00 2001
From: Frank Tang <ftang@chromium.org>
Date: Tue, 20 Oct 2020 00:11:50 +0000
Subject: [PATCH] Prepare for landing ICU68

In the landing process of ICU68 we found these need to be changed
since ICU68 no longer define TRUE and FALSE for UBool to
avoid C++20 problem.

Bug: 1138555
Change-Id: I64fd98c99864aa86b07280537a780105cb0eabbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473522
Reviewed-by: Frank Tang <ftang@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Guillaume Jenkins <gujen@google.com>
Reviewed-by: Jungshik Shin <jshin@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: Marian Fechete <marianfe@google.com>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818713}
---

diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index b225f1d..20debbe 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -327,7 +327,7 @@
   // https://ssl.icu-project.org/trac/ticket/13208 .
   string16 zone_id = android::GetDefaultTimeZoneId();
   icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone(
-      icu::UnicodeString(FALSE, zone_id.data(), zone_id.length())));
+      icu::UnicodeString(false, zone_id.data(), zone_id.length())));
 #elif defined(OS_FUCHSIA)
   // The platform-specific mechanisms used by ICU's detectHostTimeZone() to
   // determine the default time zone will not work on Fuchsia. Therefore,
diff --git a/base/i18n/string_compare.cc b/base/i18n/string_compare.cc
index c0e83c6..e4fb687 100644
--- a/base/i18n/string_compare.cc
+++ b/base/i18n/string_compare.cc
@@ -18,8 +18,8 @@
                                              StringPiece16 rhs) {
   UErrorCode error = U_ZERO_ERROR;
   UCollationResult result = collator.compare(
-      icu::UnicodeString(FALSE, lhs.data(), static_cast<int>(lhs.length())),
-      icu::UnicodeString(FALSE, rhs.data(), static_cast<int>(rhs.length())),
+      icu::UnicodeString(false, lhs.data(), static_cast<int>(lhs.length())),
+      icu::UnicodeString(false, rhs.data(), static_cast<int>(rhs.length())),
       error);
   DCHECK(U_SUCCESS(error));
   return result;
diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc
index c769b57..c085f5e 100644
--- a/base/i18n/time_formatting.cc
+++ b/base/i18n/time_formatting.cc
@@ -240,7 +240,7 @@
   icu::FieldPosition ignore(icu::FieldPosition::DONT_CARE);
   measure_format.formatMeasures(measures, 3, formatted, ignore, status);
   *out = i18n::UnicodeStringToString16(formatted);
-  return U_SUCCESS(status) == TRUE;
+  return U_SUCCESS(status);
 }
 
 string16 DateIntervalFormat(const Time& begin_time,
diff --git a/components/autofill/core/common/autofill_regexes.cc b/components/autofill/core/common/autofill_regexes.cc
index 02254fa..1cf12f3 100644
--- a/components/autofill/core/common/autofill_regexes.cc
+++ b/components/autofill/core/common/autofill_regexes.cc
@@ -43,7 +43,7 @@
 icu::RegexMatcher* AutofillRegexes::GetMatcher(const base::string16& pattern) {
   auto it = matchers_.find(pattern);
   if (it == matchers_.end()) {
-    const icu::UnicodeString icu_pattern(FALSE, pattern.data(),
+    const icu::UnicodeString icu_pattern(false, pattern.data(),
                                          pattern.length());
 
     UErrorCode status = U_ZERO_ERROR;
@@ -71,21 +71,21 @@
   base::AutoLock lock(*g_lock);
 
   icu::RegexMatcher* matcher = g_autofill_regexes->GetMatcher(pattern);
-  icu::UnicodeString icu_input(FALSE, input.data(), input.length());
+  icu::UnicodeString icu_input(false, input.data(), input.length());
   matcher->reset(icu_input);
 
   UErrorCode status = U_ZERO_ERROR;
   UBool matched = matcher->find(0, status);
   DCHECK(U_SUCCESS(status));
 
-  if (matched == TRUE && match) {
+  if (matched && match) {
     icu::UnicodeString match_unicode =
         matcher->group(group_to_be_captured, status);
     DCHECK(U_SUCCESS(status));
     *match = base::i18n::UnicodeStringToString16(match_unicode);
   }
 
-  return matched == TRUE;
+  return matched;
 }
 
 }  // namespace autofill
diff --git a/components/autofill_assistant/browser/string_conversions_util.cc b/components/autofill_assistant/browser/string_conversions_util.cc
index 212bafa..1d00d68 100644
--- a/components/autofill_assistant/browser/string_conversions_util.cc
+++ b/components/autofill_assistant/browser/string_conversions_util.cc
@@ -39,13 +39,13 @@
 // |target|.
 bool AppendUnicodeToUTF8(const UChar32 source, std::string* target) {
   char bytes[4];
-  UBool error = FALSE;
+  UBool error = false;
   size_t offset = 0;
   U8_APPEND(bytes, offset, base::size(bytes), source, error);
-  if (error == FALSE) {
+  if (error == false) {
     target->append(bytes, offset);
   }
-  return error == FALSE;
+  return !error;
 }
 
 }  // namespace autofill_assistant
diff --git a/components/signin/public/identity_manager/identity_utils.cc b/components/signin/public/identity_manager/identity_utils.cc
index 1c414e2..014d674 100644
--- a/components/signin/public/identity_manager/identity_utils.cc
+++ b/components/signin/public/identity_manager/identity_utils.cc
@@ -33,7 +33,7 @@
 
   // See if the username matches the policy-provided pattern.
   UErrorCode status = U_ZERO_ERROR;
-  const icu::UnicodeString icu_pattern(FALSE, utf16_pattern.data(),
+  const icu::UnicodeString icu_pattern(false, utf16_pattern.data(),
                                        utf16_pattern.length());
   icu::RegexMatcher matcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status);
   if (!U_SUCCESS(status)) {
diff --git a/components/spellcheck/renderer/spellcheck_worditerator.cc b/components/spellcheck/renderer/spellcheck_worditerator.cc
index ec16fef..3b1f060 100644
--- a/components/spellcheck/renderer/spellcheck_worditerator.cc
+++ b/components/spellcheck/renderer/spellcheck_worditerator.cc
@@ -442,7 +442,7 @@
   // spellchecker and we need manual normalization as well. The normalized
   // text does not have to be NUL-terminated since its characters are copied to
   // string16, which adds a NUL character when we need.
-  icu::UnicodeString input(FALSE, &text_[input_start],
+  icu::UnicodeString input(false, &text_[input_start],
                            base::checked_cast<int32_t>(input_length));
   UErrorCode status = U_ZERO_ERROR;
   icu::UnicodeString output;
diff --git a/components/url_formatter/spoof_checks/idn_spoof_checker.cc b/components/url_formatter/spoof_checks/idn_spoof_checker.cc
index 6d66a7c..d73192b1 100644
--- a/components/url_formatter/spoof_checks/idn_spoof_checker.cc
+++ b/components/url_formatter/spoof_checks/idn_spoof_checker.cc
@@ -368,7 +368,7 @@
     return Result::kICUSpoofChecks;
   }
 
-  icu::UnicodeString label_string(FALSE /* isTerminated */, label.data(),
+  icu::UnicodeString label_string(false /* isTerminated */, label.data(),
                                   base::checked_cast<int32_t>(label.size()));
 
   // A punycode label with 'xn--' prefix is not subject to the URL
@@ -711,7 +711,7 @@
     base::StringPiece tld,
     base::StringPiece16 tld_unicode) {
   icu::UnicodeString tld_string(
-      FALSE /* isTerminated */, tld_unicode.data(),
+      false /* isTerminated */, tld_unicode.data(),
       base::checked_cast<int32_t>(tld_unicode.size()));
   // Allow if the TLD contains any letter from the script, in which case it's
   // likely to be a TLD in that script.
diff --git a/components/url_formatter/spoof_checks/skeleton_generator.cc b/components/url_formatter/spoof_checks/skeleton_generator.cc
index 9628626..9a77901 100644
--- a/components/url_formatter/spoof_checks/skeleton_generator.cc
+++ b/components/url_formatter/spoof_checks/skeleton_generator.cc
@@ -116,7 +116,7 @@
 Skeletons SkeletonGenerator::GetSkeletons(base::StringPiece16 hostname) {
   Skeletons skeletons;
   size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0);
-  icu::UnicodeString host(FALSE, hostname.data(), hostname_length);
+  icu::UnicodeString host(false, hostname.data(), hostname_length);
   // If input has any characters outside Latin-Greek-Cyrillic and [0-9._-],
   // there is no point in getting rid of diacritics because combining marks
   // attached to non-LGC characters are already blocked.
diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc
index 95d5a82..b6d8e5a 100644
--- a/content/zygote/zygote_linux.cc
+++ b/content/zygote/zygote_linux.cc
@@ -557,7 +557,7 @@
   if (!iter.ReadString16(&timezone_id))
     return -1;
   icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone(
-      icu::UnicodeString(FALSE, timezone_id.data(), timezone_id.length())));
+      icu::UnicodeString(false, timezone_id.data(), timezone_id.length())));
 
   if (!iter.ReadInt(&numfds))
     return -1;
diff --git a/services/device/time_zone_monitor/time_zone_monitor_android.cc b/services/device/time_zone_monitor/time_zone_monitor_android.cc
index 818670a..f57f972 100644
--- a/services/device/time_zone_monitor/time_zone_monitor_android.cc
+++ b/services/device/time_zone_monitor/time_zone_monitor_android.cc
@@ -34,7 +34,7 @@
   // See base/i18n/icu_util.cc:InitializeIcuTimeZone() for more information.
   base::string16 zone_id = base::android::GetDefaultTimeZoneId();
   std::unique_ptr<icu::TimeZone> new_zone(icu::TimeZone::createTimeZone(
-      icu::UnicodeString(FALSE, zone_id.data(), zone_id.length())));
+      icu::UnicodeString(false, zone_id.data(), zone_id.length())));
   UpdateIcuAndNotifyClients(std::move(new_zone));
 }
 
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc
index a6b9552..36809d91 100644
--- a/third_party/blink/renderer/core/exported/web_view_test.cc
+++ b/third_party/blink/renderer/core/exported/web_view_test.cc
@@ -4868,18 +4868,18 @@
 
 TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithMutateDom) {
   // Test dom mutation.
-  TestEachMouseEvent("mutateDom", FALSE);
+  TestEachMouseEvent("mutateDom", false);
 
   // Test without any DOM mutation.
-  TestEachMouseEvent("none", TRUE);
+  TestEachMouseEvent("none", true);
 }
 
 TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithMutateStyle) {
   // Test style mutation.
-  TestEachMouseEvent("mutateStyle", FALSE);
+  TestEachMouseEvent("mutateStyle", false);
 
   // Test checkbox:indeterminate style mutation.
-  TestEachMouseEvent("mutateIndeterminate", FALSE);
+  TestEachMouseEvent("mutateIndeterminate", false);
 
   // Test click div with :active style.
   Tap("style_active");
@@ -4888,10 +4888,10 @@
 
 TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithPreventDefault) {
   // Test swallowing.
-  TestEachMouseEvent("preventDefault", FALSE);
+  TestEachMouseEvent("preventDefault", false);
 
   // Test without any preventDefault.
-  TestEachMouseEvent("none", TRUE);
+  TestEachMouseEvent("none", true);
 }
 
 TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithNonTriggeringNodes) {
diff --git a/third_party/blink/renderer/platform/text/locale_icu.cc b/third_party/blink/renderer/platform/text/locale_icu.cc
index 92fb99e0..f991b51 100644
--- a/third_party/blink/renderer/platform/text/locale_icu.cc
+++ b/third_party/blink/renderer/platform/text/locale_icu.cc
@@ -169,12 +169,12 @@
     return g_empty_string;
 
   UErrorCode status = U_ZERO_ERROR;
-  int32_t length = udat_toPattern(date_format, TRUE, nullptr, 0, &status);
+  int32_t length = udat_toPattern(date_format, true, nullptr, 0, &status);
   if (status != U_BUFFER_OVERFLOW_ERROR || !length)
     return g_empty_string;
   StringBuffer<UChar> buffer(length);
   status = U_ZERO_ERROR;
-  udat_toPattern(date_format, TRUE, buffer.Characters(), length, &status);
+  udat_toPattern(date_format, true, buffer.Characters(), length, &status);
   if (U_FAILURE(status))
     return g_empty_string;
   return String::Adopt(buffer);
diff --git a/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc b/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
index 5bea007..0e8c60a 100644
--- a/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
+++ b/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
@@ -312,13 +312,13 @@
       text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
                               ? static_cast<int32_t>(offset)
                               : 0;
-      is_accessible = TRUE;
+      is_accessible = true;
       return true;
     }
     if (native_index >= native_length &&
         text->chunkNativeLimit == native_length) {
       text->chunkOffset = text->chunkLength;
-      is_accessible = FALSE;
+      is_accessible = false;
       return true;
     }
   } else {
@@ -331,12 +331,12 @@
       text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
                               ? static_cast<int32_t>(offset)
                               : 0;
-      is_accessible = TRUE;
+      is_accessible = true;
       return true;
     }
     if (native_index <= 0 && !text->chunkNativeStart) {
       text->chunkOffset = 0;
-      is_accessible = FALSE;
+      is_accessible = false;
       return true;
     }
   }
@@ -347,7 +347,7 @@
                               int64_t native_index,
                               UBool forward) {
   if (!text->context)
-    return FALSE;
+    return false;
   int64_t native_length = TextNativeLength(text);
   UBool is_accessible;
   if (TextInChunkOrOutOfRange(text, native_index, native_length, forward,
@@ -371,7 +371,7 @@
     DCHECK_EQ(new_context, kPriorContext);
     TextLatin1SwitchToPriorContext(text, native_index, native_length, forward);
   }
-  return TRUE;
+  return true;
 }
 
 static const struct UTextFuncs kTextLatin1Funcs = {
@@ -511,7 +511,7 @@
 
 static UBool TextUTF16Access(UText* text, int64_t native_index, UBool forward) {
   if (!text->context)
-    return FALSE;
+    return false;
   int64_t native_length = TextNativeLength(text);
   UBool is_accessible;
   if (TextInChunkOrOutOfRange(text, native_index, native_length, forward,
@@ -533,7 +533,7 @@
     DCHECK_EQ(new_context, kPriorContext);
     TextUTF16SwitchToPriorContext(text, native_index, native_length, forward);
   }
-  return TRUE;
+  return true;
 }
 
 static const struct UTextFuncs kTextUTF16Funcs = {
diff --git a/third_party/blink/renderer/platform/text/unicode_utilities.cc b/third_party/blink/renderer/platform/text/unicode_utilities.cc
index 2cefd53..b8c4515 100644
--- a/third_party/blink/renderer/platform/text/unicode_utilities.cc
+++ b/third_party/blink/renderer/platform/text/unicode_utilities.cc
@@ -300,7 +300,7 @@
   DCHECK(U_SUCCESS(status));
   int32_t input_length = static_cast<int32_t>(length);
   // copy-on-write.
-  icu::UnicodeString normalized(FALSE, characters, input_length);
+  icu::UnicodeString normalized(false, characters, input_length);
   // In the vast majority of cases, input is already NFC. Run a quick check
   // to avoid normalizing the entire input unnecessarily.
   int32_t normalized_prefix_length =
diff --git a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
index b625735..fb8ab05 100644
--- a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
+++ b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
@@ -327,7 +327,7 @@
   DLOG_IF(ERROR, err == U_AMBIGUOUS_ALIAS_WARNING)
       << "ICU ambiguous alias warning for encoding: " << encoding_.GetName();
   if (converter_icu_)
-    ucnv_setFallback(converter_icu_, TRUE);
+    ucnv_setFallback(converter_icu_, true);
 }
 
 int TextCodecICU::DecodeToBuffer(UChar* target,
diff --git a/ui/base/l10n/formatter.cc b/ui/base/l10n/formatter.cc
index e4446d4..684ead8 100644
--- a/ui/base/l10n/formatter.cc
+++ b/ui/base/l10n/formatter.cc
@@ -234,7 +234,7 @@
                        int value,
                        icu::UnicodeString* formatted_string) const {
   DCHECK(simple_format_[unit]);
-  DCHECK(formatted_string->isEmpty() == TRUE);
+  DCHECK(formatted_string->isEmpty());
   UErrorCode error = U_ZERO_ERROR;
   FormatNumberInPlural(*simple_format_[unit],
                         value, formatted_string, &error);
@@ -250,7 +250,7 @@
       << "Detailed() not implemented for your (format, length) combination!";
   DCHECK(detailed_format_[units][1])
       << "Detailed() not implemented for your (format, length) combination!";
-  DCHECK(formatted_string->isEmpty() == TRUE);
+  DCHECK(formatted_string->isEmpty());
   UErrorCode error = U_ZERO_ERROR;
   FormatNumberInPlural(*detailed_format_[units][0], value_1,
                        formatted_string, &error);
@@ -283,7 +283,7 @@
     base::string16 pattern = l10n_util::GetStringUTF16(pluralities.id);
     UErrorCode error = U_ZERO_ERROR;
     std::unique_ptr<icu::MessageFormat> format(new icu::MessageFormat(
-        icu::UnicodeString(FALSE, pattern.data(), pattern.length()), error));
+        icu::UnicodeString(false, pattern.data(), pattern.length()), error));
     DCHECK(U_SUCCESS(error));
     if (format.get())
       return format;