From 17fb7aa5982207f4c918fadd8b582e5d65538e2c Mon Sep 17 00:00:00 2001 From: Thoronador Date: Sun, 26 Oct 2014 17:51:08 +0100 Subject: [PATCH 1/8] uninitialized stuff --- apps/opencs/model/world/refidadapterimp.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index d9a691abd..27406569b 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -223,7 +223,14 @@ void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdD } CSMWorld::CreatureColumns::CreatureColumns (const ActorColumns& actorColumns) -: ActorColumns (actorColumns) +: ActorColumns (actorColumns), + mType(NULL), + mSoul(NULL), + mScale(NULL), + mOriginal(NULL), + mCombat(NULL), + mMagic(NULL), + mStealth(NULL) {} CSMWorld::CreatureRefIdAdapter::CreatureRefIdAdapter (const CreatureColumns& columns) @@ -431,7 +438,15 @@ void CSMWorld::MiscRefIdAdapter::setData (const RefIdColumn *column, RefIdData& InventoryRefIdAdapter::setData (column, data, index, value); } -CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns) : ActorColumns (actorColumns) {} +CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns) +: ActorColumns (actorColumns), + mFlags(std::map()), + mRace(NULL), + mClass(NULL), + mFaction(NULL), + mHair(NULL), + mHead(NULL) +{} CSMWorld::NpcRefIdAdapter::NpcRefIdAdapter (const NpcColumns& columns) : ActorRefIdAdapter (UniversalId::Type_Npc, columns), mColumns (columns) @@ -587,4 +602,4 @@ void CSMWorld::WeaponRefIdAdapter::setData (const RefIdColumn *column, RefIdData else EnchantableRefIdAdapter::setData (column, data, index, value); } -} \ No newline at end of file +} From 91ff5364602f1aedc5e7ef49e4bf91f9d8bc2b42 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Sun, 26 Oct 2014 18:18:54 +0100 Subject: [PATCH 2/8] fix uninit, #2 --- apps/opencs/model/world/universalid.cpp | 1 + apps/opencs/view/doc/loader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/universalid.cpp b/apps/opencs/model/world/universalid.cpp index 190ea87d8..d19959d44 100644 --- a/apps/opencs/model/world/universalid.cpp +++ b/apps/opencs/model/world/universalid.cpp @@ -131,6 +131,7 @@ namespace } CSMWorld::UniversalId::UniversalId (const std::string& universalId) +: mIndex(0) { std::string::size_type index = universalId.find (':'); diff --git a/apps/opencs/view/doc/loader.cpp b/apps/opencs/view/doc/loader.cpp index ca7c93f9d..27dfd59e5 100644 --- a/apps/opencs/view/doc/loader.cpp +++ b/apps/opencs/view/doc/loader.cpp @@ -18,7 +18,7 @@ void CSVDoc::LoadingDocument::closeEvent (QCloseEvent *event) } CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document) -: mDocument (document), mAborted (false), mMessages (0) +: mDocument (document), mAborted (false), mMessages (0), mTotalRecords (0) { setWindowTitle (("Opening " + document->getSavePath().filename().string()).c_str()); @@ -199,4 +199,4 @@ void CSVDoc::Loader::loadMessage (CSMDoc::Document *document, const std::string& if (iter!=mDocuments.end()) iter->second->addMessage (message); -} \ No newline at end of file +} From 526fb1b37b8f19d472744927bc8a2b8ebf51b20d Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 00:45:50 +0100 Subject: [PATCH 3/8] fix uninitialized value in BillboardObject --- apps/openmw/mwrender/sky.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 131e12a5c..385e7d8c5 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -74,6 +74,7 @@ BillboardObject::BillboardObject( const String& textureName, const Vector3& position, SceneNode* rootNode, const std::string& material) +: mVisibility(1.0f) { SceneManager* sceneMgr = rootNode->getCreator(); From 87fac78823149c9fcc6c2c25e3e8be145593d254 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 01:01:37 +0100 Subject: [PATCH 4/8] fix uninitialized members in Cell and structures --- components/esm/loadcell.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index a24b106d4..33e4ce61e 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -70,15 +70,27 @@ struct Cell { int mFlags; int mX, mY; + + DATAstruct() : mFlags(0), mX(0), mY(0) {} }; struct AMBIstruct { Color mAmbient, mSunlight, mFog; float mFogDensity; + + AMBIstruct() : mAmbient(0), mSunlight(0), mFog(0), mFogDensity(0) {} }; - Cell() : mWater(0) {} + Cell() : mWater(0), + mName(""), + mRegion(""), + mData(DATAstruct()), + mAmbi(AMBIstruct()), + mWaterInt(false), + mMapColor(0), + mRefNumCounter(0) + {} // Interior cells are indexed by this (it's the 'id'), for exterior // cells it is optional. From 9cc219ff762e383425f474d9a8782e84d4cc753a Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 01:11:31 +0100 Subject: [PATCH 5/8] fix uninitialized members in Pathgrid::Point --- components/esm/loadpgrd.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/esm/loadpgrd.cpp b/components/esm/loadpgrd.cpp index 7fdc9a43c..61f56b511 100644 --- a/components/esm/loadpgrd.cpp +++ b/components/esm/loadpgrd.cpp @@ -8,18 +8,28 @@ namespace ESM { unsigned int Pathgrid::sRecordId = REC_PGRD; - Pathgrid::Point& Pathgrid::Point::operator=(const float rhs[3]) { + Pathgrid::Point& Pathgrid::Point::operator=(const float rhs[3]) + { mX = rhs[0]; mY = rhs[1]; mZ = rhs[2]; + mAutogenerated = 0; + mConnectionNum = 0; + mUnknown = 0; return *this; } - Pathgrid::Point::Point(const float rhs[3]) { + Pathgrid::Point::Point(const float rhs[3]) + : mAutogenerated(0), + mConnectionNum(0), + mUnknown(0) + { mX = rhs[0]; mY = rhs[1]; mZ = rhs[2]; } - Pathgrid::Point::Point():mX(0),mY(0),mZ(0) { + Pathgrid::Point::Point():mX(0),mY(0),mZ(0),mAutogenerated(0), + mConnectionNum(0),mUnknown(0) + { } void Pathgrid::load(ESMReader &esm) From 3b00a24f3fc0bdbe927944b258acb1c518524747 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 01:33:40 +0100 Subject: [PATCH 6/8] fix some uninitialized stuff in ShaderBasedRenderManager --- libs/openengine/gui/manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/openengine/gui/manager.cpp b/libs/openengine/gui/manager.cpp index 30a5b938c..512c7f069 100644 --- a/libs/openengine/gui/manager.cpp +++ b/libs/openengine/gui/manager.cpp @@ -103,6 +103,9 @@ public: mVertexProgramOneTexture(NULL), mFragmentProgramOneTexture(NULL) { + mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP; + mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP; + mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP; } void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene) From 44e01d0eaaad984e3a8014bbe7f7b4e6b19c6d12 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 02:23:10 +0100 Subject: [PATCH 7/8] remove redundant initialization statement See https://github.com/OpenMW/openmw/pull/423#discussion_r22403388 --- apps/opencs/model/world/refidadapterimp.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index 27406569b..47caa8d71 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -440,7 +440,6 @@ void CSMWorld::MiscRefIdAdapter::setData (const RefIdColumn *column, RefIdData& CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns) : ActorColumns (actorColumns), - mFlags(std::map()), mRace(NULL), mClass(NULL), mFaction(NULL), From 773669952b5baaba0cd8b1faae059a9f5a0b5314 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Fri, 2 Jan 2015 16:30:14 +0100 Subject: [PATCH 8/8] remove initializing constructors from "dumb structs" As suggested by Marc Zinnschlag: https://github.com/OpenMW/openmw/pull/423#issuecomment-68526701 --- components/esm/loadcell.hpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index 33e4ce61e..e1a6eee1a 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -70,23 +70,17 @@ struct Cell { int mFlags; int mX, mY; - - DATAstruct() : mFlags(0), mX(0), mY(0) {} }; struct AMBIstruct { Color mAmbient, mSunlight, mFog; float mFogDensity; - - AMBIstruct() : mAmbient(0), mSunlight(0), mFog(0), mFogDensity(0) {} }; Cell() : mWater(0), mName(""), mRegion(""), - mData(DATAstruct()), - mAmbi(AMBIstruct()), mWaterInt(false), mMapColor(0), mRefNumCounter(0)