Skip to content

Commit

Permalink
Merge pull request #406 from dottools/PRfixBuildWarnings
Browse files Browse the repository at this point in the history
Fix general compiler warnings
  • Loading branch information
greenfire27 committed Feb 5, 2018
2 parents 1b16cbf + fec28e4 commit 6c59203
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions engine/source/2d/core/SpriteBatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ U32 SpriteBatch::getSpriteImageFrame( void ) const
{
// Finish if a sprite is not selected.
if ( !checkSpriteSelected() )
return NULL;
return 0;

// Get image frame.
return mSelectedSprite->getImageFrame();
Expand Down Expand Up @@ -611,7 +611,7 @@ U32 SpriteBatch::getSpriteAnimationFrame(void) const
{
// Finish if a sprite is not selected.
if (!checkSpriteSelected())
return NULL;
return 0;

// Get image frame.
return mSelectedSprite->getAnimationFrame();
Expand Down
8 changes: 4 additions & 4 deletions engine/source/2d/core/Vector2_ScriptBinding.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ConsoleFunctionWithDocs( Vector2Compare, ConsoleBool, 3, 4, (Vector2 p1, Vector2
if (Utility::mGetStringElementCount(argv[1]) < 2 ||Utility::mGetStringElementCount(argv[2]) < 2 )
{
Con::warnf("Vector2Compare() - Invalid number of parameters!");
return NULL;
return false;
}

Vector2 p1( argv[1] );
Expand All @@ -228,7 +228,7 @@ ConsoleFunctionWithDocs( Vector2Distance, ConsoleFloat, 3, 3, (Vector2 p1, Vecto
if (Utility::mGetStringElementCount(argv[1]) < 2 ||Utility::mGetStringElementCount(argv[2]) < 2 )
{
Con::warnf("Vector2Distance() - Invalid number of parameters!");
return NULL;
return false;
}

Vector2 p1( argv[1] );
Expand All @@ -247,7 +247,7 @@ ConsoleFunctionWithDocs( Vector2AngleBetween, ConsoleFloat, 3, 3, (Vector2 v1, V
if (Utility::mGetStringElementCount(argv[1]) < 2 ||Utility::mGetStringElementCount(argv[2]) < 2 )
{
Con::warnf("t2dAngleBetween() - Invalid number of parameters!");
return NULL;
return false;
}

Vector2 v1( argv[1] );
Expand All @@ -269,7 +269,7 @@ ConsoleFunctionWithDocs( Vector2AngleToPoint, ConsoleFloat, 3, 3, (Vector2 p1, V
if (Utility::mGetStringElementCount(argv[1]) < 2 ||Utility::mGetStringElementCount(argv[2]) < 2 )
{
Con::warnf("t2dAngleToPoint() - Invalid number of parameters!");
return NULL;
return false;
}

Vector2 p1( argv[1] );
Expand Down
28 changes: 14 additions & 14 deletions engine/source/2d/sceneobject/SceneObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,35 +293,35 @@ void SceneObject::initPersistFields()
addProtectedField("Size", TypeVector2, Offset( mSize, SceneObject), &setSize, &defaultProtectedGetFn, &writeSize, "");

/// Position / Angle.
addProtectedField("Position", TypeVector2, NULL, &setPosition, &getPosition, &writePosition, "");
addProtectedField("Angle", TypeF32, NULL, &setAngle, &getAngle, &writeAngle, "");
addProtectedField("FixedAngle", TypeBool, NULL, &setFixedAngle, &getFixedAngle, &writeFixedAngle, "");
addProtectedField("Position", TypeVector2, 0, &setPosition, &getPosition, &writePosition, "");
addProtectedField("Angle", TypeF32, 0, &setAngle, &getAngle, &writeAngle, "");
addProtectedField("FixedAngle", TypeBool, 0, &setFixedAngle, &getFixedAngle, &writeFixedAngle, "");

/// Body.
addProtectedField("BodyType", TypeEnum, NULL, &setBodyType, &getBodyType, &writeBodyType, 1, &bodyTypeTable, "" );
addProtectedField("Active", TypeBool, NULL, &setActive, &getActive, &writeActive, "" );
addProtectedField("Awake", TypeBool, NULL, &setAwake, &getAwake, &writeAwake, "" );
addProtectedField("Bullet", TypeBool, NULL, &setBullet, &getBullet, &writeBullet, "" );
addProtectedField("SleepingAllowed", TypeBool, NULL, &setSleepingAllowed, &getSleepingAllowed, &writeSleepingAllowed, "" );
addProtectedField("BodyType", TypeEnum, 0, &setBodyType, &getBodyType, &writeBodyType, 1, &bodyTypeTable, "" );
addProtectedField("Active", TypeBool, 0, &setActive, &getActive, &writeActive, "" );
addProtectedField("Awake", TypeBool, 0, &setAwake, &getAwake, &writeAwake, "" );
addProtectedField("Bullet", TypeBool, 0, &setBullet, &getBullet, &writeBullet, "" );
addProtectedField("SleepingAllowed", TypeBool, 0, &setSleepingAllowed, &getSleepingAllowed, &writeSleepingAllowed, "" );

/// Collision control.
addProtectedField("CollisionGroups", TypeS32, Offset(mCollisionGroupMask, SceneObject), &setCollisionGroups, &getCollisionGroups, &writeCollisionGroups, "");
addProtectedField("CollisionLayers", TypeS32, Offset(mCollisionLayerMask, SceneObject), &setCollisionLayers, &getCollisionLayers, &writeCollisionLayers, "");
addField("CollisionSuppress", TypeBool, Offset(mCollisionSuppress, SceneObject), &writeCollisionSuppress, "");
addField("CollisionOneWay", TypeBool, Offset(mCollisionOneWay, SceneObject), &writeCollisionOneWay, "");
addProtectedField("GatherContacts", TypeBool, NULL, &setGatherContacts, &defaultProtectedGetFn, &writeGatherContacts, "");
addProtectedField("GatherContacts", TypeBool, 0, &setGatherContacts, &defaultProtectedGetFn, &writeGatherContacts, "");
addProtectedField("DefaultDensity", TypeF32, Offset( mDefaultFixture.density, SceneObject), &setDefaultDensity, &defaultProtectedGetFn, &writeDefaultDensity, "");
addProtectedField("DefaultFriction", TypeF32, Offset( mDefaultFixture.friction, SceneObject), &setDefaultFriction, &defaultProtectedGetFn, &writeDefaultFriction, "");
addProtectedField("DefaultRestitution", TypeF32, Offset( mDefaultFixture.restitution, SceneObject), &setDefaultRestitution, &defaultProtectedGetFn, &writeDefaultRestitution, "");

/// Velocities.
addProtectedField("LinearVelocity", TypeVector2, NULL, &setLinearVelocity, &getLinearVelocity, &writeLinearVelocity, "");
addProtectedField("AngularVelocity", TypeF32, NULL, &setAngularVelocity, &getAngularVelocity, &writeAngularVelocity, "");
addProtectedField("LinearDamping", TypeF32, NULL, &setLinearDamping, &getLinearDamping, &writeLinearDamping, "");
addProtectedField("AngularDamping", TypeF32, NULL, &setAngularDamping, &getAngularDamping, &writeAngularDamping, "");
addProtectedField("LinearVelocity", TypeVector2, 0, &setLinearVelocity, &getLinearVelocity, &writeLinearVelocity, "");
addProtectedField("AngularVelocity", TypeF32, 0, &setAngularVelocity, &getAngularVelocity, &writeAngularVelocity, "");
addProtectedField("LinearDamping", TypeF32, 0, &setLinearDamping, &getLinearDamping, &writeLinearDamping, "");
addProtectedField("AngularDamping", TypeF32, 0, &setAngularDamping, &getAngularDamping, &writeAngularDamping, "");

/// Gravity scaling.
addProtectedField("GravityScale", TypeF32, NULL, &setGravityScale, &getGravityScale, &writeGravityScale, "");
addProtectedField("GravityScale", TypeF32, 0, &setGravityScale, &getGravityScale, &writeGravityScale, "");

/// Render visibility.
addField("Visible", TypeBool, Offset(mVisible, SceneObject), &writeVisible, "");
Expand Down
2 changes: 1 addition & 1 deletion engine/source/2d/sceneobject/SceneObject_ScriptBinding.h
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,7 @@ ConsoleMethodWithDocs(SceneObject, getCollisionShapeArea, ConsoleFloat, 3, 3, (i
if ( shapeIndex >= shapeCount )
{
Con::warnf("SceneObject::getCollisionShapeArea() - Invalid shape index of %d.", shapeIndex);
return NULL;
return 0.0f;
}

// Calculate area if the shape type is circle
Expand Down
4 changes: 2 additions & 2 deletions engine/source/2d/sceneobject/SkeletonObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ void SkeletonObject::initPersistFields()
addProtectedField("Asset", TypeSkeletonAssetPtr, Offset(mSkeletonAsset, SkeletonObject), &setSkeletonAsset, &getSkeletonAsset, &writeSkeletonAsset, "The skeleton asset ID used for the skeleton.");
addProtectedField("AnimationName", TypeString, Offset(mCurrentAnimation, SkeletonObject), &setAnimationName, &getAnimationName, &writeAnimationName, "The animation name to play.");
addProtectedField("Skin", TypeString, Offset(mCurrentSkin, SkeletonObject), &setCurrentSkin, &getCurrentSkin, &writeCurrentSkin, "The skin to use.");
addProtectedField("RootBoneScale", TypeVector2, NULL, &setRootBoneScale, &getRootBoneScale, &writeRootBoneScale, "Scaling of the skeleton's root bone");
addProtectedField("RootBoneOffset", TypeVector2, NULL, &setRootBoneOffset, &getRootBoneOffset, &writeRootBoneOffset, "X/Y offset of the skeleton's root bone");
addProtectedField("RootBoneScale", TypeVector2, 0, &setRootBoneScale, &getRootBoneScale, &writeRootBoneScale, "Scaling of the skeleton's root bone");
addProtectedField("RootBoneOffset", TypeVector2, 0, &setRootBoneOffset, &getRootBoneOffset, &writeRootBoneOffset, "X/Y offset of the skeleton's root bone");
addProtectedField("AnimationCycle", TypeBool, Offset(mAnimationCycle, SkeletonObject), &setAnimationCycle, &defaultProtectedGetFn, &writeAnimationCycle, "Whether the animation loops or not");
addField("FlipX", TypeBool, Offset(mFlipX, SkeletonObject), &writeFlipX, "");
addField("FlipY", TypeBool, Offset(mFlipY, SkeletonObject), &writeFlipY, "");
Expand Down
4 changes: 2 additions & 2 deletions engine/source/Box2D/Collision/Shapes/b2ChainShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ inline b2ChainShape::b2ChainShape()
m_radius = b2_polygonRadius;
m_vertices = NULL;
m_count = 0;
m_hasPrevVertex = NULL;
m_hasNextVertex = NULL;
m_hasPrevVertex = false;
m_hasNextVertex = false;
}

#endif
2 changes: 1 addition & 1 deletion engine/source/gui/guiTextEditCtrl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool GuiTextEditCtrl::onAdd()
}
}

if( mText && mText[0] )
if( mText[0] )
{
setText(mText);
}
Expand Down
2 changes: 1 addition & 1 deletion engine/source/io/fileObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool FileObject::openForWrite(const char *fileName, const bool append)

close();

if(buffer == NULL || *buffer == 0)
if(*buffer == 0)
return false;

if ( !append )
Expand Down
2 changes: 1 addition & 1 deletion engine/source/io/fileSystem_ScriptBinding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ ConsoleFunctionWithDocs(isWriteableFileName, ConsoleBool, 2, 2, (fileName))
char filename[1024];
Con::expandPath(filename, sizeof(filename), argv[1]);

if (filename == NULL || *filename == 0)
if (*filename == 0)
return false;

// in a writeable directory?
Expand Down
2 changes: 1 addition & 1 deletion engine/source/persistence/SimXMLDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ S32 SimXMLDocument::saveFile(const char* rFileName)
char buffer[1024];
Con::expandPath(buffer, sizeof(buffer), rFileName);

if(buffer == NULL || *buffer == 0)
if(*buffer == 0)
return false;

FileStream strm;
Expand Down

0 comments on commit 6c59203

Please sign in to comment.