Merge pull request #1779 from akortunov/coverity

Fix some code coverity issues
pull/456/head
Bret Curtis 7 years ago committed by GitHub
commit a0cae78cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -158,7 +158,9 @@ namespace MWGui
getWidget(mCrosshair, "Crosshair"); getWidget(mCrosshair, "Crosshair");
LocalMapBase::init(mMinimap, mCompass, Settings::Manager::getInt("local map hud widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); int mapSize = std::max(1, Settings::Manager::getInt("local map hud widget size", "Map"));
int cellDistance = std::max(1, Settings::Manager::getInt("local map cell distance", "Map"));
LocalMapBase::init(mMinimap, mCompass, mapSize, cellDistance);
mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked); mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver); mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);

@ -679,7 +679,9 @@ namespace MWGui
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart); mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked);
LocalMapBase::init(mLocalMap, mPlayerArrowLocal, Settings::Manager::getInt("local map widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); int mapSize = std::max(1, Settings::Manager::getInt("local map widget size", "Map"));
int cellDistance = std::max(1, Settings::Manager::getInt("local map cell distance", "Map"));
LocalMapBase::init(mLocalMap, mPlayerArrowLocal, mapSize, cellDistance);
mGlobalMap->setVisible(mGlobal); mGlobalMap->setVisible(mGlobal);
mLocalMap->setVisible(!mGlobal); mLocalMap->setVisible(!mGlobal);

@ -240,6 +240,10 @@ namespace MWScript
char type = declarations.getType (iter->first); char type = declarations.getType (iter->first);
int index2 = declarations.getIndex (iter->first); int index2 = declarations.getIndex (iter->first);
// silently ignore locals that don't exist anymore
if (type == ' ' || index2 == -1)
continue;
try try
{ {
switch (type) switch (type)
@ -247,8 +251,6 @@ namespace MWScript
case 's': mShorts.at (index2) = iter->second.getInteger(); break; case 's': mShorts.at (index2) = iter->second.getInteger(); break;
case 'l': mLongs.at (index2) = iter->second.getInteger(); break; case 'l': mLongs.at (index2) = iter->second.getInteger(); break;
case 'f': mFloats.at (index2) = iter->second.getFloat(); break; case 'f': mFloats.at (index2) = iter->second.getFloat(); break;
// silently ignore locals that don't exist anymore
} }
} }
catch (...) catch (...)

@ -387,7 +387,7 @@ private:
OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder) OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder)
: mSource(src), mCurrentBufIdx(0), mFormat(AL_NONE), mSampleRate(0) : mSource(src), mCurrentBufIdx(0), mFormat(AL_NONE), mSampleRate(0)
, mBufferSize(0), mFrameSize(0), mSilence(0), mDecoder(std::move(decoder)) , mBufferSize(0), mFrameSize(0), mSilence(0), mDecoder(std::move(decoder))
, mLoudnessAnalyzer(nullptr) , mLoudnessAnalyzer(nullptr), mIsFinished(true)
{ {
mBuffers.fill(0); mBuffers.fill(0);
} }

@ -1179,8 +1179,8 @@ namespace MWWorld
} }
else else
{ {
bool currCellActive = mWorldScene->isCellActive(*currCell); bool currCellActive = currCell && mWorldScene->isCellActive(*currCell);
bool newCellActive = mWorldScene->isCellActive(*newCell); bool newCellActive = newCell && mWorldScene->isCellActive(*newCell);
if (!currCellActive && newCellActive) if (!currCellActive && newCellActive)
{ {
newPtr = currCell->moveTo(ptr, newCell); newPtr = currCell->moveTo(ptr, newCell);

@ -83,7 +83,12 @@ struct Land
struct LandData struct LandData
{ {
LandData() LandData()
: mDataLoaded(0) : mHeightOffset(0)
, mMinHeight(0)
, mMaxHeight(0)
, mUnk1(0)
, mUnk2(0)
, mDataLoaded(0)
{ {
} }

@ -36,7 +36,10 @@ struct Pathgrid
Point& operator=(const float[3]); Point& operator=(const float[3]);
Point(const float[3]); Point(const float[3]);
Point(); Point();
Point(int x, int y, int z) : mX(x), mY(y), mZ(z) {} Point(int x, int y, int z)
: mX(x), mY(y), mZ(z)
, mAutogenerated(0), mConnectionNum(0), mUnknown(0)
{}
}; // 16 bytes }; // 16 bytes
struct Edge // path grid edge struct Edge // path grid edge

@ -34,7 +34,9 @@ namespace ESM
ESM::AnimationState mAnimationState; ESM::AnimationState mAnimationState;
ObjectState() : mHasCustomState(true), mVersion(0) ObjectState()
: mHasLocals(0), mEnabled(0), mCount(0)
, mFlags(0), mHasCustomState(true), mVersion(0)
{} {}
/// @note Does not load the CellRef ID, it should already be loaded before calling this method /// @note Does not load the CellRef ID, it should already be loaded before calling this method

@ -24,6 +24,8 @@ namespace ESMTerrain
}; };
LandObject::LandObject() LandObject::LandObject()
: mLand(nullptr)
, mLoadFlags(0)
{ {
} }

@ -61,6 +61,7 @@ QuadTreeNode::QuadTreeNode(QuadTreeNode* parent, ChildDirection direction, float
, mValidBounds(false) , mValidBounds(false)
, mSize(size) , mSize(size)
, mCenter(center) , mCenter(center)
, mViewDataMap(nullptr)
{ {
for (unsigned int i=0; i<4; ++i) for (unsigned int i=0; i<4; ++i)
mNeighbours[i] = 0; mNeighbours[i] = 0;

@ -8,6 +8,7 @@ namespace Gui
WindowCaption::WindowCaption() WindowCaption::WindowCaption()
: mLeft(NULL) : mLeft(NULL)
, mRight(NULL) , mRight(NULL)
, mClient(NULL)
{ {
} }

Loading…
Cancel
Save