mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 12:18:52 -05:00
-Wformat-nonliteral
This commit is contained in:
parent
168244e422
commit
8d3bd31395
24
implot.cpp
24
implot.cpp
|
@ -122,6 +122,25 @@ You can read releases logs https://github.com/epezent/implot/releases for more d
|
||||||
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
|
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Visual Studio warnings
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning (disable: 4127) // condition expression is constant
|
||||||
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
|
||||||
|
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
|
||||||
|
#endif
|
||||||
|
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
||||||
|
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
|
||||||
|
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Clang/GCC warnings with -Weverything
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning: format string is not a string literal
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
|
||||||
|
#endif
|
||||||
|
|
||||||
// Global plot context
|
// Global plot context
|
||||||
#ifndef GImPlot
|
#ifndef GImPlot
|
||||||
ImPlotContext* GImPlot = NULL;
|
ImPlotContext* GImPlot = NULL;
|
||||||
|
@ -1503,6 +1522,11 @@ void ShowPlotContextMenu(ImPlotPlot& plot) {
|
||||||
// Axis Utils
|
// Axis Utils
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static inline void DefaultFormatter(double value, char* buff, int size, void* data) {
|
||||||
|
char* fmt = (char*)data;
|
||||||
|
snprintf(buff, size, fmt, value);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int AxisPrecision(const ImPlotAxis& axis) {
|
static inline int AxisPrecision(const ImPlotAxis& axis) {
|
||||||
const double range = axis.Ticks.Size > 1 ? (axis.Ticks.Ticks[1].PlotPos - axis.Ticks.Ticks[0].PlotPos) : axis.Range.Size();
|
const double range = axis.Ticks.Size > 1 ? (axis.Ticks.Ticks[1].PlotPos - axis.Ticks.Ticks[0].PlotPos) : axis.Range.Size();
|
||||||
return Precision(range);
|
return Precision(range);
|
||||||
|
|
|
@ -42,12 +42,12 @@
|
||||||
#error Must include implot.h before implot_internal.h
|
#error Must include implot.h before implot_internal.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Support for pre-1.84 versions. ImPool's GetSize() -> GetBufSize()
|
// Support for pre-1.84 versions. ImPool's GetSize() -> GetBufSize()
|
||||||
#if (IMGUI_VERSION_NUM < 18303)
|
#if (IMGUI_VERSION_NUM < 18303)
|
||||||
#define GetBufSize GetSize
|
#define GetBufSize GetSize
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Constants
|
// [SECTION] Constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1341,11 +1341,6 @@ IMPLOT_API bool ShowLegendContextMenu(ImPlotLegend& legend, bool visible);
|
||||||
// [SECTION] Tick Utils
|
// [SECTION] Tick Utils
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static inline void DefaultFormatter(double value, char* buff, int size, void* data) {
|
|
||||||
char* fmt = (char*)data;
|
|
||||||
snprintf(buff, size, fmt, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label a tick with time formatting.
|
// Label a tick with time formatting.
|
||||||
IMPLOT_API void LabelTickTime(ImPlotTick& tick, ImGuiTextBuffer& buffer, const ImPlotTime& t, ImPlotDateTimeFmt fmt);
|
IMPLOT_API void LabelTickTime(ImPlotTick& tick, ImGuiTextBuffer& buffer, const ImPlotTime& t, ImPlotDateTimeFmt fmt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user