From 4d62541b62d7fe7cd420aecee9d68547f5b2a2aa Mon Sep 17 00:00:00 2001 From: Thoronador Date: Sun, 12 Oct 2014 23:26:03 +0200 Subject: [PATCH 1/2] fix usage of numeric_limits static functions min() and max() Functions min() and max() of std::numeric_limits are static and can therefore be accessed via class name and :: operator. --- apps/openmw/mwgui/dialogue.cpp | 2 +- apps/openmw/mwmechanics/actors.cpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 2 +- apps/openmw/mwscript/cellextensions.cpp | 2 +- apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwsound/loudness.cpp | 2 +- apps/openmw/mwworld/scene.cpp | 8 ++++---- components/esmterrain/storage.cpp | 4 ++-- components/widgets/numericeditbox.hpp | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 196e7d8c7..6526b200f 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -507,7 +507,7 @@ namespace MWGui mScrollBar->setVisible(true); } - BookTypesetter::Ptr typesetter = BookTypesetter::create (mHistory->getWidth(), std::numeric_limits().max()); + BookTypesetter::Ptr typesetter = BookTypesetter::create (mHistory->getWidth(), std::numeric_limits::max()); for (std::vector::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it) (*it)->write(typesetter, &mKeywordSearch, mTopicLinks); diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 9b66f7afb..a31e64dd3 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -220,7 +220,7 @@ namespace MWMechanics // Use the smallest soulgem that is large enough to hold the soul MWWorld::ContainerStore& container = caster.getClass().getContainerStore(caster); MWWorld::ContainerStoreIterator gem = container.end(); - float gemCapacity = std::numeric_limits().max(); + float gemCapacity = std::numeric_limits::max(); std::string soulgemFilter = "misc_soulgem"; // no other way to check for soulgems? :/ for (MWWorld::ContainerStoreIterator it = container.begin(MWWorld::ContainerStore::Type_Miscellaneous); it != container.end(); ++it) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index ae8bb3b2d..414e13cf6 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -515,7 +515,7 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue if (density == 0) { mFogStart = 0; - mFogEnd = std::numeric_limits().max(); + mFogEnd = std::numeric_limits::max(); mRendering.getCamera()->setFarClipDistance (max); } else diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index 94d734029..a568b7943 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -153,7 +153,7 @@ namespace MWScript if (cell->getCell()->hasWater()) runtime.push (cell->getWaterLevel()); else - runtime.push (-std::numeric_limits().max()); + runtime.push (-std::numeric_limits::max()); } }; diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index c43a010b4..cb02a6c97 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -438,7 +438,7 @@ namespace MWScript // If the objects are in different worldspaces, return a large value (just like vanilla) if (ref.getCell()->getCell()->getCellId().mWorldspace != ref2.getCell()->getCell()->getCellId().mWorldspace) - return std::numeric_limits().max(); + return std::numeric_limits::max(); double diff[3]; diff --git a/apps/openmw/mwsound/loudness.cpp b/apps/openmw/mwsound/loudness.cpp index ebe3bf1ec..c64913b1f 100644 --- a/apps/openmw/mwsound/loudness.cpp +++ b/apps/openmw/mwsound/loudness.cpp @@ -29,7 +29,7 @@ namespace MWSound else if (type == SampleType_Int16) { value = *reinterpret_cast(&data[sample*advance]); - value /= float(std::numeric_limits().max()); + value /= float(std::numeric_limits::max()); } else if (type == SampleType_Float32) { diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 66c9f5b71..6f18a6ef3 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -124,10 +124,10 @@ namespace MWWorld void Scene::getGridCenter(int &cellX, int &cellY) { - int maxX = std::numeric_limits().min(); - int maxY = std::numeric_limits().min(); - int minX = std::numeric_limits().max(); - int minY = std::numeric_limits().max(); + int maxX = std::numeric_limits::min(); + int maxY = std::numeric_limits::min(); + int minX = std::numeric_limits::max(); + int minY = std::numeric_limits::max(); CellStoreCollection::iterator iter = mActiveCells.begin(); while (iter!=mActiveCells.end()) { diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index c4152533e..3c76cc3b4 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -34,8 +34,8 @@ namespace ESMTerrain if (!land) return false; - min = std::numeric_limits().max(); - max = -std::numeric_limits().max(); + min = std::numeric_limits::max(); + max = -std::numeric_limits::max(); for (int row=0; row().min()), - mMaxValue(std::numeric_limits().max()) + : mValue(0), mMinValue(std::numeric_limits::min()), + mMaxValue(std::numeric_limits::max()) {} void initialiseOverride(); From 46496a35a12ccdc2eb82fcfbc2c88be84bce4b99 Mon Sep 17 00:00:00 2001 From: Thoronador Date: Sun, 12 Oct 2014 23:42:44 +0200 Subject: [PATCH 2/2] fix uninitialized pointer variable in CSVDoc::SubView class --- apps/opencs/view/doc/subview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/doc/subview.cpp b/apps/opencs/view/doc/subview.cpp index be03f91a5..ab4325cfc 100644 --- a/apps/opencs/view/doc/subview.cpp +++ b/apps/opencs/view/doc/subview.cpp @@ -2,7 +2,8 @@ #include "view.hpp" -CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id) +CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) + : mUniversalId (id), mParent (NULL) { /// \todo add a button to the title bar that clones this sub view