add static for local function and use size_t with string length

This commit is contained in:
Denis Pauk 2024-12-19 23:22:12 +02:00
parent 8f0906704a
commit 91103f907b
34 changed files with 175 additions and 149 deletions

View file

@ -147,7 +147,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];

View file

@ -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;

View file

@ -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;

View file

@ -269,7 +269,7 @@ keyname_t keynames[] = {
/* ------------------------------------------------------------------ */
void
static void
CompleteCommand(void)
{
const char *cmd, *s;
@ -300,7 +300,7 @@ CompleteCommand(void)
key_lines[edit_line][key_linepos] = '\0';
}
void
static void
CompleteMapNameCommand(void)
{
const char *s, *cmdArg;
@ -338,7 +338,7 @@ IsInConsole(void)
(cls.state == ca_disconnected || cls.state == ca_connecting));
}
void
static void
Key_Console(int key)
{
char txt[2];
@ -606,7 +606,7 @@ char chat_buffer[MAXCMDLINE];
int chat_bufferlen = 0;
int chat_cursorpos = 0;
void
static void
Key_Message(int key)
{
char last;
@ -734,7 +734,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;
@ -821,7 +821,7 @@ Key_SetBinding(int keynum, char *binding)
keybindings[keynum] = new;
}
void
static void
Key_Unbind_f(void)
{
int b;
@ -843,7 +843,7 @@ Key_Unbind_f(void)
Key_SetBinding(b, "");
}
void
static void
Key_Unbindall_f(void)
{
int i;
@ -861,7 +861,7 @@ Key_Unbindall_f(void)
* (=> default.cfg is done) */
extern qboolean doneWithDefaultCfg;
void
static void
Key_Bind_f(void)
{
int i, c, b;
@ -1048,7 +1048,7 @@ Key_ReadConsoleHistory()
fclose(f);
}
void
static void
Key_Bindlist_f(void)
{
int i;

View file

@ -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;
@ -599,6 +600,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);

View file

@ -107,7 +107,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;
@ -374,7 +374,7 @@ void
CL_Packet_f(void)
{
char send[2048];
int i, l;
size_t i, l;
char *in, *out;
netadr_t adr;
@ -563,7 +563,7 @@ CL_PingServers_f(void)
/*
* Responses to broadcasts, etc
*/
void
static void
CL_ConnectionlessPacket(void)
{
char *s;

View file

@ -776,7 +776,7 @@ CL_FireEntityEvents(frame_t *frame)
}
}
void
static void
SHOWNET(char *s)
{
if (cl_shownet->value >= 2)
@ -1207,7 +1207,7 @@ CL_ParseClientinfo(int player)
static void
CL_ParseConfigString(void)
{
int i, length;
size_t i, length;
char *s;
char olds[MAX_QPATH];

View file

@ -2036,6 +2036,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)
{
@ -2043,8 +2046,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);

View file

@ -767,7 +767,7 @@ M_Main_Draw(void)
( int )(cls.realtime / 100) % NUM_CURSOR_FRAMES);
}
const char *
static const char *
M_Main_Key(int key)
{
return Default_MenuKey(&s_main, key);
@ -1543,7 +1543,7 @@ DrawControllerAltButtonBindingFunc(void *self)
}
else
{
int x;
size_t x;
const char *name;
name = Key_KeynumToString(keys[0]);
@ -3377,7 +3377,7 @@ ModsFunc(void *unused)
M_Menu_Mods_f();
}
void
static void
Game_MenuInit(void)
{
Mods_NamesInit();
@ -4392,7 +4392,7 @@ StartServer_MenuInit(void)
char shortname[MAX_TOKEN_CHARS];
char longname[MAX_TOKEN_CHARS];
char scratch[200];
int j, l;
size_t j, l;
strcpy(shortname, COM_Parse(&s));
l = strlen(shortname);
@ -5055,7 +5055,7 @@ DMOptions_MenuDraw(void)
Menu_Draw(&s_dmoptions_menu);
}
const char *
static const char *
DMOptions_MenuKey(int key)
{
return Default_MenuKey(&s_dmoptions_menu, key);
@ -5287,7 +5287,7 @@ AddressBook_MenuInit(void)
}
}
const char *
static const char *
AddressBook_MenuKey(int key)
{
if (key == K_ESCAPE)
@ -5412,7 +5412,7 @@ IconOfSkinExists(const char* skin, char** pcxfiles, int npcxfiles,
static void
StripExtension(char* path)
{
int length;
size_t length;
length = strlen(path) - 1;
@ -5695,7 +5695,8 @@ HasSkinsInDir(const char *dirname, int *num)
{
char **list_png, **list_pcx, **list_m8;
char **curr = NULL, **list = NULL;
int num_png, num_pcx, num_m8, dirname_size;
int num_png, num_pcx, num_m8;
size_t dirname_size;
*num = 0;
/* dir name size plus one for skip slash */
@ -5987,7 +5988,8 @@ PlayerConfig_ScanDirectories(void)
return result;
}
void ListModels_f(void)
static void
ListModels_f(void)
{
PlayerConfig_ScanDirectories();

View file

@ -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;
@ -134,19 +135,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;

View file

@ -723,7 +723,7 @@ R_FindPic(const char *name, findimage_t find_image)
}
else
{
int len;
size_t len;
len = strlen(name);

View file

@ -176,7 +176,8 @@ RDraw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext
if (alttext && alttext[0])
{
/* Show alttext if provided */
int l, i;
size_t l;
int i;
l = strlen(alttext);
for (i = 0; i < l; i++)

View file

@ -471,7 +471,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 */
@ -537,7 +537,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)
{
@ -578,7 +578,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;
@ -603,7 +603,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)
{
@ -625,7 +625,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. :)
@ -661,7 +661,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;
@ -1144,7 +1144,8 @@ R_FindImage(const char *originname, imagetype_t type)
char namewe[256], name[256] = {0};
const char* ext;
image_t *image;
int i, len;
size_t len;
int i;
if (!originname)
{

View file

@ -224,7 +224,8 @@ GL3_Draw_PicScaled(int x, int y, const char *pic, float factor, const char *altt
if (alttext && alttext[0])
{
/* Show alttext if provided */
int l, i;
size_t l;
int i;
l = strlen(alttext);
for (i = 0; i < l; i++)

View file

@ -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;
@ -614,7 +614,8 @@ GL3_FindImage(const char *originname, imagetype_t type)
char namewe[256], name[256] = {0};
gl3image_t *image;
const char* ext;
int i, len;
size_t len;
int i;
if (!originname)
{

View file

@ -407,7 +407,8 @@ RE_Draw_PicScaled(int x, int y, const char *name, float scale, const char *altte
if (alttext && alttext[0])
{
/* Show alttext if provided */
int l, i;
size_t l;
int i;
l = strlen(alttext);
for (i = 0; i < l; i++)

View file

@ -553,7 +553,8 @@ R_FindImage(const char *originname, imagetype_t type)
char namewe[256], name[256] = {0};
const char* ext;
image_t *image;
int i, len;
size_t len;
int i;
if (!originname)
{

View file

@ -2194,7 +2194,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;

View file

@ -108,6 +108,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);

View file

@ -106,7 +106,7 @@ 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)
{
@ -248,7 +248,7 @@ vidmode_t vid_modes[] = {
/*
* Callback function for the 'vid_listmodes' cmd.
*/
void
static void
VID_ListModes_f(void)
{
int i;
@ -265,7 +265,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))
@ -342,7 +342,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;
@ -351,7 +351,7 @@ VID_RequestRestart(ref_restart_t rs)
/*
* Restarts the renderer.
*/
void
static void
VID_Restart_f(void)
{
if (restart_state == RESTART_UNDEF)
@ -365,7 +365,7 @@ VID_Restart_f(void)
/*
* Shuts the renderer down and unloads it.
*/
void
static void
VID_ShutdownRenderer(void)
{
if (ref_active)
@ -385,7 +385,7 @@ VID_ShutdownRenderer(void)
/*
* Loads and initializes a renderer.
*/
qboolean
static qboolean
VID_LoadRenderer(void)
{
refimport_t ri;

View file

@ -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(const 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];
@ -550,6 +553,8 @@ Cmd_MacroExpandString(char *text)
for (i = 0; i < len; i++)
{
size_t j;
if (scan[i] == '"')
{
inquote ^= 1;
@ -784,7 +789,8 @@ const char *
Cmd_CompleteCommand(const char *partial)
{
cmd_function_t *cmd;
int len, i, o, p;
size_t len;
int i, o, p;
cmdalias_t *a;
cvar_t *cvar;
const char *pmatch[1024];
@ -908,13 +914,15 @@ const char *
Cmd_CompleteMapCommand(const 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));
@ -1095,7 +1103,7 @@ Cmd_ExecuteString(char *text)
#endif
}
void
static void
Cmd_List_f(void)
{
cmd_function_t *cmd;

View file

@ -72,7 +72,7 @@ typedef struct
char name[MAX_QPATH];
unsigned checksum;
byte *cache; /* raw converted map */
int cache_size;
size_t cache_size;
cleaf_t *map_leafs;
int emptyleaf;
@ -1659,7 +1659,8 @@ CMod_LoadEntityString(const char *name, const char **map_entitystring, int *nume
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))
@ -1762,11 +1763,11 @@ CM_ModFreeAll(void)
static void
CM_LoadCachedMap(const char *name, model_t *mod)
{
int filelen, hunkSize;
size_t length, hunkSize;
byte *cmod_base, *filebuf;
maptype_t maptype;
dheader_t *header;
size_t length;
int filelen;
filelen = FS_LoadFile(name, (void **)&filebuf);
@ -1864,7 +1865,7 @@ CM_LoadCachedMap(const char *name, model_t *mod)
CMod_LoadEntityString(mod->name, &mod->map_entitystring, &mod->numentitychars,
mod->cache, &header->lumps[LUMP_ENTITIES]);
mod->extradatasize = Hunk_End();
Com_DPrintf("Allocated %d from expected %d hunk size\n",
Com_DPrintf("Allocated %d from expected " YQ2_COM_PRIdS " hunk size\n",
mod->extradatasize, hunkSize);
free(cmod_base);

View file

@ -1009,7 +1009,7 @@ FS_LoadDAT(const char *packPath)
ddatfile_t *info = NULL; /* DAT info. */
const char *prefixpos, *pos;
char prefix[MAX_QPATH];
int prefix_size;
size_t prefix_size;
handle = Q_fopen(packPath, "rb");
@ -1078,7 +1078,7 @@ FS_LoadDAT(const char *packPath)
/* Parse the directory. */
for (i = 0; i < numFiles; i++)
{
int name_len;
size_t name_len;
/* name */
memcpy(files[i].name, prefix, prefix_size);
@ -1111,7 +1111,7 @@ FS_LoadDAT(const char *packPath)
return pack;
}
fsPack_t *
static fsPack_t *
FS_LoadSIN(const char *packPath)
{
int i; /* Loop counter. */
@ -1910,7 +1910,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;

View file

@ -117,7 +117,7 @@ static void
Qcommon_Buildstring(void)
{
int i;
int verLen;
size_t verLen;
const char* versionString;

View file

@ -185,7 +185,7 @@ Mod_Load2QBSP_IBSP_CopyLong(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
int *in, *out;
count = lumps[inlumppos].filelen / rule_size;
@ -207,7 +207,7 @@ Mod_Load2QBSP_IBSP_PLANES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dplane_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dplane_t *)(inbuf + lumps[inlumppos].fileofs);
@ -236,7 +236,7 @@ Mod_Load2QBSP_IBSP_VERTEXES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dvertex_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dvertex_t *)(inbuf + lumps[inlumppos].fileofs);
@ -263,7 +263,7 @@ Mod_Load2QBSP_IBSP_NODES(byte *outbuf, dheader_t *outheader,
{
dqnode_t *out;
dnode_t *in;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dnode_t *)(inbuf + lumps[inlumppos].fileofs);
@ -299,7 +299,7 @@ Mod_Load2QBSP_QBSP_NODES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dqnode_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dqnode_t *)(inbuf + lumps[inlumppos].fileofs);
@ -330,9 +330,9 @@ Mod_Load2QBSP_QBSP_NODES(byte *outbuf, dheader_t *outheader,
}
static void
Mod_Load2QBSP_MATERIALS_TEXINFO(xtexinfo_t *out, int count)
Mod_Load2QBSP_MATERIALS_TEXINFO(xtexinfo_t *out, size_t count)
{
int i;
size_t i;
for (i = 0; i < count; i++)
{
@ -369,7 +369,7 @@ Mod_Load2QBSP_IBSP_TEXINFO(byte *outbuf, dheader_t *outheader,
{
texinfo_t *in;
xtexinfo_t *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (texinfo_t *)(inbuf + lumps[inlumppos].fileofs);
@ -411,7 +411,7 @@ Mod_Load2QBSP_RBSP_TEXINFO(byte *outbuf, dheader_t *outheader,
{
texrinfo_t *in;
xtexinfo_t *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (texrinfo_t *)(inbuf + lumps[inlumppos].fileofs);
@ -451,7 +451,7 @@ Mod_Load2QBSP_IBSP_FACES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
dface_t *in;
dqface_t *out;
@ -479,7 +479,7 @@ Mod_Load2QBSP_RBSP_FACES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
drface_t *in;
dqface_t *out;
@ -507,7 +507,7 @@ Mod_Load2QBSP_QBSP_FACES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
dqface_t *in;
dqface_t *out;
@ -535,7 +535,7 @@ Mod_Load2QBSP_IBSP_LEAFS(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
dleaf_t *in;
dqleaf_t *out;
@ -573,7 +573,7 @@ Mod_Load2QBSP_DKBSP_LEAFS(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
ddkleaf_t *in;
dqleaf_t *out;
@ -611,7 +611,7 @@ Mod_Load2QBSP_QBSP_LEAFS(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
dqleaf_t *in;
dqleaf_t *out;
@ -649,7 +649,7 @@ Mod_Load2QBSP_IBSP_LEAFFACES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
short *in;
int *out;
@ -671,7 +671,7 @@ Mod_Load2QBSP_QBSP_LEAFFACES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
int *in, *out;
count = lumps[inlumppos].filelen / rule_size;
@ -692,7 +692,7 @@ Mod_Load2QBSP_IBSP_LEAFBRUSHES(byte *outbuf, dheader_t *outheader,
const byte *inbuf, const lump_t *lumps, size_t rule_size,
maptype_t maptype, int outlumppos, int inlumppos)
{
int i, count;
size_t i, count;
short *in;
int *out;
@ -716,7 +716,7 @@ Mod_Load2QBSP_IBSP_EDGES(byte *outbuf, dheader_t *outheader,
{
dedge_t *in;
dqedge_t *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dedge_t *)(inbuf + lumps[inlumppos].fileofs);
@ -738,7 +738,7 @@ Mod_Load2QBSP_QBSP_EDGES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dqedge_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dqedge_t *)(inbuf + lumps[inlumppos].fileofs);
@ -760,7 +760,7 @@ Mod_Load2QBSP_IBSP_MODELS(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dmodel_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dmodel_t *)(inbuf + lumps[inlumppos].fileofs);
@ -792,7 +792,7 @@ Mod_Load2QBSP_IBSP_BRUSHES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dbrush_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dbrush_t *)(inbuf + lumps[inlumppos].fileofs);
@ -816,7 +816,7 @@ Mod_Load2QBSP_IBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader,
{
dbrushside_t *in;
dqbrushside_t *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dbrushside_t *)(inbuf + lumps[inlumppos].fileofs);
@ -839,7 +839,7 @@ Mod_Load2QBSP_RBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader,
{
drbrushside_t *in;
dqbrushside_t *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (drbrushside_t *)(inbuf + lumps[inlumppos].fileofs);
@ -861,7 +861,7 @@ Mod_Load2QBSP_QBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
dqbrushside_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (dqbrushside_t *)(inbuf + lumps[inlumppos].fileofs);
@ -883,7 +883,7 @@ Mod_Load2QBSP_IBSP_AREAS(byte *outbuf, dheader_t *outheader,
maptype_t maptype, int outlumppos, int inlumppos)
{
darea_t *in, *out;
int i, count;
size_t i, count;
count = lumps[inlumppos].filelen / rule_size;
in = (darea_t *)(inbuf + lumps[inlumppos].fileofs);
@ -1111,12 +1111,13 @@ Mod_Load2QBSP(const char *name, byte *inbuf, size_t filesize, size_t *out_len,
size_t result_size;
dheader_t *outheader;
lump_t *lumps;
int s, xofs, numlumps, numrules;
int s, numlumps, numrules;
qboolean error = false;
byte *outbuf;
maptype_t detected_maptype;
int ident, version;
int *inlumps;
size_t ofs, xofs;
ident = LittleLong(((int *)inbuf)[0]);
version = LittleLong(((int *)inbuf)[1]);
@ -1215,11 +1216,17 @@ Mod_Load2QBSP(const char *name, byte *inbuf, size_t filesize, size_t *out_len,
}
outbuf = malloc(result_size);
if (!outbuf)
{
Com_Error(ERR_DROP, "%s: Map %s is huge",
__func__, name);
}
outheader = (dheader_t*)outbuf;
memset(outheader, 0, sizeof(dheader_t));
outheader->ident = QBSPHEADER;
outheader->version = BSPVERSION;
int ofs = sizeof(dheader_t);
ofs = sizeof(dheader_t);
/* mark offsets for all lumps */
for (s = 0; s < numrules; s++)

View file

@ -371,8 +371,8 @@ Mod_LoadFile(const char *name, void **buffer)
{
char namewe[256];
const char* ext;
int filesize, len;
size_t tlen;
int filesize;
size_t tlen, len;
if (!name)
{

View file

@ -224,7 +224,7 @@ ValidateSelectedItem(edict_t *ent)
/*
* Give items to a client
*/
void
static void
Cmd_Give_f(edict_t *ent)
{
char *name;
@ -454,7 +454,7 @@ Cmd_Give_f(edict_t *ent)
/*
* Sets client to godmode
*/
void
static void
Cmd_God_f(edict_t *ent)
{
char *msg;
@ -488,7 +488,7 @@ Cmd_God_f(edict_t *ent)
/*
* Sets client to notarget
*/
void
static void
Cmd_Notarget_f(edict_t *ent)
{
char *msg;
@ -522,7 +522,7 @@ Cmd_Notarget_f(edict_t *ent)
/*
* argv(0) noclip
*/
void
static void
Cmd_Noclip_f(edict_t *ent)
{
char *msg;
@ -556,7 +556,7 @@ Cmd_Noclip_f(edict_t *ent)
/*
* Use an inventory item
*/
void
static void
Cmd_Use_f(edict_t *ent)
{
int index;
@ -622,7 +622,7 @@ Cmd_Use_f(edict_t *ent)
/*
* Drop an inventory item
*/
void
static void
Cmd_Drop_f(edict_t *ent)
{
int index;
@ -761,7 +761,7 @@ Cmd_Help_f(edict_t *ent)
gi.unicast(ent, true);
}
void
static void
Cmd_Inven_f(edict_t *ent)
{
gclient_t *cl;
@ -801,7 +801,7 @@ Cmd_Inven_f(edict_t *ent)
gi.unicast(ent, true);
}
void
static void
Cmd_InvUse_f(edict_t *ent)
{
gitem_t *it;
@ -836,7 +836,7 @@ Cmd_InvUse_f(edict_t *ent)
it->use(ent, it);
}
void
static void
Cmd_WeapPrev_f(edict_t *ent)
{
gclient_t *cl;
@ -898,7 +898,7 @@ Cmd_WeapPrev_f(edict_t *ent)
}
}
void
static void
Cmd_WeapNext_f(edict_t *ent)
{
gclient_t *cl;
@ -960,7 +960,7 @@ Cmd_WeapNext_f(edict_t *ent)
}
}
void
static void
Cmd_WeapLast_f(edict_t *ent)
{
gclient_t *cl;
@ -1001,7 +1001,7 @@ Cmd_WeapLast_f(edict_t *ent)
it->use(ent, it);
}
void
static void
Cmd_InvDrop_f(edict_t *ent)
{
gitem_t *it;
@ -1030,7 +1030,7 @@ Cmd_InvDrop_f(edict_t *ent)
it->drop(ent, it);
}
void
static void
Cmd_Kill_f(edict_t *ent)
{
if (!ent)
@ -1068,7 +1068,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)
@ -1117,7 +1117,7 @@ PlayerSort(void const *a, void const *b)
return 0;
}
void
static void
Cmd_Players_f(edict_t *ent)
{
int i;
@ -1167,7 +1167,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;
@ -1291,7 +1291,7 @@ CheckFlood(edict_t *ent)
return false;
}
void
static void
Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
{
int j;
@ -1386,7 +1386,7 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
}
}
void
static void
Cmd_Ent_Count_f(edict_t *ent)
{
int x;
@ -1410,7 +1410,7 @@ Cmd_Ent_Count_f(edict_t *ent)
gi.dprintf("%d entites active\n", x);
}
void
static void
Cmd_PlayerList_f(edict_t *ent)
{
int i;
@ -1428,7 +1428,7 @@ Cmd_PlayerList_f(edict_t *ent)
for (i = 0, e2 = g_edicts + 1; i < maxclients->value; i++, e2++)
{
int text_len;
size_t text_len;
if (!e2->inuse)
{

View file

@ -2073,7 +2073,7 @@ CTFScoreboardMessage(edict_t *ent, edict_t *killer)
{
char entry[1024];
char string[1400];
int len;
size_t len;
int i, j, k, n;
int sorted[2][MAX_CLIENTS];
int sortedscores[2][MAX_CLIENTS];

View file

@ -2705,7 +2705,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)

View file

@ -99,7 +99,8 @@ DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
char model_path[MAX_QPATH * 3];
char *semicolon, *curr;
strncpy(model_path, data->model_path, sizeof(model_path));
Q_strlcpy(model_path, data->model_path,
Q_min(sizeof(model_path), sizeof(data->model_path)));
/* first model */
curr = model_path;
@ -414,7 +415,7 @@ char *
ED_NewString(const char *string, qboolean raw)
{
char *newb;
int l;
size_t l;
if (!string)
{

View file

@ -245,7 +245,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];
@ -312,7 +312,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;

View file

@ -402,7 +402,7 @@ static void
WriteField1(FILE *f, field_t *field, byte *base)
{
void *p;
int len;
size_t len;
int index;
functionList_t *func;
mmoveList_t *mmove;
@ -528,7 +528,7 @@ WriteField1(FILE *f, field_t *field, byte *base)
static void
WriteField2(FILE *f, field_t *field, byte *base)
{
int len;
size_t len;
void *p;
functionList_t *func;
mmoveList_t *mmove;

View file

@ -389,7 +389,8 @@ SV_Kick_f(void)
static void
SV_Status_f(void)
{
int i, j, l;
int i, j;
size_t l;
client_t *cl;
char *s;
int ping;

View file

@ -528,7 +528,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;