Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2635,7 +2635,7 @@ void XMLPrinter::Write( const char* data, size_t size )
fwrite ( data , sizeof(char), size, _fp);
}
else {
char* p = _buffer.PushArr( static_cast<int>(size) ) - 1; // back up over the null terminator.
char* p = _buffer.PushArr( size ) - 1; // back up over the null terminator.
memcpy( p, data, size );
p[size] = 0;
}
Expand Down
34 changes: 17 additions & 17 deletions xmltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ int main( int argc, const char ** argv )

printf( "Test file '%s' loaded. ErrorID=%d\n", argv[1], errorID );
if ( !errorID ) {
printf( "Load time=%u\n", (unsigned)(loadTime - startTime) );
printf( "Delete time=%u\n", (unsigned)(deleteTime - loadTime) );
printf( "Total time=%u\n", (unsigned)(deleteTime - startTime) );
printf( "Load time=%u\n", static_cast<unsigned>(loadTime - startTime) );
printf( "Delete time=%u\n", static_cast<unsigned>(deleteTime - loadTime) );
printf( "Total time=%u\n", static_cast<unsigned>(deleteTime - startTime) );
}
exit(0);
}
Expand Down Expand Up @@ -595,8 +595,8 @@ int main( int argc, const char ** argv )

result = ele->QueryDoubleAttribute( "attr0", &dVal );
XMLTest( "Query attribute: int as double", XML_SUCCESS, result);
XMLTest( "Query attribute: int as double", 1, (int)dVal );
XMLTest( "Query attribute: int as double", 1, (int)ele->DoubleAttribute("attr0"));
XMLTest( "Query attribute: int as double", 1, static_cast<int>(dVal) );
XMLTest( "Query attribute: int as double", 1, static_cast<int>(ele->DoubleAttribute("attr0")));

result = ele->QueryDoubleAttribute( "attr1", &dVal );
XMLTest( "Query attribute: double as double", XML_SUCCESS, result);
Expand Down Expand Up @@ -648,17 +648,17 @@ int main( int argc, const char ** argv )

{
XMLError queryResult = ele->QueryAttribute( "int", &iVal2 );
XMLTest( "Query int attribute generic", (int)XML_SUCCESS, queryResult);
XMLTest( "Query int attribute generic", static_cast<int>(XML_SUCCESS), queryResult);
}
{
XMLError queryResult = ele->QueryAttribute( "double", &dVal2 );
XMLTest( "Query double attribute generic", (int)XML_SUCCESS, queryResult);
XMLTest( "Query double attribute generic", static_cast<int>(XML_SUCCESS), queryResult);
}

XMLTest( "Attribute match test", "strValue", ele->Attribute( "str", "strValue" ) );
XMLTest( "Attribute round trip. c-string.", "strValue", cStr );
XMLTest( "Attribute round trip. int.", 1, iVal );
XMLTest( "Attribute round trip. double.", -1, (int)dVal );
XMLTest( "Attribute round trip. double.", -1, static_cast<int>(dVal) );
XMLTest( "Alternate query", true, iVal == iVal2 );
XMLTest( "Alternate query", true, dVal == dVal2 );
XMLTest( "Alternate query", true, iVal == ele->IntAttribute("int") );
Expand Down Expand Up @@ -824,7 +824,7 @@ int main( int argc, const char ** argv )
{
int v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: int", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: int", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: int", -100, v, true);
}
XMLTest("Attribute: int", -100, element->IntAttribute("attrib"), true);
Expand All @@ -840,7 +840,7 @@ int main( int argc, const char ** argv )
{
unsigned v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: unsigned", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: unsigned", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: unsigned", unsigned(100), v, true);
}
{
Expand All @@ -864,7 +864,7 @@ int main( int argc, const char ** argv )
{
int64_t v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: int64_t", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: int64_t", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: int64_t", BIG, v, true);
}
XMLTest("Attribute: int64_t", BIG, element->Int64Attribute("attrib"), true);
Expand All @@ -880,7 +880,7 @@ int main( int argc, const char ** argv )
{
uint64_t v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: uint64_t", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: uint64_t", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: uint64_t", BIG_POS, v, true);
}
XMLTest("Attribute: uint64_t", BIG_POS, element->Unsigned64Attribute("attrib"), true);
Expand All @@ -896,7 +896,7 @@ int main( int argc, const char ** argv )
{
bool v = false;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: bool", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: bool", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: bool", true, v, true);
}
XMLTest("Attribute: bool", true, element->BoolAttribute("attrib"), true);
Expand Down Expand Up @@ -924,7 +924,7 @@ int main( int argc, const char ** argv )
{
double v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: bool", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: bool", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: double", 100.0, v, true);
}
XMLTest("Attribute: double", 100.0, element->DoubleAttribute("attrib"), true);
Expand All @@ -940,7 +940,7 @@ int main( int argc, const char ** argv )
{
float v = 0;
XMLError queryResult = element->QueryAttribute("attrib", &v);
XMLTest("Attribute: float", (int)XML_SUCCESS, queryResult, true);
XMLTest("Attribute: float", static_cast<int>(XML_SUCCESS), queryResult, true);
XMLTest("Attribute: float", 100.0f, v, true);
}
XMLTest("Attribute: float", 100.0f, element->FloatAttribute("attrib"), true);
Expand Down Expand Up @@ -2779,9 +2779,9 @@ int main( int argc, const char ** argv )
#endif

#if defined( _MSC_VER )
const double duration = 1000.0 * (double)(end - start) / ((double)freq * (double)COUNT);
const double duration = 1000.0 * static_cast<double>(end - start) / (static_cast<double>(freq) * static_cast<double>(COUNT));
#else
const double duration = (double)(cend - cstart) / (double)COUNT;
const double duration = static_cast<double>(cend - cstart) / static_cast<double>(COUNT);
#endif
printf("\nParsing dream.xml (%s): %.3f milli-seconds\n", note, duration);
}
Expand Down