[quake3-commits] r2247 - in trunk/code: cgame ui

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon May 7 18:47:19 EDT 2012


Author: ztm
Date: 2012-05-07 18:47:19 -0400 (Mon, 07 May 2012)
New Revision: 2247

Modified:
   trunk/code/cgame/cg_weapons.c
   trunk/code/ui/ui_shared.c
Log:
Fixed two issues pointed out in a PVS-Studio static code analyzer article (bug #5505).

Modified: trunk/code/cgame/cg_weapons.c
===================================================================
--- trunk/code/cgame/cg_weapons.c	2012-05-07 22:26:03 UTC (rev 2246)
+++ trunk/code/cgame/cg_weapons.c	2012-05-07 22:47:19 UTC (rev 2247)
@@ -842,7 +842,7 @@
 
 	item = &bg_itemlist[ itemNum ];
 
-	memset( itemInfo, 0, sizeof( &itemInfo ) );
+	memset( itemInfo, 0, sizeof( *itemInfo ) );
 	itemInfo->registered = qtrue;
 
 	itemInfo->models[0] = trap_R_RegisterModel( item->world_model[0] );

Modified: trunk/code/ui/ui_shared.c
===================================================================
--- trunk/code/ui/ui_shared.c	2012-05-07 22:26:03 UTC (rev 2246)
+++ trunk/code/ui/ui_shared.c	2012-05-07 22:47:19 UTC (rev 2247)
@@ -3831,7 +3831,8 @@
 
 void Item_Paint(itemDef_t *item) {
   vec4_t red;
-  menuDef_t *parent = (menuDef_t*)item->parent;
+  menuDef_t *parent;
+
   red[0] = red[3] = 1;
   red[1] = red[2] = 0;
 
@@ -3839,6 +3840,8 @@
     return;
   }
 
+  parent = (menuDef_t*)item->parent;
+
   if (item->window.flags & WINDOW_ORBITING) {
     if (DC->realTime > item->window.nextTime) {
       float rx, ry, a, c, s, w, h;



More information about the quake3-commits mailing list