+2009-11-05 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Correct some identified TinyXML issues.
+
+ * tinyxml/tinyxml.h (IsWhiteSpace): Add FIXME annotation to flag
+ probable redundancy of checks for '\n' and '\r'.
+ * tinyxml/tinyxmlparser.cpp: Revert John E's 2008-08-09 change; remove
+ all such redundancies in IsWhiteSpace() calls throughout.
+
+ * tinyxml/tinyxml.cpp (TiXmlAttribute::SetDoubleValue): Correct format
+ specification in sprintf()/snprintf() calls; "%lf" is invalid; replace
+ with "%f".
+
2009-10-31 Keith Marshall <keithmarshall@users.sourceforge.net>
Add CLI loader stub.
{
char buf [256];
#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
+ TIXML_SNPRINTF( buf, sizeof(buf), "%f", _value);
#else
- sprintf (buf, "%lf", _value);
+ sprintf (buf, "%f", _value);
#endif
SetValue (buf);
}
static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
inline static bool IsWhiteSpace( char c )
{
+ // FIXME: Explicit tests for '\n' and '\r' seem redundant here;
+ // POSIX requires isspace() to match both of these characters as
+ // white space anyway; is there any know implementation which
+ // does not comply with this requirement?
+ //
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
}
inline static bool IsWhiteSpace( int c )
distribution.
*/
-/* Modified: JohnE, 2008-08-09
- * Add parentheses to fix GCC -Wall warning
- */
-
#include <ctype.h>
#include <stddef.h>
continue;
}
- if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
+ if ( IsWhiteSpace( *p ) )
++p;
else
break;
}
else
{
- while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
+ while ( *p && IsWhiteSpace( *p ) )
++p;
}
// 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 ) {