Various fixes for CppCheck warnings.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
loadfix
Lukasz Gromanowski 11 years ago
parent 07f692bdd2
commit bfd79bfbe6

@ -24,7 +24,12 @@ namespace EsmTool
bool mPrintPlain; bool mPrintPlain;
public: public:
RecordBase () { mPrintPlain = false; } RecordBase ()
: mFlags(0)
, mPrintPlain(false)
{
}
virtual ~RecordBase() {} virtual ~RecordBase() {}
const std::string &getId() const { const std::string &getId() const {

@ -75,14 +75,8 @@ void Launcher::DataFilesPage::saveSettings(const QString &profile)
mLauncherSettings.setValue(QString("Profiles/currentprofile"), ui.profilesComboBox->currentText()); mLauncherSettings.setValue(QString("Profiles/currentprofile"), ui.profilesComboBox->currentText());
foreach(const ContentSelectorModel::EsmFile *item, items) { foreach(const ContentSelectorModel::EsmFile *item, items) {
mLauncherSettings.setMultiValue(QString("Profiles/") + profileName, item->fileName());
if (item->gameFiles().size() == 0) { mGameSettings.setMultiValue(QString("content"), item->fileName());
mLauncherSettings.setMultiValue(QString("Profiles/") + profileName, item->fileName());
mGameSettings.setMultiValue(QString("content"), item->fileName());
} else {
mLauncherSettings.setMultiValue(QString("Profiles/") + profileName, item->fileName());
mGameSettings.setMultiValue(QString("content"), item->fileName());
}
} }
} }

@ -7,8 +7,6 @@ namespace CSMFilter
{ {
class AndNode : public NAryNode class AndNode : public NAryNode
{ {
bool mAnd;
public: public:
AndNode (const std::vector<boost::shared_ptr<Node> >& nodes); AndNode (const std::vector<boost::shared_ptr<Node> >& nodes);

@ -7,8 +7,6 @@ namespace CSMFilter
{ {
class OrNode : public NAryNode class OrNode : public NAryNode
{ {
bool mAnd;
public: public:
OrNode (const std::vector<boost::shared_ptr<Node> >& nodes); OrNode (const std::vector<boost::shared_ptr<Node> >& nodes);

@ -61,11 +61,11 @@ namespace CSMFilter
bool isString() const; bool isString() const;
}; };
Token::Token (Type type) : mType (type) {} Token::Token (Type type) : mType (type), mNumber(0.0) {}
Token::Token (Type type, const std::string& string) : mType (type), mString (string) {} Token::Token (Type type, const std::string& string) : mType (type), mString (string), mNumber(0.0) {}
Token::Token (const std::string& string) : mType (Type_String), mString (string) {} Token::Token (const std::string& string) : mType (Type_String), mString (string), mNumber(0.0) {}
Token::Token (double number) : mType (Type_Number), mNumber (number) {} Token::Token (double number) : mType (Type_Number), mNumber (number) {}

@ -44,7 +44,11 @@ namespace CSMSettings
inline QStringPair *getValuePair() { return mValuePair; } inline QStringPair *getValuePair() { return mValuePair; }
/// set value range (spinbox / integer use) /// set value range (spinbox / integer use)
inline void setValuePair (QStringPair valuePair) { mValuePair = new QStringPair(valuePair); } inline void setValuePair (QStringPair valuePair)
{
delete mValuePair;
mValuePair = new QStringPair(valuePair);
}
inline bool isMultivalue () { return mIsMultiValue; } inline bool isMultivalue () { return mIsMultiValue; }

@ -37,6 +37,7 @@ MWMechanics::AiSequence& MWMechanics::AiSequence::operator= (const AiSequence& s
{ {
clear(); clear();
copy (sequence); copy (sequence);
mDone = sequence.mDone;
} }
return *this; return *this;

@ -1109,7 +1109,7 @@ void CharacterController::resurrect()
if(mAnimation) if(mAnimation)
mAnimation->disable(mCurrentDeath); mAnimation->disable(mCurrentDeath);
mCurrentDeath.empty(); mCurrentDeath.clear();
mDeathState = CharState_None; mDeathState = CharState_None;
} }

@ -473,7 +473,7 @@ void WeatherManager::update(float duration)
{ {
// pick a random sound // pick a random sound
int sound = rand() % 4; int sound = rand() % 4;
std::string* soundName; std::string* soundName = NULL;
if (sound == 0) soundName = &mThunderSoundID0; if (sound == 0) soundName = &mThunderSoundID0;
else if (sound == 1) soundName = &mThunderSoundID1; else if (sound == 1) soundName = &mThunderSoundID1;
else if (sound == 2) soundName = &mThunderSoundID2; else if (sound == 2) soundName = &mThunderSoundID2;

@ -214,7 +214,7 @@ namespace MWWorld
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (true), mCells (mStore, mEsm), mSky (true), mCells (mStore, mEsm),
mActivationDistanceOverride (mActivationDistanceOverride), mActivationDistanceOverride (mActivationDistanceOverride),
mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true), mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true), mLevitationEnabled(false),
mFacedDistance(FLT_MAX), mGodMode(false) mFacedDistance(FLT_MAX), mGodMode(false)
{ {
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);

@ -160,10 +160,10 @@ void Land::loadData(int flags)
} }
mEsm->restoreContext(mContext); mEsm->restoreContext(mContext);
memset(mLandData->mNormals, 0, LAND_NUM_VERTS * 3); memset(mLandData->mNormals, 0, sizeof(mLandData->mNormals));
if (mEsm->isNextSub("VNML")) { if (mEsm->isNextSub("VNML")) {
condLoad(actual, DATA_VNML, mLandData->mNormals, sizeof(VNML)); condLoad(actual, DATA_VNML, mLandData->mNormals, sizeof(mLandData->mNormals));
} }
if (mEsm->isNextSub("VHGT")) { if (mEsm->isNextSub("VHGT")) {

@ -72,13 +72,13 @@ struct Land
}; };
#pragma pack(pop) #pragma pack(pop)
typedef signed char VNML[LAND_NUM_VERTS * 3]; typedef signed char VNML;
struct LandData struct LandData
{ {
float mHeightOffset; float mHeightOffset;
float mHeights[LAND_NUM_VERTS]; float mHeights[LAND_NUM_VERTS];
VNML mNormals; VNML mNormals[LAND_NUM_VERTS * 3];
uint16_t mTextures[LAND_NUM_TEXTURES]; uint16_t mTextures[LAND_NUM_TEXTURES];
bool mUsingColours; bool mUsingColours;

@ -349,7 +349,7 @@ protected:
{ {
//strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
// and the null terminator isn't needed // and the null terminator isn't needed
for( int i=0; p[i] && i<*length; ++i ) { for( int i=0; i<*length && p[i]; ++i ) {
_value[i] = p[i]; _value[i] = p[i];
} }
return p + (*length); return p + (*length);

@ -819,6 +819,8 @@ namespace BtOgre {
*/ */
DynamicRenderable::DynamicRenderable() DynamicRenderable::DynamicRenderable()
: mVertexBufferCapacity(0)
, mIndexBufferCapacity(0)
{ {
} }

Loading…
Cancel
Save