fix: clear 12 warning sites that only appear away from Windows (#15437)

This commit is contained in:
Kris Austin
2026-09-02 16:18:17 -05:00
committed by GitHub
parent 51fd6327fe
commit 8bf1d3ea84
5 changed files with 30 additions and 13 deletions

View File

@@ -599,7 +599,9 @@ static char* read_json_file(const std::string &preset_path)
return NULL; return NULL;
} }
fread(json_contents, 1, file_size, json_file); const size_t read_bytes = fread(json_contents, 1, file_size, json_file);
if (read_bytes != static_cast<size_t>(file_size))
BOOST_LOG_TRIVIAL(error) << "Read " << read_bytes << " of " << file_size << " bytes from the JSON file";
fclose(json_file); fclose(json_file);
return json_contents; return json_contents;

View File

@@ -941,7 +941,11 @@ void TextCtrl::BUILD() {
temp->SetToolTip(get_tooltip_text(text_value)); temp->SetToolTip(get_tooltip_text(text_value));
if (!m_opt.multiline) { if (!m_opt.multiline) {
text_ctrl->Bind(wxEVT_TEXT_ENTER, ([this, temp](wxEvent &e) text_ctrl->Bind(wxEVT_TEXT_ENTER, ([
#if !defined(__WXGTK__)
temp,
#endif // __WXGTK__
this](wxEvent &e)
{ {
#if !defined(__WXGTK__) #if !defined(__WXGTK__)
e.Skip(); e.Skip();
@@ -973,7 +977,11 @@ void TextCtrl::BUILD() {
temp->GetToolTip()->Enable(flag); temp->GetToolTip()->Enable(flag);
}), text_ctrl->GetId()); }), text_ctrl->GetId());
temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent &e) temp->Bind(wxEVT_KILL_FOCUS, ([
#if !defined(__WXGTK__)
temp,
#endif // __WXGTK__
this](wxEvent &e)
{ {
e.Skip(); e.Skip();
#if !defined(__WXGTK__) #if !defined(__WXGTK__)
@@ -2597,7 +2605,11 @@ void ColourPicker::BUILD()
// // recast as a wxWindow to fit the calling convention // // recast as a wxWindow to fit the calling convention
window = dynamic_cast<wxWindow*>(temp); window = dynamic_cast<wxWindow*>(temp);
temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([this,temp](wxCommandEvent e) { temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([
#ifdef __WXMSW__
temp,
#endif
this](wxCommandEvent e) {
#ifdef __WXMSW__ #ifdef __WXMSW__
draw_bmp_btn(temp, temp->GetColour()); draw_bmp_btn(temp, temp->GetColour());
#endif #endif

View File

@@ -48,7 +48,7 @@ void ObjectLayers::select_editor(LayerRangeEditor* editor, const bool is_last_ed
* And as a result we couldn't edit this control. * And as a result we couldn't edit this control.
* */ * */
#ifdef __WXOSX__ #ifdef __WXOSX__
wxTheApp->CallAfter([editor]() { wxTheApp->CallAfter([]() {
#endif #endif
//editor->SetFocus(); //editor->SetFocus();
//editor->SelectAll(); //editor->SelectAll();

View File

@@ -79,9 +79,12 @@ class PlaterWorker: public Worker {
steady_clock::time_point finalize_end = steady_clock::now(); steady_clock::time_point finalize_end = steady_clock::now();
long long finalize_duration = duration_cast<milliseconds>(finalize_end - finalize_start).count(); long long finalize_duration = duration_cast<milliseconds>(finalize_end - finalize_start).count();
// Bound first so typeid's operand is not a call. typeid evaluates it for a
// polymorphic type, which clang reports as -Wpotentially-evaluated-expression.
const Job &job = *m_job;
BOOST_LOG_TRIVIAL(info) BOOST_LOG_TRIVIAL(info)
<< std::fixed // do not use scientific notations << std::fixed // do not use scientific notations
<< "Job '" << typeid(*m_job).name() << "' " << "Job '" << typeid(job).name() << "' "
<< "spend " << m_process_duration + finalize_duration << "ms " << "spend " << m_process_duration + finalize_duration << "ms "
<< "(process " << m_process_duration << "ms + finalize " << finalize_duration << "ms)"; << "(process " << m_process_duration << "ms + finalize " << finalize_duration << "ms)";

View File

@@ -3068,10 +3068,10 @@ void MainFrame::init_menubar_as_editor()
"", nullptr, [this](){return can_clone(); }, this); "", nullptr, [this](){return can_clone(); }, this);
editMenu->AppendSeparator(); editMenu->AppendSeparator();
append_menu_item(editMenu, wxID_ANY, _L("Duplicate Current Plate"), append_menu_item(editMenu, wxID_ANY, _L("Duplicate Current Plate"),
_L("Duplicate the current plate"),[this, handle_key_event](wxCommandEvent&) { _L("Duplicate the current plate"),[this](wxCommandEvent&) {
m_plater->duplicate_plate(); m_plater->duplicate_plate();
}, },
"", nullptr, [this](){return true;}, this); "", nullptr, [](){return true;}, this);
editMenu->AppendSeparator(); editMenu->AppendSeparator();
#endif #endif
@@ -3338,11 +3338,11 @@ void MainFrame::init_menubar_as_editor()
//parent_menu->Insert(0, about_item); //parent_menu->Insert(0, about_item);
append_menu_item( append_menu_item(
parent_menu, wxID_ANY, _L(about_title), "", parent_menu, wxID_ANY, _L(about_title), "",
[this](wxCommandEvent &) { Slic3r::GUI::about();}, [](wxCommandEvent &) { Slic3r::GUI::about();},
"", nullptr, []() { return true; }, this, 0); "", nullptr, []() { return true; }, this, 0);
append_menu_item( append_menu_item(
parent_menu, wxID_ANY, _L("Preferences") + "\t" + ctrl + ",", "", parent_menu, wxID_ANY, _L("Preferences") + "\t" + ctrl + ",", "",
[this](wxCommandEvent &) { [](wxCommandEvent &) {
wxGetApp().open_preferences(); wxGetApp().open_preferences();
}, },
"", nullptr, []() { return true; }, this, 1); "", nullptr, []() { return true; }, this, 1);
@@ -3530,13 +3530,13 @@ void MainFrame::init_menubar_as_editor()
into_u8(_L("Syncing presets from cloud\u2026"))); into_u8(_L("Syncing presets from cloud\u2026")));
wxGetApp().restart_sync_user_preset(); wxGetApp().restart_sync_user_preset();
}, "", nullptr, }, "", nullptr,
[this]() { []() {
return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode(); return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
}, this); }, this);
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
append_menu_item( append_menu_item(
fileMenu, wxID_ANY, _L("Plugins"), "", [this](wxCommandEvent&) { wxGetApp().open_plugins_dialog(); }, "", nullptr, fileMenu, wxID_ANY, _L("Plugins"), "", [](wxCommandEvent&) { wxGetApp().open_plugins_dialog(); }, "", nullptr,
[]() { return true; }, this); []() { return true; }, this);
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
@@ -3640,7 +3640,7 @@ void MainFrame::init_menubar_as_editor()
[this]() {return m_plater->is_view3D_shown();; }, this); [this]() {return m_plater->is_view3D_shown();; }, this);
// help // help
append_menu_item(calib_menu, wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), append_menu_item(calib_menu, wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"),
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr, [](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this); [this]() {return m_plater->is_view3D_shown();; }, this);
m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration"))); m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration")));