Merge pull request #343 from Dmitry-Me/checkEntityWasPrinted

Ensure proper pattern was found and printed
This commit is contained in:
Lee Thomason 2015-07-01 14:18:15 -07:00
commit 4824e95bc0
1 changed files with 6 additions and 0 deletions

View File

@ -2146,12 +2146,18 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
Print( "%.*s", toPrint, p ); Print( "%.*s", toPrint, p );
p += toPrint; p += toPrint;
} }
bool entityPatternPrinted = false;
for( int i=0; i<NUM_ENTITIES; ++i ) { for( int i=0; i<NUM_ENTITIES; ++i ) {
if ( entities[i].value == *q ) { if ( entities[i].value == *q ) {
Print( "&%s;", entities[i].pattern ); Print( "&%s;", entities[i].pattern );
entityPatternPrinted = true;
break; break;
} }
} }
if ( !entityPatternPrinted ) {
// TIXMLASSERT( entityPatternPrinted ) causes gcc -Wunused-but-set-variable in release
TIXMLASSERT( false );
}
++p; ++p;
} }
} }