From 1f26652944d0a04dc9716578dcddef6ed3b67de1 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 23 Dec 2017 14:07:03 +0100 Subject: [PATCH] Various zealous warning fixes (thanks Clang). --- imgui.cpp | 9 ++++----- imgui.h | 2 +- imgui_draw.cpp | 5 ++--- imgui_internal.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index dd580538c..26c3b698e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -586,7 +586,6 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_PLACEMENT_NEW #include "imgui_internal.h" #include // toupper, isprint @@ -3272,16 +3271,16 @@ void ImGui::RenderTriangle(ImVec2 p_min, ImGuiDir dir, float scale) switch (dir) { case ImGuiDir_Up: - r = -r; // ...fall through, no break! case ImGuiDir_Down: + if (dir == ImGuiDir_Up) r = -r; center.y -= r * 0.25f; a = ImVec2(0,1) * r; b = ImVec2(-0.866f,-0.5f) * r; c = ImVec2(+0.866f,-0.5f) * r; break; case ImGuiDir_Left: - r = -r; // ...fall through, no break! case ImGuiDir_Right: + if (dir == ImGuiDir_Left) r = -r; center.x -= r * 0.25f; a = ImVec2(1,0) * r; b = ImVec2(-0.500f,+0.866f) * r; @@ -10254,7 +10253,7 @@ static void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGui case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return; case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return; case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return; - default: return; // Fix warning for ImGuiDir_None + default: break; // Fix warning for ImGuiDir_None } } @@ -11491,7 +11490,7 @@ void ImGui::EndDragDropTarget() #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)) #undef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN -#include +#include #endif // Win32 API clipboard implementation diff --git a/imgui.h b/imgui.h index c313080ad..11213d69c 100644 --- a/imgui.h +++ b/imgui.h @@ -622,7 +622,7 @@ enum ImGuiFocusedFlags_ { ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy) - ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows, + ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows }; // Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 2ce3c0bdc..48500c7ce 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -15,7 +15,6 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_PLACEMENT_NEW #include "imgui_internal.h" #include // vsnprintf, sscanf, printf @@ -1254,8 +1253,8 @@ void ImGui::ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, con const ImVec2 size = b - a; const ImVec2 uv_size = uv_b - uv_a; const ImVec2 scale = ImVec2( - size.x ? (uv_size.x / size.x) : 0.0f, - size.y ? (uv_size.y / size.y) : 0.0f); + size.x != 0.0f ? (uv_size.x / size.x) : 0.0f, + size.y != 0.0f ? (uv_size.y / size.y) : 0.0f); if (clamp) { diff --git a/imgui_internal.h b/imgui_internal.h index 060b20041..1e0f8ae1f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -230,7 +230,7 @@ enum ImGuiAxis { ImGuiAxis_None = -1, ImGuiAxis_X = 0, - ImGuiAxis_Y = 1, + ImGuiAxis_Y = 1 }; enum ImGuiPlotType