summaryrefslogtreecommitdiffstats
path: root/intl/icu-patches/bug-1792775-ICU-22206.diff
blob: 34e36258039e323d48e3e5e77c233c1097899cd3 (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
# https://github.com/unicode-org/icu/pull/2255
# https://github.com/unicode-org/icu/pull/2255.diff
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22206

diff --git a/intl/icu/source/common/rbbiscan.cpp b/intl/icu/source/common/rbbiscan.cpp
index 8232bd94e47..87d31f8af40 100644
--- a/intl/icu/source/common/rbbiscan.cpp
+++ b/intl/icu/source/common/rbbiscan.cpp
@@ -918,7 +918,7 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) {
             //   Toggle quoting mode.
             //   Return either '('  or ')', because quotes cause a grouping of the quoted text.
             fQuoteMode = !fQuoteMode;
-            if (fQuoteMode == true) {
+            if (fQuoteMode) {
                 c.fChar = chLParen;
             } else {
                 c.fChar = chRParen;
diff --git a/intl/icu/source/common/ucnvisci.cpp b/intl/icu/source/common/ucnvisci.cpp
index 4d747e1ff84..839f7ff9c62 100644
--- a/intl/icu/source/common/ucnvisci.cpp
+++ b/intl/icu/source/common/ucnvisci.cpp
@@ -1472,7 +1472,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
             if (targetUniChar != missingCharMarker) {
                 /* now save the targetUniChar for delayed write */
                 *toUnicodeStatus = (UChar) targetUniChar;
-                if (data->resetToDefaultToUnicode==true) {
+                if (data->resetToDefaultToUnicode) {
                     data->currentDeltaToUnicode = data->defDeltaToUnicode;
                     data->currentMaskToUnicode = data->defMaskToUnicode;
                     data->resetToDefaultToUnicode=false;
diff --git a/intl/icu/source/common/udata.cpp b/intl/icu/source/common/udata.cpp
index 2bc74c97898..c5d0a9feb7b 100644
--- a/intl/icu/source/common/udata.cpp
+++ b/intl/icu/source/common/udata.cpp
@@ -568,7 +568,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
         /* check for .dat files */
         pathBasename = findBasename(pathBuffer.data());
 
-        if(checkLastFour == true && 
+        if(checkLastFour && 
            (pathLen>=4) &&
            uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */
            uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0  && /* base matches */
diff --git a/intl/icu/source/common/uidna.cpp b/intl/icu/source/common/uidna.cpp
index 1cbdeec3272..7135a166f21 100644
--- a/intl/icu/source/common/uidna.cpp
+++ b/intl/icu/source/common/uidna.cpp
@@ -287,7 +287,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
             failPos = j;
         }
     }
-    if(useSTD3ASCIIRules == true){
+    if(useSTD3ASCIIRules){
         // verify 3a and 3b
         // 3(a) Verify the absence of non-LDH ASCII code points; that is, the
         //  absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
@@ -731,7 +731,7 @@ uidna_IDNToASCII(  const UChar *src, int32_t srcLength,
             remainingDestCapacity = 0;
         }
 
-        if(done == true){
+        if(done){
             break;
         }
 
@@ -829,7 +829,7 @@ uidna_IDNToUnicode(  const UChar* src, int32_t srcLength,
             remainingDestCapacity = 0;
         }
 
-        if(done == true){
+        if(done){
             break;
         }
 
diff --git a/intl/icu/source/common/uresbund.cpp b/intl/icu/source/common/uresbund.cpp
index 17c0177a05c..c065387bdae 100644
--- a/intl/icu/source/common/uresbund.cpp
+++ b/intl/icu/source/common/uresbund.cpp
@@ -2448,7 +2448,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
         res = res_getTableItemByKey(&resB->getResData(), resB->fRes, &t, &key);
         if(res == RES_BOGUS) {
             key = inKey;
-            if(resB->fHasFallback == true) {
+            if(resB->fHasFallback) {
                 dataEntry = getFallbackData(resB, &key, &res, status);
                 if(U_SUCCESS(*status)) {
                     /* check if resB->fResPath gives the right name here */
@@ -2503,7 +2503,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
 
         if(res == RES_BOGUS) {
             key = inKey;
-            if(resB->fHasFallback == true) {
+            if(resB->fHasFallback) {
                 dataEntry = getFallbackData(resB, &key, &res, status);
                 if(U_SUCCESS(*status)) {
                     switch (RES_GET_TYPE(res)) {
diff --git a/intl/icu/source/common/usprep.cpp b/intl/icu/source/common/usprep.cpp
index 50d16081d1d..8175dc7fa82 100644
--- a/intl/icu/source/common/usprep.cpp
+++ b/intl/icu/source/common/usprep.cpp
@@ -160,7 +160,7 @@ usprep_internal_flushCache(UBool noRefCount){
         key  = (UStringPrepKey *) e->key.pointer;
 
         if ((noRefCount== false && profile->refCount == 0) || 
-             noRefCount== true) {
+             noRefCount) {
             deletedNum++;
             uhash_removeElement(SHARED_DATA_HASHTABLE, e);
 
@@ -746,16 +746,16 @@ usprep_prepare(   const UStringPrepProfile* profile,
             }
         }
     }
-    if(profile->checkBiDi == true){
+    if(profile->checkBiDi){
         // satisfy 2
-        if( leftToRight == true && rightToLeft == true){
+        if( leftToRight && rightToLeft){
             *status = U_STRINGPREP_CHECK_BIDI_ERROR;
             uprv_syntaxError(b2,(rtlPos>ltrPos) ? rtlPos : ltrPos, b2Len, parseError);
             return 0;
         }
 
         //satisfy 3
-        if( rightToLeft == true && 
+        if( rightToLeft && 
             !((firstCharDir == U_RIGHT_TO_LEFT || firstCharDir == U_RIGHT_TO_LEFT_ARABIC) &&
               (direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC))
            ){
diff --git a/intl/icu/source/common/utext.cpp b/intl/icu/source/common/utext.cpp
index 548e6a60f31..89e3d669f6e 100644
--- a/intl/icu/source/common/utext.cpp
+++ b/intl/icu/source/common/utext.cpp
@@ -223,7 +223,7 @@ utext_current32(UText *ut) {
             trail = ut->chunkContents[ut->chunkOffset];
         }
         UBool r = ut->pFuncs->access(ut, nativePosition, false);  // reverse iteration flag loads preceding chunk
-        U_ASSERT(r==true);
+        U_ASSERT(r);
         ut->chunkOffset = originalOffset;
         if(!r) {
             return U_SENTINEL;
diff --git a/intl/icu/source/i18n/calendar.cpp b/intl/icu/source/i18n/calendar.cpp
index f5a40e48395..5431d87bdd2 100644
--- a/intl/icu/source/i18n/calendar.cpp
+++ b/intl/icu/source/i18n/calendar.cpp
@@ -3510,7 +3510,7 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w
     switch(bestField) {
     case UCAL_WEEK_OF_YEAR:
         if(woy == 1) {
-            if(jan1InPrevYear == true) {
+            if(jan1InPrevYear) {
                 // the first week of January is in the previous year
                 // therefore WOY1 is always solidly within yearWoy
                 return yearWoy;
diff --git a/intl/icu/source/i18n/dcfmtsym.cpp b/intl/icu/source/i18n/dcfmtsym.cpp
index 5d06c189fbe..fa5920aaa50 100644
--- a/intl/icu/source/i18n/dcfmtsym.cpp
+++ b/intl/icu/source/i18n/dcfmtsym.cpp
@@ -329,11 +329,13 @@ struct CurrencySpacingSink : public ResourceSink {
         // both beforeCurrency and afterCurrency were found in CLDR.
         static const char* defaults[] = { "[:letter:]", "[:digit:]", " " };
         if (!hasBeforeCurrency || !hasAfterCurrency) {
-            for (UBool beforeCurrency = 0; beforeCurrency <= true; beforeCurrency++) {
-                for (int32_t pattern = 0; pattern < UNUM_CURRENCY_SPACING_COUNT; pattern++) {
-                    dfs.setPatternForCurrencySpacing((UCurrencySpacing)pattern,
-                        beforeCurrency, UnicodeString(defaults[pattern], -1, US_INV));
-                }
+            for (int32_t pattern = 0; pattern < UNUM_CURRENCY_SPACING_COUNT; pattern++) {
+                dfs.setPatternForCurrencySpacing((UCurrencySpacing)pattern,
+                    false, UnicodeString(defaults[pattern], -1, US_INV));
+            }
+            for (int32_t pattern = 0; pattern < UNUM_CURRENCY_SPACING_COUNT; pattern++) {
+                dfs.setPatternForCurrencySpacing((UCurrencySpacing)pattern,
+                    true, UnicodeString(defaults[pattern], -1, US_INV));
             }
         }
     }
diff --git a/intl/icu/source/i18n/dtitvinf.cpp b/intl/icu/source/i18n/dtitvinf.cpp
index f5fb86ce581..0a30cf14419 100644
--- a/intl/icu/source/i18n/dtitvinf.cpp
+++ b/intl/icu/source/i18n/dtitvinf.cpp
@@ -504,7 +504,7 @@ DateIntervalInfo::setIntervalPatternInternally(const UnicodeString& skeleton,
     }
 
     patternsOfOneSkeleton[index] = intervalPattern;
-    if ( emptyHash == true ) {
+    if ( emptyHash ) {
         fIntervalPatterns->put(skeleton, patternsOfOneSkeleton, status);
     }
 }
@@ -748,7 +748,7 @@ U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) {
     const UnicodeString* pattern2 = (UnicodeString*)val2.pointer;
     UBool ret = true;
     int8_t i;
-    for ( i = 0; i < DateIntervalInfo::kMaxIntervalPatternIndex && ret == true; ++i ) {
+    for ( i = 0; i < DateIntervalInfo::kMaxIntervalPatternIndex && ret ; ++i ) {
         ret = (pattern1[i] == pattern2[i]);
     }
     return ret;
diff --git a/intl/icu/source/i18n/gregocal.cpp b/intl/icu/source/i18n/gregocal.cpp
index 882d25b4a2a..0e00127e314 100644
--- a/intl/icu/source/i18n/gregocal.cpp
+++ b/intl/icu/source/i18n/gregocal.cpp
@@ -487,7 +487,7 @@ int32_t GregorianCalendar::handleComputeJulianDay(UCalendarDateFields bestField)
         // The following check handles portions of the cutover year BEFORE the
         // cutover itself happens.
         //if ((fIsGregorian==true) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
-        if ((fIsGregorian==true) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
+        if ((fIsGregorian) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
 #if defined (U_DEBUG_CAL)
             fprintf(stderr, "%s:%d: jd [invert] %d\n", 
                 __FILE__, __LINE__, jd);
diff --git a/intl/icu/source/i18n/regexcmp.cpp b/intl/icu/source/i18n/regexcmp.cpp
index 4b507002d63..adc8f700c7f 100644
--- a/intl/icu/source/i18n/regexcmp.cpp
+++ b/intl/icu/source/i18n/regexcmp.cpp
@@ -4065,7 +4065,7 @@ void RegexCompile::nextChar(RegexPatternChar &c) {
                 if (c.fChar == (UChar32)-1) {
                     break;     // End of Input
                 }
-                if  (c.fChar == chPound && fEOLComments == true) {
+                if  (c.fChar == chPound && fEOLComments) {
                     // Start of a comment.  Consume the rest of it, until EOF or a new line
                     for (;;) {
                         c.fChar = nextCharLL();
diff --git a/intl/icu/source/i18n/search.cpp b/intl/icu/source/i18n/search.cpp
index 56d9b744098..d55902bfa7b 100644
--- a/intl/icu/source/i18n/search.cpp
+++ b/intl/icu/source/i18n/search.cpp
@@ -81,10 +81,9 @@ USearchAttributeValue SearchIterator::getAttribute(
 {
     switch (attribute) {
     case USEARCH_OVERLAP :
-        return (m_search_->isOverlap == true ? USEARCH_ON : USEARCH_OFF);
+        return (m_search_->isOverlap ? USEARCH_ON : USEARCH_OFF);
     case USEARCH_CANONICAL_MATCH :
-        return (m_search_->isCanonicalMatch == true ? USEARCH_ON : 
-                                                                USEARCH_OFF);
+        return (m_search_->isCanonicalMatch ? USEARCH_ON : USEARCH_OFF);
     case USEARCH_ELEMENT_COMPARISON :
         {
             int16_t value = m_search_->elementComparisonType;
@@ -242,7 +241,7 @@ int32_t SearchIterator::next(UErrorCode &status)
         int32_t matchindex  = m_search_->matchedIndex;
         int32_t     matchlength = m_search_->matchedLength;
         m_search_->reset = false;
-        if (m_search_->isForwardSearching == true) {
+        if (m_search_->isForwardSearching) {
             int32_t textlength = m_search_->textLength;
             if (offset == textlength || matchindex == textlength || 
                 (matchindex != USEARCH_DONE && 
@@ -295,7 +294,7 @@ int32_t SearchIterator::previous(UErrorCode &status)
         }
         
         int32_t matchindex = m_search_->matchedIndex;
-        if (m_search_->isForwardSearching == true) {
+        if (m_search_->isForwardSearching) {
             // switching direction. 
             // if matchedIndex == USEARCH_DONE, it means that either a 
             // setOffset has been called or that next ran off the text
diff --git a/intl/icu/source/i18n/usearch.cpp b/intl/icu/source/i18n/usearch.cpp
index 0fecd709e74..39f76a1b985 100644
--- a/intl/icu/source/i18n/usearch.cpp
+++ b/intl/icu/source/i18n/usearch.cpp
@@ -819,11 +819,9 @@ U_CAPI USearchAttributeValue U_EXPORT2 usearch_getAttribute(
     if (strsrch) {
         switch (attribute) {
         case USEARCH_OVERLAP :
-            return (strsrch->search->isOverlap == true ? USEARCH_ON :
-                                                        USEARCH_OFF);
+            return (strsrch->search->isOverlap ? USEARCH_ON : USEARCH_OFF);
         case USEARCH_CANONICAL_MATCH :
-            return (strsrch->search->isCanonicalMatch == true ? USEARCH_ON :
-                                                               USEARCH_OFF);
+            return (strsrch->search->isCanonicalMatch ? USEARCH_ON : USEARCH_OFF);
         case USEARCH_ELEMENT_COMPARISON :
             {
                 int16_t value = strsrch->search->elementComparisonType;
@@ -1249,7 +1247,7 @@ U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
         }
 
         int32_t matchedindex = search->matchedIndex;
-        if (search->isForwardSearching == true) {
+        if (search->isForwardSearching) {
             // switching direction.
             // if matchedIndex == USEARCH_DONE, it means that either a
             // setOffset has been called or that next ran off the text
diff --git a/intl/icu/source/i18n/uspoof_conf.cpp b/intl/icu/source/i18n/uspoof_conf.cpp
index 5ecc59c12a8..376ac64e3ce 100644
--- a/intl/icu/source/i18n/uspoof_conf.cpp
+++ b/intl/icu/source/i18n/uspoof_conf.cpp
@@ -407,7 +407,7 @@ void ConfusabledataBuilder::build(const char * confusables, int32_t confusablesL
 //
 void ConfusabledataBuilder::outputData(UErrorCode &status) {
 
-    U_ASSERT(fSpoofImpl->fSpoofData->fDataOwned == true);
+    U_ASSERT(fSpoofImpl->fSpoofData->fDataOwned);
 
     //  The Key Table
     //     While copying the keys to the runtime array,
diff --git a/intl/icu/source/io/uscanf_p.cpp b/intl/icu/source/io/uscanf_p.cpp
index 9b27e2ebf8d..26a790dd9b6 100644
--- a/intl/icu/source/io/uscanf_p.cpp
+++ b/intl/icu/source/io/uscanf_p.cpp
@@ -323,7 +323,7 @@ u_scanf_skip_leading_ws(UFILE   *input,
     UBool isNotEOF;
 
     /* skip all leading ws in the input */
-    while( ((isNotEOF = ufile_getch(input, &c)) == true) && (c == pad || u_isWhitespace(c)) )
+    while( ((isNotEOF = ufile_getch(input, &c))==(UBool)true) && (c == pad || u_isWhitespace(c)) )
     {
         count++;
     }
@@ -357,7 +357,7 @@ u_scanf_skip_leading_positive_sign(UFILE   *input,
 
         if (U_SUCCESS(localStatus)) {
             /* skip all leading ws in the input */
-            while( ((isNotEOF = ufile_getch(input, &c)) == true) && (count < symbolLen && c == plusSymbol[count]) )
+            while( ((isNotEOF = ufile_getch(input, &c))==(UBool)true) && (count < symbolLen && c == plusSymbol[count]) )
             {
                 count++;
             }
@@ -868,7 +868,7 @@ u_scanf_string_handler(UFILE        *input,
         return -1;
 
     while( (info->fWidth == -1 || count < info->fWidth) 
-        && ((isNotEOF = ufile_getch(input, &c)) == true)
+        && ((isNotEOF = ufile_getch(input, &c))==(UBool)true)
         && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
     {
 
@@ -959,7 +959,7 @@ u_scanf_ustring_handler(UFILE       *input,
     count = 0;
 
     while( (info->fWidth == -1 || count < info->fWidth)
-        && ((isNotEOF = ufile_getch(input, &c)) == true)
+        && ((isNotEOF = ufile_getch(input, &c))==(UBool)true)
         && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
     {
 
@@ -1262,7 +1262,7 @@ u_scanf_scanset_handler(UFILE       *input,
 
         /* grab characters one at a time and make sure they are in the scanset */
         while(chLeft > 0) {
-            if ( ((isNotEOF = ufile_getch32(input, &c)) == true) && uset_contains(scanset, c) ) {
+            if ( ((isNotEOF = ufile_getch32(input, &c))==(UBool)true) && uset_contains(scanset, c) ) {
                 readCharacter = true;
                 if (!info->fSkipArg) {
                     int32_t idx = 0;