Browse Source

visual studio 2012 Level 4 warning fixes

Thomas Fischer 11 years ago
parent
commit
502e346eb6

+ 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);            

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

@@ -1910,8 +1910,11 @@ extern int isatty (int );
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
+#ifdef _MSC_VER
+    b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0;
+#else
+    b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif // _MSC_VER    
 	errno = oerrno;
 }
 

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

@@ -2058,13 +2058,6 @@ yydestruct (yymsg, yytype, yyvaluep)
   if (!yymsg)
     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 - 0
Engine/source/core/util/journal/journal.h

@@ -407,6 +407,7 @@ public:
    {
       AssertFatal(IsPlaying(), "Journal::Read - not playing right now.");
       bool r = mFile->read(v);
+      TORQUE_UNUSED(r);
       AssertFatal(r, "Journal::Read - failed to read!");
    }
 
@@ -429,6 +430,7 @@ public:
    {
       AssertFatal(IsRecording(), "Journal::Write - not recording right now.");
       bool r = mFile->write(v);
+      TORQUE_UNUSED(r);
       AssertFatal(r, "Journal::Write - failed to write!");
    }
 

+ 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;
       }
 
 

+ 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",