From 9709b79717c940af0cf13121edf869dfdd94962a Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 8 Jul 2009 00:45:04 +0000 Subject: [PATCH] fixed several warnings that appear with -std=gnu99 -pedantic git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9049 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_gecko.c | 2 +- cl_main.c | 2 +- cl_particles.c | 2 +- clvm_cmds.c | 2 +- gl_backend.c | 2 +- gl_textures.c | 2 +- host_cmd.c | 2 +- image_png.c | 8 ++++---- menu.c | 2 +- model_brush.c | 2 +- netconn.c | 6 +++--- svvm_cmds.c | 2 +- vid_sdl.c | 2 +- world.c | 2 +- zone.c | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cl_gecko.c b/cl_gecko.c index 90d25a04..d17bf964 100644 --- a/cl_gecko.c +++ b/cl_gecko.c @@ -325,7 +325,7 @@ OSGK_DERIVEDTYPE(OSGK_ScriptObjectTemplate); typedef enum OSGK_ScriptResult { srSuccess = 0, - srFailed = 0x80004005L /* actually NS_ERROR_FAILURE */ + srFailed = (int)0x80004005L /* actually NS_ERROR_FAILURE */ } OSGK_ScriptResult; typedef struct OSGK_ScriptObjectCreateParams_s diff --git a/cl_main.c b/cl_main.c index 768b2004..0cb016a8 100644 --- a/cl_main.c +++ b/cl_main.c @@ -1918,7 +1918,7 @@ void CL_Locs_FreeNode(cl_locnode_t *node) return; } } - Con_Printf("CL_Locs_FreeNode: no such node! (%p)\n", node); + Con_Printf("CL_Locs_FreeNode: no such node! (%p)\n", (void *)node); } void CL_Locs_AddNode(vec3_t mins, vec3_t maxs, const char *name) diff --git a/cl_particles.c b/cl_particles.c index ead812f1..bf4f83df 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -446,7 +446,7 @@ void CL_Particles_LoadEffectInfo(void) CL_Particles_ParseEffectInfo((const char *)filedata, (const char *)filedata + filesize); Mem_Free(filedata); } -}; +} /* =============== diff --git a/clvm_cmds.c b/clvm_cmds.c index 5af7205c..ccef8d5e 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -2182,7 +2182,7 @@ int CL_GetTagIndex (prvm_edict_t *e, const char *tagname) return Mod_Alias_GetTagIndexForName(model, (int)e->fields.client->skin, tagname); else return -1; -}; +} int CL_GetExtendedTagInfo (prvm_edict_t *e, int tagindex, int *parentindex, const char **tagname, matrix4x4_t *tag_localmatrix) { diff --git a/gl_backend.c b/gl_backend.c index 8e00108c..89b789c3 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1091,7 +1091,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri if (numvertices < 3 || numtriangles < 1) { if (numvertices < 0 || numtriangles < 0 || developer.integer >= 100) - Con_Printf("R_Mesh_Draw(%d, %d, %d, %d, %8p, %8p, %i, %i);\n", firstvertex, numvertices, firsttriangle, numtriangles, element3i, element3s, bufferobject3i, bufferobject3s); + Con_Printf("R_Mesh_Draw(%d, %d, %d, %d, %8p, %8p, %i, %i);\n", firstvertex, numvertices, firsttriangle, numtriangles, (void *)element3i, (void *)element3s, bufferobject3i, bufferobject3s); return; } if (!gl_mesh_prefer_short_elements.integer) diff --git a/gl_textures.c b/gl_textures.c index fe13aca5..f86ee1f6 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -556,7 +556,7 @@ void R_TextureStats_Print(qboolean printeach, qboolean printpool, qboolean print Con_Printf("%c%4i%c%c%4i%c %s %s %s %s\n", isloaded ? '[' : ' ', (glsize + 1023) / 1024, isloaded ? ']' : ' ', glt->inputtexels ? '[' : ' ', (glt->inputdatasize + 1023) / 1024, glt->inputtexels ? ']' : ' ', isloaded ? "loaded" : " ", (glt->flags & TEXF_MIPMAP) ? "mip" : " ", (glt->flags & TEXF_ALPHA) ? "alpha" : " ", glt->identifier); } if (printpool) - Con_Printf("texturepool %10p total: %i (%.3fMB, %.3fMB original), uploaded %i (%.3fMB, %.3fMB original), upload on demand %i (%.3fMB, %.3fMB original)\n", pool, pooltotal, pooltotalt / 1048576.0, pooltotalp / 1048576.0, poolloaded, poolloadedt / 1048576.0, poolloadedp / 1048576.0, pooltotal - poolloaded, (pooltotalt - poolloadedt) / 1048576.0, (pooltotalp - poolloadedp) / 1048576.0); + Con_Printf("texturepool %10p total: %i (%.3fMB, %.3fMB original), uploaded %i (%.3fMB, %.3fMB original), upload on demand %i (%.3fMB, %.3fMB original)\n", (void *)pool, pooltotal, pooltotalt / 1048576.0, pooltotalp / 1048576.0, poolloaded, poolloadedt / 1048576.0, poolloadedp / 1048576.0, pooltotal - poolloaded, (pooltotalt - poolloadedt) / 1048576.0, (pooltotalp - poolloadedp) / 1048576.0); sumtotal += pooltotal; sumtotalt += pooltotalt; sumtotalp += pooltotalp; diff --git a/host_cmd.c b/host_cmd.c index b3b7b9bb..949c4802 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -2660,7 +2660,7 @@ void Host_Packet_f (void) // credit: taken from QuakeWorld in = Cmd_Argv(2); out = send+4; - send[0] = send[1] = send[2] = send[3] = 0xff; + send[0] = send[1] = send[2] = send[3] = -1; l = (int)strlen (in); for (i=0 ; ifirstleafsurface = loadmodel->brush.data_leafsurfaces + (unsigned short)LittleShort(in->firstmarksurface); out->numleafsurfaces = (unsigned short)LittleShort(in->nummarksurfaces); - if (out->firstleafsurface < 0 || (unsigned short)LittleShort(in->firstmarksurface) + out->numleafsurfaces > loadmodel->brush.num_leafsurfaces) + if ((unsigned short)LittleShort(in->firstmarksurface) + out->numleafsurfaces > loadmodel->brush.num_leafsurfaces) { Con_Printf("Mod_Q1BSP_LoadLeafs: invalid leafsurface range %i:%i outside range %i:%i\n", (int)(out->firstleafsurface - loadmodel->brush.data_leafsurfaces), (int)(out->firstleafsurface + out->numleafsurfaces - loadmodel->brush.data_leafsurfaces), 0, loadmodel->brush.num_leafsurfaces); out->firstleafsurface = NULL; diff --git a/netconn.c b/netconn.c index fc2b34c3..1820db4c 100755 --- a/netconn.c +++ b/netconn.c @@ -554,11 +554,11 @@ int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddres if (length > 0) { LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); - Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i from %s:\n", mysocket, addressstring, data, maxlength, peeraddress, length, addressstring2); + Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i from %s:\n", (void *)mysocket, addressstring, (void *)data, maxlength, (void *)peeraddress, length, addressstring2); Com_HexDumpToConsole((unsigned char *)data, length); } else - Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i\n", mysocket, addressstring, data, maxlength, peeraddress, length); + Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i\n", (void *)mysocket, addressstring, (void *)data, maxlength, (void *)peeraddress, length); } return length; } @@ -577,7 +577,7 @@ int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const l char addressstring[128], addressstring2[128]; LHNETADDRESS_ToString(LHNET_AddressFromSocket(mysocket), addressstring, sizeof(addressstring), true); LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); - Con_Printf("LHNET_Write(%p (%s), %p, %i, %p (%s)) = %i%s\n", mysocket, addressstring, data, length, peeraddress, addressstring2, length, ret == length ? "" : " (ERROR)"); + Con_Printf("LHNET_Write(%p (%s), %p, %i, %p (%s)) = %i%s\n", (void *)mysocket, addressstring, (void *)data, length, (void *)peeraddress, addressstring2, length, ret == length ? "" : " (ERROR)"); Com_HexDumpToConsole((unsigned char *)data, length); } return ret; diff --git a/svvm_cmds.c b/svvm_cmds.c index 19837c3d..f870319a 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -2793,7 +2793,7 @@ static void VM_SV_gettagindex (void) Con_Printf("gettagindex(entity #%i): tag \"%s\" not found\n", PRVM_NUM_FOR_EDICT(ent), tag_name); } PRVM_G_FLOAT(OFS_RETURN) = tag_index; -}; +} //vector(entity ent, float tagindex) gettaginfo; static void VM_SV_gettaginfo (void) diff --git a/vid_sdl.c b/vid_sdl.c index 5fd6230b..2ab7be84 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -537,7 +537,7 @@ static void VID_SetIcon() for(i = 0; i < colors; ++i) { - int r, g, b; + unsigned int r, g, b; char idx; if(sscanf(idata[i+1], "%c c #%02x%02x%02x", &idx, &r, &g, &b) != 4) diff --git a/world.c b/world.c index a9192494..52e25354 100644 --- a/world.c +++ b/world.c @@ -235,7 +235,7 @@ void World_LinkEdict_AreaGrid(world_t *world, prvm_edict_t *ent) if (entitynumber <= 0 || entitynumber >= prog->max_edicts || PRVM_EDICT_NUM(entitynumber) != ent) { - Con_Printf ("SV_LinkEdict_AreaGrid: invalid edict %p (edicts is %p, edict compared to prog->edicts is %i)\n", ent, prog->edicts, entitynumber); + Con_Printf ("SV_LinkEdict_AreaGrid: invalid edict %p (edicts is %p, edict compared to prog->edicts is %i)\n", (void *)ent, (void *)prog->edicts, entitynumber); return; } diff --git a/zone.c b/zone.c index 74bc06e1..1db8359b 100644 --- a/zone.c +++ b/zone.c @@ -601,7 +601,7 @@ void Mem_PrintStats(void) { if ((pool->flags & POOLFLAG_TEMP) && pool->chain) { - Con_Printf("Memory pool %p has sprung a leak totalling %lu bytes (%.3fMB)! Listing contents...\n", pool, (unsigned long)pool->totalsize, pool->totalsize / 1048576.0); + Con_Printf("Memory pool %p has sprung a leak totalling %lu bytes (%.3fMB)! Listing contents...\n", (void *)pool, (unsigned long)pool->totalsize, pool->totalsize / 1048576.0); for (mem = pool->chain;mem;mem = mem->next) Con_Printf("%10lu bytes allocated at %s:%i\n", (unsigned long)mem->size, mem->filename, mem->fileline); } -- 2.39.2