The MinGW.org Installation Manager Tool
Révision | 97d42169a25486cca7cdb9fa5d84d2d96ec7d17f (tree) |
---|---|
l'heure | 2009-11-06 06:53:19 |
Auteur | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
Correct some identified TinyXML issues.
@@ -1,3 +1,16 @@ | ||
1 | +2009-11-05 Keith Marshall <keithmarshall@users.sourceforge.net> | |
2 | + | |
3 | + Correct some identified TinyXML issues. | |
4 | + | |
5 | + * tinyxml/tinyxml.h (IsWhiteSpace): Add FIXME annotation to flag | |
6 | + probable redundancy of checks for '\n' and '\r'. | |
7 | + * tinyxml/tinyxmlparser.cpp: Revert John E's 2008-08-09 change; remove | |
8 | + all such redundancies in IsWhiteSpace() calls throughout. | |
9 | + | |
10 | + * tinyxml/tinyxml.cpp (TiXmlAttribute::SetDoubleValue): Correct format | |
11 | + specification in sprintf()/snprintf() calls; "%lf" is invalid; replace | |
12 | + with "%f". | |
13 | + | |
1 | 14 | 2009-10-31 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 15 | |
3 | 16 | Add CLI loader stub. |
@@ -1266,9 +1266,9 @@ void TiXmlAttribute::SetDoubleValue( double _value ) | ||
1266 | 1266 | { |
1267 | 1267 | char buf [256]; |
1268 | 1268 | #if defined(TIXML_SNPRINTF) |
1269 | - TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value); | |
1269 | + TIXML_SNPRINTF( buf, sizeof(buf), "%f", _value); | |
1270 | 1270 | #else |
1271 | - sprintf (buf, "%lf", _value); | |
1271 | + sprintf (buf, "%f", _value); | |
1272 | 1272 | #endif |
1273 | 1273 | SetValue (buf); |
1274 | 1274 | } |
@@ -290,6 +290,11 @@ protected: | ||
290 | 290 | static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); |
291 | 291 | inline static bool IsWhiteSpace( char c ) |
292 | 292 | { |
293 | + // FIXME: Explicit tests for '\n' and '\r' seem redundant here; | |
294 | + // POSIX requires isspace() to match both of these characters as | |
295 | + // white space anyway; is there any know implementation which | |
296 | + // does not comply with this requirement? | |
297 | + // | |
293 | 298 | return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); |
294 | 299 | } |
295 | 300 | inline static bool IsWhiteSpace( int c ) |
@@ -22,10 +22,6 @@ must not be misrepresented as being the original software. | ||
22 | 22 | distribution. |
23 | 23 | */ |
24 | 24 | |
25 | -/* Modified: JohnE, 2008-08-09 | |
26 | - * Add parentheses to fix GCC -Wall warning | |
27 | - */ | |
28 | - | |
29 | 25 | #include <ctype.h> |
30 | 26 | #include <stddef.h> |
31 | 27 |
@@ -350,7 +346,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) | ||
350 | 346 | continue; |
351 | 347 | } |
352 | 348 | |
353 | - if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space. | |
349 | + if ( IsWhiteSpace( *p ) ) | |
354 | 350 | ++p; |
355 | 351 | else |
356 | 352 | break; |
@@ -358,7 +354,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) | ||
358 | 354 | } |
359 | 355 | else |
360 | 356 | { |
361 | - while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' ) | |
357 | + while ( *p && IsWhiteSpace( *p ) ) | |
362 | 358 | ++p; |
363 | 359 | } |
364 | 360 |
@@ -1450,7 +1446,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE | ||
1450 | 1446 | // its best, even without them. |
1451 | 1447 | value = ""; |
1452 | 1448 | while ( p && *p // existence |
1453 | - && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace | |
1449 | + && !IsWhiteSpace( *p ) // whitespace | |
1454 | 1450 | && *p != '/' && *p != '>' ) // tag end |
1455 | 1451 | { |
1456 | 1452 | if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { |