From c16f2f1c1e365c546a3e9bacfc4c701f042c3029 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 27 Sep 2024 12:39:38 +0200 Subject: [PATCH] Fixed couple of compiler warnings --- src/libslic3r/Format/PrintRequest.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 2 +- src/slic3r/GUI/DoubleSliderForLayers.cpp | 4 ++-- src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 3 ++- src/slic3r/GUI/ImGuiDoubleSlider.cpp | 2 -- src/slic3r/GUI/PresetArchiveDatabase.cpp | 24 ++------------------- src/slic3r/GUI/PresetArchiveDatabase.hpp | 1 - src/slic3r/GUI/UserAccountCommunication.hpp | 1 - src/slic3r/GUI/UserAccountUtils.cpp | 5 ++--- src/slic3r/Utils/PresetUpdater.cpp | 4 ++-- src/slic3r/Utils/PrusaConnect.cpp | 4 ++-- 12 files changed, 15 insertions(+), 39 deletions(-) diff --git a/src/libslic3r/Format/PrintRequest.cpp b/src/libslic3r/Format/PrintRequest.cpp index 7dceaea77d..5584a21b23 100644 --- a/src/libslic3r/Format/PrintRequest.cpp +++ b/src/libslic3r/Format/PrintRequest.cpp @@ -24,7 +24,7 @@ void read_file(const char* input_file, pt::ptree& tree) try { pt::read_xml(ifs, tree); } - catch (const boost::property_tree::xml_parser::xml_parser_error& err) { + catch (const boost::property_tree::xml_parser::xml_parser_error&) { throw Slic3r::RuntimeError("Failed reading PrintRequest file. File format is corrupt."); } } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 6c712f51d6..3235b023c8 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2703,7 +2703,7 @@ void PrintConfigDef::init_fff_params() def->category = L("Layers and Perimeters"); def->tooltip = L("Maximal length of any scarf joint segment."); def->sidetext = L("mm"); - def->min = 0.15; + def->min = 0.15f; def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(1.0)); diff --git a/src/slic3r/GUI/DoubleSliderForLayers.cpp b/src/slic3r/GUI/DoubleSliderForLayers.cpp index 66851b29e3..1d6275e441 100644 --- a/src/slic3r/GUI/DoubleSliderForLayers.cpp +++ b/src/slic3r/GUI/DoubleSliderForLayers.cpp @@ -295,7 +295,7 @@ void DSForLayers::draw_ruler(const ImRect& slideable_region) const float tick_width = float(int(1.0f * m_scale +0.5f)); const float label_height = m_imgui->GetTextureCustomRect(ImGui::PausePrint)->Height; - const ImU32 tick_clr = IM_COL32(255, 255, 255, 255); + constexpr ImU32 tick_clr = IM_COL32(255, 255, 255, 255); const float x_center = slideable_region.GetCenter().x; @@ -328,7 +328,7 @@ void DSForLayers::draw_ruler(const ImRect& slideable_region) ImGui::RenderText(start, label.c_str()); }; - auto draw_tick = [tick_clr, x_center, tick_width, inner_x](const float tick_pos, const float outer_x) + auto draw_tick = [x_center, tick_width, inner_x](const float tick_pos, const float outer_x) { ImRect tick_right = ImRect(x_center + inner_x, tick_pos - tick_width, x_center + outer_x, tick_pos); ImGui::RenderFrame(tick_right.Min, tick_right.Max, tick_clr, false); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5b2782c5ed..dd39fed1a2 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -857,7 +857,7 @@ void GUI_App::post_init() CallAfter([this] { // preset_updater->sync downloads profile updates and than via event checks updates and incompatible presets. We need to run it on startup. // start before cw so it is canceled by cw if needed? - this->preset_updater->sync(preset_bundle, this, std::move(plater()->get_preset_archive_database()->get_selected_archive_repositories())); + this->preset_updater->sync(preset_bundle, this, plater()->get_preset_archive_database()->get_selected_archive_repositories()); bool cw_showed = this->config_wizard_startup(); if (! cw_showed) { // The CallAfter is needed as well, without it, GL extensions did not show. diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index ab100f2ad4..2aa9202349 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -2710,9 +2710,10 @@ void GLGizmoEmboss::draw_advanced() return; } + +#ifdef SHOW_FONT_FILE_PROPERTY FontProp &font_prop = m_style_manager.get_font_prop(); const FontFile::Info &font_info = get_font_info(*ff.font_file, font_prop); -#ifdef SHOW_FONT_FILE_PROPERTY ImGui::SameLine(); int cache_size = ff.has_value()? (int)ff.cache->size() : 0; std::string ff_property = diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.cpp b/src/slic3r/GUI/ImGuiDoubleSlider.cpp index 10fa392531..93d4023d30 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.cpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.cpp @@ -604,7 +604,6 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos, const ImRect& slideable_region = m_selection == ssHigher ? m_regions.higher_slideable_region : m_regions.lower_slideable_region; const ImRect& active_thumb = m_selection == ssHigher ? m_regions.higher_thumb : m_regions.lower_thumb; - bool show_move_label = false; ImRect mouse_pos_rc = active_thumb; std::string move_label = ""; @@ -617,7 +616,6 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos, sl_region.Max.x += m_draw_opts.dummy_sz().x; behavior(id, sl_region, m_min_pos, m_max_pos, &m_mouse_pos, &mouse_pos_rc, m_flags, true); - show_move_label = true; move_label = get_label_on_move(m_mouse_pos); } diff --git a/src/slic3r/GUI/PresetArchiveDatabase.cpp b/src/slic3r/GUI/PresetArchiveDatabase.cpp index d4b671d317..9cf66376a8 100644 --- a/src/slic3r/GUI/PresetArchiveDatabase.cpp +++ b/src/slic3r/GUI/PresetArchiveDatabase.cpp @@ -118,7 +118,7 @@ void delete_path_recursive(const fs::path& path) fs::remove(path); } } - catch (const std::exception& e) { + catch (const std::exception&) { BOOST_LOG_TRIVIAL(error) << "Failed to delete files at: " << path; } } @@ -154,25 +154,6 @@ bool extract_local_archive_repository( ArchiveRepository::RepositoryManifest& ma return true; } -void deserialize_string(const std::string& opt, std::vector& result) -{ - std::string val; - for (size_t i = 0; i < opt.length(); i++) { - if (std::isspace(opt[i])) { - continue; - } - if (opt[i] != ';') { - val += opt[i]; - } - else { - result.emplace_back(std::move(val)); - } - } - if (!val.empty()) { - result.emplace_back(std::move(val)); - } -} - std::string escape_string(const std::string& unescaped) { std::string ret_val; @@ -326,7 +307,6 @@ void LocalArchiveRepository::do_extract() //-------------------------------------PresetArchiveDatabase------------------------------------------------------------------------------------------------------------------------- PresetArchiveDatabase::PresetArchiveDatabase(AppConfig* app_config, wxEvtHandler* evt_handler) - : p_evt_handler(evt_handler) { // boost::system::error_code ec; @@ -382,7 +362,7 @@ bool PresetArchiveDatabase::set_selected_repositories(const std::vector& pair : m_selected_repositories_uuid) { + for (const std::pair& pair : m_selected_repositories_uuid) { if (!pair.second) { continue; } diff --git a/src/slic3r/GUI/PresetArchiveDatabase.hpp b/src/slic3r/GUI/PresetArchiveDatabase.hpp index e5720e11a7..c0ed33362d 100644 --- a/src/slic3r/GUI/PresetArchiveDatabase.hpp +++ b/src/slic3r/GUI/PresetArchiveDatabase.hpp @@ -172,7 +172,6 @@ private: void consolidate_uuid_maps(); void extract_local_archives(); std::string get_next_uuid(); - wxEvtHandler* p_evt_handler; boost::filesystem::path m_unq_tmp_path; PrivateArchiveRepositoryVector m_archive_repositories; std::map m_selected_repositories_uuid; diff --git a/src/slic3r/GUI/UserAccountCommunication.hpp b/src/slic3r/GUI/UserAccountCommunication.hpp index c0859f4ca0..b1d569be54 100644 --- a/src/slic3r/GUI/UserAccountCommunication.hpp +++ b/src/slic3r/GUI/UserAccountCommunication.hpp @@ -96,7 +96,6 @@ private: bool m_remember_session { true }; // if default is true, on every login Remember me will be checked. wxTimer* m_token_timer; - wxEvtHandler* m_timer_evt_handler; std::time_t m_next_token_refresh_at{0}; void wakeup_session_thread(); diff --git a/src/slic3r/GUI/UserAccountUtils.cpp b/src/slic3r/GUI/UserAccountUtils.cpp index 81c8dfb9b6..f74a730e80 100644 --- a/src/slic3r/GUI/UserAccountUtils.cpp +++ b/src/slic3r/GUI/UserAccountUtils.cpp @@ -26,7 +26,7 @@ std::string parse_tree_for_param(const pt::ptree& tree, const std::string& param return {}; } -void parse_tree_for_param_vector( +/*void parse_tree_for_param_vector( const pt::ptree &tree, const std::string& param, std::vector& results) { for (const auto §ion : tree) { if (section.first == param) { @@ -35,7 +35,7 @@ const pt::ptree &tree, const std::string& param, std::vector& resul parse_tree_for_param_vector(section.second, param, results); } } -} +}*/ pt::ptree parse_tree_for_subtree(const pt::ptree& tree, const std::string& param) { for (const auto §ion : tree) { @@ -324,7 +324,6 @@ std::string get_print_data_from_json(const std::string& json, const std::string& size_t end_of_sub = json.find('}', end_of_filename_data); if (end_of_sub == std::string::npos) return {}; - size_t size = json.size(); std::string result = json.substr(start_of_sub, start_of_filename_data - start_of_sub + 1); result += "%1%"; result += json.substr(end_of_filename_data, end_of_sub - end_of_filename_data); diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index ec470919ee..23a8c55233 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -74,7 +74,7 @@ void copy_file_fix(const fs::path &source, const fs::path &target) static constexpr const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read; fs::permissions(target, perms); } -std::string escape_string_url(const std::string& unescaped) +/*std::string escape_string_url(const std::string& unescaped) { std::string ret_val; CURL* curl = curl_easy_init(); @@ -87,7 +87,7 @@ std::string escape_string_url(const std::string& unescaped) curl_easy_cleanup(curl); } return ret_val; -} +}*/ } wxDEFINE_EVENT(EVT_CONFIG_UPDATER_SYNC_DONE, wxCommandEvent); diff --git a/src/slic3r/Utils/PrusaConnect.cpp b/src/slic3r/Utils/PrusaConnect.cpp index 42cee4f1a7..d35f621b8f 100644 --- a/src/slic3r/Utils/PrusaConnect.cpp +++ b/src/slic3r/Utils/PrusaConnect.cpp @@ -21,7 +21,7 @@ namespace pt = boost::property_tree; namespace Slic3r { namespace { -std::string escape_string(const std::string& unescaped) +/*std::string escape_string(const std::string& unescaped) { std::string ret_val; CURL* curl = curl_easy_init(); @@ -45,7 +45,7 @@ std::string escape_path_by_element(const boost::filesystem::path& path) parent = parent.parent_path(); } return ret_val; -} +}*/ boost::optional get_error_message_from_response_body(const std::string& body) {