From 4221b57baa7687d72f08d8c885badb93343c7edf Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 15 Dec 2012 16:46:20 -0800 Subject: [PATCH] Fix a whole bunch of clang warnings. --- Sources/Plasma/CoreLib/HeadSpin.cpp | 5 +++-- Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp | 2 +- Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp | 8 ++++---- Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h | 1 + Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp | 4 ++-- Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp | 2 +- Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h | 2 ++ Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp | 2 +- Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp | 2 +- Sources/Plasma/PubUtilLib/plPipeline/plPlates.h | 2 +- Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp | 6 ++++++ 11 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index 156242b6..b80cacc9 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -169,8 +169,7 @@ void DebugMsg(const char fmt[], ...) OutputDebugStringA("\n"); #endif } else { - fprintf(stderr, msg); - fprintf(stderr, "\n"); + fprintf(stderr, "%s\n", msg); } } @@ -315,6 +314,7 @@ int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char c } #endif + return hsMBoxCancel; } int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon) @@ -367,6 +367,7 @@ int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wch } #endif + return hsMBoxCancel; } int hsMessageBox(const char message[], const char caption[], int kind, int icon) diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp index 249650b5..90422247 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp @@ -90,7 +90,7 @@ void plLightModifier::AddTarget(plSceneObject* so) void plLightModifier::RemoveTarget(plSceneObject* so) { - if( so = fTarget ) + if ((so = fTarget)) fLight = nil; plSimpleModifier::RemoveTarget(so); } diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp index b2663d0a..c329ec71 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp @@ -510,11 +510,11 @@ void plWinAudible::DeActivate() bool plWinAudible::MsgReceive(plMessage* msg) { - plGenRefMsg *refMsg; - if (refMsg = plGenRefMsg::ConvertNoRef(msg)) + plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef(msg); + if (refMsg) { - plSound *snd; - if (snd = plSound::ConvertNoRef(refMsg->GetRef())) + plSound *snd = plSound::ConvertNoRef(refMsg->GetRef()); + if (snd) { int index = refMsg->fWhich; if( refMsg->GetContext() & (plRefMsg::kOnCreate | plRefMsg::kOnRequest) ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h index a9ec4135..41b2f544 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h @@ -94,6 +94,7 @@ protected: friend class plDynaDecalMgr; public: + virtual ~plDynaDecal() { } virtual bool Age(double t, float ramp, float decay, float life) = 0; }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp index 547207b5..c56b91bd 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp @@ -291,7 +291,7 @@ void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& c if( IsEmpty() ) return; - if( fCullFunc = cull ) + if((fCullFunc = cull)) IHarvestAndCullEnabledLeaves(fRoot, cache, list); else IHarvestEnabledLeaves(fRoot, cache, list); @@ -372,7 +372,7 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsBitVector& list) const { if( !IsEmpty() ) { - if( fCullFunc = cull ) + if((fCullFunc = cull)) IHarvestAndCullLeaves(fTree[fRoot], scratchTotVec, list); else IHarvestLeaves(fTree[fRoot], scratchTotVec, list); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp b/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp index 68edd122..dba495c8 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp @@ -191,7 +191,7 @@ plMipmap* plPNG::ReadFromFile(const wchar_t* fileName) hsUNIXStream in; if (!in.Open(fileName, L"rb")) { - return false; + return nil; } plMipmap* ret = IRead(&in); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h index 3821dd70..e0fb9fd3 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h @@ -99,6 +99,8 @@ public: kPositional = 0x80 }; + virtual ~plShadowSlave() { } + void SetFlag(SlaveFlag f, bool on) { if(on) fFlags |= f; else fFlags &= ~f; } bool HasFlag(SlaveFlag f) const { return 0 != (fFlags & f); } diff --git a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp index 93b25178..e7796b1b 100644 --- a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp +++ b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp @@ -246,7 +246,7 @@ plMipmap* plJPEG::ReadFromFile( const wchar_t *fileName ) hsRAMStream tempstream; hsUNIXStream in; if (!in.Open(fileName, L"rb")) - return false; + return nil; // The stream reader for JPEGs expects a 32-bit size at the start, // so insert that into the stream before passing it on diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp index 5245d130..4e6a4561 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp @@ -551,7 +551,7 @@ void plGraphPlate::SetDataColors( const std::vector & hexColors ) //// SetLabelText //////////////////////////////////////////////////////////// -void plGraphPlate::SetLabelText( char *text1, char *text2, char *text3, char *text4 ) +void plGraphPlate::SetLabelText(const char *text1, const char *text2, const char *text3, const char *text4 ) { std::vector strings; if( text1 != nil ) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h index 0179c10b..6d92eaaa 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h @@ -170,7 +170,7 @@ class plGraphPlate : public plPlate void SetDataRange( uint32_t min, uint32_t max, uint32_t width ); void SetDataLabels( uint32_t min, uint32_t max ); - void SetLabelText( char *text1, char *text2 = nil, char *text3 = nil, char *text4 = nil ); + void SetLabelText(const char *text1, const char *text2 = nil, const char *text3 = nil, const char *text4 = nil ); void SetLabelText( const std::vector & text ); void ClearData( void ); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index 0872328f..f97756a4 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -423,12 +423,18 @@ bool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream) ko = hsKeyedObject::ConvertNoRef(cre); if (ko != nil) + { kResMgrLog(4, ILog(4, " ...Creatable read and valid")); + } else + { kResMgrLog(3, ILog(3, " ...Creatable read from stream not keyed object!")); + } if (fProgressProc != nil) + { fProgressProc(plKey::Make(pKey)); + } } else {