From 69d521d35471c59b3598852a821c39992f964fa8 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 20 Apr 2015 18:05:53 +0300 Subject: [PATCH] Unify pointers comparison, consistency asserts --- tinyxml2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index c6845db..d4c45a4 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -2061,6 +2061,7 @@ void XMLPrinter::PrintString( const char* p, bool restricted ) if ( _processEntities ) { const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag; while ( *q ) { + TIXMLASSERT( p <= q ); // Remember, char is sometimes signed. (How many times has that bitten me?) if ( *q > 0 && *q < ENTITY_RANGE ) { // Check for entities. If one is found, flush @@ -2084,11 +2085,13 @@ void XMLPrinter::PrintString( const char* p, bool restricted ) } } ++q; + TIXMLASSERT( p <= q ); } } // Flush the remaining string. This will be the entire // string if an entity wasn't found. - if ( !_processEntities || (q-p > 0) ) { + TIXMLASSERT( p <= q ); + if ( !_processEntities || ( p < q ) ) { Print( "%s", p ); } }