diff --git a/apps/essimporter/convertscpt.cpp b/apps/essimporter/convertscpt.cpp index ca81ebbbf..cb7947e40 100644 --- a/apps/essimporter/convertscpt.cpp +++ b/apps/essimporter/convertscpt.cpp @@ -11,6 +11,7 @@ namespace ESSImport { out.mId = Misc::StringUtils::lowerCase(scpt.mSCHD.mName.toString()); out.mRunning = scpt.mRunning; + out.mTargetRef.unset(); // TODO: convert target reference of global script convertSCRI(scpt.mSCRI, out.mLocals); } diff --git a/apps/essimporter/importinventory.cpp b/apps/essimporter/importinventory.cpp index dbf9ce0bd..e91c39452 100644 --- a/apps/essimporter/importinventory.cpp +++ b/apps/essimporter/importinventory.cpp @@ -19,6 +19,7 @@ namespace ESSImport item.mCount = contItem.mCount; item.mRelativeEquipmentSlot = -1; item.mLockLevel = 0; + item.mRefNum.unset(); unsigned int itemCount = std::abs(item.mCount); bool separateStacks = false; diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 319334c9b..4ccd2a06d 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -986,20 +986,6 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base mMetaData.setRecord (0, Record (RecordBase::State_ModifiedOnly, nullptr, &metaData)); } - // Fix uninitialized master data index - for (std::vector::const_iterator masterData = mReader->getGameFiles().begin(); - masterData != mReader->getGameFiles().end(); ++masterData) - { - std::map::iterator nameResult = mContentFileNames.find(masterData->name); - if (nameResult != mContentFileNames.end()) - { - ESM::Header::MasterData& hackedMasterData = const_cast(*masterData); - - - hackedMasterData.index = nameResult->second; - } - } - return mReader->getRecordCount(); } diff --git a/components/crashcatcher/crashcatcher.cpp b/components/crashcatcher/crashcatcher.cpp index b4b2a4a0c..e0a5c964f 100644 --- a/components/crashcatcher/crashcatcher.cpp +++ b/components/crashcatcher/crashcatcher.cpp @@ -150,6 +150,9 @@ static void gdb_info(pid_t pid) * So CoverityScan warning is valid only for ancient versions of stdlib. */ strcpy(respfile, "/tmp/gdb-respfile-XXXXXX"); +#ifdef __COVERITY__ + umask(0600); +#endif if((fd=mkstemp(respfile)) >= 0 && (f=fdopen(fd, "w")) != nullptr) { fprintf(f, "attach %d\n" diff --git a/components/esm/loadtes3.cpp b/components/esm/loadtes3.cpp index 84a31b3bd..d953f1dc2 100644 --- a/components/esm/loadtes3.cpp +++ b/components/esm/loadtes3.cpp @@ -42,7 +42,6 @@ void ESM::Header::load (ESMReader &esm) MasterData m; m.name = esm.getHString(); m.size = esm.getHNLong ("DATA"); - m.index = -1; mMaster.push_back (m); } diff --git a/components/esm/loadtes3.hpp b/components/esm/loadtes3.hpp index 5b26ac7d2..014e2a136 100644 --- a/components/esm/loadtes3.hpp +++ b/components/esm/loadtes3.hpp @@ -49,7 +49,6 @@ namespace ESM { std::string name; uint64_t size; - int index; // Position of the parent file in the global list of loaded files }; GMDT mGameData; // Used in .ess savegames only diff --git a/components/nif/data.cpp b/components/nif/data.cpp index 415a013b3..b6674611b 100644 --- a/components/nif/data.cpp +++ b/components/nif/data.cpp @@ -363,11 +363,11 @@ void NiSkinPartition::read(NIFStream *nif) void NiSkinPartition::Partition::read(NIFStream *nif) { - unsigned short numVertices = nif->getUShort(); - unsigned short numTriangles = nif->getUShort(); - unsigned short numBones = nif->getUShort(); - unsigned short numStrips = nif->getUShort(); - unsigned short bonesPerVertex = nif->getUShort(); + size_t numVertices = nif->getUShort(); + size_t numTriangles = nif->getUShort(); + size_t numBones = nif->getUShort(); + size_t numStrips = nif->getUShort(); + size_t bonesPerVertex = nif->getUShort(); if (numBones) nif->getUShorts(bones, numBones); @@ -395,7 +395,7 @@ void NiSkinPartition::Partition::read(NIFStream *nif) if (numStrips) { strips.resize(numStrips); - for (unsigned short i = 0; i < numStrips; i++) + for (size_t i = 0; i < numStrips; i++) nif->getUShorts(strips[i], stripLengths[i]); } else if (numTriangles) diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index c03bbca59..c9826c0e8 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -400,7 +400,7 @@ namespace SceneUtil class LightStateAttributePerObjectUniform : public osg::StateAttribute { public: - LightStateAttributePerObjectUniform() {} + LightStateAttributePerObjectUniform() : mLightManager(nullptr) {} LightStateAttributePerObjectUniform(const std::vector>& lights, LightManager* lightManager) : mLights(lights), mLightManager(lightManager) {} LightStateAttributePerObjectUniform(const LightStateAttributePerObjectUniform& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) @@ -613,7 +613,7 @@ namespace SceneUtil class LightManagerCullCallback : public osg::NodeCallback { public: - LightManagerCullCallback(LightManager* lightManager) : mLightManager(lightManager) {} + LightManagerCullCallback(LightManager* lightManager) : mLightManager(lightManager), mLastFrameNumber(0) {} void operator()(osg::Node* node, osg::NodeVisitor* nv) override { @@ -861,7 +861,7 @@ namespace SceneUtil if (ffp) { - initFFP(LightManager::mFFPMaxLights); + initFFP(mFFPMaxLights); return; } @@ -903,6 +903,10 @@ namespace SceneUtil , mLightingMask(copy.mLightingMask) , mSun(copy.mSun) , mLightingMethod(copy.mLightingMethod) + , mPointLightRadiusMultiplier(copy.mPointLightRadiusMultiplier) + , mPointLightFadeEnd(copy.mPointLightFadeEnd) + , mPointLightFadeStart(copy.mPointLightFadeStart) + , mMaxLights(copy.mMaxLights) { } @@ -1040,7 +1044,7 @@ namespace SceneUtil auto* stateset = getOrCreateStateSet(); setLightingMethod(LightingMethod::PerObjectUniform); - setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, LightManager::mMaxLightsUpperLimit)); + setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, mMaxLightsUpperLimit)); stateset->setAttributeAndModes(new LightManagerStateAttributePerObjectUniform(this), osg::StateAttribute::ON); stateset->addUniform(new osg::Uniform(osg::Uniform::FLOAT_MAT4, "LightBuffer", getMaxLights())); @@ -1049,7 +1053,7 @@ namespace SceneUtil void LightManager::initSingleUBO(int targetLights) { setLightingMethod(LightingMethod::SingleUBO); - setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, LightManager::mMaxLightsUpperLimit)); + setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, mMaxLightsUpperLimit)); for (int i = 0; i < 2; ++i) { diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index ca223ae3b..57b211e97 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -368,6 +368,7 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v pack_evt.yrel = 0; pack_evt.z = mMouseZ; pack_evt.zrel = 0; + pack_evt.timestamp = 0; if(evt.type == SDL_MOUSEMOTION) { diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index b0013538f..e8ac7d9c3 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -278,8 +278,7 @@ namespace Shader const osg::StateSet::AttributeList& attributes = stateset->getAttributeList(); osg::StateSet::AttributeList removedAttributes; - osg::ref_ptr removedState; - if (removedState = getRemovedState(*stateset)) + if (osg::ref_ptr removedState = getRemovedState(*stateset)) removedAttributes = removedState->getAttributeList(); for (const auto& attributeMap : { attributes, removedAttributes }) { @@ -475,8 +474,7 @@ namespace Shader writableStateSet->removeAttribute(osg::StateAttribute::PROGRAM); - osg::ref_ptr removedState; - if (removedState = getRemovedState(*writableStateSet)) + if (osg::ref_ptr removedState = getRemovedState(*writableStateSet)) { // user data is normally shallow copied so shared with the original stateset osg::ref_ptr writableUserData;