Kaynağa Gözat

* BugFix: Clear a lot of warnings and correct a few actual programming errors along the way.

Robert MacGregor 3 yıl önce
ebeveyn
işleme
1b6b803a20
61 değiştirilmiş dosya ile 120 ekleme ve 118 silme
  1. 1 1
      Engine/lib/collada/include/dae.h
  2. 1 1
      Engine/lib/collada/include/dae/daeErrorHandler.h
  3. 1 1
      Engine/lib/collada/include/dae/daeStandardURIResolver.h
  4. 1 1
      Engine/lib/collada/src/dae/daeErrorHandler.cpp
  5. 10 5
      Engine/source/T3D/assets/MaterialAsset.cpp
  6. 1 1
      Engine/source/T3D/assets/assetImporter.cpp
  7. 0 9
      Engine/source/T3D/assets/assetImporter.h
  8. 2 2
      Engine/source/T3D/convexShape.cpp
  9. 10 2
      Engine/source/T3D/fx/particleEmitter.cpp
  10. 1 1
      Engine/source/T3D/fx/precipitation.cpp
  11. 1 1
      Engine/source/T3D/gameBase/gameConnection.cpp
  12. 1 1
      Engine/source/T3D/shapeBase.h
  13. 1 1
      Engine/source/afx/util/afxAnimCurve.h
  14. 1 0
      Engine/source/afx/util/afxCurveEval.h
  15. 2 1
      Engine/source/afx/xm/afxXM_WaveBase.h
  16. 1 1
      Engine/source/collision/optimizedPolyList.h
  17. 1 1
      Engine/source/collision/polytope.h
  18. 20 20
      Engine/source/console/CMDscan.cpp
  19. 2 2
      Engine/source/console/arrayObject.cpp
  20. 2 2
      Engine/source/console/simObject.cpp
  21. 1 1
      Engine/source/core/stringBuffer.cpp
  22. 2 2
      Engine/source/core/strings/unicode.cpp
  23. 2 2
      Engine/source/core/util/hashFunction.h
  24. 1 1
      Engine/source/environment/decalRoad.cpp
  25. 1 1
      Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp
  26. 1 1
      Engine/source/environment/editors/guiRiverEditorCtrl.cpp
  27. 1 1
      Engine/source/environment/editors/guiRoadEditorCtrl.cpp
  28. 2 2
      Engine/source/environment/meshRoad.cpp
  29. 1 1
      Engine/source/environment/river.cpp
  30. 2 2
      Engine/source/gfx/bitmap/gBitmap.cpp
  31. 1 1
      Engine/source/gfx/bitmap/loaders/bitmapPng.cpp
  32. 1 1
      Engine/source/gfx/gl/gfxGLCubemap.cpp
  33. 2 2
      Engine/source/gfx/gl/gfxGLStateBlock.cpp
  34. 1 1
      Engine/source/gfx/gl/gfxGLTextureArray.cpp
  35. 1 1
      Engine/source/gfx/gl/gfxGLTextureArray.h
  36. 1 1
      Engine/source/gfx/gl/gfxGLTextureObject.cpp
  37. 1 1
      Engine/source/gfx/sim/cubemapData.cpp
  38. 1 1
      Engine/source/gfx/video/videoEncoderTheora.cpp
  39. 1 1
      Engine/source/gui/core/guiCanvas.cpp
  40. 2 2
      Engine/source/gui/editor/guiInspector.cpp
  41. 3 3
      Engine/source/gui/editor/guiShapeEdPreview.cpp
  42. 1 1
      Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h
  43. 1 1
      Engine/source/gui/worldEditor/guiMissionArea.h
  44. 1 1
      Engine/source/gui/worldEditor/terrainActions.cpp
  45. 1 1
      Engine/source/lighting/advanced/advancedLightBinManager.h
  46. 2 2
      Engine/source/lighting/basic/blTerrainSystem.cpp
  47. 1 1
      Engine/source/materials/materialDefinition.cpp
  48. 1 1
      Engine/source/math/mRandom.h
  49. 1 1
      Engine/source/navigation/guiNavEditorCtrl.h
  50. 1 1
      Engine/source/persistence/taml/taml.cpp
  51. 1 1
      Engine/source/platform/platformNet.cpp
  52. 1 1
      Engine/source/platformSDL/sdlInput.cpp
  53. 8 8
      Engine/source/platformX86UNIX/x86UNIXFileio.cpp
  54. 1 1
      Engine/source/renderInstance/renderImposterMgr.cpp
  55. 1 1
      Engine/source/renderInstance/renderPassStateToken.cpp
  56. 3 3
      Engine/source/scene/mixin/scenePolyhedralObject.impl.h
  57. 1 1
      Engine/source/sim/actionMap.cpp
  58. 1 1
      Engine/source/sim/actionMap.h
  59. 2 2
      Engine/source/sim/netObject.cpp
  60. 1 5
      Engine/source/ts/tsShape.cpp
  61. 1 1
      Engine/source/ts/tsShapeConstruct.cpp

