Fix infinite loop bug in ShallowEqual. Fix a warning with a re-interpret cast. Up version to 1.0.4
diff --git a/xmltest.cpp b/xmltest.cpp
index c9fbf79..9585d04 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -793,6 +793,28 @@
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
}
+ {
+ // Make sure an attribute with a space in it succeeds.
+ static const char* xml = "<element attribute1=\"Test Attribute\"/>";
+ 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 = "<doc><element attribute='attribute'/><element attribute='attribute'/></doc>";
+ 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 = "<element attrib='bar'><sub>Text</sub></element>";