fix stuff found by cppcheck

almost 3000 lines of "errors" contained one actual memleak, one actually
unused variable and three actual ambiguous code parts

from cppcheck website: "The goal is to detect only real errors in the
 code (i.e. have zero false positives)." :)

thx for finding five problems in our code
This commit is contained in:
ac-stef
2017-06-17 12:40:35 +02:00
parent f33b9c0dba
commit 03e21b097d
8 changed files with 10 additions and 12 deletions
+1 -3
View File
@@ -956,7 +956,6 @@ bool preload_mapmodels(bool trydl)
void renderclient(playerent *d, const char *mdlname, const char *vwepname, int tex)
{
int varseed = (int)(size_t)d;
int anim = ANIM_IDLE|ANIM_LOOP;
float speed = 0.0;
vec o(d->o);
@@ -968,7 +967,6 @@ void renderclient(playerent *d, const char *mdlname, const char *vwepname, int t
loopv(bounceents) if(bounceents[i]->bouncetype==BT_GIB && bounceents[i]->owner==d) return;
d->pitch = 0.1f;
anim = ANIM_DEATH;
varseed += d->lastpain;
basetime = d->lastpain;
int t = lastmillis-d->lastpain;
if(t<0 || t>20000) return;
@@ -982,7 +980,7 @@ void renderclient(playerent *d, const char *mdlname, const char *vwepname, int t
}
else if(d->state==CS_EDITING) { anim = ANIM_JUMP|ANIM_END; }
else if(d->state==CS_LAGGED) { anim = ANIM_SALUTE|ANIM_LOOP|ANIM_TRANSLUCENT; }
else if(lastmillis-d->lastpain<300) { anim = d->crouching ? ANIM_CROUCH_PAIN : ANIM_PAIN; speed = 300.0f/4; varseed += d->lastpain; basetime = d->lastpain; }
else if(lastmillis-d->lastpain<300) { anim = d->crouching ? ANIM_CROUCH_PAIN : ANIM_PAIN; speed = 300.0f/4; basetime = d->lastpain; }
else if(d->weaponsel==d->lastattackweapon && lastmillis-d->lastaction<300 && d->lastpain < d->lastaction && !d->weaponsel->reloading && (d->weaponsel->type != GUN_GRENADE || ((grenades *)d->weaponsel)->cookingmillis))
{ anim = d->crouching ? ANIM_CROUCH_ATTACK : ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; }
else if(!d->onfloor && d->timeinair>50) { anim = (d->crouching ? ANIM_CROUCH_WALK : ANIM_JUMP)|ANIM_END; }