diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-17 17:54:18 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-18 06:05:49 +0000 |
commit | 652e09f734fefb9b49787e8e565d235d504a1e73 (patch) | |
tree | 3c1d9cdc537273d1129f43400396231b903ebf15 /i18nutil/source/utility/oneToOneMapping.cxx | |
parent | d95df6d12c8191f2c97719b59420c49651b5d8ac (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I7e85aca5a86f993a9906525edffbd44a179dc245
Reviewed-on: https://gerrit.libreoffice.org/13510
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'i18nutil/source/utility/oneToOneMapping.cxx')
-rw-r--r-- | i18nutil/source/utility/oneToOneMapping.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/i18nutil/source/utility/oneToOneMapping.cxx b/i18nutil/source/utility/oneToOneMapping.cxx index 39c74ded40bf..2ced0f898f41 100644 --- a/i18nutil/source/utility/oneToOneMapping.cxx +++ b/i18nutil/source/utility/oneToOneMapping.cxx @@ -38,10 +38,9 @@ sal_Unicode oneToOneMapping::find(const sal_Unicode nKey) const // binary search int bottom = 0; int top = mnSize - 1; - int current; for (;;) { - current = (top + bottom) / 2; + const int current = (top + bottom) / 2; if( nKey < mpTable[current].first ) top = current - 1; else if( nKey > mpTable[current].first ) @@ -78,15 +77,15 @@ void oneToOneMappingWithFlag::makeIndex() { if( !mbHasIndex && mpTableWF ) { - int i, j, high, low, current = -1; + int i, j, current = -1; for( i = 0; i < 256; i++ ) mpIndex[i] = NULL; for( size_t k = 0; k < mnSize; k++ ) { - high = (mpTableWF[k].first >> 8) & 0xFF; - low = (mpTableWF[k].first) & 0xFF; + const int high = (mpTableWF[k].first >> 8) & 0xFF; + const int low = (mpTableWF[k].first) & 0xFF; if( high != current ) { current = high; @@ -124,10 +123,9 @@ sal_Unicode oneToOneMappingWithFlag::find( const sal_Unicode nKey ) const // binary search int bottom = 0; int top = mnSize - 1; - int current; for (;;) { - current = (top + bottom) / 2; + const int current = (top + bottom) / 2; if( nKey < mpTableWF[current].first ) top = current - 1; else if( nKey > mpTableWF[current].first ) |