diff --git a/source/MaterialXGenShader/Syntax.cpp b/source/MaterialXGenShader/Syntax.cpp index 2917164417..8308f31ffa 100644 --- a/source/MaterialXGenShader/Syntax.cpp +++ b/source/MaterialXGenShader/Syntax.cpp @@ -151,7 +151,7 @@ string Syntax::getSwizzledVariable(const string& srcName, TypeDesc srcType, cons else { const size_t channelIndex = it->second; - if (channelIndex < 0 || channelIndex >= srcMembers.size()) + if (channelIndex >= srcMembers.size()) { throw ExceptionShaderGenError("Given channel index: '" + string(1, ch) + "' in channels pattern is incorrect for type '" + srcType.getName() + "'."); } @@ -197,7 +197,7 @@ ValuePtr Syntax::getSwizzledValue(ValuePtr value, TypeDesc srcType, const string else { const size_t channelIndex = it->second; - if (channelIndex < 0 || channelIndex >= srcMembers.size()) + if (channelIndex >= srcMembers.size()) { throw ExceptionShaderGenError("Given channel index: '" + string(1, ch) + "' in channels pattern is incorrect for type '" + srcType.getName() + "'."); } diff --git a/source/MaterialXRender/GeometryHandler.cpp b/source/MaterialXRender/GeometryHandler.cpp index dfea0b2ceb..f5cd02dcef 100644 --- a/source/MaterialXRender/GeometryHandler.cpp +++ b/source/MaterialXRender/GeometryHandler.cpp @@ -12,6 +12,13 @@ MATERIALX_NAMESPACE_BEGIN +namespace +{ + +const float MAX_FLOAT = std::numeric_limits::max(); + +} // anonymous namespace + void GeometryHandler::addLoader(GeometryLoaderPtr loader) { const StringSet& extensions = loader->supportedExtensions(); @@ -63,7 +70,6 @@ void GeometryHandler::getGeometry(MeshList& meshes, const string& location) void GeometryHandler::computeBounds() { - const float MAX_FLOAT = std::numeric_limits::max(); _minimumBounds = { MAX_FLOAT, MAX_FLOAT, MAX_FLOAT }; _maximumBounds = { -MAX_FLOAT, -MAX_FLOAT, -MAX_FLOAT }; for (const auto& mesh : _meshes) diff --git a/source/MaterialXRenderHw/SimpleWindowWindows.cpp b/source/MaterialXRenderHw/SimpleWindowWindows.cpp index 070950e682..64c36c80a1 100644 --- a/source/MaterialXRenderHw/SimpleWindowWindows.cpp +++ b/source/MaterialXRenderHw/SimpleWindowWindows.cpp @@ -111,9 +111,9 @@ SimpleWindow::~SimpleWindow() if (hWnd) { _windowWrapper->release(); + DestroyWindow(hWnd); } - DestroyWindow(hWnd); UnregisterClass(_windowClassName, GetModuleHandle(NULL)); }