mirror of https://github.com/AxioDL/tinyxml2.git
Minor performance tweaks
This commit is contained in:
parent
b2e08e4bc0
commit
85aac02172
12
tinyxml2.cpp
12
tinyxml2.cpp
|
@ -2489,7 +2489,7 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
|
||||||
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 ) {
|
||||||
Putc( '&' );
|
Putc( '&' );
|
||||||
Write( entities[i].pattern );
|
Write( entities[i].pattern, entities[i].length );
|
||||||
Putc( ';' );
|
Putc( ';' );
|
||||||
entityPatternPrinted = true;
|
entityPatternPrinted = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2510,7 +2510,9 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
|
||||||
// string if an entity wasn't found.
|
// string if an entity wasn't found.
|
||||||
TIXMLASSERT( p <= q );
|
TIXMLASSERT( p <= q );
|
||||||
if ( !_processEntities || ( p < q ) ) {
|
if ( !_processEntities || ( p < q ) ) {
|
||||||
Write( p );
|
const size_t delta = q - p;
|
||||||
|
const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta;
|
||||||
|
Write( p, toPrint );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2551,11 +2553,11 @@ void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
||||||
void XMLPrinter::PushAttribute( const char* name, const char* value )
|
void XMLPrinter::PushAttribute( const char* name, const char* value )
|
||||||
{
|
{
|
||||||
TIXMLASSERT( _elementJustOpened );
|
TIXMLASSERT( _elementJustOpened );
|
||||||
Write( " " );
|
Putc ( ' ' );
|
||||||
Write( name );
|
Write( name );
|
||||||
Write( "=\"" );
|
Write( "=\"" );
|
||||||
PrintString( value, false );
|
PrintString( value, false );
|
||||||
Write( "\"" );
|
Putc ( '\"' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2740,7 +2742,7 @@ void XMLPrinter::PushUnknown( const char* value )
|
||||||
|
|
||||||
Write( "<!" );
|
Write( "<!" );
|
||||||
Write( value );
|
Write( value );
|
||||||
Write( ">" );
|
Putc( '>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue