mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-31 19:20:26 +00:00
Merge branch 'coverity' into 'master'
Fix some Coverity issues See merge request OpenMW/openmw!2082
This commit is contained in:
commit
498a835b77
@ -68,7 +68,7 @@ namespace
|
||||
{
|
||||
if (isIndexedRefId(indexedRefId))
|
||||
{
|
||||
int refIndex;
|
||||
int refIndex = 0;
|
||||
std::string refId;
|
||||
splitIndexedRefId(indexedRefId, refIndex, refId);
|
||||
|
||||
@ -320,6 +320,8 @@ namespace ESSImport
|
||||
esm.startRecord(ESM::REC_CSTA);
|
||||
ESM::CellState csta;
|
||||
csta.mHasFogOfWar = 0;
|
||||
csta.mLastRespawn.mDay = 0;
|
||||
csta.mLastRespawn.mHour = 0;
|
||||
csta.mId = esmcell.getCellId();
|
||||
csta.mId.save(esm);
|
||||
// TODO csta.mLastRespawn;
|
||||
@ -352,7 +354,7 @@ namespace ESSImport
|
||||
}
|
||||
else
|
||||
{
|
||||
int refIndex;
|
||||
int refIndex = 0;
|
||||
splitIndexedRefId(cellref.mIndexedRefId, refIndex, out.mRefID);
|
||||
|
||||
std::string idLower = Misc::StringUtils::lowerCase(out.mRefID);
|
||||
@ -490,6 +492,7 @@ namespace ESSImport
|
||||
|
||||
out.mSpellId = it->mSPDT.mId.toString();
|
||||
out.mSpeed = pnam.mSpeed * 0.001f; // not sure where this factor comes from
|
||||
out.mSlot = 0;
|
||||
|
||||
esm.startRecord(ESM::REC_MPRJ);
|
||||
out.save(esm);
|
||||
|
@ -368,6 +368,7 @@ namespace ESSImport
|
||||
profile.mInGameTime.mGameHour = context.mHour;
|
||||
profile.mInGameTime.mMonth = context.mMonth;
|
||||
profile.mInGameTime.mYear = context.mYear;
|
||||
profile.mTimePlayed = 0;
|
||||
profile.mPlayerCell = header.mGameData.mCurrentCell.toString();
|
||||
if (context.mPlayerBase.mClass == "NEWCLASSID_CHARGEN")
|
||||
profile.mPlayerClassName = context.mCustomPlayerClassName;
|
||||
|
@ -21,6 +21,7 @@ void CSMDoc::Document::addGmsts()
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = CSMWorld::DefaultGmsts::Floats[i];
|
||||
gmst.mValue.setType (ESM::VT_Float);
|
||||
gmst.mRecordFlags = 0;
|
||||
gmst.mValue.setFloat (CSMWorld::DefaultGmsts::FloatsDefaultValues[i]);
|
||||
getData().getGmsts().add (gmst);
|
||||
}
|
||||
@ -30,6 +31,7 @@ void CSMDoc::Document::addGmsts()
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = CSMWorld::DefaultGmsts::Ints[i];
|
||||
gmst.mValue.setType (ESM::VT_Int);
|
||||
gmst.mRecordFlags = 0;
|
||||
gmst.mValue.setInteger (CSMWorld::DefaultGmsts::IntsDefaultValues[i]);
|
||||
getData().getGmsts().add (gmst);
|
||||
}
|
||||
@ -39,6 +41,7 @@ void CSMDoc::Document::addGmsts()
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = CSMWorld::DefaultGmsts::Strings[i];
|
||||
gmst.mValue.setType (ESM::VT_String);
|
||||
gmst.mRecordFlags = 0;
|
||||
gmst.mValue.setString ("");
|
||||
getData().getGmsts().add (gmst);
|
||||
}
|
||||
@ -164,6 +167,7 @@ void CSMDoc::Document::createBase()
|
||||
{
|
||||
ESM::Global record;
|
||||
record.mId = sGlobals[i];
|
||||
record.mRecordFlags = 0;
|
||||
record.mValue.setType (i==2 ? ESM::VT_Float : ESM::VT_Long);
|
||||
|
||||
if (i==0 || i==1)
|
||||
|
@ -1032,6 +1032,7 @@ void CSMWorld::Data::loadFallbackEntries()
|
||||
ESM::Static newMarker;
|
||||
newMarker.mId = marker.first;
|
||||
newMarker.mModel = marker.second;
|
||||
newMarker.mRecordFlags = 0;
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::Static>>();
|
||||
record->mBase = newMarker;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
@ -1046,6 +1047,7 @@ void CSMWorld::Data::loadFallbackEntries()
|
||||
ESM::Door newMarker;
|
||||
newMarker.mId = marker.first;
|
||||
newMarker.mModel = marker.second;
|
||||
newMarker.mRecordFlags = 0;
|
||||
auto record = std::make_unique<CSMWorld::Record<ESM::Door>>();
|
||||
record->mBase = newMarker;
|
||||
record->mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
|
@ -27,7 +27,10 @@ namespace CSMWorld
|
||||
const RefIdColumn *mType;
|
||||
const RefIdColumn *mBlocked;
|
||||
|
||||
BaseColumns () : mBlocked(nullptr) {}
|
||||
BaseColumns () : mId(nullptr)
|
||||
, mModified(nullptr)
|
||||
, mType(nullptr)
|
||||
, mBlocked(nullptr) {}
|
||||
};
|
||||
|
||||
/// \brief Base adapter for all refereceable record types
|
||||
|
@ -459,6 +459,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||
, mScriptBlacklistUse (true)
|
||||
, mNewGame (false)
|
||||
, mCfgMgr(configurationManager)
|
||||
, mGlMaxTextureImageUnits(0)
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); // We use only gamepads
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ public:
|
||||
|
||||
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
||||
{
|
||||
if (mNode != nullptr)
|
||||
if (mNode != nullptr && i->second != nullptr)
|
||||
i->second->destroyDrawItem (mNode);
|
||||
i->second.reset();
|
||||
}
|
||||
|
@ -494,6 +494,7 @@ namespace MWGui
|
||||
klass.mDescription = mCreateClassDialog->getDescription();
|
||||
klass.mData.mSpecialization = mCreateClassDialog->getSpecializationId();
|
||||
klass.mData.mIsPlayable = 0x1;
|
||||
klass.mRecordFlags = 0;
|
||||
|
||||
std::vector<int> attributes = mCreateClassDialog->getFavoriteAttributes();
|
||||
assert(attributes.size() == 2);
|
||||
|
@ -56,7 +56,7 @@ namespace MWRender
|
||||
postProcessor->getStateUpdater()->setEyePos(cv->getEyePoint());
|
||||
postProcessor->getStateUpdater()->setEyeVec(cv->getLookVectorLocal());
|
||||
|
||||
if (!postProcessor || !postProcessor->getFbo(PostProcessor::FBO_Primary, frameId))
|
||||
if (!postProcessor->getFbo(PostProcessor::FBO_Primary, frameId))
|
||||
{
|
||||
renderStage->setMultisampleResolveFramebufferObject(nullptr);
|
||||
renderStage->setFrameBufferObject(nullptr);
|
||||
|
@ -238,7 +238,7 @@ namespace MWRender
|
||||
}
|
||||
|
||||
mGLSLVersion = ext->glslLanguageVersion * 100;
|
||||
mUBO = ext && ext->isUniformBufferObjectSupported && mGLSLVersion >= 330;
|
||||
mUBO = ext->isUniformBufferObjectSupported && mGLSLVersion >= 330;
|
||||
mStateUpdater = new fx::StateUpdater(mUBO);
|
||||
|
||||
if (!Stereo::getStereo() && !SceneUtil::AutoDepth::isReversed() && !mSoftParticles && !mUsePostProcessing)
|
||||
|
@ -62,6 +62,7 @@ namespace MWWorld
|
||||
else
|
||||
params.mType = ESM::ActiveSpells::Type_Permanent;
|
||||
params.mWorsenings = -1;
|
||||
params.mNextWorsening = ESM::TimeStamp();
|
||||
int effectIndex = 0;
|
||||
for(const auto& enam : spell->mEffects.mList)
|
||||
{
|
||||
@ -131,6 +132,7 @@ namespace MWWorld
|
||||
params.mCasterActorId = creatureStats.mActorId;
|
||||
params.mType = ESM::ActiveSpells::Type_Enchantment;
|
||||
params.mWorsenings = -1;
|
||||
params.mNextWorsening = ESM::TimeStamp();
|
||||
for(std::size_t effectIndex = 0; effectIndex < oldMagnitudes.size() && effectIndex < enchantment->mEffects.mList.size(); ++effectIndex)
|
||||
{
|
||||
const auto& enam = enchantment->mEffects.mList[effectIndex];
|
||||
|
@ -11,17 +11,8 @@ namespace
|
||||
const T* base = list.find(name);
|
||||
|
||||
ESM::CellRef cellRef;
|
||||
cellRef.mRefNum.unset();
|
||||
cellRef.blank();
|
||||
cellRef.mRefID = name;
|
||||
cellRef.mScale = 1;
|
||||
cellRef.mFactionRank = 0;
|
||||
cellRef.mChargeInt = -1;
|
||||
cellRef.mChargeIntRemainder = 0.0f;
|
||||
cellRef.mGoldValue = 1;
|
||||
cellRef.mEnchantmentCharge = -1;
|
||||
cellRef.mTeleport = false;
|
||||
cellRef.mLockLevel = 0;
|
||||
cellRef.mReferenceBlocked = 0;
|
||||
|
||||
MWWorld::LiveCellRef<T> ref(cellRef, base);
|
||||
|
||||
|
@ -490,6 +490,7 @@ namespace MWWorld
|
||||
ESM::Global record;
|
||||
record.mId = params.first;
|
||||
record.mValue = params.second;
|
||||
record.mRecordFlags = 0;
|
||||
mStore.insertStatic(record);
|
||||
}
|
||||
}
|
||||
@ -509,6 +510,7 @@ namespace MWWorld
|
||||
ESM::Static record;
|
||||
record.mId = params.first;
|
||||
record.mModel = params.second;
|
||||
record.mRecordFlags = 0;
|
||||
mStore.insertStatic(record);
|
||||
}
|
||||
}
|
||||
@ -523,6 +525,7 @@ namespace MWWorld
|
||||
ESM::Door record;
|
||||
record.mId = params.first;
|
||||
record.mModel = params.second;
|
||||
record.mRecordFlags = 0;
|
||||
mStore.insertStatic(record);
|
||||
}
|
||||
}
|
||||
|
@ -511,6 +511,8 @@ namespace DetourNavigator
|
||||
const auto offMeshConnections = mOffMeshConnectionsManager.get().get(job.mChangedTile);
|
||||
|
||||
const PreparedNavMeshData* preparedNavMeshDataPtr = cachedNavMeshData ? &cachedNavMeshData.get() : preparedNavMeshData.get();
|
||||
assert (preparedNavMeshDataPtr != nullptr);
|
||||
|
||||
const UpdateNavMeshStatus status = navMeshCacheItem.lock()->updateTile(job.mChangedTile, std::move(cachedNavMeshData),
|
||||
makeNavMeshTileData(*preparedNavMeshDataPtr, offMeshConnections, job.mAgentBounds, job.mChangedTile, mSettings.get().mRecast));
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ESMWriter;
|
||||
|
||||
struct ContItem
|
||||
{
|
||||
int mCount;
|
||||
int mCount{0};
|
||||
std::string mItem;
|
||||
};
|
||||
|
||||
|
@ -104,7 +104,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
||||
BTXT base;
|
||||
if (reader.getExact(base))
|
||||
{
|
||||
assert(base.quadrant < 4 && base.quadrant >= 0 && "base texture quadrant index error");
|
||||
assert(base.quadrant < 4 && "base texture quadrant index error");
|
||||
|
||||
reader.adjustFormId(base.formId);
|
||||
mTextures[base.quadrant].base = std::move(base);
|
||||
@ -126,8 +126,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
||||
}
|
||||
reader.get(layer.texture);
|
||||
reader.adjustFormId(layer.texture.formId);
|
||||
assert(layer.texture.quadrant < 4 && layer.texture.quadrant >= 0
|
||||
&& "additional texture quadrant index error");
|
||||
assert(layer.texture.quadrant < 4 && "additional texture quadrant index error");
|
||||
#if 0
|
||||
FormId txt = layer.texture.formId;
|
||||
std::map<FormId, int>::iterator lb = uniqueTextures.lower_bound(txt);
|
||||
|
@ -56,11 +56,13 @@ namespace ESM4
|
||||
{
|
||||
|
||||
ReaderContext::ReaderContext() : modIndex(0), recHeaderSize(sizeof(RecordHeader)),
|
||||
filePos(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false)
|
||||
filePos(0), fileRead(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false)
|
||||
{
|
||||
currCellGrid.cellId = 0;
|
||||
currCellGrid.grid.x = 0;
|
||||
currCellGrid.grid.y = 0;
|
||||
subRecordHeader.typeId = 0;
|
||||
subRecordHeader.dataSize = 0;
|
||||
}
|
||||
|
||||
Reader::Reader(Files::IStreamPtr&& esmStream, const std::string& filename)
|
||||
|
@ -80,14 +80,17 @@ boost::filesystem::path LinuxPath::getGlobalConfigPath() const
|
||||
boost::filesystem::path LinuxPath::getLocalPath() const
|
||||
{
|
||||
boost::filesystem::path localPath("./");
|
||||
std::string binPath(pathconf(".", _PC_PATH_MAX), '\0');
|
||||
const char *statusPaths[] = {"/proc/self/exe", "/proc/self/file", "/proc/curproc/exe", "/proc/curproc/file"};
|
||||
|
||||
for(const char *path : statusPaths)
|
||||
{
|
||||
if (readlink(path, &binPath[0], binPath.size()) != -1)
|
||||
boost::filesystem::path statusPath(path);
|
||||
if (!boost::filesystem::exists(statusPath)) continue;
|
||||
|
||||
statusPath = boost::filesystem::read_symlink(statusPath);
|
||||
if (!boost::filesystem::is_empty(statusPath))
|
||||
{
|
||||
localPath = boost::filesystem::path(binPath).parent_path() / "/";
|
||||
localPath = statusPath.parent_path() / "/";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ namespace fx
|
||||
std::string mName;
|
||||
bool mLegacyGLSL;
|
||||
bool mUBO;
|
||||
bool mSupportsNormals;
|
||||
|
||||
std::array<std::string, 3> mRenderTargets;
|
||||
|
||||
|
@ -66,8 +66,8 @@ namespace fx
|
||||
void initialiseOverride() override;
|
||||
void notifyMouseButtonClick(MyGUI::Widget* sender);
|
||||
|
||||
MyGUI::Button* mCheckbutton;
|
||||
MyGUI::Widget* mFill;
|
||||
MyGUI::Button* mCheckbutton{nullptr};
|
||||
MyGUI::Widget* mFill{nullptr};
|
||||
};
|
||||
|
||||
template <class T, class UType>
|
||||
@ -236,11 +236,11 @@ namespace fx
|
||||
increment(uniform->mStep);
|
||||
}
|
||||
|
||||
MyGUI::Button* mButtonDecrease;
|
||||
MyGUI::Button* mButtonIncrease;
|
||||
MyGUI::Widget* mDragger;
|
||||
MyGUI::Widget* mFill;
|
||||
MyGUI::TextBox* mValueLabel;
|
||||
MyGUI::Button* mButtonDecrease{nullptr};
|
||||
MyGUI::Button* mButtonIncrease{nullptr};
|
||||
MyGUI::Widget* mDragger{nullptr};
|
||||
MyGUI::Widget* mFill{nullptr};
|
||||
MyGUI::TextBox* mValueLabel{nullptr};
|
||||
T mValue;
|
||||
|
||||
int mLastPointerX;
|
||||
@ -271,9 +271,9 @@ namespace fx
|
||||
|
||||
void initialiseOverride() override;
|
||||
|
||||
Gui::AutoSizedButton* mReset;
|
||||
Gui::AutoSizedTextBox* mLabel;
|
||||
MyGUI::Widget* mClient;
|
||||
Gui::AutoSizedButton* mReset{nullptr};
|
||||
Gui::AutoSizedTextBox* mLabel{nullptr};
|
||||
MyGUI::Widget* mClient{nullptr};
|
||||
std::vector<EditBase*> mBases;
|
||||
};
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ namespace LuaUi
|
||||
void textChange(MyGUI::EditBox*);
|
||||
|
||||
MyGUI::EditBox* mEditBox = nullptr;
|
||||
bool mMultiline;
|
||||
bool mAutoSize;
|
||||
bool mMultiline{false};
|
||||
bool mAutoSize{false};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace LuaUi
|
||||
|
||||
sol::object WidgetExtension::keyEvent(MyGUI::KeyCode code) const
|
||||
{
|
||||
SDL_Keysym keySym;
|
||||
auto keySym = SDL_Keysym();
|
||||
keySym.sym = SDLUtil::myGuiKeyToSdl(code);
|
||||
keySym.scancode = SDL_GetScancodeFromKey(keySym.sym);
|
||||
keySym.mod = SDL_GetModState();
|
||||
|
Loading…
x
Reference in New Issue
Block a user