From f70ec69470a06929143b85aefaef94dc772bceb8 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 21 Dec 2024 13:50:03 +0200 Subject: [PATCH] hide local functions under static Also apply recomentadion of msvc for use size_t with strlen. --- src/backends/generic/misc.c | 3 +- src/backends/windows/network.c | 4 +- src/client/cl_console.c | 4 +- src/client/cl_keyboard.c | 18 +++---- src/client/cl_main.c | 2 + src/client/cl_network.c | 6 +-- src/client/cl_parse.c | 68 ++++++++++++------------ src/client/header/client.h | 8 --- src/client/input/sdl2.c | 7 ++- src/client/menu/qmenu.c | 17 ++---- src/client/refresh/gl1/gl1_image.c | 15 +++--- src/client/refresh/gl3/gl3_image.c | 7 +-- src/client/refresh/soft/sw_image.c | 3 +- src/client/refresh/soft/sw_main.c | 2 +- src/client/refresh/soft/sw_surf.c | 2 + src/client/vid/vid.c | 14 ++--- src/common/cmdparser.c | 32 ++++++----- src/common/collision.c | 3 +- src/common/filesystem.c | 3 +- src/common/frame.c | 2 +- src/game/g_cmds.c | 36 ++++++------- src/game/g_misc.c | 3 +- src/game/g_spawn.c | 2 +- src/game/player/hud.c | 5 +- src/game/savegame/savegame.c | 4 +- src/game/savegame/tables/gamefunc_decs.h | 18 ------- src/game/savegame/tables/gamefunc_list.h | 18 ------- src/server/sv_cmd.c | 3 +- src/server/sv_init.c | 2 +- 29 files changed, 140 insertions(+), 171 deletions(-) diff --git a/src/backends/generic/misc.c b/src/backends/generic/misc.c index 68683b34..54b8f10e 100644 --- a/src/backends/generic/misc.c +++ b/src/backends/generic/misc.c @@ -146,7 +146,8 @@ static void SetExecutablePath(char* exePath) #endif } -qboolean Sys_GetCwd(char *buf, size_t size) +static qboolean +Sys_GetCwd(char *buf, size_t size) { #ifdef _WIN32 WCHAR wpath[PATH_MAX]; diff --git a/src/backends/windows/network.c b/src/backends/windows/network.c index a6d4fc3e..35de711d 100644 --- a/src/backends/windows/network.c +++ b/src/backends/windows/network.c @@ -800,7 +800,7 @@ NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to) /* ============================================================================= */ -int +static int NET_IPSocket(char *net_interface, int port, netsrc_t type, int family) { char Buf[BUFSIZ], *Host, *Service; @@ -1040,7 +1040,7 @@ NET_OpenIP(void) } } -int +static int NET_IPXSocket(int port) { int newsocket; diff --git a/src/client/cl_console.c b/src/client/cl_console.c index 9c30524b..e85764d2 100644 --- a/src/client/cl_console.c +++ b/src/client/cl_console.c @@ -472,7 +472,7 @@ Con_DrawInput(void) float scale; char *text; char ch; - int txtlen; + size_t txtlen; int linepos; int draw_icon; @@ -630,7 +630,7 @@ Con_DrawConsole(float frac) { int i, j, x, y, n; int rows; - int verLen; + size_t verLen; char *text; int row; int lines; diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c index c8efa150..9e129718 100644 --- a/src/client/cl_keyboard.c +++ b/src/client/cl_keyboard.c @@ -269,7 +269,7 @@ keyname_t keynames[] = { /* ------------------------------------------------------------------ */ -void +static void CompleteCommand(void) { char *cmd; @@ -301,7 +301,7 @@ CompleteCommand(void) key_lines[edit_line][key_linepos] = '\0'; } -void +static void CompleteMapNameCommand(void) { char *s, *cmdArg; @@ -339,7 +339,7 @@ IsInConsole(void) (cls.state == ca_disconnected || cls.state == ca_connecting)); } -void +static void Key_Console(int key) { char txt[2]; @@ -607,7 +607,7 @@ char chat_buffer[MAXCMDLINE]; int chat_bufferlen = 0; int chat_cursorpos = 0; -void +static void Key_Message(int key) { char last; @@ -735,7 +735,7 @@ Key_Message(int key) * Single ascii characters return themselves, while * the K_* names are matched up. */ -int +static int Key_StringToKeynum(char *str) { keyname_t *kn; @@ -822,7 +822,7 @@ Key_SetBinding(int keynum, char *binding) keybindings[keynum] = new; } -void +static void Key_Unbind_f(void) { int b; @@ -844,7 +844,7 @@ Key_Unbind_f(void) Key_SetBinding(b, ""); } -void +static void Key_Unbindall_f(void) { int i; @@ -862,7 +862,7 @@ Key_Unbindall_f(void) * (=> default.cfg is done) */ extern qboolean doneWithDefaultCfg; -void +static void Key_Bind_f(void) { int i, c, b; @@ -1049,7 +1049,7 @@ Key_ReadConsoleHistory() fclose(f); } -void +static void Key_Bindlist_f(void) { int i; diff --git a/src/client/cl_main.c b/src/client/cl_main.c index de050abf..172fc4b3 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -33,6 +33,7 @@ void CL_Changing_f(void); void CL_Reconnect_f(void); void CL_Connect_f(void); void CL_Rcon_f(void); +void CL_Packet_f(void); void CL_CheckForResend(void); cvar_t *rcon_client_password; @@ -597,6 +598,7 @@ CL_InitLocal(void) Cmd_AddCommand("reconnect", CL_Reconnect_f); Cmd_AddCommand("rcon", CL_Rcon_f); + Cmd_AddCommand("packet", CL_Packet_f); Cmd_AddCommand("setenv", CL_Setenv_f); diff --git a/src/client/cl_network.c b/src/client/cl_network.c index 7f068192..2e92342f 100644 --- a/src/client/cl_network.c +++ b/src/client/cl_network.c @@ -109,7 +109,7 @@ CL_Drop(void) * We have gotten a challenge from the server, so try and * connect. */ -void +static void CL_SendConnectPacket(void) { netadr_t adr; @@ -378,7 +378,7 @@ void CL_Packet_f(void) { char send[2048]; - int i, l; + size_t i, l; char *in, *out; netadr_t adr; @@ -567,7 +567,7 @@ CL_PingServers_f(void) /* * Responses to broadcasts, etc */ -void +static void CL_ConnectionlessPacket(void) { char *s; diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c index aeff4ddc..c3ae53e2 100644 --- a/src/client/cl_parse.c +++ b/src/client/cl_parse.c @@ -30,9 +30,9 @@ void CL_DownloadFileName(char *dest, int destlen, char *fn); void CL_ParseDownload(void); -int bitcounts[32]; /* just for protocol profiling */ +static int bitcounts[32]; /* just for protocol profiling */ -char *svc_strings[256] = { +static const char *svc_strings[256] = { "svc_bad", "svc_muzzleflash", @@ -83,7 +83,7 @@ CL_RegisterSounds(void) /* * Returns the entity number and the header bits */ -int +static int CL_ParseEntityBits(unsigned *bits) { unsigned b, total; @@ -137,8 +137,8 @@ CL_ParseEntityBits(unsigned *bits) /* * Can go from either a baseline or a previous packet_entity */ -void -CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits) +static void +CL_ParseDelta(const entity_state_t *from, entity_state_t *to, int number, int bits) { /* set everything to the state we are delta'ing from */ *to = *from; @@ -275,7 +275,7 @@ CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits) * Parses deltas from the given base and adds the resulting entity to * the current frame */ -void +static void CL_DeltaEntity(frame_t *frame, int newnum, entity_state_t *old, int bits) { centity_t *ent; @@ -339,13 +339,12 @@ CL_DeltaEntity(frame_t *frame, int newnum, entity_state_t *old, int bits) * parsed, deal with the rest of the * data stream. */ -void +static void CL_ParsePacketEntities(frame_t *oldframe, frame_t *newframe) { unsigned int newnum; unsigned bits; - entity_state_t - *oldstate = NULL; + entity_state_t *oldstate = NULL; int oldindex, oldnum; newframe->parse_entities = cl.parse_entities; @@ -518,13 +517,11 @@ CL_ParsePacketEntities(frame_t *oldframe, frame_t *newframe) } } -void +static void CL_ParsePlayerstate(frame_t *oldframe, frame_t *newframe) { - int flags; + int flags, i, statbits; player_state_t *state; - int i; - int statbits; state = &newframe->playerstate; @@ -656,14 +653,16 @@ CL_ParsePlayerstate(frame_t *oldframe, frame_t *newframe) } } -void +static void CL_FireEntityEvents(frame_t *frame) { - entity_state_t *s1; - int pnum, num; + int pnum; for (pnum = 0; pnum < frame->num_entities; pnum++) { + entity_state_t *s1; + int num; + num = (frame->parse_entities + pnum) & (MAX_PARSE_ENTITIES - 1); s1 = &cl_parse_entities[num]; @@ -679,7 +678,16 @@ CL_FireEntityEvents(frame_t *frame) } } -void +static void +SHOWNET(const char *s) +{ + if (cl_shownet->value >= 2) + { + Com_Printf("%3i:%s\n", net_message.readcount - 1, s); + } +} + +static void CL_ParseFrame(void) { int cmd; @@ -823,7 +831,7 @@ CL_ParseFrame(void) } } -void +static void CL_ParseServerData(void) { extern cvar_t *fs_gamedirvar; @@ -891,7 +899,7 @@ CL_ParseServerData(void) } } -void +static void CL_ParseBaseline(void) { entity_state_t *es; @@ -1061,10 +1069,11 @@ CL_ParseClientinfo(int player) CL_LoadClientinfo(ci, s); } -void +static void CL_ParseConfigString(void) { - int i, length; + size_t length; + int i; char *s; char olds[MAX_QPATH]; @@ -1072,7 +1081,7 @@ CL_ParseConfigString(void) if ((i < 0) || (i >= MAX_CONFIGSTRINGS)) { - Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); + Com_Error(ERR_DROP, "%s: configstring > MAX_CONFIGSTRINGS", __func__); } s = MSG_ReadString(&net_message); @@ -1080,9 +1089,9 @@ CL_ParseConfigString(void) Q_strlcpy(olds, cl.configstrings[i], sizeof(olds)); length = strlen(s); - if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0])*i - 1) + if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0]) * i - 1) { - Com_Error(ERR_DROP, "CL_ParseConfigString: oversize configstring"); + Com_Error(ERR_DROP, "%s: oversize configstring", __func__); } strcpy(cl.configstrings[i], s); @@ -1140,7 +1149,7 @@ CL_ParseConfigString(void) } } -void +static void CL_ParseStartSoundPacket(void) { vec3_t pos_v; @@ -1227,15 +1236,6 @@ CL_ParseStartSoundPacket(void) volume, attenuation, ofs); } -void -SHOWNET(char *s) -{ - if (cl_shownet->value >= 2) - { - Com_Printf("%3i:%s\n", net_message.readcount - 1, s); - } -} - void CL_ParseServerMessage(void) { diff --git a/src/client/header/client.h b/src/client/header/client.h index 4e7def1e..d7b38743 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -421,12 +421,7 @@ void CL_Widowbeamout (cl_sustain_t *self); void CL_Nukeblast (cl_sustain_t *self); void CL_WidowSplash (vec3_t org); -int CL_ParseEntityBits (unsigned *bits); -void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int number, int bits); -void CL_ParseFrame (void); - void CL_ParseTEnt (void); -void CL_ParseConfigString (void); void CL_AddMuzzleFlash (void); void CL_AddMuzzleFlash2 (void); void SmokeAndFlash(vec3_t origin); @@ -498,11 +493,8 @@ void CL_WriteDemoMessage (void); void CL_Stop_f (void); void CL_Record_f (void); -extern char *svc_strings[256]; - void CL_ParseServerMessage (void); void CL_LoadClientinfo (clientinfo_t *ci, char *s); -void SHOWNET(char *s); void CL_ParseClientinfo (int player); void CL_Download_f (void); diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index 0faece38..6990b2f4 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -2147,6 +2147,9 @@ IN_Controller_Init(qboolean notify_user) for (int i = 0; i < SDL_NumJoysticks(); i++) { + const char* joystick_name; + size_t name_len; + joystick = SDL_JoystickOpen(i); if (!joystick) { @@ -2154,8 +2157,8 @@ IN_Controller_Init(qboolean notify_user) continue; // try next joystick } - const char* joystick_name = SDL_JoystickName(joystick); - const int name_len = strlen(joystick_name); + joystick_name = SDL_JoystickName(joystick); + name_len = strlen(joystick_name); Com_Printf ("Trying joystick %d, '%s'\n", i+1, joystick_name); diff --git a/src/client/menu/qmenu.c b/src/client/menu/qmenu.c index 92b8cd24..2804133d 100644 --- a/src/client/menu/qmenu.c +++ b/src/client/menu/qmenu.c @@ -67,7 +67,8 @@ ClampCvar(float min, float max, float value) Bitmap_Draw ================= */ -void Bitmap_Draw(menubitmap_s * item) +static void +Bitmap_Draw(menubitmap_s * item) { float scale = SCR_GetMenuScale(); int x = 0; @@ -132,19 +133,7 @@ Action_Draw(menuaction_s *a) } } -qboolean -Field_DoEnter(menufield_s *f) -{ - if (f->generic.callback) - { - f->generic.callback(f); - return true; - } - - return false; -} - -void +static void Field_Draw(menufield_s *f) { int i, n; diff --git a/src/client/refresh/gl1/gl1_image.c b/src/client/refresh/gl1/gl1_image.c index 00761e70..1b8064d5 100644 --- a/src/client/refresh/gl1/gl1_image.c +++ b/src/client/refresh/gl1/gl1_image.c @@ -470,7 +470,7 @@ R_ImageList_f(void) /* * Fill background pixels so mipmapping doesn't have haloes */ -void +static void R_FloodFillSkin(byte *skin, int skinwidth, int skinheight) { byte fillcolor = *skin; /* assume this is the pixel to fill */ @@ -536,7 +536,7 @@ R_FloodFillSkin(byte *skin, int skinwidth, int skinheight) * texture to increase the * lighting range */ -void +static void R_LightScaleTexture(unsigned *in, int inwidth, int inheight, qboolean only_gamma) { @@ -577,7 +577,7 @@ R_LightScaleTexture(unsigned *in, int inwidth, /* * Operates in place, quartering the size of the texture */ -void +static void R_MipMap(byte *in, int width, int height) { int i, j; @@ -602,7 +602,7 @@ R_MipMap(byte *in, int width, int height) /* * Returns has_alpha */ -void +static void R_BuildPalettedTexture(unsigned char *paletted_texture, unsigned char *scaled, int scaled_width, int scaled_height) { @@ -624,7 +624,7 @@ R_BuildPalettedTexture(unsigned char *paletted_texture, unsigned char *scaled, } } -qboolean +static qboolean R_Upload32Native(unsigned *data, int width, int height, qboolean mipmap) { // This is for GL 2.x so no palettes, no scaling, no messing around with the data here. :) @@ -660,7 +660,7 @@ R_Upload32Native(unsigned *data, int width, int height, qboolean mipmap) } -qboolean +static qboolean R_Upload32Soft(unsigned *data, int width, int height, qboolean mipmap) { int samples; @@ -1126,7 +1126,8 @@ image_t * R_FindImage(const char *name, imagetype_t type) { image_t *image; - int i, len; + size_t len; + int i; char *ptr; char namewe[256]; const char* ext; diff --git a/src/client/refresh/gl3/gl3_image.c b/src/client/refresh/gl3/gl3_image.c index dc5c95e9..8738fcab 100644 --- a/src/client/refresh/gl3/gl3_image.c +++ b/src/client/refresh/gl3/gl3_image.c @@ -186,7 +186,7 @@ GL3_BindLightmap(int lightmapnum) /* * Returns has_alpha */ -qboolean +static qboolean GL3_Upload32(unsigned *data, int width, int height, qboolean mipmap) { qboolean res; @@ -237,7 +237,7 @@ GL3_Upload32(unsigned *data, int width, int height, qboolean mipmap) /* * Returns has_alpha */ -qboolean +static qboolean GL3_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky) { int s = width * height; @@ -605,7 +605,8 @@ gl3image_t * GL3_FindImage(const char *name, imagetype_t type) { gl3image_t *image; - int i, len; + size_t len; + int i; char *ptr; char namewe[256]; const char* ext; diff --git a/src/client/refresh/soft/sw_image.c b/src/client/refresh/soft/sw_image.c index e588830e..4a85dd05 100644 --- a/src/client/refresh/soft/sw_image.c +++ b/src/client/refresh/soft/sw_image.c @@ -492,7 +492,8 @@ image_t * R_FindImage(const char *name, imagetype_t type) { image_t *image; - int i, len; + size_t len; + int i; char *ptr; char namewe[256]; const char* ext; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 55f7d39a..d996d0da 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -2183,7 +2183,7 @@ RE_BufferDifferenceStart(int vmin, int vmax) return (pixel_t*)back_buffer - swap_frames[0]; } -static int +static size_t RE_BufferDifferenceEnd(int vmin, int vmax) { int *front_buffer, *back_buffer, *back_min; diff --git a/src/client/refresh/soft/sw_surf.c b/src/client/refresh/soft/sw_surf.c index 32c7c10e..2478da9a 100644 --- a/src/client/refresh/soft/sw_surf.c +++ b/src/client/refresh/soft/sw_surf.c @@ -104,6 +104,8 @@ R_DrawSurfaceBlock_Light (pixel_t *prowdest, pixel_t *psource, size_t size, for (b=(size-1); b>=0; b--) { pixel_t pix; + int j; + pix = psource[b]; prowdest[b] = R_ApplyLight(pix, light); diff --git a/src/client/vid/vid.c b/src/client/vid/vid.c index f980d5ad..cfb293ca 100644 --- a/src/client/vid/vid.c +++ b/src/client/vid/vid.c @@ -105,7 +105,7 @@ void VID_WriteScreenshot(int width, int height, int comp, const void* data) if (argc > 2) { const char* q = Cmd_Argv(2); - int qualityStrLen = strlen(q); + size_t qualityStrLen = strlen(q); for (i = 0; i < qualityStrLen; ++i) { @@ -247,7 +247,7 @@ vidmode_t vid_modes[] = { /* * Callback function for the 'vid_listmodes' cmd. */ -void +static void VID_ListModes_f(void) { int i; @@ -264,7 +264,7 @@ VID_ListModes_f(void) /* * Returns informations about the given mode. */ -qboolean +static qboolean VID_GetModeInfo(int *width, int *height, int mode) { if ((mode < 0) || (mode >= VID_NUM_MODES)) @@ -341,7 +341,7 @@ VID_HasRenderer(const char *renderer) /* * Called by the renderer to request a restart. */ -void +static void VID_RequestRestart(ref_restart_t rs) { restart_state = rs; @@ -350,7 +350,7 @@ VID_RequestRestart(ref_restart_t rs) /* * Restarts the renderer. */ -void +static void VID_Restart_f(void) { if (restart_state == RESTART_UNDEF) @@ -364,7 +364,7 @@ VID_Restart_f(void) /* * Shuts the renderer down and unloads it. */ -void +static void VID_ShutdownRenderer(void) { if (ref_active) @@ -384,7 +384,7 @@ VID_ShutdownRenderer(void) /* * Loads and initializes a renderer. */ -qboolean +static qboolean VID_LoadRenderer(void) { refimport_t ri; diff --git a/src/common/cmdparser.c b/src/common/cmdparser.c index dcbc0dad..9997c48a 100644 --- a/src/common/cmdparser.c +++ b/src/common/cmdparser.c @@ -67,7 +67,7 @@ char defer_text_buf[32768]; * until next frame. This allows commands like: bind g "impulse 5 ; * +attack ; wait ; -attack ; impulse 2" */ -void +static void Cmd_Wait_f(void) { cmd_wait = Sys_Milliseconds(); @@ -85,7 +85,7 @@ Cbuf_Init(void) void Cbuf_AddText(char *text) { - int l; + size_t l; l = strlen(text); @@ -299,7 +299,7 @@ qboolean Cbuf_AddLateCommands(void) { int i, j; - int s; + size_t s; char *text, c; int argc; qboolean has_args = false; @@ -362,7 +362,7 @@ Cbuf_AddLateCommands(void) /* * Execute a script file */ -void +static void Cmd_Exec_f(void) { char *f, *f2; @@ -400,7 +400,9 @@ Cmd_Exec_f(void) /* * Inserts the current value of a variable as command text */ -void Cmd_Vstr_f( void ) { +static void +Cmd_Vstr_f(void) +{ const char *v; if (Cmd_Argc() != 2) { @@ -415,7 +417,7 @@ void Cmd_Vstr_f( void ) { /* * Just prints the rest of the line to the console */ -void +static void Cmd_Echo_f(void) { int i; @@ -432,7 +434,7 @@ Cmd_Echo_f(void) * Creates a new command that executes * a command string (possibly ; seperated) */ -void +static void Cmd_Alias_f(void) { cmdalias_t *a; @@ -524,10 +526,11 @@ Cmd_Args(void) return cmd_args; } -char * +static char * Cmd_MacroExpandString(char *text) { - int i, j, count, len; + size_t len; + int i, count; qboolean inquote; char *scan; static char expanded[MAX_STRING_CHARS]; @@ -549,6 +552,8 @@ Cmd_MacroExpandString(char *text) for (i = 0; i < len; i++) { + size_t j; + if (scan[i] == '"') { inquote ^= 1; @@ -783,7 +788,8 @@ char * Cmd_CompleteCommand(char *partial) { cmd_function_t *cmd; - int len, i, o, p; + size_t len; + int i, o, p; cmdalias_t *a; cvar_t *cvar; char *pmatch[1024]; @@ -907,13 +913,15 @@ char * Cmd_CompleteMapCommand(char *partial) { char **mapNames; - int i, j, k, nbMatches, len, nMaps; + int i, j, k, nbMatches, nMaps; char *mapName, *lastsep; char *pmatch[1024]; qboolean partialFillContinue = true; if ((mapNames = FS_ListFiles2("maps/*.bsp", &nMaps, 0, 0)) != NULL) { + size_t len; + len = strlen(partial); nbMatches = 0; memset(retval, 0, strlen(retval)); @@ -1094,7 +1102,7 @@ Cmd_ExecuteString(char *text) #endif } -void +static void Cmd_List_f(void) { cmd_function_t *cmd; diff --git a/src/common/collision.c b/src/common/collision.c index a8aa71c1..6534d8cc 100644 --- a/src/common/collision.c +++ b/src/common/collision.c @@ -1624,7 +1624,8 @@ CMod_LoadEntityString(const lump_t *l, const char *name) if (sv_entfile->value) { char *buffer = NULL, entname[256]; - int nameLen, bufLen = -1; + size_t nameLen; + int bufLen = -1; nameLen = strlen(name); if (strcmp(name + nameLen - 4, ".bsp") || nameLen > (MAX_QPATH - 1)) diff --git a/src/common/filesystem.c b/src/common/filesystem.c index ece3ba97..34e22708 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -1431,7 +1431,8 @@ Q_sort_modcmp(const void *p1, const void *p2) char** FS_ListMods(int *nummods) { - int nmods = 0, numdirchildren, numpacksinchilddir, searchpathlength; + int nmods = 0, numdirchildren, numpacksinchilddir; + size_t searchpathlength; char findnamepattern[MAX_OSPATH], modname[MAX_QPATH], searchpath[MAX_OSPATH]; char **dirchildren, **packsinchilddir, **modnames; diff --git a/src/common/frame.c b/src/common/frame.c index ce84cd12..901fdee5 100644 --- a/src/common/frame.c +++ b/src/common/frame.c @@ -117,7 +117,7 @@ static void Qcommon_Buildstring(void) { int i; - int verLen; + size_t verLen; const char* versionString; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 1f217986..d28e7b2b 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -211,7 +211,7 @@ ValidateSelectedItem(edict_t *ent) /* * Give items to a client */ -void +static void Cmd_Give_f(edict_t *ent) { char *name; @@ -423,7 +423,7 @@ Cmd_Give_f(edict_t *ent) /* * Sets client to godmode */ -void +static void Cmd_God_f(edict_t *ent) { char *msg; @@ -457,7 +457,7 @@ Cmd_God_f(edict_t *ent) /* * Sets client to notarget */ -void +static void Cmd_Notarget_f(edict_t *ent) { char *msg; @@ -491,7 +491,7 @@ Cmd_Notarget_f(edict_t *ent) /* * argv(0) noclip */ -void +static void Cmd_Noclip_f(edict_t *ent) { char *msg; @@ -525,7 +525,7 @@ Cmd_Noclip_f(edict_t *ent) /* * Use an inventory item */ -void +static void Cmd_Use_f(edict_t *ent) { int index; @@ -566,7 +566,7 @@ Cmd_Use_f(edict_t *ent) /* * Drop an inventory item */ -void +static void Cmd_Drop_f(edict_t *ent) { int index; @@ -661,7 +661,7 @@ Cmd_Help_f(edict_t *ent) gi.unicast(ent, true); } -void +static void Cmd_Inven_f(edict_t *ent) { gclient_t *cl; @@ -688,7 +688,7 @@ Cmd_Inven_f(edict_t *ent) gi.unicast(ent, true); } -void +static void Cmd_InvUse_f(edict_t *ent) { gitem_t *it; @@ -717,7 +717,7 @@ Cmd_InvUse_f(edict_t *ent) it->use(ent, it); } -void +static void Cmd_WeapPrev_f(edict_t *ent) { gclient_t *cl; @@ -779,7 +779,7 @@ Cmd_WeapPrev_f(edict_t *ent) } } -void +static void Cmd_WeapNext_f(edict_t *ent) { gclient_t *cl; @@ -841,7 +841,7 @@ Cmd_WeapNext_f(edict_t *ent) } } -void +static void Cmd_WeapLast_f(edict_t *ent) { gclient_t *cl; @@ -882,7 +882,7 @@ Cmd_WeapLast_f(edict_t *ent) it->use(ent, it); } -void +static void Cmd_InvDrop_f(edict_t *ent) { gitem_t *it; @@ -911,7 +911,7 @@ Cmd_InvDrop_f(edict_t *ent) it->drop(ent, it); } -void +static void Cmd_Kill_f(edict_t *ent) { if (!ent) @@ -931,7 +931,7 @@ Cmd_Kill_f(edict_t *ent) player_die(ent, ent, ent, 100000, vec3_origin); } -void +static void Cmd_PutAway_f(edict_t *ent) { if (!ent) @@ -973,7 +973,7 @@ PlayerSort(void const *a, void const *b) return 0; } -void +static void Cmd_Players_f(edict_t *ent) { int i; @@ -1023,7 +1023,7 @@ Cmd_Players_f(edict_t *ent) gi.cprintf(ent, PRINT_HIGH, "%s\n%i players\n", large, count); } -void +static void Cmd_Wave_f(edict_t *ent) { int i; @@ -1147,7 +1147,7 @@ flooded(edict_t *ent) return false; } -void +static void Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0) { int j; @@ -1242,7 +1242,7 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0) } } -void +static void Cmd_PlayerList_f(edict_t *ent) { int i; diff --git a/src/game/g_misc.c b/src/game/g_misc.c index f3e2b546..4d3a0110 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -2280,7 +2280,8 @@ void target_string_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { edict_t *e; - int n, l; + size_t l; + int n; char c; if (!self) diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 363459b4..cfbf52bc 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -327,7 +327,7 @@ char * ED_NewString(const char *string) { char *newb, *new_p; - int i, l; + size_t i, l; if (!string) { diff --git a/src/game/player/hud.c b/src/game/player/hud.c index 7786a216..78860a6a 100644 --- a/src/game/player/hud.c +++ b/src/game/player/hud.c @@ -218,7 +218,7 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer) { char entry[1024]; char string[1400]; - int stringlength; + size_t stringlength; int i; int sorted[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS]; @@ -279,7 +279,8 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer) for (i = 0; i < total; i++) { char *tag; - int x, y, j; + int x, y; + size_t j; gclient_t *cl; edict_t *cl_ent; diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c index 0f030f61..a593e980 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -370,7 +370,7 @@ void WriteField1(FILE *f, field_t *field, byte *base) { void *p; - int len; + size_t len; int index; functionList_t *func; mmoveList_t *mmove; @@ -492,7 +492,7 @@ WriteField1(FILE *f, field_t *field, byte *base) void WriteField2(FILE *f, field_t *field, byte *base) { - int len; + size_t len; void *p; functionList_t *func; mmoveList_t *mmove; diff --git a/src/game/savegame/tables/gamefunc_decs.h b/src/game/savegame/tables/gamefunc_decs.h index 32e1e035..674acaae 100644 --- a/src/game/savegame/tables/gamefunc_decs.h +++ b/src/game/savegame/tables/gamefunc_decs.h @@ -1013,27 +1013,9 @@ extern void SpawnDamage ( int type , vec3_t origin , vec3_t normal ) ; extern void Killed ( edict_t * targ , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern qboolean CanDamage ( edict_t * targ , edict_t * inflictor ) ; extern void ClientCommand ( edict_t * ent ) ; -extern void Cmd_PlayerList_f ( edict_t * ent ) ; -extern void Cmd_Say_f ( edict_t * ent , qboolean team , qboolean arg0 ) ; -extern void Cmd_Wave_f ( edict_t * ent ) ; -extern void Cmd_Players_f ( edict_t * ent ) ; extern int PlayerSort ( void const * a , void const * b ) ; -extern void Cmd_PutAway_f ( edict_t * ent ) ; -extern void Cmd_Kill_f ( edict_t * ent ) ; -extern void Cmd_InvDrop_f ( edict_t * ent ) ; -extern void Cmd_WeapLast_f ( edict_t * ent ) ; -extern void Cmd_WeapNext_f ( edict_t * ent ) ; -extern void Cmd_WeapPrev_f ( edict_t * ent ) ; -extern void Cmd_InvUse_f ( edict_t * ent ) ; -extern void Cmd_Inven_f ( edict_t * ent ) ; extern void Cmd_Help_f ( edict_t * ent ) ; extern void Cmd_Score_f ( edict_t * ent ) ; -extern void Cmd_Drop_f ( edict_t * ent ) ; -extern void Cmd_Use_f ( edict_t * ent ) ; -extern void Cmd_Noclip_f ( edict_t * ent ) ; -extern void Cmd_Notarget_f ( edict_t * ent ) ; -extern void Cmd_God_f ( edict_t * ent ) ; -extern void Cmd_Give_f ( edict_t * ent ) ; extern void ValidateSelectedItem ( edict_t * ent ) ; extern void SelectPrevItem ( edict_t * ent , int itflags ) ; extern void SelectNextItem ( edict_t * ent , int itflags ) ; diff --git a/src/game/savegame/tables/gamefunc_list.h b/src/game/savegame/tables/gamefunc_list.h index 42b20eb5..4688d2b5 100644 --- a/src/game/savegame/tables/gamefunc_list.h +++ b/src/game/savegame/tables/gamefunc_list.h @@ -1012,27 +1012,9 @@ {"Killed", (byte *)Killed}, {"CanDamage", (byte *)CanDamage}, {"ClientCommand", (byte *)ClientCommand}, -{"Cmd_PlayerList_f", (byte *)Cmd_PlayerList_f}, -{"Cmd_Say_f", (byte *)Cmd_Say_f}, -{"Cmd_Wave_f", (byte *)Cmd_Wave_f}, -{"Cmd_Players_f", (byte *)Cmd_Players_f}, {"PlayerSort", (byte *)PlayerSort}, -{"Cmd_PutAway_f", (byte *)Cmd_PutAway_f}, -{"Cmd_Kill_f", (byte *)Cmd_Kill_f}, -{"Cmd_InvDrop_f", (byte *)Cmd_InvDrop_f}, -{"Cmd_WeapLast_f", (byte *)Cmd_WeapLast_f}, -{"Cmd_WeapNext_f", (byte *)Cmd_WeapNext_f}, -{"Cmd_WeapPrev_f", (byte *)Cmd_WeapPrev_f}, -{"Cmd_InvUse_f", (byte *)Cmd_InvUse_f}, -{"Cmd_Inven_f", (byte *)Cmd_Inven_f}, {"Cmd_Help_f", (byte *)Cmd_Help_f}, {"Cmd_Score_f", (byte *)Cmd_Score_f}, -{"Cmd_Drop_f", (byte *)Cmd_Drop_f}, -{"Cmd_Use_f", (byte *)Cmd_Use_f}, -{"Cmd_Noclip_f", (byte *)Cmd_Noclip_f}, -{"Cmd_Notarget_f", (byte *)Cmd_Notarget_f}, -{"Cmd_God_f", (byte *)Cmd_God_f}, -{"Cmd_Give_f", (byte *)Cmd_Give_f}, {"ValidateSelectedItem", (byte *)ValidateSelectedItem}, {"SelectPrevItem", (byte *)SelectPrevItem}, {"SelectNextItem", (byte *)SelectNextItem}, diff --git a/src/server/sv_cmd.c b/src/server/sv_cmd.c index e44c8c24..01f716fe 100644 --- a/src/server/sv_cmd.c +++ b/src/server/sv_cmd.c @@ -381,7 +381,8 @@ SV_Kick_f(void) void SV_Status_f(void) { - int i, j, l; + int i, j; + size_t l; client_t *cl; char *s; int ping; diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 3ba3a55c..4c268954 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -492,7 +492,7 @@ SV_Map(qboolean attractloop, char *levelstring, qboolean loadgame, qboolean isau { char level[MAX_QPATH]; char *ch; - int l; + size_t l; char spawnpoint[MAX_QPATH]; sv.loadgame = loadgame;