From 29a00cfa69b1cd1c73def69adc499741b6e1c318 Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 18:40:18 +0700 Subject: [PATCH 1/8] fix: tray_exist_bits != tray_exist_bits comparison --- src/slic3r/GUI/DeviceManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index b085bfb3c75..1ce29c28a35 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -3873,10 +3873,10 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) } } if (ams_exist_bits != last_ams_exist_bits - || last_tray_exist_bits != last_tray_exist_bits + || tray_exist_bits != last_tray_exist_bits || tray_is_bbl_bits != last_is_bbl_bits || tray_read_done_bits != last_read_done_bits - || last_ams_version != ams_version) { + || ams_version != last_ams_version) { is_ams_need_update = true; } else { From 234e50290a15132bf2b1b0ef962f942e2af0f1ba Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 18:42:33 +0700 Subject: [PATCH 2/8] fix: title == GetTitle() == title comparison --- src/slic3r/GUI/ReleaseNote.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 331711a823c..a2a805a39f2 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -786,7 +786,7 @@ void SecondaryCheckDialog::on_hide() void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDialog::ButtonStyle style, wxWindow* parent) { - if (m_button_style == style && title == GetTitle() == title) return; + if (m_button_style == style && title == GetTitle()) return; SetTitle(title); From 0d4112ca2f33058ced327051c219feffcb6f71a8 Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 19:03:44 +0700 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20possibly=20dangling=20reference=20to?= =?UTF-8?q?=20a=20temporary=20```=20OrcaSlicer/src/libslic3r/calib.cpp:456?= =?UTF-8?q?:17:=20warning:=20possibly=20dangling=20reference=20to=20a=20te?= =?UTF-8?q?mporary=20[-Wdangling-reference]=20=20=20456=20|=20=20=20=20=20?= =?UTF-8?q?const=20auto=20&w=20=20=20=20=20=20=20=20=20=3D=20bed=5Fext.siz?= =?UTF-8?q?e().x();=20OrcaSlicer/src/libslic3r/calib.cpp:456:45:=20note:?= =?UTF-8?q?=20the=20temporary=20was=20destroyed=20at=20the=20end=20of=20th?= =?UTF-8?q?e=20full=20expression=20=E2=80=98((Eigen::DenseCoeffsBase,=201>*)(&=20Slic3r::BoundingBox?= =?UTF-8?q?Base::size()=20const=20[with=20PointClass=20=3D=20E?= =?UTF-8?q?igen::Matrix]()))->Eigen::DenseCoeffsBas?= =?UTF-8?q?e,=201>::x()=E2=80=99=20?= =?UTF-8?q?=20=20456=20|=20=20=20=20=20const=20auto=20&w=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=3D=20bed=5Fext.size().x();=20```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libslic3r/calib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/calib.cpp b/src/libslic3r/calib.cpp index 39a36990ec1..fb986cb8da3 100644 --- a/src/libslic3r/calib.cpp +++ b/src/libslic3r/calib.cpp @@ -453,8 +453,8 @@ std::string CalibPressureAdvanceLine::generate_test(double start_pa /*= 0*/, dou } auto bed_sizes = mp_gcodegen->config().printable_area.values; - const auto &w = bed_ext.size().x(); - const auto &h = bed_ext.size().y(); + const auto w = bed_ext.size().x(); + const auto h = bed_ext.size().y(); count = std::min(count, int((h - 10) / m_space_y)); m_length_long = 40 + std::min(w - 120.0, 0.0); From 3b6f07517367be61e355157f504a1058ebd708af Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 19:10:55 +0700 Subject: [PATCH 4/8] fix: mixup of | and || in this case I think it actually does not change the semantics it just means that both comparison have to be evaluated. --- src/slic3r/GUI/Tab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index b86e2b75e13..507fb54dfc9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -881,7 +881,7 @@ void TabPrinter::init_options_list() for (const std::string& opt_key : m_config->keys()) { - if (opt_key == "printable_area" || opt_key == "bed_exclude_area" | opt_key == "thumbnails") { + if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "thumbnails") { m_options_list.emplace(opt_key, m_opt_status_value); continue; } From 06274fb9c31376041b4369dbadc510e4d0f10abe Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 19:12:51 +0700 Subject: [PATCH 5/8] fix: multi-character character constants need " MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: multi-character character constant [-Wmultichar] 392 | if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp: In member function ‘void Slic3r::GUI::MediaPlayCtrl::Stop(const wxString&)’: OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘12127’ to ‘95’ [-Woverflow] --- src/slic3r/GUI/MediaPlayCtrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 202f095cebc..208182b9a19 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -389,7 +389,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) } auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1); - if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) + if (auto n = tunnel.find_first_of("/_"); n != std::string::npos) tunnel = tunnel.substr(0, n); if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0 && m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end() From 77e04cece087a8fac63b888800cd2646a9f37396 Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 19:15:58 +0700 Subject: [PATCH 6/8] fix: missing paranthesis - skips null check --- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index e379ea2f902..2b55fb6a6a2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -915,7 +915,7 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) } else if (m_current == FdmSupports) { GLGizmoFdmSupports* fdm_support = dynamic_cast(get_current()); - if (fdm_support != nullptr && keyCode == 'F' || keyCode == 'S' || keyCode == 'C' || keyCode == 'G') { + if (fdm_support != nullptr && (keyCode == 'F' || keyCode == 'S' || keyCode == 'C' || keyCode == 'G')) { processed = fdm_support->on_key_down_select_tool_type(keyCode); } if (processed) { @@ -925,7 +925,7 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) } else if (m_current == Seam) { GLGizmoSeam* seam = dynamic_cast(get_current()); - if (seam != nullptr && keyCode == 'S' || keyCode == 'C') { + if (seam != nullptr && (keyCode == 'S' || keyCode == 'C')) { processed = seam->on_key_down_select_tool_type(keyCode); } if (processed) { From afc622d84a2b9a661dbe2c888b81f857ac68a3b5 Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 18:39:40 +0700 Subject: [PATCH 7/8] NFC: Remove this check it can never be false --- src/slic3r/GUI/Jobs/PrintJob.cpp | 10 ++++------ src/slic3r/GUI/Jobs/SendJob.cpp | 10 ++++------ src/slic3r/GUI/MainFrame.cpp | 1 - src/slic3r/GUI/SendMultiMachinePage.cpp | 10 ++++------ 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index fe4174b6ba4..bb21337e6b7 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -47,12 +47,10 @@ void PrintJob::prepare() { if (job_data.is_from_plater) m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; + job_data._temp_path = fs::path(check_access_code_path); } void PrintJob::on_success(std::function success) diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 36b5bd5b3c1..4047a84ac67 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -38,12 +38,10 @@ SendJob::SendJob(std::string dev_id) void SendJob::prepare() { m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; + job_data._temp_path = fs::path(check_access_code_path); } wxString SendJob::get_http_error_msg(unsigned int status, std::string body) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 26a96ec9b4e..123939efb04 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -916,7 +916,6 @@ void MainFrame::update_title_colour_after_set_title() void MainFrame::show_option(bool show) { - if (!this) { return; } if (!show) { if (m_slice_btn->IsShown()) { m_slice_btn->Hide(); diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index bf766d78d02..c041306122a 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -473,12 +473,10 @@ BBL::PrintParams SendMultiMachinePage::request_params(MachineObject* obj) PrintPrepareData job_data; m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; + job_data._temp_path = fs::path(check_access_code_path); int curr_plate_idx; if (job_data.plate_idx >= 0) From 2c074e56b40aba81f0578996cb5dff57b5dcea03 Mon Sep 17 00:00:00 2001 From: Marius Wachtler Date: Tue, 7 Jan 2025 19:01:11 +0700 Subject: [PATCH 8/8] NFC: fix warning: statement has no effect --- src/libslic3r/Support/TreeSupport.cpp | 4 ++-- src/slic3r/Utils/UndoRedo.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index a0440bfcaf7..df81041213f 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -2380,7 +2380,7 @@ void TreeSupport::draw_circles(const std::vector>& contact_no ExPolygons& base_areas = ts_layer->base_areas; int layer_nr_lower = layer_nr - 1; - for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) { + for (; layer_nr_lower >= 0; layer_nr_lower--) { if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; } if (layer_nr_lower <= 0) continue; @@ -2470,7 +2470,7 @@ void TreeSupport::draw_circles(const std::vector>& contact_no if (ts_layer->area_groups.empty()) continue; int layer_nr_lower = layer_nr - 1; - for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) { + for (; layer_nr_lower >= 0; layer_nr_lower--) { if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; } if (layer_nr_lower < 0) continue; diff --git a/src/slic3r/Utils/UndoRedo.cpp b/src/slic3r/Utils/UndoRedo.cpp index eaf90c73490..8e7bd703c34 100644 --- a/src/slic3r/Utils/UndoRedo.cpp +++ b/src/slic3r/Utils/UndoRedo.cpp @@ -1071,7 +1071,7 @@ bool StackImpl::has_redo_snapshot() const // BBS: undo-redo until modify record auto it = std::lower_bound(m_snapshots.begin(), m_snapshots.end(), Snapshot(m_active_snapshot_time)); - for (it; it != m_snapshots.end(); ++it) { + for (; it != m_snapshots.end(); ++it) { if (snapshot_modifies_project(*it)) return true; } @@ -1340,12 +1340,12 @@ bool StackImpl::has_real_change_from(size_t time) const Snapshot(m_active_snapshot_time)); if (it_active == m_snapshots.end()) return true; if (it_active > it_time) { - for (it_time; it_time < it_active; ++it_time) { + for (; it_time < it_active; ++it_time) { if (snapshot_modifies_project(*it_time)) return true; } } else { - for (it_active; it_active < it_time; ++it_active) { + for (; it_active < it_time; ++it_active) { if (snapshot_modifies_project(*it_active)) return true; }