Fix -Wformat and -Wformat-extra-args warnings

Fix format specifiers and use the C99 %zd for types of size_t and
alike.
This commit is contained in:
dhewg 2011-11-30 22:27:12 +01:00 committed by Daniel Gibson
parent 2101e6d35d
commit 471f51ef9b
15 changed files with 33 additions and 33 deletions

View file

@ -1364,7 +1364,7 @@ void idMultiplayerGame::PlayerStats( int clientNum, char *data, const int len )
return;
}
idStr::snPrintf( data, len, "team=%d score=%ld tks=%ld", team, playerState[ clientNum ].fragCount, playerState[ clientNum ].teamFragCount );
idStr::snPrintf( data, len, "team=%d score=%d tks=%d", team, playerState[ clientNum ].fragCount, playerState[ clientNum ].teamFragCount );
return;

View file

@ -327,9 +327,9 @@ void idAASLocal::RoutingStats( void ) const {
gameLocal.Printf( "%6d area cache (%d KB)\n", numAreaCache, totalAreaCacheMemory >> 10 );
gameLocal.Printf( "%6d portal cache (%d KB)\n", numPortalCache, totalPortalCacheMemory >> 10 );
gameLocal.Printf( "%6d total cache (%d KB)\n", numAreaCache + numPortalCache, totalCacheMemory >> 10 );
gameLocal.Printf( "%6d area travel times (%d KB)\n", numAreaTravelTimes, ( numAreaTravelTimes * sizeof( unsigned short ) ) >> 10 );
gameLocal.Printf( "%6d area cache entries (%d KB)\n", areaCacheIndexSize, ( areaCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d portal cache entries (%d KB)\n", portalCacheIndexSize, ( portalCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d area travel times (%zd KB)\n", numAreaTravelTimes, ( numAreaTravelTimes * sizeof( unsigned short ) ) >> 10 );
gameLocal.Printf( "%6d area cache entries (%zd KB)\n", areaCacheIndexSize, ( areaCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d portal cache entries (%zd KB)\n", portalCacheIndexSize, ( portalCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
}
/*

View file

@ -1046,7 +1046,7 @@ void idAnimManager::ListAnims( void ) const {
if ( animptr && *animptr ) {
anim = *animptr;
s = anim->Size();
gameLocal.Printf( "%8d bytes : %2d refs : %s\n", s, anim->NumRefs(), anim->Name() );
gameLocal.Printf( "%8zd bytes : %2d refs : %s\n", s, anim->NumRefs(), anim->Name() );
size += s;
num++;
}
@ -1057,8 +1057,8 @@ void idAnimManager::ListAnims( void ) const {
namesize += jointnames[ i ].Size();
}
gameLocal.Printf( "\n%d memory used in %d anims\n", size, num );
gameLocal.Printf( "%d memory used in %d joint names\n", namesize, jointnames.Num() );
gameLocal.Printf( "\n%zd memory used in %d anims\n", size, num );
gameLocal.Printf( "%zd memory used in %d joint names\n", namesize, jointnames.Num() );
}
/*

View file

@ -866,7 +866,7 @@ void idEvent::Restore( idRestoreGame *savefile ) {
// read the args
savefile->ReadInt( argsize );
if ( argsize != event->eventdef->GetArgSize() ) {
savefile->Error( "idEvent::Restore: arg size (%d) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
savefile->Error( "idEvent::Restore: arg size (%zd) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
}
if ( argsize ) {
event->data = eventDataAllocator.Alloc( argsize );
@ -947,7 +947,7 @@ void idEvent::Restore( idRestoreGame *savefile ) {
// read the args
savefile->ReadInt( argsize );
if ( argsize != event->eventdef->GetArgSize() ) {
savefile->Error( "idEvent::Restore: arg size (%d) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
savefile->Error( "idEvent::Restore: arg size (%zd) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
}
if ( argsize ) {
event->data = eventDataAllocator.Alloc( argsize );

View file

@ -87,7 +87,7 @@ void Cmd_EntityList_f( const idCmdArgs &args ) {
size += check->spawnArgs.Allocated();
}
gameLocal.Printf( "...%d entities\n...%d bytes of spawnargs\n", count, size );
gameLocal.Printf( "...%d entities\n...%zd bytes of spawnargs\n", count, size );
}
/*
@ -1508,7 +1508,7 @@ static void Cmd_ListAnims_f( const idCmdArgs &args ) {
}
}
gameLocal.Printf( "%d memory used in %d entity animators\n", size, num );
gameLocal.Printf( "%zd memory used in %d entity animators\n", size, num );
}
}

View file

@ -61,7 +61,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char
const char *ui_teamArgs[] = { "Red", "Blue", NULL };
struct gameVersion_s {
gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
char string[256];
} gameVersion;

View file

@ -1237,7 +1237,7 @@ byte *idProgram::ReserveMem(int size) {
byte *res = &variables[ numVariables ];
numVariables += size;
if ( numVariables > sizeof( variables ) ) {
throw idCompileError( va( "Exceeded global memory size (%d bytes)", sizeof( variables ) ) );
throw idCompileError( va( "Exceeded global memory size (%zd bytes)", sizeof( variables ) ) );
}
memset( res, 0, size );
@ -1801,13 +1801,13 @@ void idProgram::CompileStats( void ) {
gameLocal.Printf( "\nMemory usage:\n" );
gameLocal.Printf( " Strings: %d, %d bytes\n", fileList.Num(), stringspace );
gameLocal.Printf( " Statements: %d, %d bytes\n", statements.Num(), statements.MemoryUsed() );
gameLocal.Printf( " Statements: %d, %zd bytes\n", statements.Num(), statements.MemoryUsed() );
gameLocal.Printf( " Functions: %d, %d bytes\n", functions.Num(), funcMem );
gameLocal.Printf( " Variables: %d bytes\n", numVariables );
gameLocal.Printf( " Mem used: %d bytes\n", memused );
gameLocal.Printf( " Static data: %d bytes\n", sizeof( idProgram ) );
gameLocal.Printf( " Static data: %zd bytes\n", sizeof( idProgram ) );
gameLocal.Printf( " Allocated: %d bytes\n", memallocated );
gameLocal.Printf( " Thread size: %d bytes\n\n", sizeof( idThread ) );
gameLocal.Printf( " Thread size: %zd bytes\n\n", sizeof( idThread ) );
}
/*

View file

@ -935,7 +935,7 @@ void idMultiplayerGame::PlayerStats( int clientNum, char *data, const int len )
return;
}
idStr::snPrintf( data, len, "team=%d score=%ld tks=%ld", team, playerState[ clientNum ].fragCount, playerState[ clientNum ].teamFragCount );
idStr::snPrintf( data, len, "team=%d score=%d tks=%d", team, playerState[ clientNum ].fragCount, playerState[ clientNum ].teamFragCount );
return;

View file

@ -327,9 +327,9 @@ void idAASLocal::RoutingStats( void ) const {
gameLocal.Printf( "%6d area cache (%d KB)\n", numAreaCache, totalAreaCacheMemory >> 10 );
gameLocal.Printf( "%6d portal cache (%d KB)\n", numPortalCache, totalPortalCacheMemory >> 10 );
gameLocal.Printf( "%6d total cache (%d KB)\n", numAreaCache + numPortalCache, totalCacheMemory >> 10 );
gameLocal.Printf( "%6d area travel times (%d KB)\n", numAreaTravelTimes, ( numAreaTravelTimes * sizeof( unsigned short ) ) >> 10 );
gameLocal.Printf( "%6d area cache entries (%d KB)\n", areaCacheIndexSize, ( areaCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d portal cache entries (%d KB)\n", portalCacheIndexSize, ( portalCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d area travel times (%zu KB)\n", numAreaTravelTimes, ( numAreaTravelTimes * sizeof( unsigned short ) ) >> 10 );
gameLocal.Printf( "%6d area cache entries (%zu KB)\n", areaCacheIndexSize, ( areaCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
gameLocal.Printf( "%6d portal cache entries (%zu KB)\n", portalCacheIndexSize, ( portalCacheIndexSize * sizeof( idRoutingCache * ) ) >> 10 );
}
/*

View file

@ -1046,7 +1046,7 @@ void idAnimManager::ListAnims( void ) const {
if ( animptr && *animptr ) {
anim = *animptr;
s = anim->Size();
gameLocal.Printf( "%8d bytes : %2d refs : %s\n", s, anim->NumRefs(), anim->Name() );
gameLocal.Printf( "%8zd bytes : %2d refs : %s\n", s, anim->NumRefs(), anim->Name() );
size += s;
num++;
}
@ -1057,8 +1057,8 @@ void idAnimManager::ListAnims( void ) const {
namesize += jointnames[ i ].Size();
}
gameLocal.Printf( "\n%d memory used in %d anims\n", size, num );
gameLocal.Printf( "%d memory used in %d joint names\n", namesize, jointnames.Num() );
gameLocal.Printf( "\n%zd memory used in %d anims\n", size, num );
gameLocal.Printf( "%zd memory used in %d joint names\n", namesize, jointnames.Num() );
}
/*

View file

@ -715,7 +715,7 @@ void idEvent::Restore( idRestoreGame *savefile ) {
// read the args
savefile->ReadInt( argsize );
if ( argsize != event->eventdef->GetArgSize() ) {
savefile->Error( "idEvent::Restore: arg size (%d) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
savefile->Error( "idEvent::Restore: arg size (%zd) doesn't match saved arg size(%d) on event '%s'", event->eventdef->GetArgSize(), argsize, event->eventdef->GetName() );
}
if ( argsize ) {
event->data = eventDataAllocator.Alloc( argsize );

View file

@ -87,7 +87,7 @@ void Cmd_EntityList_f( const idCmdArgs &args ) {
size += check->spawnArgs.Allocated();
}
gameLocal.Printf( "...%d entities\n...%d bytes of spawnargs\n", count, size );
gameLocal.Printf( "...%d entities\n...%zd bytes of spawnargs\n", count, size );
}
/*
@ -1439,7 +1439,7 @@ static void Cmd_ListAnims_f( const idCmdArgs &args ) {
}
}
gameLocal.Printf( "%d memory used in %d entity animators\n", size, num );
gameLocal.Printf( "%zd memory used in %d entity animators\n", size, num );
}
}

View file

@ -51,7 +51,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char
const char *ui_teamArgs[] = { "Red", "Blue", NULL };
struct gameVersion_s {
gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
char string[256];
} gameVersion;

View file

@ -1237,7 +1237,7 @@ byte *idProgram::ReserveMem(int size) {
byte *res = &variables[ numVariables ];
numVariables += size;
if ( numVariables > sizeof( variables ) ) {
throw idCompileError( va( "Exceeded global memory size (%d bytes)", sizeof( variables ) ) );
throw idCompileError( va( "Exceeded global memory size (%zd bytes)", sizeof( variables ) ) );
}
memset( res, 0, size );
@ -1801,13 +1801,13 @@ void idProgram::CompileStats( void ) {
gameLocal.Printf( "\nMemory usage:\n" );
gameLocal.Printf( " Strings: %d, %d bytes\n", fileList.Num(), stringspace );
gameLocal.Printf( " Statements: %d, %d bytes\n", statements.Num(), statements.MemoryUsed() );
gameLocal.Printf( " Statements: %d, %zd bytes\n", statements.Num(), statements.MemoryUsed() );
gameLocal.Printf( " Functions: %d, %d bytes\n", functions.Num(), funcMem );
gameLocal.Printf( " Variables: %d bytes\n", numVariables );
gameLocal.Printf( " Mem used: %d bytes\n", memused );
gameLocal.Printf( " Static data: %d bytes\n", sizeof( idProgram ) );
gameLocal.Printf( " Static data: %zd bytes\n", sizeof( idProgram ) );
gameLocal.Printf( " Allocated: %d bytes\n", memallocated );
gameLocal.Printf( " Thread size: %d bytes\n\n", sizeof( idThread ) );
gameLocal.Printf( " Thread size: %zd bytes\n\n", sizeof( idThread ) );
}
/*

View file

@ -645,8 +645,8 @@ idDict::ShowMemoryUsage_f
================
*/
void idDict::ShowMemoryUsage_f( const idCmdArgs &args ) {
idLib::common->Printf( "%5d KB in %d keys\n", globalKeys.Size() >> 10, globalKeys.Num() );
idLib::common->Printf( "%5d KB in %d values\n", globalValues.Size() >> 10, globalValues.Num() );
idLib::common->Printf( "%5zd KB in %d keys\n", globalKeys.Size() >> 10, globalKeys.Num() );
idLib::common->Printf( "%5zd KB in %d values\n", globalValues.Size() >> 10, globalValues.Num() );
}
/*