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;
}
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);
return json_contents;

View File

@@ -941,7 +941,11 @@ void TextCtrl::BUILD() {
temp->SetToolTip(get_tooltip_text(text_value));
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__)
e.Skip();
@@ -973,7 +977,11 @@ void TextCtrl::BUILD() {
temp->GetToolTip()->Enable(flag);
}), 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();
#if !defined(__WXGTK__)
@@ -2597,7 +2605,11 @@ void ColourPicker::BUILD()
// // recast as a wxWindow to fit the calling convention
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__
draw_bmp_btn(temp, temp->GetColour());
#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.
* */
#ifdef __WXOSX__
wxTheApp->CallAfter([editor]() {
wxTheApp->CallAfter([]() {
#endif
//editor->SetFocus();
//editor->SelectAll();

View File

@@ -79,9 +79,12 @@ class PlaterWorker: public Worker {
steady_clock::time_point finalize_end = steady_clock::now();
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)
<< std::fixed // do not use scientific notations
<< "Job '" << typeid(*m_job).name() << "' "
<< "Job '" << typeid(job).name() << "' "
<< "spend " << m_process_duration + 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);
editMenu->AppendSeparator();
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();
},
"", nullptr, [this](){return true;}, this);
"", nullptr, [](){return true;}, this);
editMenu->AppendSeparator();
#endif
@@ -3338,11 +3338,11 @@ void MainFrame::init_menubar_as_editor()
//parent_menu->Insert(0, about_item);
append_menu_item(
parent_menu, wxID_ANY, _L(about_title), "",
[this](wxCommandEvent &) { Slic3r::GUI::about();},
[](wxCommandEvent &) { Slic3r::GUI::about();},
"", nullptr, []() { return true; }, this, 0);
append_menu_item(
parent_menu, wxID_ANY, _L("Preferences") + "\t" + ctrl + ",", "",
[this](wxCommandEvent &) {
[](wxCommandEvent &) {
wxGetApp().open_preferences();
},
"", nullptr, []() { return true; }, this, 1);
@@ -3530,13 +3530,13 @@ void MainFrame::init_menubar_as_editor()
into_u8(_L("Syncing presets from cloud\u2026")));
wxGetApp().restart_sync_user_preset();
}, "", nullptr,
[this]() {
[]() {
return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
}, this);
fileMenu->AppendSeparator();
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);
fileMenu->AppendSeparator();
@@ -3640,7 +3640,7 @@ void MainFrame::init_menubar_as_editor()
[this]() {return m_plater->is_view3D_shown();; }, this);
// help
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);
m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration")));