Merge pull request #469 from Trebgarta/master

Bool true/false rather than 0/1 : #399
This commit is contained in:
Lee Thomason 2016-08-28 17:21:04 -07:00 committed by GitHub
commit 4fe8c102da
2 changed files with 3 additions and 3 deletions

View File

@ -538,7 +538,7 @@ void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize )
void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) void XMLUtil::ToStr( bool v, char* buffer, int bufferSize )
{ {
TIXML_SNPRINTF( buffer, bufferSize, "%d", v ? 1 : 0 ); TIXML_SNPRINTF( buffer, bufferSize, "%s", v ? "true" : "false" );
} }
/* /*

View File

@ -451,7 +451,7 @@ int main( int argc, const char ** argv )
{ {
XMLPrinter streamer( 0, true ); XMLPrinter streamer( 0, true );
doc->Print( &streamer ); doc->Print( &streamer );
XMLTest( "Compact mode", "<element><sub attrib=\"1\"/><sub/></element>", streamer.CStr(), false ); XMLTest( "Compact mode", "<element><sub attrib=\"true\"/><sub/></element>", streamer.CStr(), false );
} }
doc->SaveFile( "./resources/out/pretty.xml" ); doc->SaveFile( "./resources/out/pretty.xml" );
doc->SaveFile( "./resources/out/compact.xml", true ); doc->SaveFile( "./resources/out/compact.xml", true );
@ -679,7 +679,7 @@ int main( int argc, const char ** argv )
XMLTest( "SetText types", "1", element->GetText() ); XMLTest( "SetText types", "1", element->GetText() );
element->SetText( true ); element->SetText( true );
XMLTest( "SetText types", "1", element->GetText() ); // TODO: should be 'true'? XMLTest( "SetText types", "true", element->GetText() );
element->SetText( 1.5f ); element->SetText( 1.5f );
XMLTest( "SetText types", "1.5", element->GetText() ); XMLTest( "SetText types", "1.5", element->GetText() );