mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Added IMGUI_USE_STB_SPRINTF (undocumented) (#1038)
This commit is contained in:
parent
b33977bc15
commit
57b1622afc
13
imgui.cpp
13
imgui.cpp
@ -1351,6 +1351,11 @@ void ImStrTrimBlanks(char* buf)
|
||||
// B) When buf==NULL vsnprintf() will return the output size.
|
||||
#ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
|
||||
|
||||
#ifdef IMGUI_USE_STB_SPRINTF
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "imstb_sprintf.h"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(vsnprintf)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
@ -1359,7 +1364,11 @@ int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
#ifdef IMGUI_USE_STB_SPRINTF
|
||||
int w = stbsp_vsnprintf(buf, (int)buf_size, fmt, args);
|
||||
#else
|
||||
int w = vsnprintf(buf, buf_size, fmt, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
if (buf == NULL)
|
||||
return w;
|
||||
@ -1371,7 +1380,11 @@ int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...)
|
||||
|
||||
int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args)
|
||||
{
|
||||
#ifdef IMGUI_USE_STB_SPRINTF
|
||||
int w = stbsp_vsnprintf(buf, (int)buf_size, fmt, args);
|
||||
#else
|
||||
int w = vsnprintf(buf, buf_size, fmt, args);
|
||||
#endif
|
||||
if (buf == NULL)
|
||||
return w;
|
||||
if (w == -1 || w >= (int)buf_size)
|
||||
|
Loading…
Reference in New Issue
Block a user