merge 2013-11-13 branch into trunk

This commit is contained in:
Justin Hammond 2014-02-14 13:46:51 +00:00
parent b38e81fcc8
commit 4e0a719d10
148 changed files with 9046 additions and 4471 deletions

View file

@ -29,6 +29,8 @@ distribution.
#include <iostream>
#endif
#include <new>
#include "tinyxml.h"
@ -731,7 +733,7 @@ void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
return;
}
TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
TiXmlAttribute* attrib = new (std::nothrow) TiXmlAttribute( cname, cvalue );
if ( attrib )
{
attributeSet.Add( attrib );
@ -754,7 +756,7 @@ void TiXmlElement::SetAttribute( const std::string& name, const std::string& _va
return;
}
TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
TiXmlAttribute* attrib = new (std::nothrow) TiXmlAttribute( name, _value );
if ( attrib )
{
attributeSet.Add( attrib );
@ -859,7 +861,7 @@ bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlElement::Clone() const
{
TiXmlElement* clone = new TiXmlElement( Value() );
TiXmlElement* clone = new (std::nothrow) TiXmlElement( Value() );
if ( !clone )
return 0;
@ -1130,14 +1132,15 @@ void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
TiXmlNode* node = 0;
for ( node = firstChild; node; node = node->NextSibling() )
{
target->LinkEndChild( node->Clone() );
TiXmlNode* clonedNode=node->Clone();
if (clonedNode!=NULL) target->LinkEndChild( clonedNode );
}
}
TiXmlNode* TiXmlDocument::Clone() const
{
TiXmlDocument* clone = new TiXmlDocument();
TiXmlDocument* clone = new (std::nothrow) TiXmlDocument();
if ( !clone )
return 0;
@ -1322,7 +1325,7 @@ bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlComment::Clone() const
{
TiXmlComment* clone = new TiXmlComment();
TiXmlComment* clone = new (std::nothrow) TiXmlComment();
if ( !clone )
return 0;
@ -1369,7 +1372,7 @@ bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlText::Clone() const
{
TiXmlText* clone = 0;
clone = new TiXmlText( "" );
clone = new (std::nothrow) TiXmlText( "" );
if ( !clone )
return 0;
@ -1457,7 +1460,7 @@ bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlDeclaration::Clone() const
{
TiXmlDeclaration* clone = new TiXmlDeclaration();
TiXmlDeclaration* clone = new (std::nothrow) TiXmlDeclaration();
if ( !clone )
return 0;
@ -1489,7 +1492,7 @@ bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlUnknown::Clone() const
{
TiXmlUnknown* clone = new TiXmlUnknown();
TiXmlUnknown* clone = new (std::nothrow) TiXmlUnknown();
if ( !clone )
return 0;

View file

@ -24,6 +24,7 @@ distribution.
#include <ctype.h>
#include <stddef.h>
#include <new>
#include "tinyxml.h"
@ -850,21 +851,21 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing Declaration\n" );
#endif
returnNode = new TiXmlDeclaration();
returnNode = new (std::nothrow) TiXmlDeclaration();
}
else if ( StringEqual( p, commentHeader, false, encoding ) )
{
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing Comment\n" );
#endif
returnNode = new TiXmlComment();
returnNode = new (std::nothrow) TiXmlComment();
}
else if ( StringEqual( p, cdataHeader, false, encoding ) )
{
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing CDATA\n" );
#endif
TiXmlText* text = new TiXmlText( "" );
TiXmlText* text = new (std::nothrow) TiXmlText( "" );
text->SetCDATA( true );
returnNode = text;
}
@ -873,7 +874,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing Unknown(1)\n" );
#endif
returnNode = new TiXmlUnknown();
returnNode = new (std::nothrow) TiXmlUnknown();
}
else if ( IsAlpha( *(p+1), encoding )
|| *(p+1) == '_' )
@ -881,14 +882,14 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing Element\n" );
#endif
returnNode = new TiXmlElement( "" );
returnNode = new (std::nothrow) TiXmlElement( "" );
}
else
{
#ifdef DEBUG_PARSER
TIXML_LOG( "XML parsing Unknown(2)\n" );
#endif
returnNode = new TiXmlUnknown();
returnNode = new (std::nothrow) TiXmlUnknown();
}
if ( returnNode )
@ -1136,7 +1137,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
else
{
// Try to read an attribute:
TiXmlAttribute* attrib = new TiXmlAttribute();
TiXmlAttribute* attrib = new (std::nothrow) TiXmlAttribute();
if ( !attrib )
{
if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
@ -1187,7 +1188,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
if ( *p != '<' )
{
// Take what we have, make a text element.
TiXmlText* textNode = new TiXmlText( "" );
TiXmlText* textNode = new (std::nothrow) TiXmlText( "" );
if ( !textNode )
{