mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 03:11:47 +00:00
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:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user