@@ -1986,15 +1986,15 @@ void ImStrncpy(char* dst, const char* src, size_t count)
1986
1986
1987
1987
char* ImStrdup(const char* str)
1988
1988
{
1989
- size_t len = strlen (str);
1989
+ size_t len = ImStrlen (str);
1990
1990
void* buf = IM_ALLOC(len + 1);
1991
1991
return (char*)memcpy(buf, (const void*)str, len + 1);
1992
1992
}
1993
1993
1994
1994
char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
1995
1995
{
1996
- size_t dst_buf_size = p_dst_size ? *p_dst_size : strlen (dst) + 1;
1997
- size_t src_size = strlen (src) + 1;
1996
+ size_t dst_buf_size = p_dst_size ? *p_dst_size : ImStrlen (dst) + 1;
1997
+ size_t src_size = ImStrlen (src) + 1;
1998
1998
if (dst_buf_size < src_size)
1999
1999
{
2000
2000
IM_FREE(dst);
@@ -2007,7 +2007,7 @@ char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
2007
2007
2008
2008
const char* ImStrchrRange(const char* str, const char* str_end, char c)
2009
2009
{
2010
- const char* p = (const char*)memchr (str, (int)c, str_end - str);
2010
+ const char* p = (const char*)ImMemchr (str, (int)c, str_end - str);
2011
2011
return p;
2012
2012
}
2013
2013
@@ -2022,13 +2022,13 @@ int ImStrlenW(const ImWchar* str)
2022
2022
// Find end-of-line. Return pointer will point to either first \n, either str_end.
2023
2023
const char* ImStreolRange(const char* str, const char* str_end)
2024
2024
{
2025
- const char* p = (const char*)memchr (str, '\n', str_end - str);
2025
+ const char* p = (const char*)ImMemchr (str, '\n', str_end - str);
2026
2026
return p ? p : str_end;
2027
2027
}
2028
2028
2029
2029
const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find beginning-of-line
2030
2030
{
2031
- IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + strlen (buf_begin));
2031
+ IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + ImStrlen (buf_begin));
2032
2032
while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n')
2033
2033
buf_mid_line--;
2034
2034
return buf_mid_line;
@@ -2037,7 +2037,7 @@ const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find be
2037
2037
const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)
2038
2038
{
2039
2039
if (!needle_end)
2040
- needle_end = needle + strlen (needle);
2040
+ needle_end = needle + ImStrlen (needle);
2041
2041
2042
2042
const char un0 = (char)ImToUpper(*needle);
2043
2043
while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
@@ -2158,7 +2158,7 @@ void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end,
2158
2158
if (buf == NULL)
2159
2159
buf = "(null)";
2160
2160
*out_buf = buf;
2161
- if (out_buf_end) { *out_buf_end = buf + strlen (buf); }
2161
+ if (out_buf_end) { *out_buf_end = buf + ImStrlen (buf); }
2162
2162
}
2163
2163
else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
2164
2164
{
@@ -2567,11 +2567,11 @@ const char* ImTextFindPreviousUtf8Codepoint(const char* in_text_start, const cha
2567
2567
int ImTextCountLines(const char* in_text, const char* in_text_end)
2568
2568
{
2569
2569
if (in_text_end == NULL)
2570
- in_text_end = in_text + strlen (in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
2570
+ in_text_end = in_text + ImStrlen (in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
2571
2571
int count = 0;
2572
2572
while (in_text < in_text_end)
2573
2573
{
2574
- const char* line_end = (const char*)memchr (in_text, '\n', in_text_end - in_text);
2574
+ const char* line_end = (const char*)ImMemchr (in_text, '\n', in_text_end - in_text);
2575
2575
in_text = line_end ? line_end + 1 : in_text_end;
2576
2576
count++;
2577
2577
}
@@ -2852,7 +2852,7 @@ void ImGuiTextFilter::ImGuiTextRange::split(char separator, ImVector<ImGuiTextRa
2852
2852
void ImGuiTextFilter::Build()
2853
2853
{
2854
2854
Filters.resize(0);
2855
- ImGuiTextRange input_range(InputBuf, InputBuf + strlen (InputBuf));
2855
+ ImGuiTextRange input_range(InputBuf, InputBuf + ImStrlen (InputBuf));
2856
2856
input_range.split(',', &Filters);
2857
2857
2858
2858
CountGrep = 0;
@@ -2920,7 +2920,7 @@ char ImGuiTextBuffer::EmptyString[1] = { 0 };
2920
2920
2921
2921
void ImGuiTextBuffer::append(const char* str, const char* str_end)
2922
2922
{
2923
- int len = str_end ? (int)(str_end - str) : (int)strlen (str);
2923
+ int len = str_end ? (int)(str_end - str) : (int)ImStrlen (str);
2924
2924
2925
2925
// Add zero-terminator the first time
2926
2926
const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
@@ -2979,7 +2979,7 @@ void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
2979
2979
if (EndOffset == 0 || base[EndOffset - 1] == '\n')
2980
2980
LineOffsets.push_back(EndOffset);
2981
2981
const char* base_end = base + new_size;
2982
- for (const char* p = base + old_size; (p = (const char*)memchr (p, '\n', base_end - p)) != 0; )
2982
+ for (const char* p = base + old_size; (p = (const char*)ImMemchr (p, '\n', base_end - p)) != 0; )
2983
2983
if (++p < base_end) // Don't push a trailing offset on last \n
2984
2984
LineOffsets.push_back((int)(intptr_t)(p - base));
2985
2985
EndOffset = ImMax(EndOffset, new_size);
@@ -3603,7 +3603,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
3603
3603
else
3604
3604
{
3605
3605
if (!text_end)
3606
- text_end = text + strlen (text); // FIXME-OPT
3606
+ text_end = text + ImStrlen (text); // FIXME-OPT
3607
3607
text_display_end = text_end;
3608
3608
}
3609
3609
@@ -3621,7 +3621,7 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
3621
3621
ImGuiWindow* window = g.CurrentWindow;
3622
3622
3623
3623
if (!text_end)
3624
- text_end = text + strlen (text); // FIXME-OPT
3624
+ text_end = text + ImStrlen (text); // FIXME-OPT
3625
3625
3626
3626
if (text != text_end)
3627
3627
{
@@ -4294,7 +4294,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NUL
4294
4294
memset(this, 0, sizeof(*this));
4295
4295
Ctx = ctx;
4296
4296
Name = ImStrdup(name);
4297
- NameBufLen = (int)strlen (name) + 1;
4297
+ NameBufLen = (int)ImStrlen (name) + 1;
4298
4298
ID = ImHashStr(name);
4299
4299
IDStack.push_back(ID);
4300
4300
MoveId = GetID("#MOVE");
@@ -8829,7 +8829,7 @@ const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
8829
8829
(key != ImGuiKey_None || key_chord == ImGuiKey_None) ? GetKeyName(key) : "");
8830
8830
size_t len;
8831
8831
if (key == ImGuiKey_None && key_chord != 0)
8832
- if ((len = strlen (g.TempKeychordName)) != 0) // Remove trailing '+'
8832
+ if ((len = ImStrlen (g.TempKeychordName)) != 0) // Remove trailing '+'
8833
8833
g.TempKeychordName[len - 1] = 0;
8834
8834
return g.TempKeychordName;
8835
8835
}
@@ -14134,7 +14134,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
14134
14134
cond = ImGuiCond_Always;
14135
14135
14136
14136
IM_ASSERT(type != NULL);
14137
- IM_ASSERT(strlen (type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
14137
+ IM_ASSERT(ImStrlen (type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
14138
14138
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
14139
14139
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
14140
14140
IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
@@ -14378,7 +14378,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
14378
14378
}
14379
14379
14380
14380
if (prefix)
14381
- LogRenderedText(ref_pos, prefix, prefix + strlen (prefix)); // Calculate end ourself to ensure "##" are included here.
14381
+ LogRenderedText(ref_pos, prefix, prefix + ImStrlen (prefix)); // Calculate end ourself to ensure "##" are included here.
14382
14382
14383
14383
// Re-adjust padding if we have popped out of our starting depth
14384
14384
if (g.LogDepthRef > window->DC.TreeDepth)
@@ -14411,7 +14411,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
14411
14411
}
14412
14412
14413
14413
if (suffix)
14414
- LogRenderedText(ref_pos, suffix, suffix + strlen (suffix));
14414
+ LogRenderedText(ref_pos, suffix, suffix + ImStrlen (suffix));
14415
14415
}
14416
14416
14417
14417
// Start logging/capturing text output
@@ -14677,7 +14677,7 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)
14677
14677
// For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).
14678
14678
// For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy..
14679
14679
if (ini_size == 0)
14680
- ini_size = strlen (ini_data);
14680
+ ini_size = ImStrlen (ini_data);
14681
14681
g.SettingsIniData.Buf.resize((int)ini_size + 1);
14682
14682
char* const buf = g.SettingsIniData.Buf.Data;
14683
14683
char* const buf_end = buf + ini_size;
@@ -14778,7 +14778,7 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
14778
14778
if (const char* p = strstr(name, "###"))
14779
14779
name = p;
14780
14780
}
14781
- const size_t name_len = strlen (name);
14781
+ const size_t name_len = ImStrlen (name);
14782
14782
14783
14783
// Allocate chunk
14784
14784
const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;
@@ -15070,7 +15070,7 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext*, const char* t
15070
15070
if (!main_clipboard)
15071
15071
PasteboardCreate(kPasteboardClipboard, &main_clipboard);
15072
15072
PasteboardClear(main_clipboard);
15073
- CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, strlen (text));
15073
+ CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, ImStrlen (text));
15074
15074
if (cf_data)
15075
15075
{
15076
15076
PasteboardPutItemFlavor(main_clipboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), cf_data, 0);
@@ -15124,7 +15124,7 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext* ctx, const cha
15124
15124
{
15125
15125
ImGuiContext& g = *ctx;
15126
15126
g.ClipboardHandlerData.clear();
15127
- const char* text_end = text + strlen (text);
15127
+ const char* text_end = text + ImStrlen (text);
15128
15128
g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
15129
15129
memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
15130
15130
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
@@ -16894,7 +16894,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
16894
16894
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id);
16895
16895
break;
16896
16896
case ImGuiDataType_String:
16897
- ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen ((const char*)data_id), (const char*)data_id);
16897
+ ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)ImStrlen ((const char*)data_id), (const char*)data_id);
16898
16898
break;
16899
16899
case ImGuiDataType_Pointer:
16900
16900
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id);
0 commit comments