+ 1 - 1
Engine/lib/collada/include/dae.h

@@ -195,7 +195,7 @@ private:
 	daeRawRefCache rawRefCache;
 	daeSidRefCache sidRefCache;
 
-	std::auto_ptr<charEncoding> localCharEncoding;
+	std::unique_ptr<charEncoding> localCharEncoding;
 	static charEncoding globalCharEncoding;
 };
 

+ 1 - 1
Engine/lib/collada/include/dae/daeErrorHandler.h

@@ -60,7 +60,7 @@ public:
 
 private:
 	static daeErrorHandler *_instance;
-	static std::auto_ptr<daeErrorHandler> _defaultInstance;
+	static std::unique_ptr<daeErrorHandler> _defaultInstance;
 };
 
 #endif

+ 1 - 1
Engine/lib/collada/include/dae/daeStandardURIResolver.h

@@ -12,7 +12,7 @@
  */
 
 #ifndef __DAE_STANDARD_URI_RESOLVER__
-#define __DAE_STANDARD_URI_RESOVLER__
+#define __DAE_STANDARD_URI_RESOLVER__
 
 #include <string>
 #include "dae/daeURI.h"

+ 1 - 1
Engine/lib/collada/src/dae/daeErrorHandler.cpp

@@ -15,7 +15,7 @@
 #include <modules/stdErrPlugin.h>
 
 daeErrorHandler *daeErrorHandler::_instance = NULL;
-std::auto_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
+std::unique_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
 
 daeErrorHandler::daeErrorHandler() {
 }

+ 10 - 5
Engine/source/T3D/assets/MaterialAsset.cpp

@@ -19,7 +19,6 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
-#pragma once
 
 #ifndef MATERIALASSET_H
 #include "MaterialAsset.h"
@@ -171,10 +170,16 @@ void MaterialAsset::initializeAsset()
    if (Torque::FS::IsScriptFile(mScriptPath))
    {
       if (!Sim::findObject(mMatDefinitionName))
-         if (Con::executeFile(mScriptPath, false, false))
-            mLoadedState = ScriptLoaded;
-         else
-            mLoadedState = Failed;
+      {
+          if (Con::executeFile(mScriptPath, false, false))
+          {
+              mLoadedState = ScriptLoaded;
+          }
+          else
+          {
+              mLoadedState = Failed;
+          }
+      }
    }
 
    loadMaterial();

+ 1 - 1
Engine/source/T3D/assets/assetImporter.cpp

@@ -1409,7 +1409,7 @@ void AssetImporter::processImportAssets(AssetImportObject* assetItem)
 		      Con::executef(this, processCommand.c_str(), item);
 		}
 
-      item->importStatus == AssetImportObject::Processed;
+      item->importStatus = AssetImportObject::Processed;
 
       //try recusing on the children(if any)
       processImportAssets(item);

+ 0 - 9
Engine/source/T3D/assets/assetImporter.h

@@ -931,15 +931,6 @@ public:
       return imagePath;
    }
 
-   static inline const char* makeFullPath(const String& path)
-   {
-      char qualifiedFilePath[2048];
-
-      Platform::makeFullPathName(path.c_str(), qualifiedFilePath, sizeof(qualifiedFilePath));
-
-      return qualifiedFilePath;
-   }
-
    //
    void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
    const String& getTargetModuleId() { return targetModuleId; }

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

@@ -318,10 +318,10 @@ void ConvexShape::initPersistFields()
 
    addGroup( "Internal" );
 
-      addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn, 
+      addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn,
          "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
 
-	  addProtectedField( "surfaceTexture", TypeRealString, NULL, &protectedSetSurfaceTexture, &defaultProtectedGetFn, 
+	  addProtectedField( "surfaceTexture", TypeRealString, 0, &protectedSetSurfaceTexture, &defaultProtectedGetFn,
          "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
 
    endGroup( "Internal" );

+ 10 - 2
Engine/source/T3D/fx/particleEmitter.cpp

@@ -1914,7 +1914,11 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie
          {
             SortParticle* partPtr = orderedVector.address();
             for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4)
-               setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
+            {
+                SortParticle* part = partPtr;
+                partPtr++;
+                setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr);
+            }
          }
          // do unsorted-oriented particles
          else
@@ -1933,7 +1937,11 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie
          {
             SortParticle* partPtr = orderedVector.address();
             for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4)
-               setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
+            {
+                SortParticle* part = partPtr;
+                partPtr++;
+                setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr);
+            }
          }
          // do unsorted-oriented particles
          else

