From 4dee8473b54919dcdf78b6bcd77f8dd8a00aa9fd Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Tue, 10 Nov 2015 17:06:37 -0600 Subject: [PATCH] Fixed a couple of problems found by CppCat code analyzer. * incorrect implementation of ImVec4 operator- which always gives a w value of 0 * boolean formula of ((A && B) || B) can be simplified to just (B) --- imgui.cpp | 2 +- imgui_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index b100aa2a..5315a7b8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5592,7 +5592,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display else { // Unframed typed for tree nodes - if ((held && hovered) || hovered) + if (hovered) RenderFrame(bb.Min, bb.Max, col, false); RenderCollapseTriangle(bb.Min + ImVec2(style.FramePadding.x, g.FontSize*0.15f), opened, 0.70f, false); if (g.LogEnabled) diff --git a/imgui_internal.h b/imgui_internal.h index 8e266b62..4a4b8478 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -117,7 +117,7 @@ static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } -static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); } +static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-rhs.w); } #endif static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; }