diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-27 20:34:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-27 23:00:45 +0000 |
commit | fc95782eb39cf4974ac4b3096695eeb89008937c (patch) | |
tree | 2dd8744662157c4414e4449bbd6217272be9af34 /i18nutil | |
parent | 4e7b2a7885ac0a3194f7f9d974c901cd41640a71 (diff) |
coverity#984097 Uninitialized pointer field
Change-Id: I3098e446f0a2a4cd82785d7dcaf101575ed0b476
Diffstat (limited to 'i18nutil')
-rw-r--r-- | i18nutil/source/utility/oneToOneMapping.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/i18nutil/source/utility/oneToOneMapping.cxx b/i18nutil/source/utility/oneToOneMapping.cxx index 2ced0f898f41..3c735427dd53 100644 --- a/i18nutil/source/utility/oneToOneMapping.cxx +++ b/i18nutil/source/utility/oneToOneMapping.cxx @@ -62,24 +62,25 @@ oneToOneMappingWithFlag::oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF mnFlag ( rnFlag ), mbHasIndex( false ) { + memset(mpIndex, 0, sizeof(mpIndex)); } oneToOneMappingWithFlag::~oneToOneMappingWithFlag() { if( mbHasIndex ) - for( int i = 0; i < 256; i++ ) - if( mpIndex[i] ) - delete [] mpIndex[i]; + { + for (size_t i = 0; i < SAL_N_ELEMENTS(mpIndex); ++i) + delete [] mpIndex[i]; + } } - void oneToOneMappingWithFlag::makeIndex() { if( !mbHasIndex && mpTableWF ) { - int i, j, current = -1; + int current = -1; - for( i = 0; i < 256; i++ ) + for (size_t i = 0; i < SAL_N_ELEMENTS(mpIndex); ++i) mpIndex[i] = NULL; for( size_t k = 0; k < mnSize; k++ ) @@ -91,7 +92,7 @@ void oneToOneMappingWithFlag::makeIndex() current = high; mpIndex[high] = new UnicodePairWithFlag*[256]; - for( j = 0; j < 256; j++ ) + for (int j = 0; j < 256; ++j) mpIndex[high][j] = NULL; } mpIndex[high][low] = &mpTableWF[k]; |