MCPcopy Create free account
hub / github.com/SatDump/SatDump / ImFormatStringToTempBufferV

Function ImFormatStringToTempBufferV

src-core/imgui/imgui.cpp:1929–1951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1927}
1928
1929void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args)
1930{
1931 ImGuiContext& g = *GImGui;
1932 if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)
1933 {
1934 const char* buf = va_arg(args, const char*); // Skip formatting when using "%s"
1935 *out_buf = buf;
1936 if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
1937 }
1938 else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
1939 {
1940 int buf_len = va_arg(args, int); // Skip formatting when using "%.*s"
1941 const char* buf = va_arg(args, const char*);
1942 *out_buf = buf;
1943 *out_buf_end = buf + buf_len; // Disallow not passing 'out_buf_end' here. User is expected to use it.
1944 }
1945 else
1946 {
1947 int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
1948 *out_buf = g.TempBuffer.Data;
1949 if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; }
1950 }
1951}
1952
1953// CRC32 needs a 1KB lookup table (not cache friendly)
1954// Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily:

Callers 5

TextVMethod · 0.85
LabelTextVMethod · 0.85
BulletTextVMethod · 0.85
TreeNodeExVMethod · 0.85

Calls 1

ImFormatStringVFunction · 0.85

Tested by

no test coverage detected