From 801e2d6ad0f66ce9646c06ff6b73793c54349ce4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 9 Jan 2021 13:36:40 +0400 Subject: [PATCH] Avoid to use uninitialized variables --- apps/opencs/model/world/refidadapterimp.cpp | 2 +- apps/opencs/model/world/refidadapterimp.hpp | 2 +- components/files/constrainedfilestream.cpp | 2 +- components/nif/data.hpp | 10 +++++----- components/sceneutil/mwshadowtechnique.cpp | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index d85fcc068..d944adc23 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -10,7 +10,7 @@ #include "nestedtablewrapper.hpp" CSMWorld::PotionColumns::PotionColumns (const InventoryColumns& columns) -: InventoryColumns (columns) {} +: InventoryColumns (columns), mEffects(nullptr) {} CSMWorld::PotionRefIdAdapter::PotionRefIdAdapter (const PotionColumns& columns, const RefIdColumn *autoCalc) diff --git a/apps/opencs/model/world/refidadapterimp.hpp b/apps/opencs/model/world/refidadapterimp.hpp index 7695e9ace..a73f76af9 100644 --- a/apps/opencs/model/world/refidadapterimp.hpp +++ b/apps/opencs/model/world/refidadapterimp.hpp @@ -115,7 +115,7 @@ namespace CSMWorld { const RefIdColumn *mModel; - ModelColumns (const BaseColumns& base) : BaseColumns (base) {} + ModelColumns (const BaseColumns& base) : BaseColumns (base), mModel(nullptr) {} }; /// \brief Adapter for IDs with models (all but levelled lists) diff --git a/components/files/constrainedfilestream.cpp b/components/files/constrainedfilestream.cpp index baab1b081..b9968038d 100644 --- a/components/files/constrainedfilestream.cpp +++ b/components/files/constrainedfilestream.cpp @@ -21,7 +21,7 @@ namespace Files LowLevelFile mFile; - char mBuffer[sBufferSize]; + char mBuffer[sBufferSize]{0}; public: ConstrainedFileStreamBuf(const std::string &fname, size_t start, size_t length) diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 66a391afc..efbe138c5 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -71,7 +71,7 @@ struct NiParticlesData : public NiGeometryData { int numParticles{0}; - int activeCount; + int activeCount{0}; std::vector particleRadii, sizes, rotationAngles; std::vector rotations; @@ -119,14 +119,14 @@ struct NiPixelData : public Record NIPXFMT_DXT5, NIPXFMT_DXT5_ALT }; - Format fmt; + Format fmt{NIPXFMT_RGB8}; - unsigned int colorMask[4]; - unsigned int bpp, pixelTiling{0}; + unsigned int colorMask[4]{0}; + unsigned int bpp{0}, pixelTiling{0}; bool sRGB{false}; NiPalettePtr palette; - unsigned int numberOfMipmaps; + unsigned int numberOfMipmaps{0}; struct Mipmap { diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index c49a14777..294780cfd 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -785,6 +785,7 @@ MWShadowTechnique::MWShadowTechnique(): _debugHud(nullptr) { _shadowRecievingPlaceholderStateSet = new osg::StateSet; + mSetDummyStateWhenDisabled = false; } MWShadowTechnique::MWShadowTechnique(const MWShadowTechnique& vdsm, const osg::CopyOp& copyop): @@ -792,6 +793,7 @@ MWShadowTechnique::MWShadowTechnique(const MWShadowTechnique& vdsm, const osg::C { _shadowRecievingPlaceholderStateSet = new osg::StateSet; _enableShadows = vdsm._enableShadows; + mSetDummyStateWhenDisabled = vdsm.mSetDummyStateWhenDisabled; } MWShadowTechnique::~MWShadowTechnique()