1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Various zealous warning fixes (thanks Clang).

This commit is contained in:
omar 2017-12-23 14:07:03 +01:00
parent cf9b893841
commit 1f26652944
4 changed files with 8 additions and 10 deletions

View File

@ -586,7 +586,6 @@
#include "imgui.h" #include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_PLACEMENT_NEW
#include "imgui_internal.h" #include "imgui_internal.h"
#include <ctype.h> // toupper, isprint #include <ctype.h> // toupper, isprint
@ -3272,16 +3271,16 @@ void ImGui::RenderTriangle(ImVec2 p_min, ImGuiDir dir, float scale)
switch (dir) switch (dir)
{ {
case ImGuiDir_Up: case ImGuiDir_Up:
r = -r; // ...fall through, no break!
case ImGuiDir_Down: case ImGuiDir_Down:
if (dir == ImGuiDir_Up) r = -r;
center.y -= r * 0.25f; center.y -= r * 0.25f;
a = ImVec2(0,1) * r; a = ImVec2(0,1) * r;
b = ImVec2(-0.866f,-0.5f) * r; b = ImVec2(-0.866f,-0.5f) * r;
c = ImVec2(+0.866f,-0.5f) * r; c = ImVec2(+0.866f,-0.5f) * r;
break; break;
case ImGuiDir_Left: case ImGuiDir_Left:
r = -r; // ...fall through, no break!
case ImGuiDir_Right: case ImGuiDir_Right:
if (dir == ImGuiDir_Left) r = -r;
center.x -= r * 0.25f; center.x -= r * 0.25f;
a = ImVec2(1,0) * r; a = ImVec2(1,0) * r;
b = ImVec2(-0.500f,+0.866f) * 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_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_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; 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)) #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <Windows.h>
#endif #endif
// Win32 API clipboard implementation // Win32 API clipboard implementation

View File

@ -622,7 +622,7 @@ enum ImGuiFocusedFlags_
{ {
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused 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_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() // Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()

View File

@ -15,7 +15,6 @@
#include "imgui.h" #include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_PLACEMENT_NEW
#include "imgui_internal.h" #include "imgui_internal.h"
#include <stdio.h> // vsnprintf, sscanf, printf #include <stdio.h> // vsnprintf, sscanf, printf
@ -1254,8 +1253,8 @@ void ImGui::ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, con
const ImVec2 size = b - a; const ImVec2 size = b - a;
const ImVec2 uv_size = uv_b - uv_a; const ImVec2 uv_size = uv_b - uv_a;
const ImVec2 scale = ImVec2( const ImVec2 scale = ImVec2(
size.x ? (uv_size.x / size.x) : 0.0f, size.x != 0.0f ? (uv_size.x / size.x) : 0.0f,
size.y ? (uv_size.y / size.y) : 0.0f); size.y != 0.0f ? (uv_size.y / size.y) : 0.0f);
if (clamp) if (clamp)
{ {

View File

@ -230,7 +230,7 @@ enum ImGuiAxis
{ {
ImGuiAxis_None = -1, ImGuiAxis_None = -1,
ImGuiAxis_X = 0, ImGuiAxis_X = 0,
ImGuiAxis_Y = 1, ImGuiAxis_Y = 1
}; };
enum ImGuiPlotType enum ImGuiPlotType