Extract and reuse conversion code
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 5cdedbb..a8a4a20 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -2380,8 +2380,9 @@
}
for( int i=0; i<NUM_ENTITIES; ++i ) {
const char entityValue = entities[i].value;
- TIXMLASSERT( ((unsigned char)entityValue) < ENTITY_RANGE );
- _entityFlag[ (unsigned char)entityValue ] = true;
+ const unsigned char flagIndex = (unsigned char)entityValue;
+ TIXMLASSERT( flagIndex < ENTITY_RANGE );
+ _entityFlag[flagIndex] = true;
}
_restrictedEntityFlag[(unsigned char)'&'] = true;
_restrictedEntityFlag[(unsigned char)'<'] = true;