From 044a1c4fc59e2886b1583a80880a26b9258ac8be Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Sat, 7 Sep 2024 13:16:50 +0300 Subject: [PATCH] Warnings: various fixes (#6582) * Warnings: various fixes * Use std::ignore --- src/imgui/imgui_widgets.cpp | 6 +++--- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 2 +- src/slic3r/GUI/Jobs/PrintJob.cpp | 2 +- src/slic3r/GUI/ObjColorDialog.cpp | 8 +++++--- src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/WebGuideDialog.cpp | 10 +++++----- src/slic3r/GUI/WipeTowerDialog.cpp | 1 + 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/imgui/imgui_widgets.cpp b/src/imgui/imgui_widgets.cpp index ded72f4178..79d0638c1c 100644 --- a/src/imgui/imgui_widgets.cpp +++ b/src/imgui/imgui_widgets.cpp @@ -2134,7 +2134,7 @@ bool ImGui::BBLBeginCombo(const char *label, const char *preview_value, ImGuiCom bool hovered, held; bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held); - bool push_color_count = 0; + int push_color_count = 0; if (hovered || g.ActiveId == id) { ImGui::PushStyleColor(ImGuiCol_Border, GetColorU32(ImGuiCol_BorderActive)); push_color_count = 1; @@ -2168,7 +2168,7 @@ bool ImGui::BBLBeginCombo(const char *label, const char *preview_value, ImGuiCom OpenPopupEx(popup_id, ImGuiPopupFlags_None); popup_open = true; } - if (push_color_count > 0) { ImGui::PopStyleColor(push_color_count); } + if (push_color_count > 0) { ImGui::PopStyleColor(push_color_count); } if (!popup_open) return false; if (has_window_size_constraint) { @@ -4170,7 +4170,7 @@ bool ImGui::BBLInputScalar(const char *label, ImGuiDataType data_type, void *p_d // We are only allowed to access the state if we are already the active widget. ImGuiInputTextState *state = GetInputTextState(id); - bool push_color_count = 0; + int push_color_count = 0; if (hovered || g.ActiveId == id) { ImGui::PushStyleColor(ImGuiCol_Border, GetColorU32(ImGuiCol_BorderActive)); push_color_count = 1; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index bee454af28..2f101b09e3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -3057,7 +3057,7 @@ bool GLGizmoEmboss::choose_font_by_wxdialog() } #endif // ALLOW_ADD_FONT_BY_OS_SELECTOR -#if defined ALLOW_ADD_FONT_BY_FILE or defined ALLOW_DEBUG_MODE +#if defined ALLOW_ADD_FONT_BY_FILE || defined ALLOW_DEBUG_MODE namespace priv { static std::string get_file_name(const std::string &file_path) { diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 31bbccfb96..e9e56b3953 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -446,7 +446,7 @@ void PrintJob::process(Ctl &ctl) std::string curr_job_id; json job_info_j; try { - job_info_j.parse(job_info); + std::ignore = job_info_j.parse(job_info); if (job_info_j.contains("job_id")) { curr_job_id = job_info_j["job_id"].get(); } diff --git a/src/slic3r/GUI/ObjColorDialog.cpp b/src/slic3r/GUI/ObjColorDialog.cpp index 648faffbf9..bf05b43195 100644 --- a/src/slic3r/GUI/ObjColorDialog.cpp +++ b/src/slic3r/GUI/ObjColorDialog.cpp @@ -27,11 +27,13 @@ const int HEADER_BORDER = 5; const int CONTENT_BORDER = 3; const int PANEL_WIDTH = 370; const int COLOR_LABEL_WIDTH = 180; -#define ICON_SIZE wxSize(FromDIP(16), FromDIP(16)) + +#undef ICON_SIZE +#define ICON_SIZE wxSize(FromDIP(16), FromDIP(16)) #define MIN_OBJCOLOR_DIALOG_WIDTH FromDIP(400) #define FIX_SCROLL_HEIGTH FromDIP(400) -#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) -#define BTN_GAP FromDIP(20) +#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) +#define BTN_GAP FromDIP(20) static void update_ui(wxWindow* window) { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 342963ab05..9f717cd8c6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1789,7 +1789,7 @@ void Sidebar::sync_ams_list() // BBS:Record consumables information before synchronization std::vector color_before_sync; - std::vector is_support_before; + std::vector is_support_before; DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config; ConfigOptionStrings* color_opt = project_config.option("filament_colour"); for (int i = 0; i < p->combos_filament.size(); ++i) { diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 342a8958d8..84c54a2732 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -1139,8 +1139,8 @@ int GuideFrame::LoadProfile() //cout << iter->path().string() << endl; wxString strVendor = from_u8(iter->path().string()).BeforeLast('.'); - strVendor = strVendor.AfterLast( '\\'); - strVendor = strVendor.AfterLast('\/'); + strVendor = strVendor.AfterLast('\\'); + strVendor = strVendor.AfterLast('/'); wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower(); if (w2s(strVendor) == PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json") == 0) @@ -1158,8 +1158,8 @@ int GuideFrame::LoadProfile() //cout << "is a file" << endl; //cout << iter->path().string() << endl; wxString strVendor = from_u8(iter->path().string()).BeforeLast('.'); - strVendor = strVendor.AfterLast( '\\'); - strVendor = strVendor.AfterLast('\/'); + strVendor = strVendor.AfterLast('\\'); + strVendor = strVendor.AfterLast('/'); wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower(); if (w2s(strVendor) != PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json")==0) @@ -1656,7 +1656,7 @@ std::string GuideFrame::w2s(wxString sSrc) void GuideFrame::GetStardardFilePath(std::string &FilePath) { StrReplace(FilePath, "\\", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); - StrReplace(FilePath, "\/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); + StrReplace(FilePath, "/" , w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); } bool GuideFrame::LoadFile(std::string jPath, std::string &sContent) diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 98d79db27f..04c067f7d7 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -20,6 +20,7 @@ int scale(const int val) { return val * Slic3r::GUI::wxGetApp().em_unit() / 10; int ITEM_WIDTH() { return scale(30); } static const wxColour g_text_color = wxColour(107, 107, 107, 255); +#undef ICON_SIZE #define ICON_SIZE wxSize(FromDIP(16), FromDIP(16)) #define TABLE_BORDER FromDIP(28) #define HEADER_VERT_PADDING FromDIP(12)