From 85f432dc8dcc027e968cbb2daf501113a34ccc17 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 21 Mar 2015 19:27:29 +0000 Subject: [PATCH] Commented standard library include with the functions we use. Using ImFormatString in place of sprintf (part of #172) --- imgui.cpp | 12 ++++++------ imgui.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 07115c54..12e25ca4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -339,10 +339,10 @@ #endif #include "imgui.h" -#include // toupper -#include // sqrtf +#include // toupper, isprint +#include // sqrtf, fabsf, fmodf, powf, cosf, sinf, floorf, ceilf #include // intptr_t -#include // vsnprintf +#include // vsnprintf, sscanf #include // new (ptr) #ifdef _MSC_VER @@ -6710,9 +6710,9 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha) const float w_slider_all = w_full - square_sz; char buf[64]; if (alpha) - sprintf(buf, "#%02X%02X%02X%02X", ix, iy, iz, iw); + ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", ix, iy, iz, iw); else - sprintf(buf, "#%02X%02X%02X", ix, iy, iz); + ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", ix, iy, iz); ImGui::PushItemWidth(w_slider_all - style.ItemInnerSpacing.x); value_changed |= ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal); ImGui::PopItemWidth(); @@ -7224,7 +7224,7 @@ void ImGui::Value(const char* prefix, float v, const char* float_format) if (float_format) { char fmt[64]; - sprintf(fmt, "%%s: %s", float_format); + ImFormatString(fmt, IM_ARRAYSIZE(fmt), "%%s: %s", float_format); ImGui::Text(fmt, prefix, v); } else diff --git a/imgui.h b/imgui.h index ffbf7fb7..4b4ea533 100644 --- a/imgui.h +++ b/imgui.h @@ -9,9 +9,9 @@ #include "imconfig.h" // User-editable configuration file #include // FLT_MAX #include // va_list -#include // ptrdiff_t -#include // NULL, malloc -#include // memset, memmove +#include // ptrdiff_t, NULL +#include // NULL, malloc, free, qsort, atoi +#include // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp #define IMGUI_VERSION "1.37 WIP"