Prechádzať zdrojové kódy

Merge pull request #581 from tdev/vs2012_fixes

Visual Studio 2012 32Bit Level 4 Warning fixes
Thomas Fischer 11 rokov pred
rodič
commit
7239c791f2

+ 2 - 2
Engine/source/T3D/shapeBase.cpp

@@ -3158,9 +3158,9 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
             stream->writeFlag(image.triggerDown);
             stream->writeFlag(image.altTriggerDown);
 
-            for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i)
+            for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
             {
-               stream->writeFlag(image.genericTrigger[i]);
+               stream->writeFlag(image.genericTrigger[j]);
             }
 
             stream->writeInt(image.fireCount,3);            

+ 1 - 2
Engine/source/console/CMDscan.cpp

@@ -1910,8 +1910,7 @@ extern int isatty (int );
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
+    b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
 	errno = oerrno;
 }
 

+ 0 - 6
Engine/source/console/cmdgram.cpp

@@ -2059,12 +2059,6 @@ yydestruct (yymsg, yytype, yyvaluep)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  switch (yytype)
-    {
-
-      default:
-	break;
-    }
 }
 
 

+ 1 - 1
Engine/source/console/consoleFunctions.cpp

@@ -479,7 +479,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
       if(!scan)
       {
          dStrcpy(ret + dstp, source + scanp);
-         return ret;
+         break;
       }
       U32 len = scan - (source + scanp);
       dStrncpy(ret + dstp, source + scanp, len);

+ 3 - 3
Engine/source/core/strings/stringFunctions.cpp

@@ -108,7 +108,7 @@ compare_right(const nat_char* a, const nat_char* b)
    remember it in BIAS. */
    for (;; a++, b++) {
       if (!nat_isdigit(*a)  &&  !nat_isdigit(*b))
-         return bias;
+         break;
       else if (!nat_isdigit(*a))
          return -1;
       else if (!nat_isdigit(*b))
@@ -123,7 +123,7 @@ compare_right(const nat_char* a, const nat_char* b)
          return bias;
    }
 
-   return 0;
+   return bias;
 }
 
 
@@ -134,7 +134,7 @@ compare_left(const nat_char* a, const nat_char* b)
    different value wins. */
    for (;; a++, b++) {
       if (!nat_isdigit(*a)  &&  !nat_isdigit(*b))
-         return 0;
+         break;
       else if (!nat_isdigit(*a))
          return -1;
       else if (!nat_isdigit(*b))

+ 2 - 2
Engine/source/platform/platformAssert.h

@@ -96,8 +96,8 @@ public:
             { if ( ::PlatformAssert::processAssert(::PlatformAssert::Fatal, __FILE__, __LINE__,  y) ) { ::Platform::debugBreak(); } } }
 
 #else
