Extract and reuse conversion code

This commit is contained in:
Dmitry-Me 2017-08-25 18:34:18 +03:00
parent d69e2c0d08
commit a28eb0763d
1 changed files with 3 additions and 2 deletions

View File

@ -2380,8 +2380,9 @@ XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) :
} }
for( int i=0; i<NUM_ENTITIES; ++i ) { for( int i=0; i<NUM_ENTITIES; ++i ) {
const char entityValue = entities[i].value; const char entityValue = entities[i].value;
TIXMLASSERT( ((unsigned char)entityValue) < ENTITY_RANGE ); const unsigned char flagIndex = (unsigned char)entityValue;
_entityFlag[ (unsigned char)entityValue ] = true; TIXMLASSERT( flagIndex < ENTITY_RANGE );
_entityFlag[flagIndex] = true;
} }
_restrictedEntityFlag[(unsigned char)'&'] = true; _restrictedEntityFlag[(unsigned char)'&'] = true;
_restrictedEntityFlag[(unsigned char)'<'] = true; _restrictedEntityFlag[(unsigned char)'<'] = true;