]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/usearch.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / i18n / usearch.cpp
index b067a1524a806ad4f91ba6518f8c32af9e91c95c..197d7cc31e8eb657f6b13ed38f64ef69e6a71532 100644 (file)
@@ -321,7 +321,7 @@ inline uint16_t initializePatternCETable(UStringSearch *strsrch,
         uprv_free(pattern->ces);
     }
 
-    uint16_t  offset      = 0;
+    uint32_t  offset      = 0;
     uint16_t  result      = 0;
     int32_t   ce;
 
@@ -392,7 +392,7 @@ inline uint16_t initializePatternPCETable(UStringSearch *strsrch,
         uprv_free(pattern->pces);
     }
 
-    uint16_t  offset = 0;
+    uint32_t  offset = 0;
     uint16_t  result = 0;
     int64_t   pce;
 
@@ -1355,7 +1355,7 @@ inline int getUnblockedAccentIndex(UChar *accents, int32_t *accentsindex)
 * @param destinationlength target array size, returning the appended length
 * @param source1 null-terminated first array
 * @param source2 second array
-* @param source2length length of seond array
+* @param source2length length of second array
 * @param source3 null-terminated third array
 * @param status error status if any
 * @return new destination array, destination if there was no new allocation
@@ -1564,7 +1564,7 @@ inline void cleanUpSafeText(const UStringSearch *strsrch, UChar *safetext,
 
 /**
 * Take the rearranged end accents and tries matching. If match failed at
-* a seperate preceding set of accents (seperated from the rearranged on by
+* a separate preceding set of accents (separated from the rearranged on by
 * at least a base character) then we rearrange the preceding accents and
 * tries matching again.
 * We allow skipping of the ends of the accent set if the ces do not match.
@@ -2224,7 +2224,7 @@ int32_t doPreviousCanonicalSuffixMatch(UStringSearch *strsrch,
 
 /**
 * Take the rearranged start accents and tries matching. If match failed at
-* a seperate following set of accents (seperated from the rearranged on by
+* a separate following set of accents (separated from the rearranged on by
 * at least a base character) then we rearrange the preceding accents and
 * tries matching again.
 * We allow skipping of the ends of the accent set if the ces do not match.
@@ -3552,7 +3552,10 @@ const CEI *CEIBuffer::get(int32_t index) {
         os_log(OS_LOG_DEFAULT, "# CEIBuffer::get param err, index %d limitIx %d", index, limitIx); // <rdar://51554495> 
 #endif
         U_ASSERT(FALSE);
-
+        // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
+        // which unconditionally calls abort(). However, there were cases where this was
+        // being hit. This change is reverted for now, restoring the existing behavior.
+        // ICU-20792 tracks the follow-up work/further investigation on this.
         return NULL;
     }
 
@@ -3594,7 +3597,10 @@ const CEI *CEIBuffer::getPrevious(int32_t index) {
         os_log(OS_LOG_DEFAULT, "# CEIBuffer::getPrevious param err, index %d limitIx %d", index, limitIx); // <rdar://51554495> 
 #endif
         U_ASSERT(FALSE);
-
+        // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
+        // which unconditionally calls abort(). However, there were cases where this was
+        // being hit. This change is reverted for now, restoring the existing behavior.
+        // ICU-20792 tracks the follow-up work/further investigation on this.
         return NULL;
     }
 
@@ -3866,7 +3872,7 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch  *strsrch,
 
 #endif
     // Input parameter sanity check.
-    //  TODO:  should input indicies clip to the text length
+    //  TODO:  should input indices clip to the text length
     //         in the same way that UText does.
     if(strsrch->pattern.cesLength == 0         ||
        startIdx < 0                           ||
@@ -4028,7 +4034,7 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch  *strsrch,
 
         // Check for the start of the match being within an Collation Element Expansion,
         //   meaning that the first char of the match is only partially matched.
-        //   With exapnsions, the first CE will report the index of the source
+        //   With expansions, the first CE will report the index of the source
         //   character, and all subsequent (expansions) CEs will report the source index of the
         //    _following_ character.
         int32_t secondIx = firstCEI->highIndex;