From 2eb1adb719d39440c2c13d45010eb28702bf53ae Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Thu, 22 Aug 2024 19:02:58 +0300 Subject: [PATCH] Reduce warnings: remove unused variables (#6499) Removed unused variables --- src/OrcaSlicer.cpp | 1 - src/libslic3r/Format/bbs_3mf.cpp | 1 - src/slic3r/GUI/DeviceManager.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 1 - src/slic3r/GUI/GLTexture.cpp | 1 - src/slic3r/GUI/GUI_App.cpp | 12 +++++------- src/slic3r/GUI/GUI_Factories.cpp | 1 - src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/Jobs/PrintJob.cpp | 3 +-- src/slic3r/GUI/Jobs/SendJob.cpp | 1 - src/slic3r/GUI/ModelMall.cpp | 2 +- src/slic3r/GUI/PartPlate.cpp | 8 ++++---- src/slic3r/GUI/Plater.cpp | 9 ++++----- src/slic3r/GUI/Project.cpp | 2 +- src/slic3r/GUI/Search.cpp | 1 - src/slic3r/GUI/UserManager.cpp | 2 +- src/slic3r/GUI/WebDownPluginDlg.cpp | 2 +- src/slic3r/GUI/Widgets/WebView.cpp | 2 +- 18 files changed, 21 insertions(+), 32 deletions(-) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index bb52a0aea..5ec7d97d9 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -1190,7 +1190,6 @@ int CLI::run(int argc, char **argv) //BBS: add plate data related logic PlateDataPtrs plate_data_src; std::vector plate_obj_size_infos; - int arrange_option; int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0; bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false; bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false; diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index 90f4536b9..206fc2aac 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -878,7 +878,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) bool extract_object_model() { mz_zip_archive archive; - mz_zip_archive_file_stat stat; mz_zip_zero_struct(&archive); if (!open_zip_reader(&archive, zip_path)) { diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index a79dd0a02..4c4eb37c6 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -5662,7 +5662,7 @@ void DeviceManager::parse_user_print_info(std::string body) } } } - catch (std::exception& e) { + catch (std::exception&) { ; } } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6365b88a2..5f45d9b1c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -8434,7 +8434,6 @@ void GLCanvas3D::_render_assemble_info() const auto canvas_h = float(get_canvas_size().get_height()); float space_size = imgui->get_style_scaling() * 8.0f; float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size; - char buf[3][64]; ImGuiIO& io = ImGui::GetIO(); ImFont* font = io.Fonts->Fonts[0]; diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 79cbb7737..be0b40265 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -470,7 +470,6 @@ void GLTexture::reset() bool GLTexture::generate_from_text_string(const std::string& text_str, wxFont &font, wxColor background, wxColor foreground) { - int w,h,hl; return generate_from_text(text_str, font, background, foreground); } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index eb5ae0c38..4c89e966b 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1026,7 +1026,7 @@ void GUI_App::post_init() try { std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ; files_vec.push_back({ lw_t, temp_path.filename().string() }); - } catch (const std::exception &ex) { + } catch (const std::exception &) { } } std::sort(files_vec.begin(), files_vec.end(), []( @@ -3365,7 +3365,7 @@ if (res) { mainframe->refresh_plugin_tips(); // BBS: remove SLA related message } - } catch (std::exception &e) { + } catch (std::exception &) { // wxMessageBox(e.what(), "", MB_OK); } } @@ -3379,7 +3379,7 @@ void GUI_App::ShowDownNetPluginDlg() { return; DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in")); dlg.ShowModal(); - } catch (std::exception &e) { + } catch (std::exception &) { ; } } @@ -3396,7 +3396,7 @@ void GUI_App::ShowUserLogin(bool show) login_dlg = new ZUserLogin(); } login_dlg->ShowModal(); - } catch (std::exception &e) { + } catch (std::exception &) { ; } } else { @@ -3418,7 +3418,7 @@ void GUI_App::ShowOnlyFilament() { // BBS: remove SLA related message } - } catch (std::exception &e) { + } catch (std::exception &) { // wxMessageBox(e.what(), "", MB_OK); } } @@ -6507,8 +6507,6 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t return false; if (!bDidntExist) { - DWORD dwDisposition; - HKEY hkey; iRC = ::RegDeleteKeyExW(hkeyHive, pszVar, KEY_ALL_ACCESS, 0); if (iRC == ERROR_SUCCESS) { return true; diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index ee19b2549..3cd5c2e05 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -1977,7 +1977,6 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu) for (wxDataViewItem item : sels) { ItemType type = list->GetModel()->GetItemType(item); - bool check; if (type != itInstance && type != itObject) continue; else { diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 30846abf5..e1fc0b0f1 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2006,7 +2006,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo try { model = Model::read_from_file(input_file, nullptr, nullptr, LoadStrategy::LoadModel); } - catch (std::exception& e) { + catch (std::exception&) { // auto msg = _L("Error!") + " " + input_file + " : " + e.what() + "."; auto msg = _L("Error!") + " " + _L("Failed to get the model data in the current file."); show_error(parent, msg); diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index a54310c23..31bbccfb9 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -150,7 +150,6 @@ void PrintJob::process(Ctl &ctl) ctl.call_on_main_thread([this] { prepare(); }).wait(); int result = -1; - unsigned int http_code; std::string http_body; int total_plate_num = plate_data.plate_count; @@ -312,7 +311,7 @@ void PrintJob::process(Ctl &ctl) try { stl_design_id = std::stoi(wxGetApp().model().stl_design_id); } - catch (const std::exception& e) { + catch (const std::exception&) { stl_design_id = 0; } params.stl_design_id = stl_design_id; diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 656606054..1964aa24e 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -111,7 +111,6 @@ void SendJob::process(Ctl &ctl) NetworkAgent* m_agent = wxGetApp().getAgent(); AppConfig* config = wxGetApp().app_config; int result = -1; - unsigned int http_code; std::string http_body; if (this->connection_type == "lan") { diff --git a/src/slic3r/GUI/ModelMall.cpp b/src/slic3r/GUI/ModelMall.cpp index f14de1ebf..45833ba80 100644 --- a/src/slic3r/GUI/ModelMall.cpp +++ b/src/slic3r/GUI/ModelMall.cpp @@ -133,7 +133,7 @@ namespace GUI { } } - catch (std::exception& e) { + catch (std::exception&) { // wxMessageBox(e.what(), "json Exception", MB_OK); } } diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 7f2353a30..ce6581193 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -2522,7 +2522,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon) { auto compute_points = [&print_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count) { - double angle, angle_steps; + double angle_steps; angle_steps = (stop_angle - start_angle) / (count - 1); for(int j = 0; j < count; j++ ) { @@ -2541,7 +2541,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon) { const Vec2d& p = m_shape[i]; Vec2d center; - double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius; + double start_angle, stop_angle, radius_x, radius_y, radius; switch (i) { case 0: radius = 5.f; @@ -2592,7 +2592,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) { auto compute_exclude_points = [&exclude_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count) { - double angle, angle_steps; + double angle_steps; angle_steps = (stop_angle - start_angle) / (count - 1); for(int j = 0; j < count; j++ ) { @@ -2611,7 +2611,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) { const Vec2d& p = m_exclude_area[i]; Vec2d center; - double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius; + double start_angle, stop_angle, radius; switch (i) { case 0: radius = 5.f; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 469bba911..34eaa55be 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9083,7 +9083,7 @@ void Plater::import_model_id(wxString download_info) } } - catch (const std::exception& error) + catch (const std::exception&) { //wxString sError = error.what(); } @@ -9125,7 +9125,6 @@ void Plater::import_model_id(wxString download_info) // if (!m_agent) return; int res = 0; - unsigned int http_code; std::string http_body; msg = _L("prepare 3mf file..."); @@ -9164,7 +9163,7 @@ void Plater::import_model_id(wxString download_info) if (sFile == filename) is_already_exist = true; } } - catch (const std::exception& error) + catch (const std::exception&) { //wxString sError = error.what(); } @@ -12604,7 +12603,7 @@ int Plater::send_gcode(int plate_idx, Export3mfProgressFn proFn) p->m_print_job_data._3mf_path = fs::path(plate->get_tmp_gcode_path()); p->m_print_job_data._3mf_path.replace_extension("3mf"); } - catch (std::exception& e) { + catch (std::exception&) { BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed"; return -1; } @@ -12637,7 +12636,7 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn) try { p->m_print_job_data._3mf_config_path = fs::path(plate->get_temp_config_3mf_path()); } - catch (std::exception& e) { + catch (std::exception&) { BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed"; return -1; } diff --git a/src/slic3r/GUI/Project.cpp b/src/slic3r/GUI/Project.cpp index 003d0e4cd..e69ba143d 100644 --- a/src/slic3r/GUI/Project.cpp +++ b/src/slic3r/GUI/Project.cpp @@ -266,7 +266,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt) } } - catch (std::exception& e) { + catch (std::exception&) { // wxMessageBox(e.what(), "json Exception", MB_OK); } } diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index c8a661769..958f3b2b2 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -816,7 +816,6 @@ void SearchDialog::OnCheck(wxCommandEvent &event) void SearchDialog::OnMotion(wxMouseEvent &event) { wxDataViewItem item; - wxDataViewColumn *col; wxWindow * win = this; // search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col); diff --git a/src/slic3r/GUI/UserManager.cpp b/src/slic3r/GUI/UserManager.cpp index 29f5f2d13..4d3c1aceb 100644 --- a/src/slic3r/GUI/UserManager.cpp +++ b/src/slic3r/GUI/UserManager.cpp @@ -41,7 +41,7 @@ int UserManager::parse_json(std::string payload) //bind if (j_pre["bind"]["command"].get() == "bind") { std::string dev_id; - std:; string result; + std::string result; if (j_pre["bind"].contains("dev_id")) { dev_id = j_pre["bind"]["dev_id"].get(); diff --git a/src/slic3r/GUI/WebDownPluginDlg.cpp b/src/slic3r/GUI/WebDownPluginDlg.cpp index 82d2816f2..a4f3cc93c 100644 --- a/src/slic3r/GUI/WebDownPluginDlg.cpp +++ b/src/slic3r/GUI/WebDownPluginDlg.cpp @@ -227,7 +227,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt) auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string(); desktop_open_any_folder(plugin_folder); } - } catch (std::exception &e) { + } catch (std::exception &) { // wxMessageBox(e.what(), "json Exception", MB_OK); } } diff --git a/src/slic3r/GUI/Widgets/WebView.cpp b/src/slic3r/GUI/Widgets/WebView.cpp index 11f431c30..a84a15041 100644 --- a/src/slic3r/GUI/Widgets/WebView.cpp +++ b/src/slic3r/GUI/Widgets/WebView.cpp @@ -373,7 +373,7 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript) }, NULL); return true; #endif - } catch (std::exception &e) { + } catch (std::exception &) { return false; } }