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

This commit is contained in:
Robert MacGregor 2021-10-04 20:04:21 -04:00
parent ef514d0e6b
commit 1b6b803a20
61 changed files with 120 additions and 118 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -931,15 +931,6 @@ public:
return imagePath; 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; } void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
const String& getTargetModuleId() { return targetModuleId; } const String& getTargetModuleId() { return targetModuleId; }

View file

@ -318,10 +318,10 @@ void ConvexShape::initPersistFields()
addGroup( "Internal" ); addGroup( "Internal" );
addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn, addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors ); "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 ); "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
endGroup( "Internal" ); endGroup( "Internal" );

View file

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

View file

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

View file

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

View file

@ -116,7 +116,7 @@ class ShapeBaseConvex : public Convex
Box3F box; Box3F box;
public: 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) { ShapeBaseConvex(const ShapeBaseConvex& cv) {
mObject = cv.mObject; mObject = cv.mObject;
pShapeBase = cv.pShapeBase; pShapeBase = cv.pShapeBase;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -30,9 +30,9 @@
namespace Torque 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);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -647,7 +647,7 @@ void River::initPersistFields()
addGroup( "Internal" ); 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" ); endGroup( "Internal" );

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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.") "@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
{ {
if ( !obj) if ( !obj)
return NULL; return 0;
SimObject *inspector = GuiInspector::findByObject(obj); SimObject *inspector = GuiInspector::findByObject(obj);
if ( !inspector ) if ( !inspector )
return NULL; return 0;
return inspector->getId(); return inspector->getId();
} }

View file

@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields()
addGroup( "Animation" ); addGroup( "Animation" );
addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ), addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ),
"Index of the active thread, or -1 if none" ); "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)" ); "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" ); "Playback direction of the active thread" );
addProtectedField( "threadPingPong", TypeBool, NULL, &setFieldThreadPingPong, &getFieldThreadPingPong, addProtectedField( "threadPingPong", TypeBool, 0, &setFieldThreadPingPong, &getFieldThreadPingPong,
"'PingPong' mode of the active thread" ); "'PingPong' mode of the active thread" );
endGroup( "Animation" ); endGroup( "Animation" );

View file

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

View file

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

View file

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

View file

@ -70,7 +70,7 @@ protected:
GFXStateBlockRef mLitState[NUM_LIT_STATES][2]; GFXStateBlockRef mLitState[NUM_LIT_STATES][2];
public: 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 init( const FeatureSet &features, const GFXVertexFormat *vertexFormat );
virtual bool setupPass( SceneRenderState *state, const SceneData &sgData ); virtual bool setupPass( SceneRenderState *state, const SceneData &sgData );

View file

@ -682,9 +682,9 @@ bool blTerrainSystem::createPersistChunkFromProxy(SceneLighting::ObjectProxy* ob
{ {
*ret = new blTerrainChunk(); *ret = new blTerrainChunk();
return true; 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 // Given a ray, this will return the color from the lightmap of this object, return true if handled

View file

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

View file

@ -54,7 +54,7 @@ public:
inline F32 MRandomGenerator::randF() inline F32 MRandomGenerator::randF()
{ {
// default: multiply by 1/(2^31) // 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) inline S32 MRandomGenerator::randI(S32 i, S32 n)

View file

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

View file

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

View file

@ -241,7 +241,7 @@ namespace PlatformNetState
struct addrinfo* pickAddressByProtocol(struct addrinfo* addr, int protocol) 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) if (addr->ai_family == protocol)
return addr; return addr;

View file

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

View file

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

View file

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

View file

@ -86,7 +86,7 @@ static const char *_get_enable(void* obj, const char* data)
void RenderPassStateToken::initPersistFields() 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(); Parent::initPersistFields();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -357,7 +357,7 @@ void TSShapeConstructor::initPersistFields()
endGroup("Collada"); endGroup("Collada");
addGroup("Sequences"); 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" "Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n"
"@tsexample\n" "@tsexample\n"
"singleton TSShapeConstructor(MyShapeDae)\n" "singleton TSShapeConstructor(MyShapeDae)\n"