From 6d3f3f2081f3a140e1d348f339eb92c0de54ee24 Mon Sep 17 00:00:00 2001 From: sezero Date: Mon, 31 May 2010 07:42:36 +0000 Subject: [PATCH] host_cmd.c, console.c, gl_draw.c, image.c, gl_model.c, r_sprite.c, cl_parse.c, gl_warp.c, host.c, gl_mesh.c, gl_sky.c, gl_texmgr.c, cvar.c, sv_main.c, cvar.h, gl_screen.c, r_brush.c, gl_vidsdl.c, zone.c, cl_main.c, cmd.c, snd_dma.c, snd_mem.c, common.c, sv_phys.c: Added explicit casts to eliminate -Wc++-compat warnings. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@170 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/cl_main.c | 2 +- quakespasm/Quake/cl_parse.c | 2 +- quakespasm/Quake/cmd.c | 10 ++-- quakespasm/Quake/common.c | 30 ++++++------ quakespasm/Quake/console.c | 6 +-- quakespasm/Quake/cvar.c | 10 ++-- quakespasm/Quake/cvar.h | 4 +- quakespasm/Quake/gl_draw.c | 6 +-- quakespasm/Quake/gl_mesh.c | 4 +- quakespasm/Quake/gl_model.c | 93 +++++++++++++++++------------------- quakespasm/Quake/gl_screen.c | 2 +- quakespasm/Quake/gl_sky.c | 4 +- quakespasm/Quake/gl_texmgr.c | 18 +++---- quakespasm/Quake/gl_vidsdl.c | 16 ++++--- quakespasm/Quake/gl_warp.c | 2 +- quakespasm/Quake/host.c | 2 +- quakespasm/Quake/host_cmd.c | 10 ++-- quakespasm/Quake/image.c | 4 +- quakespasm/Quake/r_brush.c | 2 +- quakespasm/Quake/r_sprite.c | 4 +- quakespasm/Quake/snd_dma.c | 4 +- quakespasm/Quake/snd_mem.c | 6 +-- quakespasm/Quake/sv_main.c | 2 +- quakespasm/Quake/sv_phys.c | 4 +- quakespasm/Quake/zone.c | 4 +- 25 files changed, 127 insertions(+), 124 deletions(-) diff --git a/quakespasm/Quake/cl_main.c b/quakespasm/Quake/cl_main.c index df6c574b..0e131e96 100644 --- a/quakespasm/Quake/cl_main.c +++ b/quakespasm/Quake/cl_main.c @@ -87,7 +87,7 @@ void CL_ClearState (void) //johnfitz -- cl_entities is now dynamically allocated cl_max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); - cl_entities = Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities"); + cl_entities = (entity_t *) Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities"); //johnfitz // diff --git a/quakespasm/Quake/cl_parse.c b/quakespasm/Quake/cl_parse.c index 97cd2f11..ceccbd58 100644 --- a/quakespasm/Quake/cl_parse.c +++ b/quakespasm/Quake/cl_parse.c @@ -280,7 +280,7 @@ void CL_ParseServerInfo (void) Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients); return; } - cl.scores = Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores"); + cl.scores = (scoreboard_t *) Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores"); // parse gametype cl.gametype = MSG_ReadByte (); diff --git a/quakespasm/Quake/cmd.c b/quakespasm/Quake/cmd.c index b133a475..7730be9f 100644 --- a/quakespasm/Quake/cmd.c +++ b/quakespasm/Quake/cmd.c @@ -121,7 +121,7 @@ void Cbuf_InsertText (char *text) templen = cmd_text.cursize; if (templen) { - temp = Z_Malloc (templen); + temp = (char *) Z_Malloc (templen); Q_memcpy (temp, cmd_text.data, templen); SZ_Clear (&cmd_text); } @@ -295,7 +295,7 @@ char *CopyString (char *in) { char *out; - out = Z_Malloc (strlen(in)+1); + out = (char *) Z_Malloc (strlen(in)+1); strcpy (out, in); return out; } @@ -350,7 +350,7 @@ void Cmd_Alias_f (void) if (!a) { - a = Z_Malloc (sizeof(cmdalias_t)); + a = (cmdalias_t *) Z_Malloc (sizeof(cmdalias_t)); a->next = cmd_alias; cmd_alias = a; } @@ -589,7 +589,7 @@ void Cmd_TokenizeString (char *text) if (cmd_argc < MAX_ARGS) { - cmd_argv[cmd_argc] = Z_Malloc (Q_strlen(com_token)+1); + cmd_argv[cmd_argc] = (char *) Z_Malloc (Q_strlen(com_token)+1); Q_strcpy (cmd_argv[cmd_argc], com_token); cmd_argc++; } @@ -627,7 +627,7 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function) } } - cmd = Hunk_Alloc (sizeof(cmd_function_t)); + cmd = (cmd_function_t *) Hunk_Alloc (sizeof(cmd_function_t)); cmd->name = cmd_name; cmd->function = function; diff --git a/quakespasm/Quake/common.c b/quakespasm/Quake/common.c index 1ac8505c..491858f6 100644 --- a/quakespasm/Quake/common.c +++ b/quakespasm/Quake/common.c @@ -534,7 +534,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c) Sys_Error ("MSG_WriteChar: range error"); #endif - buf = SZ_GetSpace (sb, 1); + buf = (byte *) SZ_GetSpace (sb, 1); buf[0] = c; } @@ -547,7 +547,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c) Sys_Error ("MSG_WriteByte: range error"); #endif - buf = SZ_GetSpace (sb, 1); + buf = (byte *) SZ_GetSpace (sb, 1); buf[0] = c; } @@ -560,7 +560,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c) Sys_Error ("MSG_WriteShort: range error"); #endif - buf = SZ_GetSpace (sb, 2); + buf = (byte *) SZ_GetSpace (sb, 2); buf[0] = c&0xff; buf[1] = c>>8; } @@ -569,7 +569,7 @@ void MSG_WriteLong (sizebuf_t *sb, int c) { byte *buf; - buf = SZ_GetSpace (sb, 4); + buf = (byte *) SZ_GetSpace (sb, 4); buf[0] = c&0xff; buf[1] = (c>>8)&0xff; buf[2] = (c>>16)&0xff; @@ -801,7 +801,7 @@ void SZ_Alloc (sizebuf_t *buf, int startsize) { if (startsize < 256) startsize = 256; - buf->data = Hunk_AllocName (startsize, "sizebuf"); + buf->data = (byte *) Hunk_AllocName (startsize, "sizebuf"); buf->maxsize = startsize; buf->cursize = 0; } @@ -1639,17 +1639,17 @@ byte *COM_LoadFile (char *path, int usehunk) COM_FileBase (path, base); if (usehunk == 1) - buf = Hunk_AllocName (len+1, base); + buf = (byte *) Hunk_AllocName (len+1, base); else if (usehunk == 2) - buf = Hunk_TempAlloc (len+1); + buf = (byte *) Hunk_TempAlloc (len+1); else if (usehunk == 0) - buf = Z_Malloc (len+1); + buf = (byte *) Z_Malloc (len+1); else if (usehunk == 3) - buf = Cache_Alloc (loadcache, len+1, base); + buf = (byte *) Cache_Alloc (loadcache, len+1, base); else if (usehunk == 4) { if (len+1 > loadsize) - buf = Hunk_TempAlloc (len+1); + buf = (byte *) Hunk_TempAlloc (len+1); else buf = loadbuf; } @@ -1737,7 +1737,7 @@ pack_t *COM_LoadPackFile (char *packfile) //johnfitz -- dynamic gamedir loading //Hunk_AllocName (numpackfiles * sizeof(packfile_t), "packfile"); - newfiles = Z_Malloc(numpackfiles * sizeof(packfile_t)); + newfiles = (packfile_t *) Z_Malloc(numpackfiles * sizeof(packfile_t)); //johnfitz Sys_FileSeek (packhandle, header.dirofs); @@ -1760,7 +1760,7 @@ pack_t *COM_LoadPackFile (char *packfile) //johnfitz -- dynamic gamedir loading //pack = Hunk_Alloc (sizeof (pack_t)); - pack = Z_Malloc (sizeof (pack_t)); + pack = (pack_t *) Z_Malloc (sizeof (pack_t)); //johnfitz strcpy (pack->filename, packfile); @@ -1787,7 +1787,7 @@ void COM_AddGameDirectory (char *dir) strcpy (com_gamedir, dir); // add the directory to the search path - search = Z_Malloc(sizeof(searchpath_t)); + search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t)); strcpy (search->filename, dir); search->next = com_searchpaths; com_searchpaths = search; @@ -1799,7 +1799,7 @@ void COM_AddGameDirectory (char *dir) pak = COM_LoadPackFile (pakfile); if (!pak) break; - search = Z_Malloc(sizeof(searchpath_t)); + search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t)); search->pack = pak; search->next = com_searchpaths; com_searchpaths = search; @@ -1897,7 +1897,7 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial { if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-') break; - search = Hunk_Alloc (sizeof(searchpath_t)); + search = (searchpath_t *) Hunk_Alloc (sizeof(searchpath_t)); if (!strcmp(COM_FileExtension(com_argv[i]), "pak") ) { search->pack = COM_LoadPackFile (com_argv[i]); diff --git a/quakespasm/Quake/console.c b/quakespasm/Quake/console.c index a02de6ad..265cff20 100644 --- a/quakespasm/Quake/console.c +++ b/quakespasm/Quake/console.c @@ -300,7 +300,7 @@ void Con_CheckResize (void) numchars = con_linewidth; mark = Hunk_LowMark (); //johnfitz - tbuf = Hunk_Alloc (con_buffersize); //johnfitz + tbuf = (char *) Hunk_Alloc (con_buffersize); //johnfitz Q_memcpy (tbuf, con_text, con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE Q_memset (con_text, ' ', con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE @@ -337,7 +337,7 @@ void Con_Init (void) con_buffersize = CON_TEXTSIZE; //johnfitz - con_text = Hunk_AllocName (con_buffersize, "context");//johnfitz -- con_buffersize replaces CON_TEXTSIZE + con_text = (char *) Hunk_AllocName (con_buffersize, "context");//johnfitz -- con_buffersize replaces CON_TEXTSIZE Q_memset (con_text, ' ', con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE con_linewidth = -1; @@ -767,7 +767,7 @@ void AddToTabList (char *name, char *type) *i_bash = 0; } - t = Hunk_Alloc(sizeof(tab_t)); + t = (tab_t *) Hunk_Alloc(sizeof(tab_t)); t->name = name; t->type = type; diff --git a/quakespasm/Quake/cvar.c b/quakespasm/Quake/cvar.c index b6c1587d..d034257a 100644 --- a/quakespasm/Quake/cvar.c +++ b/quakespasm/Quake/cvar.c @@ -334,7 +334,7 @@ void Cvar_Set (char *var_name, char *value) Z_Free (var->string); // free the old value string - var->string = Z_Malloc (Q_strlen(value)+1); + var->string = (char *) Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->string, value); var->value = Q_atof (var->string); @@ -342,7 +342,7 @@ void Cvar_Set (char *var_name, char *value) if (!host_initialized) { Z_Free (var->default_string); - var->default_string = Z_Malloc (Q_strlen(value)+1); + var->default_string = (char *) Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->default_string, value); } //johnfitz @@ -400,12 +400,12 @@ void Cvar_RegisterVariable (cvar_t *variable, void *function) // copy the value off, because future sets will Z_Free it oldstr = variable->string; - variable->string = Z_Malloc (Q_strlen(variable->string)+1); + variable->string = (char *) Z_Malloc (Q_strlen(variable->string)+1); Q_strcpy (variable->string, oldstr); variable->value = Q_atof (variable->string); //johnfitz -- save initial value for "reset" command - variable->default_string = Z_Malloc (Q_strlen(variable->string)+1); + variable->default_string = (char *) Z_Malloc (Q_strlen(variable->string)+1); Q_strcpy (variable->default_string, oldstr); //johnfitz @@ -431,7 +431,7 @@ void Cvar_RegisterVariable (cvar_t *variable, void *function) } //johnfitz - variable->callback = function; //johnfitz + variable->callback = (cvarcallback_t) function; //johnfitz } /* diff --git a/quakespasm/Quake/cvar.h b/quakespasm/Quake/cvar.h index 2e1b6d68..8d4e6c15 100644 --- a/quakespasm/Quake/cvar.h +++ b/quakespasm/Quake/cvar.h @@ -58,6 +58,8 @@ Cvars are restricted from having the same names as commands to keep this interface from being ambiguous. */ +typedef void (*cvarcallback_t) (void); + typedef struct cvar_s { char *name; @@ -67,7 +69,7 @@ typedef struct cvar_s float value; struct cvar_s *next; char *default_string; //johnfitz -- remember defaults for reset function - void (*callback) (void); //johnfitz + cvarcallback_t callback; //johnfitz } cvar_t; void Cvar_RegisterVariable (cvar_t *variable, void *function); //johnfitz -- cvar callback diff --git a/quakespasm/Quake/gl_draw.c b/quakespasm/Quake/gl_draw.c index 6b06e6dc..c90a283e 100644 --- a/quakespasm/Quake/gl_draw.c +++ b/quakespasm/Quake/gl_draw.c @@ -218,7 +218,7 @@ qpic_t *Draw_PicFromWad (char *name) glpic_t gl; src_offset_t offset; //johnfitz - p = W_GetLumpName (name); + p = (qpic_t *) W_GetLumpName (name); if (!p) return pic_nul; //johnfitz // load little ones into the scrap @@ -377,7 +377,7 @@ qpic_t *Draw_MakePic (char *name, int width, int height, byte *data) qpic_t *pic; glpic_t gl; - pic = Hunk_Alloc (sizeof(qpic_t) - 4 + sizeof (glpic_t)); + pic = (qpic_t *) Hunk_Alloc (sizeof(qpic_t) - 4 + sizeof (glpic_t)); pic->width = width; pic->height = height; @@ -407,7 +407,7 @@ void Draw_LoadPics (void) byte *data; src_offset_t offset; - data = W_GetLumpName ("conchars"); + data = (byte *) W_GetLumpName ("conchars"); if (!data) Sys_Error ("Draw_LoadPics: couldn't load conchars"); offset = (src_offset_t)data - (src_offset_t)wad_base; char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data, diff --git a/quakespasm/Quake/gl_mesh.c b/quakespasm/Quake/gl_mesh.c index 6cd1c4e6..1719fc1b 100644 --- a/quakespasm/Quake/gl_mesh.c +++ b/quakespasm/Quake/gl_mesh.c @@ -312,7 +312,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) paliashdr->poseverts = numorder; - cmds = Hunk_Alloc (numcommands * 4); + cmds = (int *) Hunk_Alloc (numcommands * 4); paliashdr->commands = (byte *)cmds - (byte *)paliashdr; //johnfitz -- precompute texcoords for padded skins @@ -335,7 +335,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) } //johnfitz - verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t)); + verts = (trivertx_t *) Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t)); paliashdr->posedata = (byte *)verts - (byte *)paliashdr; for (i=0 ; inumposes ; i++) for (j=0 ; jname, "notexture"); r_notexture_mip->height = r_notexture_mip->width = 32; - r_notexture_mip2 = Hunk_AllocName (sizeof(texture_t), "r_notexture_mip2"); + r_notexture_mip2 = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip2"); strcpy (r_notexture_mip2->name, "notexture2"); r_notexture_mip2->height = r_notexture_mip2->width = 32; //johnfitz @@ -398,7 +398,7 @@ void Mod_LoadTextures (lump_t *l) //johnfitz loadmodel->numtextures = nummiptex + 2; //johnfitz -- need 2 dummy texture chains for missing textures - loadmodel->textures = Hunk_AllocName (loadmodel->numtextures * sizeof(*loadmodel->textures) , loadname); + loadmodel->textures = (texture_t **) Hunk_AllocName (loadmodel->numtextures * sizeof(*loadmodel->textures) , loadname); for (i=0 ; iwidth & 15) || (mt->height & 15) ) Sys_Error ("Texture %s is not 16 aligned", mt->name); pixels = mt->width*mt->height/64*85; - tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname ); + tx = (texture_t *) Hunk_AllocName (sizeof(texture_t) +pixels, loadname ); loadmodel->textures[i] = tx; memcpy (tx->name, mt->name, sizeof(tx->name)); @@ -630,7 +630,6 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc */ void Mod_LoadLighting (lump_t *l) { - // int i; byte *in, *out, *data; byte d; @@ -661,7 +660,7 @@ void Mod_LoadLighting (lump_t *l) // LordHavoc: no .lit found, expand the white lighting data to color if (!l->filelen) return; - loadmodel->lightdata = Hunk_AllocName ( l->filelen*3, litfilename); + loadmodel->lightdata = (byte *) Hunk_AllocName ( l->filelen*3, litfilename); in = loadmodel->lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write out = loadmodel->lightdata; memcpy (in, mod_base + l->fileofs, l->filelen); @@ -687,7 +686,7 @@ void Mod_LoadVisibility (lump_t *l) loadmodel->visdata = NULL; return; } - loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname); + loadmodel->visdata = (byte *) Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen); } @@ -704,7 +703,7 @@ void Mod_LoadEntities (lump_t *l) loadmodel->entities = NULL; return; } - loadmodel->entities = Hunk_AllocName ( l->filelen, loadname); + loadmodel->entities = (char *) Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen); } @@ -720,11 +719,11 @@ void Mod_LoadVertexes (lump_t *l) mvertex_t *out; int i, count; - in = (void *)(mod_base + l->fileofs); + in = (dvertex_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mvertex_t *) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->vertexes = out; loadmodel->numvertexes = count; @@ -746,13 +745,13 @@ void Mod_LoadEdges (lump_t *l) { dedge_t *in; medge_t *out; - int i, count; + int i, count; - in = (void *)(mod_base + l->fileofs); + in = (dedge_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); + out = (medge_t *) Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); loadmodel->edges = out; loadmodel->numedges = count; @@ -773,15 +772,15 @@ void Mod_LoadTexinfo (lump_t *l) { texinfo_t *in; mtexinfo_t *out; - int i, j, count, miptex; + int i, j, count, miptex; float len1, len2; int missing = 0; //johnfitz - in = (void *)(mod_base + l->fileofs); + in = (texinfo_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mtexinfo_t *) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->texinfo = out; loadmodel->numtexinfo = count; @@ -923,7 +922,7 @@ void Mod_PolyForUnlitSurface (msurface_t *fa) } //create the poly - poly = Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float)); + poly = (glpoly_t *) Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float)); poly->next = NULL; fa->polys = poly; poly->numverts = numverts; @@ -984,11 +983,11 @@ void Mod_LoadFaces (lump_t *l) int i, count, surfnum; int planenum, side; - in = (void *)(mod_base + l->fileofs); + in = (dface_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (msurface_t *) Hunk_AllocName ( count*sizeof(*out), loadname); //johnfitz -- warn mappers about exceeding old limits if (count > 32767) @@ -1018,7 +1017,6 @@ void Mod_LoadFaces (lump_t *l) Mod_CalcSurfaceBounds (out); //johnfitz -- for per-surface frustum culling // lighting info - for (i=0 ; istyles[i] = in->styles[i]; i = LittleLong(in->lightofs); @@ -1079,13 +1077,13 @@ void Mod_LoadNodes (lump_t *l) { int i, j, count, p; dnode_t *in; - mnode_t *out; + mnode_t *out; - in = (void *)(mod_base + l->fileofs); + in = (dnode_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname); //johnfitz -- warn mappers about exceeding old limits if (count > 32767) @@ -1140,15 +1138,15 @@ Mod_LoadLeafs */ void Mod_LoadLeafs (lump_t *l) { - dleaf_t *in; - mleaf_t *out; + dleaf_t *in; + mleaf_t *out; int i, j, count, p; - in = (void *)(mod_base + l->fileofs); + in = (dleaf_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mleaf_t *) Hunk_AllocName ( count*sizeof(*out), loadname); //johnfitz if (count > 32767) @@ -1198,11 +1196,11 @@ void Mod_LoadClipnodes (lump_t *l) int i, count; hull_t *hull; - in = (void *)(mod_base + l->fileofs); + in = (dclipnode_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mclipnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname); //johnfitz -- warn about exceeding old limits if (count > 32767) @@ -1274,7 +1272,7 @@ void Mod_MakeHull0 (void) in = loadmodel->nodes; count = loadmodel->numnodes; - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (mclipnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname); hull->clipnodes = out; hull->firstclipnode = 0; @@ -1306,11 +1304,11 @@ void Mod_LoadMarksurfaces (lump_t *l) short *in; msurface_t **out; - in = (void *)(mod_base + l->fileofs); + in = (short *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (msurface_t **) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->marksurfaces = out; loadmodel->nummarksurfaces = count; @@ -1339,11 +1337,11 @@ void Mod_LoadSurfedges (lump_t *l) int i, count; int *in, *out; - in = (void *)(mod_base + l->fileofs); + in = (int *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (int *) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfedges = out; loadmodel->numsurfedges = count; @@ -1366,11 +1364,11 @@ void Mod_LoadPlanes (lump_t *l) int count; int bits; - in = (void *)(mod_base + l->fileofs); + in = (dplane_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*2*sizeof(*out), loadname); + out = (mplane_t *) Hunk_AllocName ( count*2*sizeof(*out), loadname); loadmodel->planes = out; loadmodel->numplanes = count; @@ -1420,11 +1418,11 @@ void Mod_LoadSubmodels (lump_t *l) dmodel_t *out; int i, j, count; - in = (void *)(mod_base + l->fileofs); + in = (dmodel_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = (dmodel_t *) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->submodels = out; loadmodel->numsubmodels = count; @@ -1826,7 +1824,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) Mod_FloodFillSkin( skin, pheader->skinwidth, pheader->skinheight ); // save 8 bit texels for the player model to remap - texels = Hunk_AllocName(size, loadname); + texels = (byte *) Hunk_AllocName(size, loadname); pheader->texels[i] = texels - (byte *)pheader; memcpy (texels, (byte *)(pskintype + 1), size); @@ -1862,13 +1860,13 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) groupskins = LittleLong (pinskingroup->numskins); pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1); - pskintype = (void *)(pinskinintervals + groupskins); + pskintype = (daliasskintype_t *)(pinskinintervals + groupskins); for (j=0 ; jskinwidth, pheader->skinheight ); if (j == 0) { - texels = Hunk_AllocName(size, loadname); + texels = (byte *) Hunk_AllocName(size, loadname); pheader->texels[i] = texels - (byte *)pheader; memcpy (texels, (byte *)(pskintype), size); } @@ -2038,7 +2036,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) size = sizeof (aliashdr_t) + (LittleLong (pinmodel->numframes) - 1) * sizeof (pheader->frames[0]); - pheader = Hunk_AllocName (size, loadname); + pheader = (aliashdr_t *) Hunk_AllocName (size, loadname); mod->flags = LittleLong (pinmodel->flags); @@ -2088,7 +2086,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) // load the skins // pskintype = (daliasskintype_t *)&pinmodel[1]; - pskintype = Mod_LoadAllSkins (pheader->numskins, pskintype); + pskintype = (daliasskintype_t *) Mod_LoadAllSkins (pheader->numskins, pskintype); // // load base s and t vertices @@ -2182,7 +2180,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) height = LittleLong (pinframe->height); size = width * height; - pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t),loadname); + pspriteframe = (mspriteframe_t *) Hunk_AllocName (sizeof (mspriteframe_t),loadname); Q_memset (pspriteframe, 0, sizeof (mspriteframe_t)); @@ -2231,7 +2229,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum) numframes = LittleLong (pingroup->numframes); - pspritegroup = Hunk_AllocName (sizeof (mspritegroup_t) + + pspritegroup = (mspritegroup_t *) Hunk_AllocName (sizeof (mspritegroup_t) + (numframes - 1) * sizeof (pspritegroup->frames[0]), loadname); pspritegroup->numframes = numframes; @@ -2240,7 +2238,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum) pin_intervals = (dspriteinterval_t *)(pingroup + 1); - poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname); + poutintervals = (float *) Hunk_AllocName (numframes * sizeof (float), loadname); pspritegroup->intervals = poutintervals; @@ -2292,7 +2290,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) size = sizeof (msprite_t) + (numframes - 1) * sizeof (psprite->frames); - psprite = Hunk_AllocName (size, loadname); + psprite = (msprite_t *) Hunk_AllocName (size, loadname); mod->cache.data = psprite; @@ -2362,4 +2360,3 @@ void Mod_Print (void) Con_Printf ("%i models\n",mod_numknown); //johnfitz -- print the total too } - diff --git a/quakespasm/Quake/gl_screen.c b/quakespasm/Quake/gl_screen.c index fbb893a6..58910c59 100644 --- a/quakespasm/Quake/gl_screen.c +++ b/quakespasm/Quake/gl_screen.c @@ -750,7 +750,7 @@ void SCR_ScreenShot_f (void) } //get data - buffer = malloc(glwidth*glheight*3); + buffer = (byte *) malloc(glwidth*glheight*3); glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer); // now write the file diff --git a/quakespasm/Quake/gl_sky.c b/quakespasm/Quake/gl_sky.c index 7bf56a84..6b07d106 100644 --- a/quakespasm/Quake/gl_sky.c +++ b/quakespasm/Quake/gl_sky.c @@ -591,7 +591,7 @@ void Sky_ProcessEntities (void) { //copy the polygon and translate manually, since Sky_ProcessPoly needs it to be in world space mark = Hunk_LowMark(); - p = Hunk_Alloc (sizeof(*s->polys)); //FIXME: don't allocate for each poly + p = (glpoly_t *) Hunk_Alloc (sizeof(*s->polys)); //FIXME: don't allocate for each poly p->numverts = s->polys->numverts; for (k=0; knumverts; k++) { @@ -891,7 +891,7 @@ void Sky_DrawFace (int axis) Sky_SetBoxVert(1.0, -1.0, axis, verts[3]); start = Hunk_LowMark (); - p = Hunk_Alloc(sizeof(glpoly_t)); + p = (glpoly_t *) Hunk_Alloc(sizeof(glpoly_t)); VectorSubtract(verts[2],verts[3],vup); VectorSubtract(verts[2],verts[1],vright); diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index c628c87e..0271240c 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -245,13 +245,13 @@ void TexMgr_Imagedump_f (void) GL_Bind (glt); if (glt->flags & TEXPREF_ALPHA) { - buffer = malloc(glt->width*glt->height*4); + buffer = (byte *) malloc(glt->width*glt->height*4); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); Image_WriteTGA (tganame, buffer, glt->width, glt->height, 32, true); } else { - buffer = malloc(glt->width*glt->height*3); + buffer = (byte *) malloc(glt->width*glt->height*3); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer); Image_WriteTGA (tganame, buffer, glt->width, glt->height, 24, true); } @@ -438,7 +438,7 @@ void TexMgr_LoadPalette (void) Sys_Error ("Couldn't load gfx/palette.lmp"); mark = Hunk_LowMark (); - pal = Hunk_Alloc (768); + pal = (byte *) Hunk_Alloc (768); fread (pal, 1, 768, f); fclose(f); @@ -532,7 +532,7 @@ void TexMgr_RecalcWarpImageSize (void) // resize the textures in opengl // mark = Hunk_LowMark(); - dummy = Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4); + dummy = (byte *) Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4); for (glt=active_gltextures; glt; glt=glt->next) { @@ -709,7 +709,7 @@ unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qbool outwidth = TexMgr_Pad(inwidth); outheight = TexMgr_Pad(inheight); - out = Hunk_Alloc(outwidth*outheight*4); + out = (unsigned *) Hunk_Alloc(outwidth*outheight*4); xfrac = ((inwidth-1) << 16) / (outwidth-1); yfrac = ((inheight-1) << 16) / (outheight-1); @@ -889,7 +889,7 @@ unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal) int i; unsigned *out, *data; - out = data = Hunk_Alloc(pixels*4); + out = data = (unsigned *) Hunk_Alloc(pixels*4); for (i=0 ; iwidth * glt->height; - dst = translated = Hunk_Alloc (size); + dst = translated = (byte *) Hunk_Alloc (size); src = data; for (i=0; inext = warpface->polys->next; warpface->polys->next = poly; poly->numverts = numverts; diff --git a/quakespasm/Quake/host.c b/quakespasm/Quake/host.c index f85e39da..c6a12c8f 100644 --- a/quakespasm/Quake/host.c +++ b/quakespasm/Quake/host.c @@ -214,7 +214,7 @@ void Host_FindMaxClients (void) svs.maxclientslimit = svs.maxclients; if (svs.maxclientslimit < 4) svs.maxclientslimit = 4; - svs.clients = Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients"); + svs.clients = (struct client_s *) Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients"); if (svs.maxclients > 1) Cvar_SetValue ("deathmatch", 1.0); diff --git a/quakespasm/Quake/host_cmd.c b/quakespasm/Quake/host_cmd.c index 760f158a..8d6a38e1 100644 --- a/quakespasm/Quake/host_cmd.c +++ b/quakespasm/Quake/host_cmd.c @@ -170,7 +170,7 @@ void Host_Game_f (void) if (Q_strcasecmp(Cmd_Argv(1), GAMENAME)) //game is not id1 { - search = Z_Malloc(sizeof(searchpath_t)); + search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t)); strcpy (search->filename, pakfile); search->next = com_searchpaths; com_searchpaths = search; @@ -182,7 +182,7 @@ void Host_Game_f (void) pak = COM_LoadPackFile (pakfile); if (!pak) break; - search = Z_Malloc(sizeof(searchpath_t)); + search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t)); search->pack = pak; search->next = com_searchpaths; com_searchpaths = search; @@ -227,7 +227,7 @@ void ExtraMaps_Add (char *name) if (!Q_strcmp (name, level->name)) return; - level = Z_Malloc(sizeof(extralevel_t)); + level = (extralevel_t *) Z_Malloc(sizeof(extralevel_t)); strcpy (level->name, name); //insert each entry in alphabetical order @@ -359,7 +359,7 @@ void Modlist_Add (char *name) if (!Q_strcmp (name, mod->name)) return; - mod = Z_Malloc(sizeof(mod_t)); + mod = (mod_t *) Z_Malloc(sizeof(mod_t)); strcpy (mod->name, name); //insert each entry in alphabetical order @@ -1149,7 +1149,7 @@ void Host_Loadgame_f (void) for (i=0 ; inext = fa->polys; fa->polys = poly; poly->numverts = lnumverts; diff --git a/quakespasm/Quake/r_sprite.c b/quakespasm/Quake/r_sprite.c index 36c899f9..ed12d5c8 100644 --- a/quakespasm/Quake/r_sprite.c +++ b/quakespasm/Quake/r_sprite.c @@ -35,7 +35,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity) int i, numframes, frame; float *pintervals, fullinterval, targettime, time; - psprite = currententity->model->cache.data; + psprite = (msprite_t *) currententity->model->cache.data; frame = currententity->frame; if ((frame >= psprite->numframes) || (frame < 0)) @@ -89,7 +89,7 @@ void R_DrawSpriteModel (entity_t *e) //TODO: frustum cull it? frame = R_GetSpriteFrame (e); - psprite = currententity->model->cache.data; + psprite = (msprite_t *) currententity->model->cache.data; switch(psprite->type) { diff --git a/quakespasm/Quake/snd_dma.c b/quakespasm/Quake/snd_dma.c index 2f31287d..de84cca6 100644 --- a/quakespasm/Quake/snd_dma.c +++ b/quakespasm/Quake/snd_dma.c @@ -171,7 +171,7 @@ void S_Init (void) SND_InitScaletable (); - known_sfx = Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t"); + known_sfx = (sfx_t *) Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t"); num_sfx = 0; snd_initialized = true; @@ -885,7 +885,7 @@ void S_SoundList(void) total = 0; for (sfx=known_sfx, i=0 ; icache); + sc = (sfxcache_t *) Cache_Check (&sfx->cache); if (!sc) continue; size = sc->length*sc->width*(sc->stereo+1); diff --git a/quakespasm/Quake/snd_mem.c b/quakespasm/Quake/snd_mem.c index 4378abdd..03230f88 100644 --- a/quakespasm/Quake/snd_mem.c +++ b/quakespasm/Quake/snd_mem.c @@ -40,7 +40,7 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) int sample, samplefrac, fracstep; sfxcache_t *sc; - sc = Cache_Check (&sfx->cache); + sc = (sfxcache_t *) Cache_Check (&sfx->cache); if (!sc) return; @@ -106,7 +106,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) byte stackbuf[1*1024]; // avoid dirtying the cache heap // see if still in memory - sc = Cache_Check (&s->cache); + sc = (sfxcache_t *) Cache_Check (&s->cache); if (sc) return sc; @@ -137,7 +137,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) len = len * info.width * info.channels; - sc = Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name); + sc = (sfxcache_t *) Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name); if (!sc) return NULL; diff --git a/quakespasm/Quake/sv_main.c b/quakespasm/Quake/sv_main.c index 5ed398e6..413ed70c 100644 --- a/quakespasm/Quake/sv_main.c +++ b/quakespasm/Quake/sv_main.c @@ -1323,7 +1323,7 @@ void SV_SpawnServer (char *server) // allocate server memory sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar - sv.edicts = Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts"); + sv.edicts = (edict_t *) Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts"); sv.datagram.maxsize = sizeof(sv.datagram_buf); sv.datagram.cursize = 0; diff --git a/quakespasm/Quake/sv_phys.c b/quakespasm/Quake/sv_phys.c index 6f2ecf2f..a699d553 100644 --- a/quakespasm/Quake/sv_phys.c +++ b/quakespasm/Quake/sv_phys.c @@ -474,8 +474,8 @@ void SV_PushMove (edict_t *pusher, float movetime) //johnfitz -- dynamically allocate mark = Hunk_LowMark (); - moved_edict = Hunk_Alloc (sv.num_edicts*sizeof(edict_t *)); - moved_from = Hunk_Alloc (sv.num_edicts*sizeof(vec3_t)); + moved_edict = (edict_t **) Hunk_Alloc (sv.num_edicts*sizeof(edict_t *)); + moved_from = (vec3_t *) Hunk_Alloc (sv.num_edicts*sizeof(vec3_t)); //johnfitz // see if any solid entities are inside the final position diff --git a/quakespasm/Quake/zone.c b/quakespasm/Quake/zone.c index 284db540..00213ad0 100644 --- a/quakespasm/Quake/zone.c +++ b/quakespasm/Quake/zone.c @@ -962,7 +962,7 @@ void Memory_Init (void *buf, int size) int p; int zonesize = DYNAMIC_SIZE; - hunk_base = buf; + hunk_base = (byte *) buf; hunk_size = size; hunk_low_used = 0; hunk_high_used = 0; @@ -976,7 +976,7 @@ void Memory_Init (void *buf, int size) else Sys_Error ("Memory_Init: you must specify a size in KB after -zone"); } - mainzone = Hunk_AllocName (zonesize, "zone" ); + mainzone = (memzone_t *) Hunk_AllocName (zonesize, "zone" ); Memory_InitZone (mainzone, zonesize); Cmd_AddCommand ("hunk_print", Hunk_Print_f); //johnfitz