-   #define AssertFatal(x, y)   { (void)sizeof(x); (void)sizeof(y); }
-   #define AssertWarn(x, y)    { (void)sizeof(x); (void)sizeof(y); }
+   #define AssertFatal(x, y)   { TORQUE_UNUSED(x); TORQUE_UNUSED(y); }
+   #define AssertWarn(x, y)    { TORQUE_UNUSED(x); TORQUE_UNUSED(y); }
 #endif
 
 /*!

+ 5 - 8
Engine/source/platform/platformCPUCount.cpp

@@ -99,12 +99,11 @@ namespace CPUInfo {
       //
       static unsigned int CpuIDSupported(void)
       {
-         unsigned int MaxInputValue;
+         unsigned int maxInputValue = 0;
          // If CPUID instruction is supported
 #ifdef TORQUE_COMPILER_GCC
          try    
          {		
-            MaxInputValue = 0;
             // call cpuid with eax = 0
             asm
                (
@@ -112,7 +111,7 @@ namespace CPUInfo {
                "xorl %%eax,%%eax\n\t"
                "cpuid\n\t"
                "popl %%ebx\n\t"
-               : "=a" (MaxInputValue)
+               : "=a" (maxInputValue)
                : 
                : "%ecx", "%edx"
                );		
@@ -124,25 +123,23 @@ namespace CPUInfo {
 #elif defined( TORQUE_COMPILER_VISUALC )
          try
          {
-            MaxInputValue = 0;
             // call cpuid with eax = 0
             __asm
             {
                xor eax, eax
                   cpuid
-                  mov MaxInputValue, eax
+                  mov maxInputValue, eax
             }
          }
          catch (...)
          {
-            return(0);                   // cpuid instruction is unavailable
+            // cpuid instruction is unavailable
          }
 #else
 #  error Not implemented.
 #endif
 
-         return MaxInputValue;
-
+         return maxInputValue;
       }
 
 

+ 2 - 4
Engine/source/platform/platformMemory.cpp

@@ -798,19 +798,17 @@ void checkPtr( void* ptr )
       AllocatedHeader* header = ( AllocatedHeader* ) *iter;
       if( header->getUserPtr() == ptr )
       {
-         char buffer[ 1024 ];
-
 #ifdef TORQUE_DEBUG_GUARD
+         char buffer[ 1024 ];
          if( !checkGuard( *iter, true ) )
          {
             dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer but has its guards corrupted", ptr );
             Platform::outputDebugString( buffer );
             return;
          }
-#endif
-
          //dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer", ptr );
          //Platform::outputDebugString( buffer );
+#endif
          return;
       }
    }

+ 4 - 0
Engine/source/platform/platformNet.cpp

@@ -27,7 +27,11 @@
 #define TORQUE_USE_WINSOCK
 #include <errno.h>
 #include <winsock.h>
+
+#ifndef EINPROGRESS
 #define EINPROGRESS             WSAEINPROGRESS
+#endif // EINPROGRESS
+
 #define ioctl ioctlsocket
 
 typedef int socklen_t;

+ 1 - 1
Engine/source/platform/types.h

@@ -40,7 +40,7 @@ typedef double             F64;     ///< Compiler independent 64-bit float
 
 struct EmptyType {};             ///< "Null" type used by templates
 
-#define TORQUE_UNUSED(var) (void)var
+#define TORQUE_UNUSED(var) (void)(var)
 
 //------------------------------------------------------------------------------
 //------------------------------------- String Types

+ 2 - 3
Engine/source/scene/reflectionManager.cpp

@@ -189,11 +189,8 @@ void ReflectionManager::update(  F32 timeSlice,
          break;
    }
 
-   U32 totalElapsed = mTimer->getElapsedMs();
-
    // Set metric/debug related script variables...
 
-   U32 numEnabled = mReflectors.size();   
    U32 numVisible = 0;
    U32 numOccluded = 0;
 
@@ -208,6 +205,8 @@ void ReflectionManager::update(  F32 timeSlice,
    }
 
 #ifdef TORQUE_GATHER_METRICS
+   U32 numEnabled = mReflectors.size();   
+   U32 totalElapsed = mTimer->getElapsedMs();
    const GFXTextureProfileStats &stats = ReflectRenderTargetProfile.getStats();
    
    F32 mb = ( stats.activeBytes / 1024.0f ) / 1024.0f;

+ 1 - 1
Engine/source/terrain/hlsl/terrFeatureHLSL.cpp

@@ -800,7 +800,7 @@ void TerrainMacroMapFeatHLSL::processPix(   Vector<ShaderComponent*> &componentL
    meta->addStatement( new GenOp( "      @ *= @.y * @.w;\r\n",
                                     detailColor, detailInfo, inDet ) );
 
-   Var *baseColor = (Var*)LangElement::find( "baseColor" );
+   //Var *baseColor = (Var*)LangElement::find( "baseColor" );
    Var *outColor = (Var*)LangElement::find( "col" );
 
    meta->addStatement( new GenOp( "      @ = lerp( @, @ + @, @ );\r\n",

+ 0 - 1
Engine/source/ts/tsShapeAlloc.cpp

@@ -213,7 +213,6 @@ void TSShapeAlloc::checkGuard()
    bool check32 = checkGuard32();
    bool check16 = checkGuard16();
    bool check8  = checkGuard8();
-
    AssertFatal(check32,avar("TSShapeAlloc::checkGuard32: found %i, wanted %i",getSaveGuard32(),getPrevGuard32()));
    AssertFatal(check16,avar("TSShapeAlloc::checkGuard16: found %i, wanted %i",getSaveGuard16(),getPrevGuard16()));
    AssertFatal(check8 ,avar("TSShapeAlloc::checkGuard8:  found %i, wanted %i",getSaveGuard8() ,getPrevGuard8()));