From 0db6e1bc57c9d92188d081500e1656d325f4593e Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Wed, 4 Dec 2013 16:50:23 -0500 Subject: [PATCH] Fix potential crashes - some compilers have problems with using locally redeclared loop vars after an internal loop - fix ordering of conditional checks --- Engine/source/T3D/shapeBase.cpp | 4 ++-- Engine/source/core/util/path.cpp | 2 +- Engine/source/gfx/gfxDrawUtil.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 0ecde5097..58f04cee9 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3303,9 +3303,9 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream) image.triggerDown = stream->readFlag(); image.altTriggerDown = stream->readFlag(); - for (U32 i=0; ireadFlag(); + image.genericTrigger[j] = stream->readFlag(); } int count = stream->readInt(3); diff --git a/Engine/source/core/util/path.cpp b/Engine/source/core/util/path.cpp index 5bcea08fb..c90e6e127 100644 --- a/Engine/source/core/util/path.cpp +++ b/Engine/source/core/util/path.cpp @@ -408,7 +408,7 @@ String Path::getDirectory(U32 count) const U32 end = offset; - while (mPath[end] != '/' && end < mPath.length()) + while (end < mPath.length() && mPath[end] != '/') end++; return mPath.substr(offset,end - offset); diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index d7e4b921e..7e22ed8b8 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -183,7 +183,7 @@ U32 GFXDrawUtil::drawTextN( GFont *font, const Point2I &ptDraw, const UTF16 *in_ U32 i; UTF16 c; - for(i = 0, c = in_string[i]; in_string[i] && i < n; i++, c = in_string[i]) + for (i = 0, c = in_string[i]; i < n && in_string[i]; i++, c = in_string[i]) { switch(c) { @@ -445,7 +445,7 @@ void GFXDrawUtil::drawRect( const Point2F &upperLeft, const Point2F &lowerRight, // Into Triangle-Strip Outline // v0-----------v2 // | a x | - // | v1-----v3 | + // | v1-----v3 | // | | | | // | v7-----v5 | // | x b | @@ -512,7 +512,7 @@ void GFXDrawUtil::drawRectFill( const Point2F &upperLeft, const Point2F &lowerRi // Into Quad // v0---------v1 // | a x | - // | | + // | | // | x b | // v2---------v3 //