diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 3614b46..c0711a6 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -58,7 +58,7 @@ const char* StrPair::GetStr() else { ++p; } - *q = LF; + *q++ = LF; } else if ( (flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { if ( *(p+1) == CR ) { @@ -67,7 +67,7 @@ const char* StrPair::GetStr() else { ++p; } - *q = LF; + *q++ = LF; } else if ( (flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { int i=0; @@ -275,11 +275,9 @@ bool XMLDocument::Accept( XMLVisitor* visitor ) const XMLNode::XMLNode( XMLDocument* doc ) : document( doc ), parent( 0 ), -// isTextParent( false ), firstChild( 0 ), lastChild( 0 ), prev( 0 ), next( 0 ) { - } @@ -342,9 +340,6 @@ XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) addThis->prev = 0; addThis->next = 0; } -// if ( addThis->ToText() ) { -// SetTextParent(); -// } return addThis; } @@ -384,15 +379,6 @@ void XMLNode::DeleteChild( XMLNode* node ) } -/*void XMLNode::Print( XMLStreamer* streamer ) -{ - for( XMLNode* node = firstChild; node; node=node->next ) { - node->Print( streamer ); - } -} -*/ - - char* XMLNode::ParseDeep( char* p ) { while( p && *p ) { @@ -524,14 +510,6 @@ char* XMLAttribute::ParseDeep( char* p ) } -/* -void XMLAttribute::Print( XMLStreamer* streamer ) -{ - // fixme: sort out single vs. double quote - //fprintf( cfile, "%s=\"%s\"", name.GetStr(), value.GetStr() ); - streamer->PushAttribute( name.GetStr(), value.GetStr() ); -} -*/ // --------- XMLElement ---------- // XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), @@ -544,8 +522,6 @@ XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), XMLElement::~XMLElement() { - //printf( "~XMLElemen %x\n",this ); - XMLAttribute* attribute = rootAttribute; while( attribute ) { XMLAttribute* next = attribute->next; @@ -643,29 +619,6 @@ char* XMLElement::ParseDeep( char* p ) } -/* -void XMLElement::Print( XMLStreamer* streamer ) -{ - //if ( !parent || !parent->IsTextParent() ) { - // PrintSpace( cfile, depth ); - //} - //fprintf( cfile, "<%s", Name() ); - streamer->OpenElement( Name() ); - - for( XMLAttribute* attrib=rootAttribute; attrib; attrib=attrib->next ) { - //fprintf( cfile, " " ); - attrib->Print( streamer ); - - } - - for( XMLNode* node=firstChild; node; node=node->next ) { - node->Print( streamer ); - } - streamer->CloseElement(); -} -*/ - - bool XMLElement::Accept( XMLVisitor* visitor ) const { if ( visitor->VisitEnter( *this, rootAttribute ) ) @@ -695,12 +648,13 @@ XMLDocument::~XMLDocument() ClearChildren(); delete [] charBuffer; - /* +#if 1 textPool.Trace( "text" ); elementPool.Trace( "element" ); commentPool.Trace( "comment" ); attributePool.Trace( "attribute" ); - */ +#endif + TIXMLASSERT( textPool.CurrentAllocs() == 0 ); TIXMLASSERT( elementPool.CurrentAllocs() == 0 ); TIXMLASSERT( commentPool.CurrentAllocs() == 0 ); diff --git a/xmltest.cpp b/xmltest.cpp index b624d9b..88f8ac4 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -3,11 +3,21 @@ #include #include +#if defined( WIN32 ) + #include + _CrtMemState startMemState; + _CrtMemState endMemState; +#endif + using namespace tinyxml2; int main( int argc, const char* argv ) { -#if 1 + #if defined( WIN32 ) + _CrtMemCheckpoint( &startMemState ); + #endif + +#if 0 { static const char* test = "