build: clear 6 warnings - data passed as ImGui format strings (#15585)

ImGui::Text and ImGui::TextColored take a printf format, so these six sites
passed data where a literal belonged. A % in that data reads a vararg that
was never supplied.

Three sites in GLCanvas3D's paint toolbar passed filament text, which comes
from the filament preset config and is user-editable. Two more passed
translated strings, where a % in any of the 23 catalogs does the same.
GLGizmoSimplify passed its progress label.

That label had been built with an escaped %% because it was being used as a
format string. Passing it as an argument instead needs a single %, so it
still renders as "42%".

ToUTF8() returns a buffer class, which converts to const char* for a named
parameter but not through varargs, so those two sites need .data().

GLGizmoSimplify.cpp:335 is unchanged, because _u8L("%d triangles") is passed
with a real argument and has to stay a format string.
This commit is contained in:
Kris Austin
2026-09-09 07:41:51 -03:00
committed by GitHub
parent d112a0af29
commit 10c123f2aa
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -9780,18 +9780,18 @@ void GLCanvas3D::_render_paint_toolbar() const
ImVec2 number_label_size = ImGui::CalcTextSize(std::to_string(i + 1).c_str());
ImGui::SetCursorPosY(cursor_y + text_offset_y);
ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - number_label_size.x) / 2);
ImGui::TextColored(text_color, std::to_string(i + 1).c_str());
ImGui::TextColored(text_color, "%s", std::to_string(i + 1).c_str());
imgui.pop_bold_font();
ImVec2 filament_first_line_label_size = ImGui::CalcTextSize(filament_text_first_line[i].c_str());
ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y);
ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_first_line_label_size.x) / 2);
ImGui::TextColored(text_color, filament_text_first_line[i].c_str());
ImGui::TextColored(text_color, "%s", filament_text_first_line[i].c_str());
ImVec2 filament_second_line_label_size = ImGui::CalcTextSize(filament_text_second_line[i].c_str());
ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y + filament_first_line_label_size.y);
ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_second_line_label_size.x) / 2);
ImGui::TextColored(text_color, filament_text_second_line[i].c_str());
ImGui::TextColored(text_color, "%s", filament_text_second_line[i].c_str());
}
if (ImGui::GetWindowWidth() == constraint_window_width) {
@@ -10018,9 +10018,9 @@ void GLCanvas3D::_render_assemble_info() const
double size1 = m_selection.get_bounding_box().size()(1);
double size2 = m_selection.get_bounding_box().size()(2);
if (!m_selection.is_empty()) {
ImGui::Text(_L("Volume:").ToUTF8()); ImGui::SameLine(caption_max);
ImGui::Text("%s", _L("Volume:").ToUTF8().data()); ImGui::SameLine(caption_max);
ImGui::Text("%.2f", size0 * size1 * size2);
ImGui::Text(_L("Size:").ToUTF8()); ImGui::SameLine(caption_max);
ImGui::Text("%s", _L("Size:").ToUTF8().data()); ImGui::SameLine(caption_max);
ImGui::Text("%.2f x %.2f x %.2f", size0, size1, size2);
}
imgui->end();