Skip to content

Commit

Permalink
Fixed handful of uninitialized assignments shown up by static analysi…
Browse files Browse the repository at this point in the history
…s. Thanks for the report yagisan.

All but two of these were innoxious however as they are not read after the fact. The rest of the issues are false positives due to the logic flow algorithm used by the analysis tool being unaware that execution stops after a call to Con_Error, which never returns.

We should consider enhancing Con_Error so as to allow the analysis tool(s) to detect the termination of the logic flow.
  • Loading branch information
danij-deng committed Aug 10, 2010
1 parent bcc4bfb commit 0e009bb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/gl_drawcompositefont.c
Expand Up @@ -1051,7 +1051,7 @@ void GL_DrawTextFragment7(const char* string, int x, int y, compositefontid_t fo
flashMul = 0;

shadow = (noShadow? 0 : shadowStrength);
shadowMul = origColor[CA];
shadowMul = (noShadow? 0 : origColor[CA]);

if(!(noTypein && noShadow && noGlitter))
glColor4fv(origColor);
Expand Down Expand Up @@ -1124,7 +1124,7 @@ void GL_DrawTextFragment7(const char* string, int x, int y, compositefontid_t fo
// The character itself.
GL_DrawChar2(c, cx, cy + yoff, fontId);

if(flash > 0)
if(!noGlitter && flash > 0)
{ // Do something flashy.
glColor4f(flashColor[CR], flashColor[CG], flashColor[CB], flash * flashMul);
drawFlash(cx, cy + yoff, w, h, true);
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/portable/src/p_particle.c
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2010 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2006-2007 Jamie Jones <jamie_jones_au@yahoo.com.au>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -24,7 +24,7 @@
*/

/**
* p_particle.c: Particle Generator Management
* Particle Generator Management
*/

// HEADER FILES ------------------------------------------------------------
Expand Down Expand Up @@ -675,8 +675,8 @@ static void P_NewParticle(ptcgen_t* gen)
if(mf &&
(mf->sub[0].flags & MFF_PARTICLE_SUB1 || def->subModel >= 0))
{
int subidx;
float off[3];
float off[3] = { 0, 0, 0 };
int subidx;

// Select the right submodel to use as the origin.
if(def->subModel >= 0)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/r_things.c
Expand Up @@ -25,7 +25,7 @@
*/

/**
* r_things.c: Object Management and Refresh
* Object Management and Refresh.
*/

/**
Expand Down Expand Up @@ -1122,7 +1122,7 @@ void R_ProjectSprite(mobj_t* mo)
{
sector_t* sect = mo->subsector->sector;
float thangle = 0, alpha, floorClip, secFloor, secCeil;
float pos[2], yaw, pitch;
float pos[2], yaw = 0, pitch = 0;
vec3_t visOff;
spritedef_t* sprDef;
spriteframe_t* sprFrame = NULL;
Expand Down
11 changes: 2 additions & 9 deletions doomsday/plugins/common/src/hu_inventory.c
Expand Up @@ -24,7 +24,7 @@
*/

/**
* hu_inventory.c: Heads-up display(s) for the player inventory.
* Heads-up display(s) for the player inventory.
*/

#if defined(__JHERETIC__) || defined(__JHEXEN__)
Expand Down Expand Up @@ -244,14 +244,7 @@ static void inventoryIndexes(const player_t* plr, const hud_inventory_t* inv,
}
else
{
int last;

from = cursor - inv->selected;
if(from < 0)
from = 0;

last = inv->numUsedSlots - 1 -
(inv->selected + cursor);
from = MAX_OF(0, cursor - (unsigned)inv->selected);
to = maxVisSlots;
}
}
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/src/p_start.c
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1999 Activision
*\author Copyright © 1993-1996 by id Software, Inc.
*
Expand All @@ -25,7 +25,7 @@
*/

/**
* p_start.c
* Common player (re)spawning logic.
*/

// HEADER FILES ------------------------------------------------------------
Expand Down Expand Up @@ -609,7 +609,7 @@ void P_RebornPlayer(int plrNum)
float pos[3];
angle_t angle;
int spawnFlags;
boolean makeCamera;
boolean makeCamera = false;

if(plrNum < 0 || plrNum >= MAXPLAYERS)
return; // Wha?
Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/common/src/p_xgsec.c
Expand Up @@ -2050,6 +2050,11 @@ int C_DECL XSTrav_SectorLight(sector_t* sector, boolean ceiling,

if(sector)
P_GetFloatpv(sector, DMU_COLOR, usergb);
else
{
XG_Dev("XSTrav_SectorLight: Warning, the referenced LineDef has no back sector. Using default color.");
memset(usergb, 0, sizeof(usergb));
}
break;
}
case LIGHTREF_ORIGINAL:
Expand Down

0 comments on commit 0e009bb

Please sign in to comment.