changeset 2196:628a0ad87136

Some more PVS error fixing
author Grumpy7
date Fri, 31 Jan 2014 00:37:26 +0100
parents 70b63fe6587c
children 42c8807225a2 f0477fe92362
files Level/Decoration.cpp Party.cpp Random.cpp Viewport.cpp mm7_3.cpp
diffstat 5 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Level/Decoration.cpp	Thu Jan 30 23:03:04 2014 +0100
+++ b/Level/Decoration.cpp	Fri Jan 31 00:37:26 2014 +0100
@@ -5,7 +5,7 @@
 //----- (004583B0) --------------------------------------------------------
 LevelDecoration::LevelDecoration()
 {
-  memset(this, 0, sizeof(this));
+  memset(this, 0, sizeof(*this));
 }
 
 //----- (00450929) --------------------------------------------------------
--- a/Party.cpp	Thu Jan 30 23:03:04 2014 +0100
+++ b/Party.cpp	Fri Jan 31 00:37:26 2014 +0100
@@ -540,7 +540,7 @@
   pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;  // default character ui - stats
   uFlags = 0;
   memset(_autonote_bits, 0, sizeof(_autonote_bits));
-  memset(_quest_bits, 0, sizeof(_autonote_bits));
+  memset(_quest_bits, 0, sizeof(_quest_bits));
   pIsArtifactFound.fill(0);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_RED_POTION_ACTIVE, 1);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE, 1);
--- a/Random.cpp	Thu Jan 30 23:03:04 2014 +0100
+++ b/Random.cpp	Fri Jan 31 00:37:26 2014 +0100
@@ -37,8 +37,8 @@
      + v2 * 5115.0
      + this->field_0[4];
   v1->field_0[0] = v3 - floor(v3);
-  v1->field_0[4] = v3 * 2.328306436538696e-10;
-  return v3 - v3;
+  v1->field_0[4] = floor(v3) * 2.328306436538696e-10;
+  return v1->field_0[0];
 }
 
 //----- (004BE623) --------------------------------------------------------
--- a/Viewport.cpp	Thu Jan 30 23:03:04 2014 +0100
+++ b/Viewport.cpp	Fri Jan 31 00:37:26 2014 +0100
@@ -34,19 +34,17 @@
     tl_x = sTL_X;
     br_x = sBR_X;
     if ( sTL_X > sBR_X )
-        {
-          __debugbreak(); // check this code
-        br_x = sBR_X ^ sTL_X ^ sBR_X;                           // swap x's
-        tl_x = br_x ^ sBR_X ^ sTL_X;
-        }
+    {
+      br_x = sTL_X;                           // swap x's
+      tl_x = sBR_X;
+    }
     tl_y = sTL_Y;
     br_y = sBR_Y;
     if ( sTL_Y > sBR_Y )
-        {
-          __debugbreak(); // check this code
-        br_y = sBR_Y ^ sTL_Y ^ sBR_Y;                           // swap y's 
-        tl_y = br_y ^ sBR_Y ^ sTL_Y;
-        }
+    {
+      br_y = sTL_Y;                           // swap y's 
+      tl_y = sBR_Y;
+    }
     this->uScreen_TL_X = tl_x;
     this->uScreen_TL_Y = tl_y;
     this->uScreen_BR_X = br_x;
--- a/mm7_3.cpp	Thu Jan 30 23:03:04 2014 +0100
+++ b/mm7_3.cpp	Fri Jan 31 00:37:26 2014 +0100
@@ -2831,13 +2831,13 @@
   if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater )
     return 0xFF000000;
   if ( a3 == 0.0 )
-    return (-1 - 216) << 24;
+    return (unsigned int)(-1 - 216) << 24;
   if ( a2 )
-    return (-1 - 248) << 24;
+    return (unsigned int)(-1 - 248) << 24;
   if (a3 < (double)day_fogrange_1)
-    return -1 << 24;
+    return (unsigned int)(-1) << 24;
   if (a3 < (double)day_fogrange_2)
-    return (-1 - 216) << 24;
+    return (unsigned int)(-1 - 216) << 24;
 
   if ( pWeather->bNight && !bUnderwater)
   {