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;
public:
RecordBase () { mPrintPlain = false; }
RecordBase ()
: mFlags(0)
, mPrintPlain(false)
{
}
virtual ~RecordBase() {}
const std::string &getId() const {

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

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

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

@ -61,11 +61,11 @@ namespace CSMFilter
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) {}
@ -614,4 +614,4 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::getFilter() const
throw std::logic_error ("No filter available");
return mFilter;
}
}

@ -44,7 +44,11 @@ namespace CSMSettings
inline QStringPair *getValuePair() { return mValuePair; }
/// 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; }

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

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

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

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

@ -160,10 +160,10 @@ void Land::loadData(int flags)
}
mEsm->restoreContext(mContext);
memset(mLandData->mNormals, 0, LAND_NUM_VERTS * 3);
memset(mLandData->mNormals, 0, sizeof(mLandData->mNormals));
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")) {

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

@ -349,7 +349,7 @@ protected:
{
//strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
// 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];
}
return p + (*length);

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

Loading…
Cancel
Save