Procházet zdrojové kódy

Ensure proper pattern was found and printed

Dmitry-Me před 10 roky
rodič
revize
39c399a0f2
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      tinyxml2.cpp

+ 6 - 0
tinyxml2.cpp

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