+ 1 - 1
Engine/source/T3D/fx/precipitation.cpp

@@ -996,7 +996,7 @@ void Precipitation::initRenderObjects()
    // entire or a partially filled vb.
    mRainIB.set(GFX, mMaxVBDrops * 6, 0, GFXBufferTypeStatic);
    U16 *idxBuff;
-   mRainIB.lock(&idxBuff, NULL, NULL, NULL);
+   mRainIB.lock(&idxBuff, NULL, 0, 0);
    for( U32 i=0; i < mMaxVBDrops; i++ )
    {
       //

+ 1 - 1
Engine/source/T3D/gameBase/gameConnection.cpp

@@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
       return cObj->isValidCameraFov(fov);
    }
 
-   return NULL;
+   return false;
 }
 
 bool GameConnection::setControlCameraFov(F32 fov)

+ 1 - 1
Engine/source/T3D/shapeBase.h

@@ -116,7 +116,7 @@ class ShapeBaseConvex : public Convex
    Box3F       box;
 
   public:
-   ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; }
+   ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(0), nodeTransform(0) { mType = ShapeBaseConvexType; }
    ShapeBaseConvex(const ShapeBaseConvex& cv) {
       mObject    = cv.mObject;
       pShapeBase = cv.pShapeBase;

+ 1 - 1
Engine/source/afx/util/afxAnimCurve.h

@@ -56,7 +56,7 @@ class afxAnimCurve
 
 	public:
 		afxAnimCurve();
-		~afxAnimCurve();
+		virtual ~afxAnimCurve();
 
 		void    addKey( Point2F &v );
 		void    addKey( F32 time, F32 value );

+ 1 - 0
Engine/source/afx/util/afxCurveEval.h

@@ -32,6 +32,7 @@
 class afxCurveEval
 {
 public:
+  virtual ~afxCurveEval() { }
   virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t)=0;
   virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0;
   virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t)=0;

+ 2 - 1
Engine/source/afx/xm/afxXM_WaveBase.h

@@ -81,6 +81,7 @@ public:
 class afxXM_WaveInterp
 {
 public:
+  virtual ~afxXM_WaveInterp() { }
   virtual void interpolate(F32 t, afxXM_Params& params)=0;
   virtual void pulse()=0;
 
@@ -250,7 +251,7 @@ protected:
 
 public:
   /*C*/                 afxXM_WaveBase(afxXM_WaveBaseData*, afxEffectWrapper*, afxXM_WaveInterp*);
-  /*D*/                 ~afxXM_WaveBase();
+  /*D*/                 virtual ~afxXM_WaveBase();
 
   virtual void          updateParams(F32 dt, F32 elapsed, afxXM_Params& params);
 };

+ 1 - 1
Engine/source/collision/optimizedPolyList.h

@@ -87,7 +87,7 @@ class OptimizedPolyList : public AbstractPolyList
 
       Poly()
          : plane( -1 ),
-           material( NULL ),
+           material( 0 ),
            vertexStart(0),
            vertexCount( 0 ),
            surfaceKey(0),

+ 1 - 1
Engine/source/collision/polytope.h

@@ -76,7 +76,7 @@ public:
       Collision()
       {
          object = NULL;
-         material = NULL;
+         material = 0;
          distance = 0.0;
       }
    };

+ 20 - 20
Engine/source/console/CMDscan.cpp

