@@ -24,7 +24,7 @@ distribution.
2424#include " tinyxml2.h"
2525
2626#include < new> // yes, this one new style header, is in the Android SDK.
27- #if defined(ANDROID_NDK) || defined(__QNXNTO__)
27+ #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined( __QNXNTO__)
2828# include < stddef.h>
2929# include < stdarg.h>
3030#else
@@ -471,7 +471,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
471471 else {
472472 return 0 ;
473473 }
474- TIXMLASSERT ( digit >= 0 && digit < 16 );
474+ TIXMLASSERT ( digit < 16 );
475475 TIXMLASSERT ( digit == 0 || mult <= UINT_MAX / digit );
476476 const unsigned int digitScaled = mult * digit;
477477 TIXMLASSERT ( ucs <= ULONG_MAX - digitScaled );
@@ -501,7 +501,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
501501 while ( *q != ' #' ) {
502502 if ( *q >= ' 0' && *q <= ' 9' ) {
503503 const unsigned int digit = *q - ' 0' ;
504- TIXMLASSERT ( digit >= 0 && digit < 10 );
504+ TIXMLASSERT ( digit < 10 );
505505 TIXMLASSERT ( digit == 0 || mult <= UINT_MAX / digit );
506506 const unsigned int digitScaled = mult * digit;
507507 TIXMLASSERT ( ucs <= ULONG_MAX - digitScaled );
@@ -776,6 +776,7 @@ void XMLNode::DeleteChild( XMLNode* node )
776776 TIXMLASSERT ( node );
777777 TIXMLASSERT ( node->_document == _document );
778778 TIXMLASSERT ( node->_parent == this );
779+ Unlink ( node );
779780 DeleteNode ( node );
780781}
781782
@@ -1285,7 +1286,7 @@ void XMLAttribute::SetName( const char* n )
12851286XMLError XMLAttribute::QueryIntValue ( int * value ) const
12861287{
12871288 if ( XMLUtil::ToInt ( Value (), value )) {
1288- return XML_NO_ERROR ;
1289+ return XML_SUCCESS ;
12891290 }
12901291 return XML_WRONG_ATTRIBUTE_TYPE;
12911292}
@@ -1294,7 +1295,7 @@ XMLError XMLAttribute::QueryIntValue( int* value ) const
12941295XMLError XMLAttribute::QueryUnsignedValue ( unsigned int * value ) const
12951296{
12961297 if ( XMLUtil::ToUnsigned ( Value (), value )) {
1297- return XML_NO_ERROR ;
1298+ return XML_SUCCESS ;
12981299 }
12991300 return XML_WRONG_ATTRIBUTE_TYPE;
13001301}
@@ -1303,7 +1304,7 @@ XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
13031304XMLError XMLAttribute::QueryBoolValue ( bool * value ) const
13041305{
13051306 if ( XMLUtil::ToBool ( Value (), value )) {
1306- return XML_NO_ERROR ;
1307+ return XML_SUCCESS ;
13071308 }
13081309 return XML_WRONG_ATTRIBUTE_TYPE;
13091310}
@@ -1312,7 +1313,7 @@ XMLError XMLAttribute::QueryBoolValue( bool* value ) const
13121313XMLError XMLAttribute::QueryFloatValue ( float * value ) const
13131314{
13141315 if ( XMLUtil::ToFloat ( Value (), value )) {
1315- return XML_NO_ERROR ;
1316+ return XML_SUCCESS ;
13161317 }
13171318 return XML_WRONG_ATTRIBUTE_TYPE;
13181319}
@@ -1321,7 +1322,7 @@ XMLError XMLAttribute::QueryFloatValue( float* value ) const
13211322XMLError XMLAttribute::QueryDoubleValue ( double * value ) const
13221323{
13231324 if ( XMLUtil::ToDouble ( Value (), value )) {
1324- return XML_NO_ERROR ;
1325+ return XML_SUCCESS ;
13251326 }
13261327 return XML_WRONG_ATTRIBUTE_TYPE;
13271328}
@@ -1770,7 +1771,7 @@ XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) :
17701771 XMLNode ( 0 ),
17711772 _writeBOM ( false ),
17721773 _processEntities ( processEntities ),
1773- _errorID ( XML_NO_ERROR ),
1774+ _errorID (XML_SUCCESS ),
17741775 _whitespace ( whitespace ),
17751776 _errorStr1 ( 0 ),
17761777 _errorStr2 ( 0 ),
@@ -1794,7 +1795,7 @@ void XMLDocument::Clear()
17941795#ifdef DEBUG
17951796 const bool hadError = Error ();
17961797#endif
1797- _errorID = XML_NO_ERROR ;
1798+ _errorID = XML_SUCCESS ;
17981799 _errorStr1 = 0 ;
17991800 _errorStr2 = 0 ;
18001801
@@ -1953,6 +1954,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
19531954 SetError ( XML_ERROR_FILE_READ_ERROR, 0 , 0 );
19541955 return _errorID;
19551956 }
1957+ TIXMLASSERT ( filelength >= 0 );
19561958
19571959 if ( !LongFitsIntoSizeTMinusOne<>::Fits ( filelength ) ) {
19581960 // Cannot handle files which won't fit in buffer together with null terminator
@@ -1998,7 +2000,7 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
19982000{
19992001 // Clear any error from the last save, otherwise it will get reported
20002002 // for *this* call.
2001- SetError ( XML_NO_ERROR , 0 , 0 );
2003+ SetError (XML_SUCCESS , 0 , 0 );
20022004 XMLPrinter stream ( fp, compact );
20032005 Print ( &stream );
20042006 return _errorID;
0 commit comments