]> granicus.if.org Git - icu/commitdiff
ICU-10998 test for only-none before comparing with the current list of reordering...
authorMarkus Scherer <markus.icu@gmail.com>
Wed, 9 Jul 2014 23:36:19 +0000 (23:36 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Wed, 9 Jul 2014 23:36:19 +0000 (23:36 +0000)
X-SVN-Rev: 36018

icu4c/source/i18n/rulebasedcollator.cpp

index ddc7de7910286de78f4ad850318ddce5b9400fbf..40d657009e4a9394ac9d4ac25a8ce567159d72da 100644 (file)
@@ -646,6 +646,9 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
+    if(length == 1 && reorderCodes[0] == UCOL_REORDER_CODE_NONE) {
+        length = 0;
+    }
     if(length == settings->reorderCodesLength &&
             uprv_memcmp(reorderCodes, settings->reorderCodes, length * 4) == 0) {
         return;
@@ -670,7 +673,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
-    if(length == 0 || (length == 1 && reorderCodes[0] == UCOL_REORDER_CODE_NONE)) {
+    if(length == 0) {
         ownedSettings->resetReordering();
     } else {
         uint8_t reorderTable[256];