Kaydet (Commit) fc95782e authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#984097 Uninitialized pointer field

Change-Id: I3098e446f0a2a4cd82785d7dcaf101575ed0b476
üst 4e7b2a78
...@@ -62,24 +62,25 @@ oneToOneMappingWithFlag::oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF ...@@ -62,24 +62,25 @@ oneToOneMappingWithFlag::oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF
mnFlag ( rnFlag ), mnFlag ( rnFlag ),
mbHasIndex( false ) mbHasIndex( false )
{ {
memset(mpIndex, 0, sizeof(mpIndex));
} }
oneToOneMappingWithFlag::~oneToOneMappingWithFlag() oneToOneMappingWithFlag::~oneToOneMappingWithFlag()
{ {
if( mbHasIndex ) if( mbHasIndex )
for( int i = 0; i < 256; i++ ) {
if( mpIndex[i] ) for (size_t i = 0; i < SAL_N_ELEMENTS(mpIndex); ++i)
delete [] mpIndex[i]; delete [] mpIndex[i];
}
} }
void oneToOneMappingWithFlag::makeIndex() void oneToOneMappingWithFlag::makeIndex()
{ {
if( !mbHasIndex && mpTableWF ) 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; mpIndex[i] = NULL;
for( size_t k = 0; k < mnSize; k++ ) for( size_t k = 0; k < mnSize; k++ )
...@@ -91,7 +92,7 @@ void oneToOneMappingWithFlag::makeIndex() ...@@ -91,7 +92,7 @@ void oneToOneMappingWithFlag::makeIndex()
current = high; current = high;
mpIndex[high] = new UnicodePairWithFlag*[256]; mpIndex[high] = new UnicodePairWithFlag*[256];
for( j = 0; j < 256; j++ ) for (int j = 0; j < 256; ++j)
mpIndex[high][j] = NULL; mpIndex[high][j] = NULL;
} }
mpIndex[high][low] = &mpTableWF[k]; mpIndex[high][low] = &mpTableWF[k];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment