From e54777276d28e6bbceefa07e260926c81790938c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 3 Aug 2020 08:41:49 +0200 Subject: loplugin:flatten in configmgr..i18nutil Change-Id: Idaeed33df4f1dd1b2acbdaf8a895c5d56c3ca14c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99980 Tested-by: Jenkins Reviewed-by: Noel Grandin --- i18nutil/source/utility/oneToOneMapping.cxx | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'i18nutil') diff --git a/i18nutil/source/utility/oneToOneMapping.cxx b/i18nutil/source/utility/oneToOneMapping.cxx index ea8afdeb1fcc..fbb7054d91cc 100644 --- a/i18nutil/source/utility/oneToOneMapping.cxx +++ b/i18nutil/source/utility/oneToOneMapping.cxx @@ -70,27 +70,27 @@ oneToOneMappingWithFlag::~oneToOneMappingWithFlag() void oneToOneMappingWithFlag::makeIndex() { - if( !mbHasIndex && mpTableWF ) - { - int current = -1; + if( mbHasIndex || !mpTableWF ) + return; + + int current = -1; - for( size_t k = 0; k < mnSize; k++ ) + for( size_t k = 0; k < mnSize; k++ ) + { + const int high = (mpTableWF[k].first >> 8) & 0xFF; + const int low = (mpTableWF[k].first) & 0xFF; + if( high != current ) { - const int high = (mpTableWF[k].first >> 8) & 0xFF; - const int low = (mpTableWF[k].first) & 0xFF; - if( high != current ) - { - current = high; - mpIndex[high].reset(new UnicodePairWithFlag const *[256]); - - for (int j = 0; j < 256; ++j) - mpIndex[high][j] = nullptr; - } - mpIndex[high][low] = &mpTableWF[k]; - } + current = high; + mpIndex[high].reset(new UnicodePairWithFlag const *[256]); - mbHasIndex = true; + for (int j = 0; j < 256; ++j) + mpIndex[high][j] = nullptr; + } + mpIndex[high][low] = &mpTableWF[k]; } + + mbHasIndex = true; } sal_Unicode oneToOneMappingWithFlag::find( const sal_Unicode nKey ) const -- cgit