diff --git a/CMakeLists.txt b/CMakeLists.txt index 83a6ab7..cdfc66c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(GNUInstallDirs) ################################ # set lib version here -set(GENERIC_LIB_VERSION "1.0.3") +set(GENERIC_LIB_VERSION "1.0.4") set(GENERIC_LIB_SOVERSION "1") diff --git a/dox b/dox index 31ffa76..0818de4 100755 --- a/dox +++ b/dox @@ -32,7 +32,7 @@ PROJECT_NAME = "TinyXML-2" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.3 +PROJECT_NUMBER = 1.0.4 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/tinyxml2.cpp b/tinyxml2.cpp index de1f173..e4ac977 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1242,6 +1242,8 @@ bool XMLElement::ShallowEqual( const XMLNode* compare ) const if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { return false; } + a = a->Next(); + b = b->Next(); } if ( a || b ) { // different count diff --git a/tinyxml2.h b/tinyxml2.h index e90d60f..e231f09 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -83,9 +83,9 @@ distribution. #define TIXML_SSCANF sscanf #endif -static const int TIXML2_MAJOR_VERSION = 1; -static const int TIXML2_MINOR_VERSION = 0; -static const int TIXML2_PATCH_VERSION = 3; +static const int TIXML2_MAJOR_VERSION = 1; +static const int TIXML2_MINOR_VERSION = 0; +static const int TIXML2_PATCH_VERSION = 4; namespace tinyxml2 { @@ -363,8 +363,8 @@ class XMLUtil public: // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't // correct, but simple, and usually works. - static const char* SkipWhiteSpace( const char* p ) { while( !IsUTF8Continuation(*p) && isspace( *p ) ) { ++p; } return p; } - static char* SkipWhiteSpace( char* p ) { while( !IsUTF8Continuation(*p) && isspace( *p ) ) { ++p; } return p; } + static const char* SkipWhiteSpace( const char* p ) { while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { ++p; } return p; } + static char* SkipWhiteSpace( char* p ) { while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { ++p; } return p; } inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { int n = 0; diff --git a/xmltest.cpp b/xmltest.cpp index c9fbf79..9585d04 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -793,6 +793,28 @@ int main( int /*argc*/, const char ** /*argv*/ ) XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false ); } + { + // Make sure an attribute with a space in it succeeds. + static const char* xml = ""; + XMLDocument doc; + doc.Parse( xml ); + + XMLElement* ele = doc.FirstChildElement(); + XMLTest( "Attribute with space", "Test Attribute", ele->Attribute( "attribute1" ) ); + } + + { + // Make sure we don't go into an infinite loop. + static const char* xml = ""; + XMLDocument doc; + doc.Parse( xml ); + XMLElement* ele0 = doc.FirstChildElement()->FirstChildElement(); + XMLElement* ele1 = ele0->NextSiblingElement(); + bool equal = ele0->ShallowEqual( ele1 ); + + XMLTest( "Infinite loop in shallow equal.", true, equal ); + } + // -------- Handles ------------ { static const char* xml = "Text";