gecko-dev/intl/icu-patches/bug-1792775-ICU-22206.diff
André Bargull 7a825e75ec Bug 1792775 - Part 1: Update or remove ICU patches. r=platform-i18n-reviewers,dminor
Remove the patch for bug 1766220 because the local patch was just a backport
from the ICU development branch.

And update the local patches for Sorbian and WASI integration to apply cleanly
on ICU 72.

Differential Revision: https://phabricator.services.mozilla.com/D160179
2022-11-23 17:56:03 +00:00

352 lines
16 KiB
Diff

# 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;