Updated TinyXML
This commit is contained in:
parent
348232a599
commit
6ceb4b057b
|
@ -2037,7 +2037,7 @@ void XMLDocument::Clear()
|
||||||
DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete.
|
DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete.
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef TINYXML2_DEBUG
|
||||||
const bool hadError = Error();
|
const bool hadError = Error();
|
||||||
#endif
|
#endif
|
||||||
ClearError();
|
ClearError();
|
||||||
|
@ -2052,7 +2052,7 @@ void XMLDocument::Clear()
|
||||||
_attributePool.Trace( "attribute" );
|
_attributePool.Trace( "attribute" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef TINYXML2_DEBUG
|
||||||
if ( !hadError ) {
|
if ( !hadError ) {
|
||||||
TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() );
|
TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() );
|
||||||
TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );
|
TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );
|
||||||
|
@ -2151,10 +2151,16 @@ void XMLDocument::DeleteNode( XMLNode* node ) {
|
||||||
|
|
||||||
XMLError XMLDocument::LoadFile( const char* filename )
|
XMLError XMLDocument::LoadFile( const char* filename )
|
||||||
{
|
{
|
||||||
|
if ( !filename ) {
|
||||||
|
TIXMLASSERT( false );
|
||||||
|
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=<null>" );
|
||||||
|
return _errorID;
|
||||||
|
}
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
FILE* fp = callfopen( filename, "rb" );
|
FILE* fp = callfopen( filename, "rb" );
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
SetError( XML_ERROR_FILE_NOT_FOUND, 0, "filename=%s", filename ? filename : "<null>");
|
SetError( XML_ERROR_FILE_NOT_FOUND, 0, "filename=%s", filename );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
LoadFile( fp );
|
LoadFile( fp );
|
||||||
|
@ -2233,9 +2239,15 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
|
|
||||||
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
||||||
{
|
{
|
||||||
|
if ( !filename ) {
|
||||||
|
TIXMLASSERT( false );
|
||||||
|
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=<null>" );
|
||||||
|
return _errorID;
|
||||||
|
}
|
||||||
|
|
||||||
FILE* fp = callfopen( filename, "w" );
|
FILE* fp = callfopen( filename, "w" );
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=%s", filename ? filename : "<null>");
|
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=%s", filename );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
SaveFile(fp, compact);
|
SaveFile(fp, compact);
|
||||||
|
@ -2791,4 +2803,3 @@ bool XMLPrinter::Visit( const XMLUnknown& unknown )
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tinyxml2
|
} // namespace tinyxml2
|
||||||
|
|
||||||
|
|
|
@ -47,15 +47,15 @@ distribution.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
gcc:
|
gcc:
|
||||||
g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
|
g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
|
||||||
|
|
||||||
Formatting, Artistic Style:
|
Formatting, Artistic Style:
|
||||||
AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
|
AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined( _DEBUG ) || defined (__DEBUG__)
|
#if defined( _DEBUG ) || defined (__DEBUG__)
|
||||||
# ifndef DEBUG
|
# ifndef TINYXML2_DEBUG
|
||||||
# define DEBUG
|
# define TINYXML2_DEBUG
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ distribution.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(TINYXML2_DEBUG)
|
||||||
# if defined(_MSC_VER)
|
# if defined(_MSC_VER)
|
||||||
# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
|
# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
|
||||||
# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
|
# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
|
||||||
|
@ -395,7 +395,7 @@ public:
|
||||||
}
|
}
|
||||||
--_currentAllocs;
|
--_currentAllocs;
|
||||||
Item* item = static_cast<Item*>( mem );
|
Item* item = static_cast<Item*>( mem );
|
||||||
#ifdef DEBUG
|
#ifdef TINYXML2_DEBUG
|
||||||
memset( item, 0xfe, sizeof( *item ) );
|
memset( item, 0xfe, sizeof( *item ) );
|
||||||
#endif
|
#endif
|
||||||
item->next = _root;
|
item->next = _root;
|
||||||
|
|
Loading…
Reference in New Issue