From 8606d9fa1121b463295934aa7200a234054721d1 Mon Sep 17 00:00:00 2001 From: Elias Daler Date: Mon, 15 Oct 2018 18:07:06 +0300 Subject: [PATCH] Fix Clang/GCC's null-conversion warning: (#2081) The warning is "implicit conversion of NULL constant to 'unsigned int' [-Wnull-conversion]". Happens when ImTextureID is not a void*, but unsigned int, for example. --- imgui.h | 2 +- imgui_draw.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui.h b/imgui.h index 05ede495..3dd26365 100644 --- a/imgui.h +++ b/imgui.h @@ -1597,7 +1597,7 @@ struct ImDrawCmd ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. void* UserCallbackData; // The draw callback code can access this. - ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = NULL; UserCallback = NULL; UserCallbackData = NULL; } + ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = (ImTextureID)NULL; UserCallback = NULL; UserCallbackData = NULL; } }; // Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 14d924d4..553fb16e 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1395,7 +1395,7 @@ ImFontAtlas::ImFontAtlas() { Locked = false; Flags = ImFontAtlasFlags_None; - TexID = NULL; + TexID = (ImTextureID)NULL; TexDesiredWidth = 0; TexGlyphPadding = 1; @@ -1711,7 +1711,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) ImFontAtlasBuildRegisterDefaultCustomRects(atlas); - atlas->TexID = NULL; + atlas->TexID = (ImTextureID)NULL; atlas->TexWidth = atlas->TexHeight = 0; atlas->TexUvScale = ImVec2(0.0f, 0.0f); atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f);