From 502e346eb6d063b4f54a4b0926e06c9d1958f5fb Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sat, 15 Mar 2014 11:38:53 +0100 Subject: [PATCH] visual studio 2012 Level 4 warning fixes --- Engine/source/T3D/shapeBase.cpp | 4 ++-- Engine/source/console/CMDscan.cpp | 7 +++++-- Engine/source/console/cmdgram.cpp | 7 ------- Engine/source/console/consoleFunctions.cpp | 2 +- Engine/source/core/strings/stringFunctions.cpp | 6 +++--- Engine/source/core/util/journal/journal.h | 2 ++ Engine/source/platform/platformCPUCount.cpp | 13 +++++-------- Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 2 +- 8 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 58f04cee9..571b3c163 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/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; iwriteFlag(image.genericTrigger[i]); + stream->writeFlag(image.genericTrigger[j]); } stream->writeInt(image.fireCount,3); diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 4ce606638..75f27dd72 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/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; } diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 35ed58bd0..0f6c8de71 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/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; - } } diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 537f583ba..96f340f25 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/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); diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 25c7e22b1..b84f378ff 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/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)) diff --git a/Engine/source/core/util/journal/journal.h b/Engine/source/core/util/journal/journal.h index 9db84e2f6..4df3a4ebb 100644 --- a/Engine/source/core/util/journal/journal.h +++ b/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!"); } diff --git a/Engine/source/platform/platformCPUCount.cpp b/Engine/source/platform/platformCPUCount.cpp index 116251e08..3e3e3df11 100644 --- a/Engine/source/platform/platformCPUCount.cpp +++ b/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; } diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index f7d2c740a..6c94e0743 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -800,7 +800,7 @@ void TerrainMacroMapFeatHLSL::processPix( Vector &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",