@@ -774,9 +774,9 @@ YY_MALLOC_DECL
 
 YY_DECL
 	{
-	register yy_state_type yy_current_state;
-	register char *yy_cp, *yy_bp;
-	register int yy_act;
+    yy_state_type yy_current_state;
+    char *yy_cp, *yy_bp;
+    int yy_act;
 
 #line 105 "CMDscan.l"
 
@@ -823,7 +823,7 @@ YY_DECL
 yy_match:
 		do
 			{
-			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+		    YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 			if ( yy_accept[yy_current_state] )
 				{
 				yy_last_accepting_state = yy_current_state;
@@ -1430,9 +1430,9 @@ case YY_STATE_EOF(INITIAL):
 
 static int yy_get_next_buffer()
 	{
-	register char *dest = yy_current_buffer->yy_ch_buf;
-	register char *source = yytext_ptr;
-	register int number_to_move, i;
+    char *dest = yy_current_buffer->yy_ch_buf;
+    char *source = yytext_ptr;
+    int number_to_move, i;
 	int ret_val;
 
 	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
@@ -1560,14 +1560,14 @@ static int yy_get_next_buffer()
 
 static yy_state_type yy_get_previous_state()
 	{
-	register yy_state_type yy_current_state;
-	register char *yy_cp;
+    yy_state_type yy_current_state;
+    char *yy_cp;
 
 	yy_current_state = yy_start;
 
 	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
 		{
-		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+	    YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 		if ( yy_accept[yy_current_state] )
 			{
 			yy_last_accepting_state = yy_current_state;
@@ -1599,10 +1599,10 @@ static yy_state_type yy_try_NUL_trans( yy_current_state )
 yy_state_type yy_current_state;
 #endif
 	{
-	register int yy_is_jam;
-	register char *yy_cp = yy_c_buf_p;
+    int yy_is_jam;
+    char *yy_cp = yy_c_buf_p;
 
-	register YY_CHAR yy_c = 1;
+    YY_CHAR yy_c = 1;
 	if ( yy_accept[yy_current_state] )
 		{
 		yy_last_accepting_state = yy_current_state;
@@ -1623,14 +1623,14 @@ yy_state_type yy_current_state;
 
 #ifndef YY_NO_UNPUT
 #ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
+static void yyunput( int c, char *yy_bp )
 #else
 static void yyunput( c, yy_bp )
 int c;
-register char *yy_bp;
+char *yy_bp;
 #endif
 	{
-	register char *yy_cp = yy_c_buf_p;
+    char *yy_cp = yy_c_buf_p;
 
 	/* undo effects of setting up yytext */
 	*yy_cp = yy_hold_char;
@@ -1638,10 +1638,10 @@ register char *yy_bp;
 	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
 		{ /* need to shift things up to make room */
 		/* +2 for EOB chars. */
-		register int number_to_move = yy_n_chars + 2;
-		register char *dest = &yy_current_buffer->yy_ch_buf[
+		int number_to_move = yy_n_chars + 2;
+		char *dest = &yy_current_buffer->yy_ch_buf[
 					yy_current_buffer->yy_buf_size + 2];
-		register char *source =
+		char *source =
 				&yy_current_buffer->yy_ch_buf[number_to_move];
 
 		while ( source > yy_current_buffer->yy_ch_buf )
@@ -2095,7 +2095,7 @@ yyconst char *s2;
 int n;
 #endif
 	{
-	register int i;
+    int i;
 	for ( i = 0; i < n; ++i )
 		s1[i] = s2[i];
 	}

+ 2 - 2
Engine/source/console/arrayObject.cpp

@@ -125,7 +125,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void
 
 ArrayObject::ArrayObject()
    : mCaseSensitive( false ),
-     mCurrentIndex( NULL )
+     mCurrentIndex( 0 )
 {
 }
 
@@ -137,7 +137,7 @@ void ArrayObject::initPersistFields()
       "Makes the keys and values case-sensitive.\n"
       "By default, comparison of key and value strings will be case-insensitive." );
 
-   addProtectedField( "key", TypeCaseString, NULL, &_addKeyFromField, &emptyStringProtectedGetFn, 
+   addProtectedField( "key", TypeCaseString, 0, &_addKeyFromField, &emptyStringProtectedGetFn,
       "Helper field which allows you to add new key['keyname'] = value pairs." );
 
    Parent::initPersistFields();

+ 2 - 2
Engine/source/console/simObject.cpp

@@ -179,10 +179,10 @@ void SimObject::initPersistFields()
    
    addGroup( "Editing" );
    
-      addProtectedField( "hidden", TypeBool, NULL,
+      addProtectedField( "hidden", TypeBool, 0,
          &_setHidden, &_getHidden,
          "Whether the object is visible." );
-      addProtectedField( "locked", TypeBool, NULL,
+      addProtectedField( "locked", TypeBool, 0,
          &_setLocked, &_getLocked,
          "Whether the object can be edited." );
    

+ 1 - 1
Engine/source/core/stringBuffer.cpp

@@ -371,7 +371,7 @@ void StringBuffer::getCopy(UTF16 *buff, const U32 buffSize) const
    AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!");
    dMemcpy(buff, mBuffer.address(), sizeof(UTF16) * getMin(buffSize, (U32)mBuffer.size()));
    // ensure null termination.
-   buff[buffSize-1] = NULL;
+   buff[buffSize-1] = 0;
 }
 
 UTF8* StringBuffer::createCopy8() const

+ 2 - 2
Engine/source/core/strings/unicode.cpp

@@ -236,8 +236,8 @@ U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8  *outbuffer, U32
    }
 
    nCodeunits = getMin(nCodeunits,len - 1);
-   outbuffer[nCodeunits] = NULL;
-   outbuffer[nCodeunits+1] = NULL;
+   outbuffer[nCodeunits] = '\0';
+   outbuffer[nCodeunits+1] = '\0';
 
    PROFILE_END();
    return nCodeunits;

+ 2 - 2
Engine/source/core/util/hashFunction.h

@@ -30,9 +30,9 @@
 namespace Torque
 {
 
-extern U32 hash(register const U8 *k, register U32 length, register U32 initval);
+extern U32 hash(const U8 *k, U32 length, U32 initval);
 
-extern U64 hash64(register const U8 *k, register U32 length, register U64 initval);
+extern U64 hash64(const U8 *k, U32 length, U64 initval);
 
 }
 

+ 1 - 1
Engine/source/environment/decalRoad.cpp

@@ -320,7 +320,7 @@ void DecalRoad::initPersistFields()
 
    addGroup( "Internal" );
 
-      addProtectedField( "node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, 
+      addProtectedField( "node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn,
          "Do not modify, for internal use." );
 
    endGroup( "Internal" );

+ 1 - 1
Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp

@@ -1757,7 +1757,7 @@ DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
 {
    MeshRoad *road = object->getSelectedRoad();
    if ( !road )
-      return NULL;
+      return 0;
 
    return road->getId();
 }

+ 1 - 1
Engine/source/environment/editors/guiRiverEditorCtrl.cpp

@@ -1472,7 +1472,7 @@ DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" )
 {
    River *river = object->getSelectedRiver();
    if ( !river )
-      return NULL;
+      return 0;
 
    return river->getId();
 }

+ 1 - 1
Engine/source/environment/editors/guiRoadEditorCtrl.cpp

@@ -1097,7 +1097,7 @@ DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
    if ( road )
       return road->getId();
    
-   return NULL;
+   return 0;
 }
 
 DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" )

+ 2 - 2
Engine/source/environment/meshRoad.cpp

@@ -954,10 +954,10 @@ void MeshRoad::initPersistFields()
 
    addGroup( "Internal" );
 
-      addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, 
+      addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn,
          "Do not modify, for internal use." );
 
-      addProtectedField( "ProfileNode", TypeString, NULL, &addProfileNodeFromField, &emptyStringProtectedGetFn,
+      addProtectedField( "ProfileNode", TypeString, 0, &addProfileNodeFromField, &emptyStringProtectedGetFn,
          "Do not modify, for internal use." );
 
    endGroup( "Internal" );

+ 1 - 1
Engine/source/environment/river.cpp

@@ -647,7 +647,7 @@ void River::initPersistFields()
 
    addGroup( "Internal" );
 
-      addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." );
+      addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." );
 
    endGroup( "Internal" );
 

+ 2 - 2
Engine/source/gfx/bitmap/gBitmap.cpp

@@ -1199,7 +1199,7 @@ bool  GBitmap::readBitmap( const String &bmType, Stream &ioStream )
    if ( regInfo == NULL )
    {
       Con::errorf( "[GBitmap::readBitmap] unable to find registration for extension [%s]", bmType.c_str() );
-      return NULL;
+      return false;
    }
 
    return regInfo->readFunc( ioStream, this );
@@ -1212,7 +1212,7 @@ bool  GBitmap::writeBitmap( const String &bmType, Stream &ioStream, U32 compress
    if ( regInfo == NULL )
    {
       Con::errorf( "[GBitmap::writeBitmap] unable to find registration for extension [%s]", bmType.c_str() );
-      return NULL;
+      return false;
    }
 
    return regInfo->writeFunc( this, ioStream, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel );

+ 1 - 1
Engine/source/gfx/bitmap/loaders/bitmapPng.cpp

@@ -143,7 +143,7 @@ static bool sReadPNG(Stream &stream, GBitmap *bitmap)
    stream.read(cs_headerBytesChecked, header);
 
    bool isPng = png_check_sig(header, cs_headerBytesChecked) != 0;
-   if (isPng == false) 
+   if (!isPng)
    {
       AssertWarn(false, "GBitmap::readPNG: stream doesn't contain a PNG");
       return false;

+ 1 - 1
Engine/source/gfx/gl/gfxGLCubemap.cpp

@@ -308,7 +308,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip)
 
 GFXGLCubemapArray::GFXGLCubemapArray()
 {
-   mCubemap = NULL;
+   mCubemap = 0;
 }
 
 GFXGLCubemapArray::~GFXGLCubemapArray()

+ 2 - 2
Engine/source/gfx/gl/gfxGLStateBlock.cpp

@@ -101,8 +101,8 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
    // the state value even if that value is identical to the current value.
 
 #define STATE_CHANGE(state) (!oldState || oldState->mDesc.state != mDesc.state)
-#define TOGGLE_STATE(state, enum) if(mDesc.state) glEnable(enum); else glDisable(enum)
-#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) if(mDesc.state) glEnable(enum); else glDisable(enum)
+#define TOGGLE_STATE(state, enum) if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }
+#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) { if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }}
 
    // Blending
    CHECK_TOGGLE_STATE(blendEnable, GL_BLEND);

+ 1 - 1
Engine/source/gfx/gl/gfxGLTextureArray.cpp

@@ -6,7 +6,7 @@
 
 GFXGLTextureArray::GFXGLTextureArray()
 {
-   mTextureArray = NULL;
+   mTextureArray = 0;
 }
 
 void GFXGLTextureArray::init()

+ 1 - 1
Engine/source/gfx/gl/gfxGLTextureArray.h

@@ -13,7 +13,7 @@ public:
 
    ~GFXGLTextureArray() { Release(); };
 
-   void init();
+   void init() override;
 
    void setToTexUnit(U32 tuNum) override;
 

+ 1 - 1
Engine/source/gfx/gl/gfxGLTextureObject.cpp

@@ -46,7 +46,7 @@ GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *p
 {
 
 #if TORQUE_DEBUG
-   mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark();
+   mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark();
 #endif
 
    dMemset(&mLockedRect, 0, sizeof(mLockedRect));

+ 1 - 1
Engine/source/gfx/sim/cubemapData.cpp

@@ -135,7 +135,7 @@ void CubemapData::createMap()
        if( initSuccess )
        {
            mCubemap = GFX->createCubemap();
-           if (mCubeMapFace == NULL || mCubeMapFace->isNull())
+           if (!mCubeMapFace || mCubeMapFace->isNull())
               return;
            mCubemap->initStatic(mCubeMapFace);
        }

+ 1 - 1
Engine/source/gfx/video/videoEncoderTheora.cpp

@@ -226,7 +226,7 @@ public:
          return setStatus(false);
       }
 
-      ogg_stream_init(&to, Platform::getRandom() * S32_MAX);
+      ogg_stream_init(&to, Platform::getRandom() * double(S32_MAX));
 
       ogg_packet op;
 

+ 1 - 1
Engine/source/gui/core/guiCanvas.cpp

@@ -2438,7 +2438,7 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
    if (control)
       return control->getId();
    
-   return NULL;
+   return 0;
 }
 
 DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,

+ 2 - 2
Engine/source/gui/editor/guiInspector.cpp

@@ -908,12 +908,12 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), ,
 	"@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
 {
    if ( !obj)
-      return NULL;
+      return 0;
 
    SimObject *inspector = GuiInspector::findByObject(obj);
 
    if ( !inspector )
-      return NULL;
+      return 0;
 
    return inspector->getId();
 }

+ 3 - 3
Engine/source/gui/editor/guiShapeEdPreview.cpp

@@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields()
    addGroup( "Animation" );
    addField( "activeThread",              TypeS32,    Offset( mActiveThread, GuiShapeEdPreview ),
       "Index of the active thread, or -1 if none" );
-   addProtectedField( "threadPos",        TypeF32,    NULL, &setFieldThreadPos, &getFieldThreadPos,
+   addProtectedField( "threadPos",        TypeF32,    0, &setFieldThreadPos, &getFieldThreadPos,
       "Current position of the active thread (0-1)" );
-   addProtectedField( "threadDirection",  TypeS32,    NULL, &setFieldThreadDir, &getFieldThreadDir,
+   addProtectedField( "threadDirection",  TypeS32,    0, &setFieldThreadDir, &getFieldThreadDir,
       "Playback direction of the active thread" );
-   addProtectedField( "threadPingPong",   TypeBool,   NULL, &setFieldThreadPingPong, &getFieldThreadPingPong,
+   addProtectedField( "threadPingPong",   TypeBool,   0, &setFieldThreadPingPong, &getFieldThreadPingPong,
       "'PingPong' mode of the active thread" );
    endGroup( "Animation" );
 

+ 1 - 1
Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h

@@ -248,7 +248,7 @@ class GuiConvexEditorUndoAction : public UndoAction
    friend class GuiConvexEditorCtrl;
 public:
 
-   GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(NULL)
+   GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(0)
    {
    }
 

+ 1 - 1
Engine/source/gui/worldEditor/guiMissionArea.h

@@ -145,7 +145,7 @@ class GuiMissionAreaUndoAction : public UndoAction
 {
    public:
 
-      GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(NULL)
+      GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(0)
       {
       }
 

+ 1 - 1
Engine/source/gui/worldEditor/terrainActions.cpp

@@ -773,7 +773,7 @@ ConsoleDocClass( TerrainSmoothAction,
 );
 
 TerrainSmoothAction::TerrainSmoothAction()
-   : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(NULL)
+   : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(0)
 {
 }
 

+ 1 - 1
Engine/source/lighting/advanced/advancedLightBinManager.h

@@ -70,7 +70,7 @@ protected:
    GFXStateBlockRef mLitState[NUM_LIT_STATES][2];
 
 public:
-   LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false),  mSpecialLight(NULL) {}
+   LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false),  mSpecialLight(false) {}
 
    virtual bool init( const FeatureSet &features, const GFXVertexFormat *vertexFormat );
    virtual bool setupPass( SceneRenderState *state, const SceneData &sgData );

+ 2 - 2
Engine/source/lighting/basic/blTerrainSystem.cpp

@@ -682,9 +682,9 @@ bool blTerrainSystem::createPersistChunkFromProxy(SceneLighting::ObjectProxy* ob
    {
       *ret = new blTerrainChunk();
       return true;
-   } else {
-      return NULL;
    }
+
+   return false;
 }
 
 // Given a ray, this will return the color from the lightmap of this object, return true if handled

+ 1 - 1
Engine/source/materials/materialDefinition.cpp

@@ -218,7 +218,7 @@ Material::Material()
    mPlanarReflection = false;
 
    mCubemapData = NULL;
-   mDynamicCubemap = NULL;
+   mDynamicCubemap = false;
 
    mLastUpdateTime = 0;
 

+ 1 - 1
Engine/source/math/mRandom.h

@@ -54,7 +54,7 @@ public:
 inline F32 MRandomGenerator::randF()
 {
    // default: multiply by 1/(2^31)
-   return F32(randI()) * (1.0f / S32_MAX);
+   return F32(randI()) * (1.0f / F64(S32_MAX));
 }
 
 inline S32 MRandomGenerator::randI(S32 i, S32 n)

+ 1 - 1
Engine/source/navigation/guiNavEditorCtrl.h

@@ -168,7 +168,7 @@ protected:
 class GuiNavEditorUndoAction : public UndoAction
 {
 public:
-   GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(NULL)
+   GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(0)
    {
    }
 

+ 1 - 1
Engine/source/persistence/taml/taml.cpp

@@ -335,7 +335,7 @@ ImplementEnumType(_TamlFormatMode,
 
          // Write.
          //return writer.write( stream, pRootNode );
-         return NULL;
+         return false;
       }
 
       /// Invalid.

+ 1 - 1
Engine/source/platform/platformNet.cpp

@@ -241,7 +241,7 @@ namespace PlatformNetState
 
    struct addrinfo* pickAddressByProtocol(struct addrinfo* addr, int protocol)
    {
-      for (addr; addr != NULL; addr = addr->ai_next)
+      for (; addr != NULL; addr = addr->ai_next)
       {
          if (addr->ai_family == protocol)
             return addr;

+ 1 - 1
Engine/source/platformSDL/sdlInput.cpp

@@ -102,7 +102,7 @@ U16 Input::getKeyCode( U16 asciiCode )
 
     char c[2];
     c[0]= asciiCode;
-    c[1] = NULL;
+    c[1] = 0;
     return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromKey( SDL_GetKeyFromName(c) ) );
 }
 

+ 8 - 8
Engine/source/platformX86UNIX/x86UNIXFileio.cpp

@@ -594,20 +594,20 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
          return currentStatus;
 
      U32 finalPos = 0;
-     switch (absolutePos)
+
+     if (absolutePos)
      {
-     case true:                                                    // absolute position
          AssertFatal(0 <= position, "File::setPosition: negative absolute position");
 
          // position beyond EOS is OK
          finalPos = lseek(*((int *)handle), position, SEEK_SET);
-         break;
-     case false:                                                    // relative position
+     }
+     else
+     {
          AssertFatal((getPosition() >= (U32)abs(position) && 0 > position) || 0 <= position, "File::setPosition: negative relative position");
 
          // position beyond EOS is OK
          finalPos = lseek(*((int *)handle), position, SEEK_CUR);
- 	break;
      }
 
      if (0xffffffff == finalPos)
@@ -1110,7 +1110,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
    if (dip == NULL)
      return false;
 
-   while (d = readdir(dip))
+   while ((d = readdir(dip)))
      {
 	bool isDir = false;
 	if (d->d_type == DT_UNKNOWN)
@@ -1229,14 +1229,14 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
    // Iterate through and grab valid directories
    //////////////////////////////////////////////////////////////////////////
 
-	while (d = readdir(dip))
+	while ((d = readdir(dip)))
 	{
 		bool	isDir;
 		isDir = false;
 		if (d->d_type == DT_UNKNOWN)
 		{
 			char child [1024];
-			if ((Path[dStrlen(Path) - 1] == '/'))
+			if (Path[dStrlen(Path) - 1] == '/')
 				dSprintf(child, 1024, "%s%s", Path, d->d_name);
 			else
 				dSprintf(child, 1024, "%s/%s", Path, d->d_name);

+ 1 - 1
Engine/source/renderInstance/renderImposterMgr.cpp

@@ -152,7 +152,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDefer
       // Setup a static index buffer for rendering.
       mIB.set( GFX, smImposterBatchSize * 6, 0, GFXBufferTypeStatic );
       U16 *idxBuff;
-      mIB.lock(&idxBuff, NULL, NULL, NULL);
+      mIB.lock(&idxBuff, NULL, 0, 0);
       for ( U32 i=0; i < smImposterBatchSize; i++ )
       {
          //

+ 1 - 1
Engine/source/renderInstance/renderPassStateToken.cpp

@@ -86,7 +86,7 @@ static const char *_get_enable(void* obj, const char* data)
 
 void RenderPassStateToken::initPersistFields()
 {
-   addProtectedField("enabled", TypeBool, NULL, &_set_enable, &_get_enable, "Enables or disables this token.");
+   addProtectedField("enabled", TypeBool, 0, &_set_enable, &_get_enable, "Enables or disables this token.");
    Parent::initPersistFields();
 }
 

+ 3 - 3
Engine/source/scene/mixin/scenePolyhedralObject.impl.h

@@ -44,15 +44,15 @@ void ScenePolyhedralObject< Base, P >::initPersistFields()
 {
    Parent::addGroup( "Internal" );
 
-      Parent::addProtectedField( "plane", TypeRealString, NULL,
+      Parent::addProtectedField( "plane", TypeRealString, 0,
          &_setPlane, &defaultProtectedGetFn,
          "For internal use only.",
          AbstractClassRep::FIELD_HideInInspectors );
-      Parent::addProtectedField( "point", TypeRealString, NULL,
+      Parent::addProtectedField( "point", TypeRealString, 0,
          &_setPoint, &defaultProtectedGetFn,
          "For internal use only.",
          AbstractClassRep::FIELD_HideInInspectors );
-      Parent::addProtectedField( "edge", TypeRealString, NULL,
+      Parent::addProtectedField( "edge", TypeRealString, 0,
          &_setEdge, &defaultProtectedGetFn,
          "For internal use only.",
          AbstractClassRep::FIELD_HideInInspectors );

+ 1 - 1
Engine/source/sim/actionMap.cpp

@@ -1962,7 +1962,7 @@ void ContextAction::processTick()
    if (mActive)
    {
       F32 currTime = Sim::getCurrentTime();
-      static const char *argv[2];
+      static const char *argv[3];
 
       //see if this key even is still active  
       if (!mBreakEvent)

+ 1 - 1
Engine/source/sim/actionMap.h

@@ -92,7 +92,7 @@ class ActionMap : public SimObject
       U32 deviceInst;
 
       Vector<Node> nodeMap;
-      DeviceMap():deviceType(NULL), deviceInst(NULL){
+      DeviceMap():deviceType(0), deviceInst(0){
          VECTOR_SET_ASSOCIATION(nodeMap);
       }
       ~DeviceMap();

+ 2 - 2
Engine/source/sim/netObject.cpp

@@ -407,7 +407,7 @@ DefineEngineMethod( NetObject, getClientObject, S32, (),,
 	if ( obj )
 		return obj->getId();
 	
-	return NULL;
+	return 0;
 }
 
 //ConsoleMethod( NetObject, getClientObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." )
@@ -439,7 +439,7 @@ DefineEngineMethod( NetObject, getServerObject, S32, (),,
 	if ( obj )
 		return obj->getId();
 	
-	return NULL;
+	return 0;
 }
 
 //ConsoleMethod( NetObject, getServerObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." )

+ 1 - 5
Engine/source/ts/tsShape.cpp

@@ -74,7 +74,7 @@ TSShape::TSShape()
    mRadius = 0;
    mFlags = 0;
    tubeRadius = 0;
-   data = NULL;
+   data = 0;
    materialList = NULL;
    mReadVersion = -1; // -1 means constructed from scratch (e.g., in exporter or no read yet)
    mSequencesConstructed = false;
@@ -225,11 +225,7 @@ const String& TSShape::getTargetName( S32 mapToNameIndex ) const
 
 S32 TSShape::getTargetCount() const
 {
-	if(!this)
-		return -1;
-
 	return materialList->getMaterialNameList().size();
-
 }
 
 S32 TSShape::findNode(S32 nameIndex) const

+ 1 - 1
Engine/source/ts/tsShapeConstruct.cpp

@@ -357,7 +357,7 @@ void TSShapeConstructor::initPersistFields()
    endGroup("Collada");
 
    addGroup("Sequences");
-   addProtectedField("sequence", TypeStringFilename, NULL, &addSequenceFromField, &emptyStringProtectedGetFn,
+   addProtectedField("sequence", TypeStringFilename, 0, &addSequenceFromField, &emptyStringProtectedGetFn,
       "Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n"
       "@tsexample\n"
       "singleton TSShapeConstructor(MyShapeDae)\n"