Fix size_t/%d format mismatch in MsgDialog::add_button (#15852)

Fix size_t/%d mismatch in MsgDialog button keys

`m_buttons.size()` is a `size_t`, which does not match the `%d` conversion in
printf-style variadics. Build the key with `std::to_string` instead; exact
for any size_t, no behavior change for realistic counts.

Co-authored-by: yw4z <ywsyildiz@gmail.com>
This commit is contained in:
Kenneth Raplee
2026-09-27 19:21:03 +03:00
committed by GitHub
co-authored by yw4z
parent ea471dc82d
commit 4964f49765
+3 -2
View File
@@ -194,9 +194,10 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con
bd->button = btn; bd->button = btn;
//bd->type = type; //bd->type = type;
mb->id = wxString::Format("%d", m_buttons.size()); // m_buttons.size() is a size_t, which does not match the %d conversion
mb->id = wxString(std::to_string(m_buttons.size()));
mb->buttondata = bd; mb->buttondata = bd;
m_buttons[ wxString::Format("%d", m_buttons.size())] = mb; m_buttons[ wxString(std::to_string(m_buttons.size()))] = mb;
return btn; return btn;
}; };