|
@@ -1986,15 +1986,15 @@ void ImStrncpy(char* dst, const char* src, size_t count)
|
|
|
|
|
|
char* ImStrdup(const char* str)
|
|
|
{
|
|
|
- size_t len = strlen(str);
|
|
|
+ size_t len = ImStrlen(str);
|
|
|
void* buf = IM_ALLOC(len + 1);
|
|
|
return (char*)memcpy(buf, (const void*)str, len + 1);
|
|
|
}
|
|
|
|
|
|
char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
|
|
|
{
|
|
|
- size_t dst_buf_size = p_dst_size ? *p_dst_size : strlen(dst) + 1;
|
|
|
- size_t src_size = strlen(src) + 1;
|
|
|
+ size_t dst_buf_size = p_dst_size ? *p_dst_size : ImStrlen(dst) + 1;
|
|
|
+ size_t src_size = ImStrlen(src) + 1;
|
|
|
if (dst_buf_size < src_size)
|
|
|
{
|
|
|
IM_FREE(dst);
|
|
@@ -2007,7 +2007,7 @@ char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
|
|
|
|
|
|
const char* ImStrchrRange(const char* str, const char* str_end, char c)
|
|
|
{
|
|
|
- const char* p = (const char*)memchr(str, (int)c, str_end - str);
|
|
|
+ const char* p = (const char*)ImMemchr(str, (int)c, str_end - str);
|
|
|
return p;
|
|
|
}
|
|
|
|
|
@@ -2022,13 +2022,13 @@ int ImStrlenW(const ImWchar* str)
|
|
|
// Find end-of-line. Return pointer will point to either first \n, either str_end.
|
|
|
const char* ImStreolRange(const char* str, const char* str_end)
|
|
|
{
|
|
|
- const char* p = (const char*)memchr(str, '\n', str_end - str);
|
|
|
+ const char* p = (const char*)ImMemchr(str, '\n', str_end - str);
|
|
|
return p ? p : str_end;
|
|
|
}
|
|
|
|
|
|
const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find beginning-of-line
|
|
|
{
|
|
|
- IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + strlen(buf_begin));
|
|
|
+ IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + ImStrlen(buf_begin));
|
|
|
while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n')
|
|
|
buf_mid_line--;
|
|
|
return buf_mid_line;
|
|
@@ -2037,7 +2037,7 @@ const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find be
|
|
|
const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)
|
|
|
{
|
|
|
if (!needle_end)
|
|
|
- needle_end = needle + strlen(needle);
|
|
|
+ needle_end = needle + ImStrlen(needle);
|
|
|
|
|
|
const char un0 = (char)ImToUpper(*needle);
|
|
|
while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
|
|
@@ -2158,7 +2158,7 @@ void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end,
|
|
|
if (buf == NULL)
|
|
|
buf = "(null)";
|
|
|
*out_buf = buf;
|
|
|
- if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
|
|
|
+ if (out_buf_end) { *out_buf_end = buf + ImStrlen(buf); }
|
|
|
}
|
|
|
else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
|
|
|
{
|
|
@@ -2567,11 +2567,11 @@ const char* ImTextFindPreviousUtf8Codepoint(const char* in_text_start, const cha
|
|
|
int ImTextCountLines(const char* in_text, const char* in_text_end)
|
|
|
{
|
|
|
if (in_text_end == NULL)
|
|
|
- in_text_end = in_text + strlen(in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
|
|
|
+ in_text_end = in_text + ImStrlen(in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
|
|
|
int count = 0;
|
|
|
while (in_text < in_text_end)
|
|
|
{
|
|
|
- const char* line_end = (const char*)memchr(in_text, '\n', in_text_end - in_text);
|
|
|
+ const char* line_end = (const char*)ImMemchr(in_text, '\n', in_text_end - in_text);
|
|
|
in_text = line_end ? line_end + 1 : in_text_end;
|
|
|
count++;
|
|
|
}
|
|
@@ -2852,7 +2852,7 @@ void ImGuiTextFilter::ImGuiTextRange::split(char separator, ImVector<ImGuiTextRa
|
|
|
void ImGuiTextFilter::Build()
|
|
|
{
|
|
|
Filters.resize(0);
|
|
|
- ImGuiTextRange input_range(InputBuf, InputBuf + strlen(InputBuf));
|
|
|
+ ImGuiTextRange input_range(InputBuf, InputBuf + ImStrlen(InputBuf));
|
|
|
input_range.split(',', &Filters);
|
|
|
|
|
|
CountGrep = 0;
|
|
@@ -2920,7 +2920,7 @@ char ImGuiTextBuffer::EmptyString[1] = { 0 };
|
|
|
|
|
|
void ImGuiTextBuffer::append(const char* str, const char* str_end)
|
|
|
{
|
|
|
- int len = str_end ? (int)(str_end - str) : (int)strlen(str);
|
|
|
+ int len = str_end ? (int)(str_end - str) : (int)ImStrlen(str);
|
|
|
|
|
|
// Add zero-terminator the first time
|
|
|
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)
|
|
|
if (EndOffset == 0 || base[EndOffset - 1] == '\n')
|
|
|
LineOffsets.push_back(EndOffset);
|
|
|
const char* base_end = base + new_size;
|
|
|
- for (const char* p = base + old_size; (p = (const char*)memchr(p, '\n', base_end - p)) != 0; )
|
|
|
+ for (const char* p = base + old_size; (p = (const char*)ImMemchr(p, '\n', base_end - p)) != 0; )
|
|
|
if (++p < base_end) // Don't push a trailing offset on last \n
|
|
|
LineOffsets.push_back((int)(intptr_t)(p - base));
|
|
|
EndOffset = ImMax(EndOffset, new_size);
|
|
@@ -3603,7 +3603,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
|
|
|
else
|
|
|
{
|
|
|
if (!text_end)
|
|
|
- text_end = text + strlen(text); // FIXME-OPT
|
|
|
+ text_end = text + ImStrlen(text); // FIXME-OPT
|
|
|
text_display_end = text_end;
|
|
|
}
|
|
|
|
|
@@ -3621,7 +3621,7 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
if (!text_end)
|
|
|
- text_end = text + strlen(text); // FIXME-OPT
|
|
|
+ text_end = text + ImStrlen(text); // FIXME-OPT
|
|
|
|
|
|
if (text != text_end)
|
|
|
{
|
|
@@ -4294,7 +4294,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NUL
|
|
|
memset(this, 0, sizeof(*this));
|
|
|
Ctx = ctx;
|
|
|
Name = ImStrdup(name);
|
|
|
- NameBufLen = (int)strlen(name) + 1;
|
|
|
+ NameBufLen = (int)ImStrlen(name) + 1;
|
|
|
ID = ImHashStr(name);
|
|
|
IDStack.push_back(ID);
|
|
|
MoveId = GetID("#MOVE");
|
|
@@ -8829,7 +8829,7 @@ const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
|
|
|
(key != ImGuiKey_None || key_chord == ImGuiKey_None) ? GetKeyName(key) : "");
|
|
|
size_t len;
|
|
|
if (key == ImGuiKey_None && key_chord != 0)
|
|
|
- if ((len = strlen(g.TempKeychordName)) != 0) // Remove trailing '+'
|
|
|
+ if ((len = ImStrlen(g.TempKeychordName)) != 0) // Remove trailing '+'
|
|
|
g.TempKeychordName[len - 1] = 0;
|
|
|
return g.TempKeychordName;
|
|
|
}
|
|
@@ -14134,7 +14134,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
|
|
|
cond = ImGuiCond_Always;
|
|
|
|
|
|
IM_ASSERT(type != NULL);
|
|
|
- IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
|
|
|
+ IM_ASSERT(ImStrlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
|
|
|
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
|
|
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
|
|
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*
|
|
|
}
|
|
|
|
|
|
if (prefix)
|
|
|
- LogRenderedText(ref_pos, prefix, prefix + strlen(prefix)); // Calculate end ourself to ensure "##" are included here.
|
|
|
+ LogRenderedText(ref_pos, prefix, prefix + ImStrlen(prefix)); // Calculate end ourself to ensure "##" are included here.
|
|
|
|
|
|
// Re-adjust padding if we have popped out of our starting depth
|
|
|
if (g.LogDepthRef > window->DC.TreeDepth)
|
|
@@ -14411,7 +14411,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
|
|
|
}
|
|
|
|
|
|
if (suffix)
|
|
|
- LogRenderedText(ref_pos, suffix, suffix + strlen(suffix));
|
|
|
+ LogRenderedText(ref_pos, suffix, suffix + ImStrlen(suffix));
|
|
|
}
|
|
|
|
|
|
// Start logging/capturing text output
|
|
@@ -14677,7 +14677,7 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)
|
|
|
// For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).
|
|
|
// 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..
|
|
|
if (ini_size == 0)
|
|
|
- ini_size = strlen(ini_data);
|
|
|
+ ini_size = ImStrlen(ini_data);
|
|
|
g.SettingsIniData.Buf.resize((int)ini_size + 1);
|
|
|
char* const buf = g.SettingsIniData.Buf.Data;
|
|
|
char* const buf_end = buf + ini_size;
|
|
@@ -14778,7 +14778,7 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
|
|
if (const char* p = strstr(name, "###"))
|
|
|
name = p;
|
|
|
}
|
|
|
- const size_t name_len = strlen(name);
|
|
|
+ const size_t name_len = ImStrlen(name);
|
|
|
|
|
|
// Allocate chunk
|
|
|
const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;
|
|
@@ -15070,7 +15070,7 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext*, const char* t
|
|
|
if (!main_clipboard)
|
|
|
PasteboardCreate(kPasteboardClipboard, &main_clipboard);
|
|
|
PasteboardClear(main_clipboard);
|
|
|
- CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, strlen(text));
|
|
|
+ CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, ImStrlen(text));
|
|
|
if (cf_data)
|
|
|
{
|
|
|
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
|
|
|
{
|
|
|
ImGuiContext& g = *ctx;
|
|
|
g.ClipboardHandlerData.clear();
|
|
|
- const char* text_end = text + strlen(text);
|
|
|
+ const char* text_end = text + ImStrlen(text);
|
|
|
g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
|
|
|
memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
|
|
|
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
|
|
@@ -16894,7 +16894,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|
|
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id);
|
|
|
break;
|
|
|
case ImGuiDataType_String:
|
|
|
- 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);
|
|
|
+ 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);
|
|
|
break;
|
|
|
case ImGuiDataType_Pointer:
|
|
|
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id);
|