Merge pull request #581 from tdev/vs2012_fixes

Visual Studio 2012 32Bit Level 4 Warning fixes
This commit is contained in:
Thomas Fischer 2014-03-17 10:02:19 +01:00
commit 7239c791f2
13 changed files with 24 additions and 34 deletions

View file

@ -3158,9 +3158,9 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
stream->writeFlag(image.triggerDown); stream->writeFlag(image.triggerDown);
stream->writeFlag(image.altTriggerDown); 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); stream->writeInt(image.fireCount,3);

View file

@ -1910,8 +1910,7 @@ extern int isatty (int );
b->yy_bs_column = 0; 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; errno = oerrno;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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