ImStrv: Fixed various compile errors/warnings.

This commit is contained in:
ocornut
2022-08-22 11:06:33 +02:00
committed by ocornut
parent d0e4faeffd
commit 872292c5d2

View File

@@ -12047,7 +12047,7 @@ void ImGui::OpenPopup(ImStrv str_id, ImGuiPopupFlags popup_flags)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiID id = g.CurrentWindow->GetID(str_id); ImGuiID id = g.CurrentWindow->GetID(str_id);
IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopup(\"%.*s\" -> 0x%08X\n", (int)(str_id.End - str_id.Begin), str_id, id); IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopup(\"%.*s\" -> 0x%08X\n", (int)(str_id.End - str_id.Begin), str_id.Begin, id);
OpenPopupEx(id, popup_flags); OpenPopupEx(id, popup_flags);
} }
@@ -15948,7 +15948,7 @@ void ImGui::DebugRenderKeyboardPreview(ImDrawList* draw_list)
// Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct. // Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct.
void ImGui::DebugTextEncoding(ImStrv str) void ImGui::DebugTextEncoding(ImStrv str)
{ {
Text("Text: \"%s\"", str); Text("Text: \"%.*s\"", (int)str.length(), str.Begin);
if (!BeginTable("##DebugTextEncoding", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable)) if (!BeginTable("##DebugTextEncoding", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable))
return; return;
TableSetupColumn("Offset"); TableSetupColumn("Offset");
@@ -15961,7 +15961,7 @@ void ImGui::DebugTextEncoding(ImStrv str)
unsigned int c; unsigned int c;
const int c_utf8_len = ImTextCharFromUtf8(&c, p, str.End); const int c_utf8_len = ImTextCharFromUtf8(&c, p, str.End);
TableNextColumn(); TableNextColumn();
Text("%d", (int)(size_t)(p - str)); Text("%d", (int)(p - str.Begin));
TableNextColumn(); TableNextColumn();
for (int byte_index = 0; byte_index < c_utf8_len; byte_index++) for (int byte_index = 0; byte_index < c_utf8_len; byte_index++)
{ {
@@ -15970,7 +15970,7 @@ void ImGui::DebugTextEncoding(ImStrv str)
Text("0x%02X", (int)(unsigned char)p[byte_index]); Text("0x%02X", (int)(unsigned char)p[byte_index]);
} }
TableNextColumn(); TableNextColumn();
TextUnformatted(p, p + c_utf8_len); TextUnformatted(ImStrv(p, p + c_utf8_len));
if (!GetFont()->IsGlyphInFont((ImWchar)c)) if (!GetFont()->IsGlyphInFont((ImWchar)c))
{ {
SameLine(); SameLine();