From 1379df978956d8e8e5ffd8e55f02b4704c644485 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Wed, 9 Jul 2014 23:36:19 +0000 Subject: [PATCH] ICU-10998 test for only-none before comparing with the current list of reordering codes X-SVN-Rev: 36018 --- icu4c/source/i18n/rulebasedcollator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/rulebasedcollator.cpp b/icu4c/source/i18n/rulebasedcollator.cpp index ddc7de79102..40d657009e4 100644 --- a/icu4c/source/i18n/rulebasedcollator.cpp +++ b/icu4c/source/i18n/rulebasedcollator.cpp @@ -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]; -- 2.40.0