From: havoc Date: Sat, 19 Dec 2020 10:15:44 +0000 (+0000) Subject: Fix a few warnings in VS2019. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b49b978aa7e5f734a083abc02110b1e8c5682c26;p=xonotic%2Fdarkplaces.git Fix a few warnings in VS2019. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13071 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/console.c b/console.c index ad20495c..219a68d7 100644 --- a/console.c +++ b/console.c @@ -1526,7 +1526,7 @@ Modified by EvilTypeGuy eviltypeguy@qeradiant.com */ static void Con_DrawInput(qbool is_console, float x, float v, float inputsize) { - int y, i, col_out, linepos, text_start, prefix_start; + int y, i, col_out, linepos, text_start, prefix_start = 0; char text[MAX_INPUTLINE + 5 + 9 + 1]; // space for ^xRGB, "say_team:" and \0 float xo; size_t len_out; diff --git a/sv_ccmds.c b/sv_ccmds.c index d9e08c04..b995ff7a 100644 --- a/sv_ccmds.c +++ b/sv_ccmds.c @@ -1411,7 +1411,6 @@ static void SV_Ent_Create_f(cmd_state_t *cmd) int i; qbool haveorigin; - qbool expectval = false; void (*print)(const char *, ...) = (cmd->source == src_client ? SV_ClientPrintf : Con_Printf); if(!Cmd_Argc(cmd)) @@ -1450,31 +1449,24 @@ static void SV_Ent_Create_f(cmd_state_t *cmd) } // Allow more than one key/value pair by cycling between expecting either one. - for(i = 2; i < Cmd_Argc(cmd); i++) + for(i = 2; i < Cmd_Argc(cmd); i += 2) { - if(!expectval) + if(!(key = PRVM_ED_FindField(prog, Cmd_Argv(cmd, i)))) { - if(!(key = PRVM_ED_FindField(prog, Cmd_Argv(cmd, i)))) - { - print("Key %s not found!\n", Cmd_Argv(cmd, i)); - PRVM_ED_Free(prog, ed); - return; - } + print("Key %s not found!\n", Cmd_Argv(cmd, i)); + PRVM_ED_Free(prog, ed); + return; + } - /* - * This is mostly for dedicated server console, but if the - * player gave a custom origin, we can ignore the traceline. - */ - if(!strcmp(Cmd_Argv(cmd, i), "origin")) - haveorigin = true; + /* + * This is mostly for dedicated server console, but if the + * player gave a custom origin, we can ignore the traceline. + */ + if(!strcmp(Cmd_Argv(cmd, i), "origin")) + haveorigin = true; - expectval = true; - } - else - { - PRVM_ED_ParseEpair(prog, ed, key, Cmd_Argv(cmd, i), false); - expectval = false; - } + if (i + 1 < Cmd_Argc(cmd)) + PRVM_ED_ParseEpair(prog, ed, key, Cmd_Argv(cmd, i+1), false); } if(!haveorigin) @@ -1509,7 +1501,7 @@ static void SV_Ent_Remove_f(cmd_state_t *cmd) { prvm_prog_t *prog = SVVM_prog; prvm_edict_t *ed; - int i, ednum; + int i, ednum = 0; void (*print)(const char *, ...) = (cmd->source == src_client ? SV_ClientPrintf : Con_Printf); if(!Cmd_Argc(cmd)) diff --git a/zone.c b/zone.c index 8657a476..b357a013 100644 --- a/zone.c +++ b/zone.c @@ -201,14 +201,14 @@ static void *Clump_AllocBlock(size_t size) #if MEMCLUMPING if (size <= MEMCLUMPSIZE) { - int index; - unsigned int bit; - unsigned int needbits; - unsigned int startbit; - unsigned int endbit; - unsigned int needints; - int startindex; - int endindex; + intptr_t index; + size_t bit; + size_t needbits; + size_t startbit; + size_t endbit; + size_t needints; + intptr_t startindex; + intptr_t endindex; unsigned int value; unsigned int mask; unsigned int *array; @@ -312,10 +312,10 @@ nofreeblock: static void Clump_FreeBlock(void *base, size_t size) { #if MEMCLUMPING - unsigned int needbits; - unsigned int startbit; - unsigned int endbit; - unsigned int bit; + size_t needbits; + size_t startbit; + size_t endbit; + size_t bit; memclump_t **clumpchainpointer; memclump_t *clump; unsigned char *start = (unsigned char *)base;