From: cloudwalk Date: Thu, 4 Jun 2020 17:32:19 +0000 (+0000) Subject: Fix a few compile warnings from clang X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a56a1e472c82d13cc8bae656f01d16e1ff5474e2;p=xonotic%2Fdarkplaces.git Fix a few compile warnings from clang git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12638 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/csprogs.c b/csprogs.c index c0c4eb42..61e6bae9 100644 --- a/csprogs.c +++ b/csprogs.c @@ -20,10 +20,10 @@ void CL_VM_PreventInformationLeaks(void) prvm_prog_t *prog = CLVM_prog; if(!cl.csqc_loaded) return; - CSQC_BEGIN - VM_ClearTraceGlobals(prog); - PRVM_clientglobalfloat(trace_networkentity) = 0; - CSQC_END +CSQC_BEGIN + VM_ClearTraceGlobals(prog); + PRVM_clientglobalfloat(trace_networkentity) = 0; +CSQC_END } //[515]: these are required funcs @@ -442,20 +442,20 @@ qboolean CL_VM_InputEvent (int eventtype, float x, float y) if(!cl.csqc_loaded) return false; - CSQC_BEGIN - if (!PRVM_clientfunction(CSQC_InputEvent)) - r = false; - else - { - PRVM_clientglobalfloat(time) = cl.time; - PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity]; - PRVM_G_FLOAT(OFS_PARM0) = eventtype; - PRVM_G_FLOAT(OFS_PARM1) = x; // key or x - PRVM_G_FLOAT(OFS_PARM2) = y; // ascii or y - prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_InputEvent), "QC function CSQC_InputEvent is missing"); - r = CSQC_RETURNVAL != 0; - } - CSQC_END +CSQC_BEGIN + if (!PRVM_clientfunction(CSQC_InputEvent)) + r = false; + else + { + PRVM_clientglobalfloat(time) = cl.time; + PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity]; + PRVM_G_FLOAT(OFS_PARM0) = eventtype; + PRVM_G_FLOAT(OFS_PARM1) = x; // key or x + PRVM_G_FLOAT(OFS_PARM2) = y; // ascii or y + prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_InputEvent), "QC function CSQC_InputEvent is missing"); + r = CSQC_RETURNVAL != 0; + } +CSQC_END return r; } @@ -1170,16 +1170,16 @@ void CL_VM_ShutDown (void) //Cvar_SetValueQuick(&csqc_progsize, -1); if(!cl.csqc_loaded) return; - CSQC_BEGIN - if (prog->loaded) - { - PRVM_clientglobalfloat(time) = cl.time; - PRVM_clientglobaledict(self) = 0; - if (PRVM_clientfunction(CSQC_Shutdown)) - prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Shutdown), "QC function CSQC_Shutdown is missing"); - } - PRVM_Prog_Reset(prog); - CSQC_END +CSQC_BEGIN + if (prog->loaded) + { + PRVM_clientglobalfloat(time) = cl.time; + PRVM_clientglobaledict(self) = 0; + if (PRVM_clientfunction(CSQC_Shutdown)) + prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Shutdown), "QC function CSQC_Shutdown is missing"); + } + PRVM_Prog_Reset(prog); +CSQC_END Con_DPrint("CSQC ^1unloaded\n"); cl.csqc_loaded = false; } diff --git a/host_cmd.c b/host_cmd.c index a944a230..280ce6a6 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -151,7 +151,7 @@ static void Host_Status_f(cmd_state_t *cmd) if(sv_status_privacy.integer && cmd->source != src_command) strlcpy(ip, client->netconnection ? "hidden" : "botclient", 48); else - strlcpy(ip, (client->netconnection && client->netconnection->address) ? client->netconnection->address : "botclient", 48); + strlcpy(ip, (client->netconnection && *client->netconnection->address) ? client->netconnection->address : "botclient", 48); frags = client->frags; diff --git a/netconn.c b/netconn.c index 5874e7f9..b7527d74 100755 --- a/netconn.c +++ b/netconn.c @@ -2746,7 +2746,7 @@ static qboolean hmac_mdfour_time_matching(lhnetaddress_t *peeraddress, const cha t1 = (long) time(NULL); t2 = strtol(s, NULL, 0); - if(abs(t1 - t2) > rcon_secure_maxdiff.integer) + if(labs(t1 - t2) > rcon_secure_maxdiff.integer) return false; if(!HMAC_MDFOUR_16BYTES((unsigned char *) mdfourbuf, (unsigned char *) s, slen, (unsigned char *) password, (int)strlen(password))) diff --git a/protocol.c b/protocol.c index bdeebdd5..0fa00971 100644 --- a/protocol.c +++ b/protocol.c @@ -1700,10 +1700,12 @@ int EntityFrame4_AckFrame(entityframe4_database_t *d, int framenum, int servermo // reset reference, but leave commits alone d->referenceframenum = -1; for (i = 0;i < d->maxreferenceentities;i++) + { d->referenceentity[i] = defaultstate; // if this is the server, remove commits for (i = 0, commit = d->commit;i < MAX_ENTITY_HISTORY;i++, commit++) commit->numentities = 0; + } found = true; } else if (d->referenceframenum == framenum) diff --git a/r_shadow.c b/r_shadow.c index 817aa1c1..6adc4ccc 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -5419,7 +5419,7 @@ static void R_Shadow_EditLights_Edit_f(cmd_state_t *cmd) VectorCopy(r_shadow_selectedlight->color, color); radius = r_shadow_selectedlight->radius; style = r_shadow_selectedlight->style; - if (r_shadow_selectedlight->cubemapname) + if (*r_shadow_selectedlight->cubemapname) strlcpy(cubemapname, r_shadow_selectedlight->cubemapname, sizeof(cubemapname)); else cubemapname[0] = 0; @@ -5954,7 +5954,7 @@ static void R_Shadow_EditLights_CopyInfo_f(cmd_state_t *cmd) VectorCopy(r_shadow_selectedlight->color, r_shadow_bufferlight.color); r_shadow_bufferlight.radius = r_shadow_selectedlight->radius; r_shadow_bufferlight.style = r_shadow_selectedlight->style; - if (r_shadow_selectedlight->cubemapname) + if (*r_shadow_selectedlight->cubemapname) strlcpy(r_shadow_bufferlight.cubemapname, r_shadow_selectedlight->cubemapname, sizeof(r_shadow_bufferlight.cubemapname)); else r_shadow_bufferlight.cubemapname[0] = 0; diff --git a/taskqueue.c b/taskqueue.c index 06312cda..1ad3bb07 100644 --- a/taskqueue.c +++ b/taskqueue.c @@ -138,7 +138,7 @@ void TaskQueue_Yield(taskqueue_task_t *t) qboolean TaskQueue_IsDone(taskqueue_task_t *t) { - return !t->done != 0; + return !!t->done; } static void TaskQueue_DistributeTasks(void)