mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-13 03:08:57 -04:00
Updated TinyXML to v2.6.2
This commit is contained in:
Vendored
+30
-30
@@ -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!
|
||||
@@ -346,7 +346,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
|
||||
if ( IsWhiteSpace( *p ) ) // Still using old rules for white space.
|
||||
++p;
|
||||
else
|
||||
break;
|
||||
@@ -354,7 +354,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( (*p && IsWhiteSpace( *p )) || *p == '\n' || *p =='\r' )
|
||||
while ( *p && IsWhiteSpace( *p ) )
|
||||
++p;
|
||||
}
|
||||
|
||||
@@ -631,9 +631,9 @@ const char* TiXmlBase::ReadText( const char* p,
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( p )
|
||||
if ( p && *p )
|
||||
p += strlen( endTag );
|
||||
return p;
|
||||
return ( p && *p ) ? p : 0;
|
||||
}
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
@@ -825,7 +825,6 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
|
||||
return 0;
|
||||
}
|
||||
|
||||
TiXmlDocument* doc = GetDocument();
|
||||
p = SkipWhiteSpace( p, encoding );
|
||||
|
||||
if ( !p || !*p )
|
||||
@@ -896,11 +895,6 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
|
||||
// Set the parent, so it can report errors
|
||||
returnNode->parent = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( doc )
|
||||
doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
}
|
||||
return returnNode;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1077,6 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
|
||||
TIXML_STRING endTag ("</");
|
||||
endTag += value;
|
||||
endTag += ">";
|
||||
|
||||
// Check for and read attributes. Also look for an empty
|
||||
// tag or an end tag.
|
||||
@@ -1122,10 +1115,20 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
}
|
||||
|
||||
// We should find the end tag now
|
||||
// note that:
|
||||
// </foo > and
|
||||
// </foo>
|
||||
// are both valid end tags.
|
||||
if ( StringEqual( p, endTag.c_str(), false, encoding ) )
|
||||
{
|
||||
p += endTag.length();
|
||||
return p;
|
||||
p = SkipWhiteSpace( p, encoding );
|
||||
if ( p && *p && *p == '>' ) {
|
||||
++p;
|
||||
return p;
|
||||
}
|
||||
if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1139,7 +1142,6 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
TiXmlAttribute* attrib = new TiXmlAttribute();
|
||||
if ( !attrib )
|
||||
{
|
||||
if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1162,7 +1164,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
#endif
|
||||
if ( node )
|
||||
{
|
||||
node->SetValue( attrib->Value() );
|
||||
if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
|
||||
delete attrib;
|
||||
return 0;
|
||||
}
|
||||
@@ -1191,8 +1193,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
|
||||
|
||||
if ( !textNode )
|
||||
{
|
||||
if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( TiXmlBase::IsWhiteSpaceCondensed() )
|
||||
@@ -1297,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;
|
||||
}
|
||||
@@ -1349,7 +1351,8 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
|
||||
if ( !StringEqual( p, startTag, false, encoding ) )
|
||||
{
|
||||
document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
|
||||
if ( document )
|
||||
document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
p += strlen( startTag );
|
||||
@@ -1379,7 +1382,7 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
value.append( p, 1 );
|
||||
++p;
|
||||
}
|
||||
if ( p )
|
||||
if ( p && *p )
|
||||
p += strlen( endTag );
|
||||
|
||||
return p;
|
||||
@@ -1391,10 +1394,6 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
|
||||
p = SkipWhiteSpace( p, encoding );
|
||||
if ( !p || !*p ) return 0;
|
||||
|
||||
// int tabsize = 4;
|
||||
// if ( document )
|
||||
// tabsize = document->TabSize();
|
||||
|
||||
if ( data )
|
||||
{
|
||||
data->Stamp( p, encoding );
|
||||
@@ -1446,7 +1445,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
|
||||
// its best, even without them.
|
||||
value = "";
|
||||
while ( p && *p // existence
|
||||
&& !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace
|
||||
&& !IsWhiteSpace( *p ) // whitespace
|
||||
&& *p != '/' && *p != '>' ) // tag end
|
||||
{
|
||||
if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
|
||||
@@ -1515,7 +1514,8 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
|
||||
|
||||
if ( !StringEqual( p, startTag, false, encoding ) )
|
||||
{
|
||||
document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
|
||||
if ( document )
|
||||
document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
p += strlen( startTag );
|
||||
@@ -1539,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user