]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix clang-analyzer false positives.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Mar 2015 17:30:20 +0000 (17:30 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Mar 2015 17:30:20 +0000 (17:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12187 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
model_shared.c
prvm_edict.c

index 7e15123c133df5b2f088ab58ed836057818ee428..66c17e170636bca59e87e7e3aa27aca104d497cf 100644 (file)
@@ -1957,10 +1957,12 @@ void SHOWLMP_decodeshow(void)
                showlmp_t *oldshowlmps = cl.showlmps;
                cl.max_showlmps += 16;
                cl.showlmps = (showlmp_t *) Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
-               if (cl.num_showlmps)
-                       memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
                if (oldshowlmps)
+               {
+                       if (cl.num_showlmps)
+                               memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
                        Mem_Free(oldshowlmps);
+               }
        }
        for (k = 0;k < cl.max_showlmps;k++)
                if (cl.showlmps[k].isactive && !strcmp(cl.showlmps[k].label, lmplabel))
index ec6a94abc1e5468edf5e06fa024984b961e9a070..c1bd882ffad173d045c68434a171fb42d35bd5a2 100644 (file)
@@ -1578,7 +1578,7 @@ static void Q3Shader_AddToHash (q3shaderinfo_t* shader)
        unsigned short hash = CRC_Block_CaseInsensitive ((const unsigned char *)shader->name, strlen (shader->name));
        q3shader_hash_entry_t* entry = q3shader_data->hash + (hash % Q3SHADER_HASH_SIZE);
        q3shader_hash_entry_t* lastEntry = NULL;
-       while (entry != NULL)
+       do
        {
                if (strcasecmp (entry->shader.name, shader->name) == 0)
                {
@@ -1611,6 +1611,7 @@ static void Q3Shader_AddToHash (q3shaderinfo_t* shader)
                lastEntry = entry;
                entry = entry->chain;
        }
+       while (entry != NULL);
        if (entry == NULL)
        {
                if (lastEntry->shader.name[0] != 0)
index 31557d21f82de8d3cbb1338638bfba8e37d40766..bc6c5ad53efa731413ba8ad91ddd4dc239801741 100644 (file)
@@ -3087,10 +3087,12 @@ int PRVM_SetTempString(prvm_prog_t *prog, const char *s)
                {
                        Con_DPrintf("PRVM_SetTempString: enlarging tempstrings buffer (%iKB -> %iKB)\n", old.maxsize/1024, prog->tempstringsbuf.maxsize/1024);
                        prog->tempstringsbuf.data = (unsigned char *) Mem_Alloc(prog->progs_mempool, prog->tempstringsbuf.maxsize);
-                       if (old.cursize)
-                               memcpy(prog->tempstringsbuf.data, old.data, old.cursize);
                        if (old.data)
+                       {
+                               if (old.cursize)
+                                       memcpy(prog->tempstringsbuf.data, old.data, old.cursize);
                                Mem_Free(old.data);
+                       }
                }
        }
        t = (char *)prog->tempstringsbuf.data + prog->tempstringsbuf.cursize;