diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 2d3a1f7..ad854cb 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1962,16 +1962,13 @@ XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : _restrictedEntityFlag[i] = false; } for( int i=0; i'] = true; // not required, but consistency is nice + _restrictedEntityFlag[(unsigned char)'&'] = true; + _restrictedEntityFlag[(unsigned char)'<'] = true; + _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice _buffer.Push( 0 ); } @@ -2039,7 +2036,7 @@ void XMLPrinter::PrintString( const char* p, bool restricted ) // Check for entities. If one is found, flush // the stream up until the entity, write the // entity, and keep looking. - if ( flag[(unsigned)(*q)] ) { + if ( flag[(unsigned char)(*q)] ) { while ( p < q ) { Print( "%c", *p ); ++p; diff --git a/xmltest.cpp b/xmltest.cpp index ebcd4dd..31e1187 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -1398,6 +1398,10 @@ int main( int argc, const char ** argv ) doc.DeleteNode(pRoot); } + { + // Should not assert in DEBUG + XMLPrinter printer; + } // ----------- Performance tracking -------------- {