From 6d351b2bddaea566066684157bbe285c712c8fac Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 21 Apr 2021 09:31:44 +0400 Subject: [PATCH] Fix MSVC 4706 warnings --- apps/openmw/mwrender/sky.cpp | 3 ++- components/bsa/compressedbsafile.cpp | 11 ++++++++++- components/interpreter/defines.cpp | 3 ++- components/nifbullet/bulletnifloader.cpp | 3 +-- components/nifosg/nifloader.cpp | 6 +++--- components/sceneutil/shadowsbin.cpp | 3 ++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index f0e8764709..67b24d60a4 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1315,7 +1315,8 @@ public: while (callback) { - if ((composite = dynamic_cast(callback))) + composite = dynamic_cast(callback); + if (composite) break; callback = callback->getNestedCallback(); diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index 0f3a26e159..09a05d2f5f 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -35,7 +35,16 @@ #include #include -#include + +#if defined(_MSC_VER) + #pragma warning (push) + #pragma warning (disable : 4706) + #include + #pragma warning (pop) +#else + #include +#endif + #include #include diff --git a/components/interpreter/defines.cpp b/components/interpreter/defines.cpp index 0ceed80d53..d2e7067c6c 100644 --- a/components/interpreter/defines.cpp +++ b/components/interpreter/defines.cpp @@ -176,7 +176,8 @@ namespace Interpreter{ transform(temp.begin(), temp.end(), temp.begin(), ::tolower); } - if((found = check(temp, globals[j], &i, &start))){ + found = check(temp, globals[j], &i, &start); + if(found){ char type = context.getGlobalType(globals[j]); switch(type){ diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index d72cef1940..72c740af38 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -126,8 +126,7 @@ osg::ref_ptr BulletNifLoader::load(const Nif::File& nif) { Nif::Record* r = nif.getRoot(i); assert(r != nullptr); - Nif::Node* node = nullptr; - if ((node = dynamic_cast(r))) + if (Nif::Node* node = dynamic_cast(r)) roots.emplace_back(node); } const std::string filename = nif.getFilename(); diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 5f083f9253..49d52074a5 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -312,8 +312,7 @@ namespace NifOsg for (size_t i = 0; i < numRoots; ++i) { const Nif::Record* r = nif->getRoot(i); - const Nif::Node* nifNode = nullptr; - if ((nifNode = dynamic_cast(r))) + if (const Nif::Node* nifNode = dynamic_cast(r)) roots.emplace_back(nifNode); } if (roots.empty()) @@ -609,7 +608,8 @@ namespace NifOsg bool hasVisController = false; for (Nif::ControllerPtr ctrl = nifNode->controller; !ctrl.empty(); ctrl = ctrl->next) { - if ((hasVisController |= (ctrl->recType == Nif::RC_NiVisController))) + hasVisController |= (ctrl->recType == Nif::RC_NiVisController); + if (hasVisController) break; } diff --git a/components/sceneutil/shadowsbin.cpp b/components/sceneutil/shadowsbin.cpp index 5a4096f5c3..abc1fa8b44 100644 --- a/components/sceneutil/shadowsbin.cpp +++ b/components/sceneutil/shadowsbin.cpp @@ -194,8 +194,9 @@ void ShadowsBin::sortImplementation() // noTestRoot is now a stategraph with useDiffuseMapForShadowAlpha disabled but minimal other state bool cullFaceOverridden = false; - while ((root = root->_parent)) + while (root->_parent) { + root = root->_parent; if (!root->getStateSet()) continue; unsigned int cullFaceFlags = root->getStateSet()->getMode(GL_CULL_FACE);