1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-25 21:23:00 +04:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Lee Thomason 7589178395 minor readme fixes 2025-11-22 16:23:12 -08:00
2 changed files with 4 additions and 15 deletions
+3 -8
View File
@@ -114,9 +114,6 @@ distribution.
#define TIXML_VSNPRINTF vsnprintf
static inline int TIXML_VSCPRINTF( const char* format, va_list va )
{
if (!format) {
return 0;
}
int len = vsnprintf( 0, 0, format, va );
TIXMLASSERT( len >= 0 );
return len;
@@ -2347,11 +2344,9 @@ static FILE* callfopen( const char* filepath, const char* mode )
return fp;
}
void XMLDocument::DeleteNode( XMLNode* node ) {
if(node == 0) {
return; // check for null pointer
}
TIXMLASSERT(node->_document == this);
void XMLDocument::DeleteNode( XMLNode* node ) {
TIXMLASSERT( node );
TIXMLASSERT(node->_document == this );
if (node->_parent) {
node->_parent->DeleteChild( node );
}
+1 -7
View File
@@ -2025,13 +2025,7 @@ int main( int argc, const char ** argv )
XMLTest("Parse nested elements with pedantic whitespace", false, doc.Error());
XMLTest("Pedantic whitespace", true, 0 == doc.RootElement()->FirstChildElement()->GetText());
}
//Check the robustness of the DeleteNode function in handling null pointers.
{
XMLDocument doc;
doc.DeleteNode(nullptr);
XMLTest("DeleteNode with null pointer", true, doc.Error() == XML_SUCCESS);
}
// Check sample xml can be parsed with pedantic mode
{
XMLDocument doc(true, PEDANTIC_WHITESPACE);