1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-21 19:23:00 +04:00

Fixed -Wold-style-cast warnings

Fixed old-style-cast warnings
This commit is contained in:
Albert Hung
2024-12-02 13:47:07 +08:00
parent 374292e9ba
commit 162bd4e925
+4 -4
View File
@@ -234,13 +234,13 @@ char* StrPair::ParseName( char* p )
if ( !p || !(*p) ) { if ( !p || !(*p) ) {
return 0; return 0;
} }
if ( !XMLUtil::IsNameStartChar( (unsigned char) *p ) ) { if ( !XMLUtil::IsNameStartChar( static_cast<unsigned char>(*p) ) ) {
return 0; return 0;
} }
char* const start = p; char* const start = p;
++p; ++p;
while ( *p && XMLUtil::IsNameChar( (unsigned char) *p ) ) { while ( *p && XMLUtil::IsNameChar( static_cast<unsigned char>(*p) ) ) {
++p; ++p;
} }
@@ -700,7 +700,7 @@ bool XMLUtil::ToInt64(const char* str, int64_t* value)
bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) { bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) {
unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu
if(TIXML_SSCANF(str, IsPrefixHex(str) ? "%llx" : "%llu", &v) == 1) { if(TIXML_SSCANF(str, IsPrefixHex(str) ? "%llx" : "%llu", &v) == 1) {
*value = (uint64_t)v; *value = static_cast<uint64_t>(v);
return true; return true;
} }
return false; return false;
@@ -1977,7 +1977,7 @@ char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr )
} }
// attribute. // attribute.
if (XMLUtil::IsNameStartChar( (unsigned char) *p ) ) { if (XMLUtil::IsNameStartChar( static_cast<unsigned char>(*p) ) ) {
XMLAttribute* attrib = CreateAttribute(); XMLAttribute* attrib = CreateAttribute();
TIXMLASSERT( attrib ); TIXMLASSERT( attrib );
attrib->_parseLineNum = _document->_parseCurLineNum; attrib->_parseLineNum = _document->_parseCurLineNum;