update TinyXML to v2.6.2
This commit is contained in:
parent
511c5a62e7
commit
ea941adae2
|
@ -286,5 +286,14 @@ Changes in version 2.1.5
|
|||
- tibur found a bug in end tag parsing
|
||||
|
||||
|
||||
|
||||
2.6.2
|
||||
- Switched over to VC 2010
|
||||
- Fixed up all the build issues arising from that. (Lots of latent build problems.)
|
||||
- Removed the old, now unmaintained and likely not working, build files.
|
||||
- Fixed some static analysis issues reported by orbitcowboy from cppcheck.
|
||||
- Bayard 95 sent in analysis from a different analyzer - fixes applied from that as well.
|
||||
- Tim Kosse sent a patch fixing an infinite loop.
|
||||
- Ma Anguo identified a doc issue.
|
||||
- Eddie Cohen identified a missing qualifier resulting in a compilation error on some systems.
|
||||
- Fixed a line ending bug. (What year is this? Can we all agree on a format for text files? Please? ...oh well.)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original file by Yves Berquin.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
|
@ -22,10 +21,6 @@ must not be misrepresented as being the original software.
|
|||
distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original file by Yves Berquin.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
|
@ -22,17 +21,6 @@ must not be misrepresented as being the original software.
|
|||
distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
|
||||
*
|
||||
* - completely rewritten. compact, clean, and fast implementation.
|
||||
* - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
|
||||
* - fixed reserve() to work as per specification.
|
||||
* - fixed buggy compares operator==(), operator<(), and operator>()
|
||||
* - fixed operator+=() to take a const ref argument, following spec.
|
||||
* - added "copy" constructor with length, and most compare operators.
|
||||
* - added swap(), clear(), size(), capacity(), operator+().
|
||||
*/
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
|
@ -106,13 +94,11 @@ class TiXmlString
|
|||
quit();
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const char * copy)
|
||||
{
|
||||
return assign( copy, (size_type)strlen(copy));
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const TiXmlString & copy)
|
||||
{
|
||||
return assign(copy.start(), copy.length());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
||||
Original code by Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
|
@ -191,7 +191,8 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
|
|||
if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT )
|
||||
{
|
||||
delete node;
|
||||
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
if ( GetDocument() )
|
||||
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -214,7 +215,8 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
|
|||
{
|
||||
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
|
||||
{
|
||||
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
if ( GetDocument() )
|
||||
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return 0;
|
||||
}
|
||||
TiXmlNode* node = addThis.Clone();
|
||||
|
@ -232,7 +234,8 @@ TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode&
|
|||
}
|
||||
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
|
||||
{
|
||||
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
if ( GetDocument() )
|
||||
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -264,7 +267,8 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a
|
|||
}
|
||||
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
|
||||
{
|
||||
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
if ( GetDocument() )
|
||||
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -544,10 +548,11 @@ TiXmlElement::TiXmlElement( const TiXmlElement& copy)
|
|||
}
|
||||
|
||||
|
||||
void TiXmlElement::operator=( const TiXmlElement& base )
|
||||
TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base )
|
||||
{
|
||||
ClearThis();
|
||||
base.CopyTo( this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -662,6 +667,45 @@ int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
|
|||
}
|
||||
|
||||
|
||||
int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const
|
||||
{
|
||||
const TiXmlAttribute* node = attributeSet.Find( name );
|
||||
if ( !node )
|
||||
return TIXML_NO_ATTRIBUTE;
|
||||
|
||||
int ival = 0;
|
||||
int result = node->QueryIntValue( &ival );
|
||||
*value = (unsigned)ival;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const
|
||||
{
|
||||
const TiXmlAttribute* node = attributeSet.Find( name );
|
||||
if ( !node )
|
||||
return TIXML_NO_ATTRIBUTE;
|
||||
|
||||
int result = TIXML_WRONG_TYPE;
|
||||
if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN )
|
||||
|| StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN )
|
||||
|| StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) )
|
||||
{
|
||||
*bval = true;
|
||||
result = TIXML_SUCCESS;
|
||||
}
|
||||
else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN )
|
||||
|| StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN )
|
||||
|| StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) )
|
||||
{
|
||||
*bval = false;
|
||||
result = TIXML_SUCCESS;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
|
||||
{
|
||||
|
@ -899,10 +943,11 @@ TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode
|
|||
}
|
||||
|
||||
|
||||
void TiXmlDocument::operator=( const TiXmlDocument& copy )
|
||||
TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy )
|
||||
{
|
||||
Clear();
|
||||
copy.CopyTo( this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1241,10 +1286,11 @@ TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::T
|
|||
}
|
||||
|
||||
|
||||
void TiXmlComment::operator=( const TiXmlComment& base )
|
||||
TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base )
|
||||
{
|
||||
Clear();
|
||||
base.CopyTo( this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1361,10 +1407,11 @@ TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
|
|||
}
|
||||
|
||||
|
||||
void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
|
||||
TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
|
||||
{
|
||||
Clear();
|
||||
copy.CopyTo( this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
||||
Original code by Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
|
@ -26,8 +26,6 @@ distribution.
|
|||
#ifndef TINYXML_INCLUDED
|
||||
#define TINYXML_INCLUDED
|
||||
|
||||
#define TIXML_USE_STL
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4530 )
|
||||
|
@ -93,7 +91,7 @@ class TiXmlParsingData;
|
|||
|
||||
const int TIXML_MAJOR_VERSION = 2;
|
||||
const int TIXML_MINOR_VERSION = 6;
|
||||
const int TIXML_PATCH_VERSION = 1;
|
||||
const int TIXML_PATCH_VERSION = 2;
|
||||
|
||||
/* Internal structure for tracking location of items
|
||||
in the XML file.
|
||||
|
@ -148,7 +146,7 @@ public:
|
|||
virtual bool Visit( const TiXmlText& /*text*/ ) { return true; }
|
||||
/// Visit a comment node
|
||||
virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; }
|
||||
/// Visit an unknow node
|
||||
/// Visit an unknown node
|
||||
virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; }
|
||||
};
|
||||
|
||||
|
@ -680,8 +678,8 @@ public:
|
|||
#endif
|
||||
|
||||
/** Query the type (as an enumerated value, above) of this node.
|
||||
The possible types are: DOCUMENT, ELEMENT, COMMENT,
|
||||
UNKNOWN, TEXT, and DECLARATION.
|
||||
The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT,
|
||||
TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION.
|
||||
*/
|
||||
int Type() const { return type; }
|
||||
|
||||
|
@ -952,7 +950,7 @@ public:
|
|||
|
||||
TiXmlElement( const TiXmlElement& );
|
||||
|
||||
void operator=( const TiXmlElement& base );
|
||||
TiXmlElement& operator=( const TiXmlElement& base );
|
||||
|
||||
virtual ~TiXmlElement();
|
||||
|
||||
|
@ -985,6 +983,13 @@ public:
|
|||
does not exist, then TIXML_NO_ATTRIBUTE is returned.
|
||||
*/
|
||||
int QueryIntAttribute( const char* name, int* _value ) const;
|
||||
/// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute().
|
||||
int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
|
||||
/** QueryBoolAttribute examines the attribute - see QueryIntAttribute().
|
||||
Note that '1', 'true', or 'yes' are considered true, while '0', 'false'
|
||||
and 'no' are considered false.
|
||||
*/
|
||||
int QueryBoolAttribute( const char* name, bool* _value ) const;
|
||||
/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
|
||||
int QueryDoubleAttribute( const char* name, double* _value ) const;
|
||||
/// QueryFloatAttribute examines the attribute - see QueryIntAttribute().
|
||||
|
@ -1164,7 +1169,7 @@ public:
|
|||
SetValue( _value );
|
||||
}
|
||||
TiXmlComment( const TiXmlComment& );
|
||||
void operator=( const TiXmlComment& base );
|
||||
TiXmlComment& operator=( const TiXmlComment& base );
|
||||
|
||||
virtual ~TiXmlComment() {}
|
||||
|
||||
|
@ -1229,7 +1234,7 @@ public:
|
|||
#endif
|
||||
|
||||
TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); }
|
||||
void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
|
||||
TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; }
|
||||
|
||||
// Write this text object to a FILE stream.
|
||||
virtual void Print( FILE* cfile, int depth ) const;
|
||||
|
@ -1296,7 +1301,7 @@ public:
|
|||
const char* _standalone );
|
||||
|
||||
TiXmlDeclaration( const TiXmlDeclaration& copy );
|
||||
void operator=( const TiXmlDeclaration& copy );
|
||||
TiXmlDeclaration& operator=( const TiXmlDeclaration& copy );
|
||||
|
||||
virtual ~TiXmlDeclaration() {}
|
||||
|
||||
|
@ -1353,7 +1358,7 @@ public:
|
|||
virtual ~TiXmlUnknown() {}
|
||||
|
||||
TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); }
|
||||
void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
|
||||
TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; }
|
||||
|
||||
/// Creates a copy of this Unknown and returns it.
|
||||
virtual TiXmlNode* Clone() const;
|
||||
|
@ -1399,7 +1404,7 @@ public:
|
|||
#endif
|
||||
|
||||
TiXmlDocument( const TiXmlDocument& copy );
|
||||
void operator=( const TiXmlDocument& copy );
|
||||
TiXmlDocument& operator=( const TiXmlDocument& copy );
|
||||
|
||||
virtual ~TiXmlDocument() {}
|
||||
|
||||
|
@ -1637,7 +1642,7 @@ public:
|
|||
TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
|
||||
/// Copy constructor
|
||||
TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
|
||||
TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
|
||||
TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; }
|
||||
|
||||
/// Return a handle to the first child node.
|
||||
TiXmlHandle FirstChild() const;
|
||||
|
@ -1798,4 +1803,3 @@ private:
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ distribution.
|
|||
// It also cleans up the code a bit.
|
||||
//
|
||||
|
||||
const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
|
||||
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
|
||||
{
|
||||
"No error",
|
||||
"Error",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
|
||||
Original code by Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
|
@ -40,7 +40,7 @@ distribution.
|
|||
// Note tha "PutString" hardcodes the same list. This
|
||||
// is less flexible than it appears. Changing the entries
|
||||
// or order will break putstring.
|
||||
TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
|
||||
TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] =
|
||||
{
|
||||
{ "&", 5, '&' },
|
||||
{ "<", 4, '<' },
|
||||
|
@ -174,7 +174,7 @@ class TiXmlParsingData
|
|||
public:
|
||||
void Stamp( const char* now, TiXmlEncoding encoding );
|
||||
|
||||
const TiXmlCursor& Cursor() { return cursor; }
|
||||
const TiXmlCursor& Cursor() const { return cursor; }
|
||||
|
||||
private:
|
||||
// Only used by the document!
|
||||
|
@ -633,7 +633,7 @@ const char* TiXmlBase::ReadText( const char* p,
|
|||
}
|
||||
if ( p && *p )
|
||||
p += strlen( endTag );
|
||||
return p;
|
||||
return ( p && *p ) ? p : 0;
|
||||
}
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
|
@ -1298,9 +1298,10 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
|||
|
||||
if ( !p )
|
||||
{
|
||||
if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
|
||||
if ( document )
|
||||
document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
|
||||
}
|
||||
if ( *p == '>' )
|
||||
if ( p && *p == '>' )
|
||||
return p+1;
|
||||
return p;
|
||||
}
|
||||
|
@ -1350,6 +1351,7 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
|||
|
||||
if ( !StringEqual( p, startTag, false, encoding ) )
|
||||
{
|
||||
if ( document )
|
||||
document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
|
@ -1512,6 +1514,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
|
|||
|
||||
if ( !StringEqual( p, startTag, false, encoding ) )
|
||||
{
|
||||
if ( document )
|
||||
document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
|
@ -1536,7 +1539,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
|
|||
|
||||
const char* end = "<";
|
||||
p = ReadText( p, &value, ignoreWhite, end, false, encoding );
|
||||
if ( p )
|
||||
if ( p && *p )
|
||||
return p-1; // don't truncate the '<'
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue