]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix a few compile warnings from clang
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 4 Jun 2020 17:32:19 +0000 (17:32 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 4 Jun 2020 17:32:19 +0000 (17:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12638 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
host_cmd.c
netconn.c
protocol.c
r_shadow.c
taskqueue.c

index c0c4eb42ff7d63df2f31cad2d17a7a6c5fc9f41d..61e6bae9d5e8db6a059fc368f121d7ed1008fa91 100644 (file)
--- 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;
 }
index a944a23074ef5b66e4da06d5180115563aa16ac8..280ce6a6f1c79e6dae8a8a9e3c0f51be45047190 100644 (file)
@@ -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;
 
index 5874e7f9c2ecc7974245b5b68b1a5e38841a379a..b7527d7480cf469a36470672cb0f62023378fa2a 100755 (executable)
--- 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)))
index bdeebdd5763cd16426131b3bea446bb372a87d14..0fa00971e62fec834a8c28914ecbfceb85f13f54 100644 (file)
@@ -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)
index 817aa1c182e53e2a2637472c3e36e5326dcf9ad0..6adc4ccca16410ba8deda911c9a89730c538c83e 100644 (file)
@@ -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;
index 06312cda5095370fb524e8c037e7e90bceab5a76..1ad3bb079967814646c161a76c7d7ba68d12c286 100644 (file)
@@ -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)