mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-27 06:32:27 +00:00
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:
parent
5c9973773b
commit
04d1e91d80
21 changed files with 44 additions and 44 deletions
|
@ -3195,13 +3195,13 @@ idCollisionModelManagerLocal::PrintModelInfo
|
|||
==================
|
||||
*/
|
||||
void idCollisionModelManagerLocal::PrintModelInfo( const cm_model_t *model ) {
|
||||
common->Printf( "%6i vertices (%i KB)\n", model->numVertices, (model->numVertices * sizeof(cm_vertex_t))>>10 );
|
||||
common->Printf( "%6i edges (%i KB)\n", model->numEdges, (model->numEdges * sizeof(cm_edge_t))>>10 );
|
||||
common->Printf( "%6i vertices (%zu KB)\n", model->numVertices, (model->numVertices * sizeof(cm_vertex_t))>>10 );
|
||||
common->Printf( "%6i edges (%zu KB)\n", model->numEdges, (model->numEdges * sizeof(cm_edge_t))>>10 );
|
||||
common->Printf( "%6i polygons (%i KB)\n", model->numPolygons, model->polygonMemory>>10 );
|
||||
common->Printf( "%6i brushes (%i KB)\n", model->numBrushes, model->brushMemory>>10 );
|
||||
common->Printf( "%6i nodes (%i KB)\n", model->numNodes, (model->numNodes * sizeof(cm_node_t))>>10 );
|
||||
common->Printf( "%6i polygon refs (%i KB)\n", model->numPolygonRefs, (model->numPolygonRefs * sizeof(cm_polygonRef_t))>>10 );
|
||||
common->Printf( "%6i brush refs (%i KB)\n", model->numBrushRefs, (model->numBrushRefs * sizeof(cm_brushRef_t))>>10 );
|
||||
common->Printf( "%6i nodes (%zu KB)\n", model->numNodes, (model->numNodes * sizeof(cm_node_t))>>10 );
|
||||
common->Printf( "%6i polygon refs (%zu KB)\n", model->numPolygonRefs, (model->numPolygonRefs * sizeof(cm_polygonRef_t))>>10 );
|
||||
common->Printf( "%6i brush refs (%zu KB)\n", model->numBrushRefs, (model->numBrushRefs * sizeof(cm_brushRef_t))>>10 );
|
||||
common->Printf( "%6i internal edges\n", model->numInternalEdges );
|
||||
common->Printf( "%6i sharp edges\n", model->numSharpEdges );
|
||||
common->Printf( "%6i contained polygons removed\n", model->numRemovedPolys );
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -349,7 +349,7 @@ void idCommonLocal::VPrintf( const char *fmt, va_list args ) {
|
|||
// don't overflow
|
||||
if ( idStr::vsnPrintf( msg+timeLength, MAX_PRINT_MSG_SIZE-timeLength-1, fmt, args ) < 0 ) {
|
||||
msg[sizeof(msg)-2] = '\n'; msg[sizeof(msg)-1] = '\0'; // avoid output garbling
|
||||
Sys_Printf( "idCommon::VPrintf: truncated to %d characters\n", strlen(msg)-1 );
|
||||
Sys_Printf( "idCommon::VPrintf: truncated to %zd characters\n", strlen(msg)-1 );
|
||||
}
|
||||
|
||||
if ( rd_buffer ) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -310,7 +310,7 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height, ID_T
|
|||
}
|
||||
if ( bmpHeader.fileSize != length )
|
||||
{
|
||||
common->Error( "LoadBMP: header size does not match file size (%lu vs. %d) (%s)\n", bmpHeader.fileSize, length, name );
|
||||
common->Error( "LoadBMP: header size does not match file size (%u vs. %d) (%s)\n", bmpHeader.fileSize, length, name );
|
||||
}
|
||||
if ( bmpHeader.compression != 0 )
|
||||
{
|
||||
|
|
|
@ -1492,7 +1492,7 @@ void idRenderWorldLocal::GenerateAllInteractions() {
|
|||
}
|
||||
|
||||
common->Printf( "interactionTable size: %i bytes\n", size );
|
||||
common->Printf( "%i interaction take %i bytes\n", count, count * sizeof( idInteraction ) );
|
||||
common->Printf( "%d interaction take %zd bytes\n", count, count * sizeof( idInteraction ) );
|
||||
}
|
||||
|
||||
// entities flagged as noDynamicInteractions will no longer make any
|
||||
|
|
|
@ -121,7 +121,7 @@ void *idVertexCache::Position( vertCache_t *buffer ) {
|
|||
if ( buffer->vbo ) {
|
||||
if ( r_showVertexCache.GetInteger() == 2 ) {
|
||||
if ( buffer->tag == TAG_TEMP ) {
|
||||
common->Printf( "GL_ARRAY_BUFFER_ARB = %i + %i (%i bytes)\n", buffer->vbo, buffer->offset, buffer->size );
|
||||
common->Printf( "GL_ARRAY_BUFFER_ARB = %i + %zd (%i bytes)\n", buffer->vbo, buffer->offset, buffer->size );
|
||||
} else {
|
||||
common->Printf( "GL_ARRAY_BUFFER_ARB = %i (%i bytes)\n", buffer->vbo, buffer->size );
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ R_ShowTriMemory_f
|
|||
===============
|
||||
*/
|
||||
void R_ShowTriSurfMemory_f( const idCmdArgs &args ) {
|
||||
common->Printf( "%6d kB in %d triangle surfaces\n",
|
||||
common->Printf( "%6zd kB in %d triangle surfaces\n",
|
||||
( srfTrianglesAllocator.GetAllocCount() * sizeof( srfTriangles_t ) ) >> 10,
|
||||
srfTrianglesAllocator.GetAllocCount() );
|
||||
|
||||
|
@ -267,7 +267,7 @@ void R_ShowTriSurfMemory_f( const idCmdArgs &args ) {
|
|||
triDupVertAllocator.GetBaseBlockMemory() >> 10, triDupVertAllocator.GetFreeBlockMemory() >> 10,
|
||||
triDupVertAllocator.GetNumFreeBlocks(), triDupVertAllocator.GetNumEmptyBaseBlocks() );
|
||||
|
||||
common->Printf( "%6d kB total triangle memory\n",
|
||||
common->Printf( "%6zu kB total triangle memory\n",
|
||||
( srfTrianglesAllocator.GetAllocCount() * sizeof( srfTriangles_t ) +
|
||||
triVertexAllocator.GetBaseBlockMemory() +
|
||||
triIndexAllocator.GetBaseBlockMemory() +
|
||||
|
|
Loading…
Reference in a new issue