FIX: remove some warnings

jira: [none]
Change-Id: I0e74b7316d0efe38c65e1f695b2a09eb09103552
This commit is contained in:
xin.zhang 2025-03-13 17:01:52 +08:00 committed by lane.wei
parent 6f527fd6aa
commit 766c6e0041
24 changed files with 54 additions and 53 deletions

View File

@ -33,8 +33,9 @@ struct ExtrusionLayer
enum class ExtrusionLayersType { INFILL, PERIMETERS, SUPPORT, WIPE_TOWER }; enum class ExtrusionLayersType { INFILL, PERIMETERS, SUPPORT, WIPE_TOWER };
struct ExtrusionLayers : public std::vector<ExtrusionLayer> class ExtrusionLayers : public std::vector<ExtrusionLayer>
{ {
public:
ExtrusionLayersType type; ExtrusionLayersType type;
}; };

View File

@ -1791,7 +1791,7 @@ void PresetBundle::export_selections(AppConfig &config)
// BBS // BBS
void PresetBundle::set_num_filaments(unsigned int n, std::string new_color) void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
{ {
int old_filament_count = this->filament_presets.size(); unsigned old_filament_count = this->filament_presets.size();
if (n > old_filament_count && old_filament_count != 0) if (n > old_filament_count && old_filament_count != 0)
filament_presets.resize(n, filament_presets.back()); filament_presets.resize(n, filament_presets.back());
else { else {
@ -1807,7 +1807,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
//BBS set new filament color to new_color //BBS set new filament color to new_color
if (old_filament_count < n) { if (old_filament_count < n) {
if (!new_color.empty()) { if (!new_color.empty()) {
for (int i = old_filament_count; i < n; i++) { for (unsigned i = old_filament_count; i < n; i++) {
filament_color->values[i] = new_color; filament_color->values[i] = new_color;
} }
} }
@ -1818,7 +1818,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
void PresetBundle::update_num_filaments(unsigned int to_del_flament_id) void PresetBundle::update_num_filaments(unsigned int to_del_flament_id)
{ {
int old_filament_count = this->filament_presets.size(); unsigned old_filament_count = this->filament_presets.size();
assert(to_del_flament_id < old_filament_count); assert(to_del_flament_id < old_filament_count);
filament_presets.erase(filament_presets.begin() + to_del_flament_id); filament_presets.erase(filament_presets.begin() + to_del_flament_id);
@ -2291,7 +2291,7 @@ Preset *PresetBundle::get_similar_printer_preset(std::string printer_model, std:
//BBS: check whether this is the only edited filament //BBS: check whether this is the only edited filament
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index) bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
{ {
int n = this->filament_presets.size(); unsigned n = this->filament_presets.size();
if (filament_index >= n) if (filament_index >= n)
return false; return false;
@ -2300,7 +2300,7 @@ bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
if (edited_preset.name != name) if (edited_preset.name != name)
return false; return false;
int index = 0; unsigned index = 0;
while (index < n) while (index < n)
{ {
if (index == filament_index) { if (index == filament_index) {

View File

@ -3456,7 +3456,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":error parsing thin_fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":error parsing thin_fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing thin_fills at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing thin_fills at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@ -3511,7 +3511,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing perimeters found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing perimeters found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing perimeters at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing perimeters at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@ -3526,7 +3526,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing fills at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing fills at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@ -3606,7 +3606,7 @@ void extract_support_layer(const json& support_layer_json, SupportLayer& support
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at support_layer %1%, print_z %2%")%support_layer.id() %support_layer.print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at support_layer %1%, print_z %2%")%support_layer.id() %support_layer.print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing fills at support_layer %d, print_z %f", support_layer.id(), support_layer.print_z); ::sprintf(error_buf, "Error while parsing fills at support_layer %zu, print_z %f", support_layer.id(), support_layer.print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }

View File

@ -6568,7 +6568,7 @@ std::vector<int> DynamicPrintConfig::update_values_to_printer_extruders(DynamicP
auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type")); auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type"));
if (extruder_id > 0 && extruder_id <= extruder_count) { if (extruder_id > 0 && extruder_id <= static_cast<unsigned> (extruder_count)) {
variant_index.resize(1); variant_index.resize(1);
ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(extruder_id - 1)); ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(extruder_id - 1));
NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(extruder_id - 1)); NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(extruder_id - 1));

View File

@ -5765,7 +5765,7 @@ NozzleFlowType MachineObject::get_nozzle_flow_type(int extruder_id) const
return NozzleFlowType::NONE_FLOWTYPE; return NozzleFlowType::NONE_FLOWTYPE;
} }
const Extder& MachineObject::get_current_extruder() const Extder MachineObject::get_current_extruder() const
{ {
if (m_extder_data.extders.size() <= m_extder_data.current_extder_id) if (m_extder_data.extders.size() <= m_extder_data.current_extder_id)
{ {

View File

@ -773,7 +773,7 @@ public:
/*extruder*/ /*extruder*/
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; }; [[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; };
[[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const; [[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const;
[[nodiscard]] const Extder& get_current_extruder() const; [[nodiscard]] Extder get_current_extruder() const;
//new fan data //new fan data
AirDuctData m_air_duct_data; AirDuctData m_air_duct_data;

View File

@ -32,7 +32,7 @@ void BindJob::on_exception(const std::exception_ptr &eptr)
try { try {
if (eptr) if (eptr)
std::rethrow_exception(eptr); std::rethrow_exception(eptr);
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
PlaterJob::on_exception(eptr); PlaterJob::on_exception(eptr);
} }
} }

View File

@ -60,7 +60,7 @@ void PrintJob::on_exception(const std::exception_ptr &eptr)
try { try {
if (eptr) if (eptr)
std::rethrow_exception(eptr); std::rethrow_exception(eptr);
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
PlaterJob::on_exception(eptr); PlaterJob::on_exception(eptr);
} }
} }
@ -113,9 +113,9 @@ wxString PrintJob::get_http_error_msg(unsigned int status, std::string body)
if (!j["message"].is_null()) if (!j["message"].is_null())
message = j["message"].get<std::string>(); message = j["message"].get<std::string>();
} }
switch (status) { //switch (status) {
; // ;
} //}
} }
catch (...) { catch (...) {
; ;
@ -157,7 +157,7 @@ void PrintJob::process()
} }
int result = -1; int result = -1;
unsigned int http_code; //unsigned int http_code;
std::string http_body; std::string http_body;
int total_plate_num = plate_data.plate_count; int total_plate_num = plate_data.plate_count;

View File

@ -50,7 +50,7 @@ void SendJob::on_exception(const std::exception_ptr &eptr)
try { try {
if (eptr) if (eptr)
std::rethrow_exception(eptr); std::rethrow_exception(eptr);
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
PlaterJob::on_exception(eptr); PlaterJob::on_exception(eptr);
} }
} }
@ -76,9 +76,6 @@ wxString SendJob::get_http_error_msg(unsigned int status, std::string body)
if (!j["message"].is_null()) if (!j["message"].is_null())
message = j["message"].get<std::string>(); message = j["message"].get<std::string>();
} }
switch (status) {
;
}
} }
catch (...) { catch (...) {
; ;
@ -120,7 +117,7 @@ void SendJob::process()
NetworkAgent* m_agent = wxGetApp().getAgent(); NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config; AppConfig* config = wxGetApp().app_config;
int result = -1; int result = -1;
unsigned int http_code; //unsigned int http_code;
std::string http_body; std::string http_body;

View File

@ -25,7 +25,7 @@ void UpgradeNetworkJob::on_exception(const std::exception_ptr &eptr)
try { try {
if (eptr) if (eptr)
std::rethrow_exception(eptr); std::rethrow_exception(eptr);
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
UpgradeNetworkJob::on_exception(eptr); UpgradeNetworkJob::on_exception(eptr);
} }
} }

View File

@ -133,7 +133,7 @@ namespace GUI {
} }
} }
catch (std::exception& e) { catch (std::exception& /*e*/) {
// wxMessageBox(e.what(), "json Exception", MB_OK); // wxMessageBox(e.what(), "json Exception", MB_OK);
} }
} }

View File

@ -160,7 +160,7 @@ MonitorPanel::~MonitorPanel()
m_refresh_timer = new wxTimer(); m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
wxPostEvent(this, wxTimerEvent()); if (update_flag) { update_all();}
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return; if (!dev) return;
@ -468,7 +468,7 @@ bool MonitorPanel::Show(bool show)
m_refresh_timer->Stop(); m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
wxPostEvent(this, wxTimerEvent()); if (update_flag) { update_all(); }
if (dev) { if (dev) {
//set a default machine when obj is null //set a default machine when obj is null

View File

@ -21,7 +21,6 @@ MonitorBasePanel::MonitorBasePanel(wxWindow* parent, wxWindowID id, const wxPoin
m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_BORDER); m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_BORDER);
m_splitter->SetSashGravity(0); m_splitter->SetSashGravity(0);
m_splitter->SetSashSize(0);
m_splitter->Connect(wxEVT_IDLE, wxIdleEventHandler(MonitorBasePanel::m_splitterOnIdle), NULL, this); m_splitter->Connect(wxEVT_IDLE, wxIdleEventHandler(MonitorBasePanel::m_splitterOnIdle), NULL, this);
m_splitter->SetMinimumPaneSize(182); m_splitter->SetMinimumPaneSize(182);

View File

@ -324,7 +324,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt)
} }
} }
catch (std::exception& e) { catch (std::exception& /*e*/) {
// wxMessageBox(e.what(), "json Exception", MB_OK); // wxMessageBox(e.what(), "json Exception", MB_OK);
} }
} }

View File

@ -855,7 +855,7 @@ void SearchDialog::OnCheck(wxCommandEvent &event)
void SearchDialog::OnMotion(wxMouseEvent &event) void SearchDialog::OnMotion(wxMouseEvent &event)
{ {
wxDataViewItem item; wxDataViewItem item;
wxDataViewColumn *col; //wxDataViewColumn *col;
wxWindow * win = this; wxWindow * win = this;
// search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col); // search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col);

View File

@ -406,7 +406,13 @@ void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus))
} }
} }
wxPostEvent(this, wxTimerEvent()); {
wxGetApp().reset_to_active();
wxCommandEvent user_event(EVT_UPDATE_USER_MACHINE_LIST);
user_event.SetEventObject(this);
wxPostEvent(this, user_event);
}
PopupWindow::Popup(); PopupWindow::Popup();
} }

View File

@ -442,7 +442,7 @@ static std::string generate_system_info_json()
pt::ptree hw_node; pt::ptree hw_node;
{ {
hw_node.put("ArchName", wxPlatformInfo::Get().GetArchName()); hw_node.put("ArchName", wxPlatformInfo::Get().GetBitnessName());
size_t num = std::round(Slic3r::total_physical_memory()/107374100.); size_t num = std::round(Slic3r::total_physical_memory()/107374100.);
hw_node.put("RAM_GiB", std::to_string(num / 10) + "." + std::to_string(num % 10)); hw_node.put("RAM_GiB", std::to_string(num / 10) + "." + std::to_string(num % 10));
} }

View File

@ -227,7 +227,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string(); auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string();
desktop_open_any_folder(plugin_folder); desktop_open_any_folder(plugin_folder);
} }
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
// wxMessageBox(e.what(), "json Exception", MB_OK); // wxMessageBox(e.what(), "json Exception", MB_OK);
} }
} }

View File

@ -309,11 +309,11 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con
m_playing_timer = new wxTimer(); m_playing_timer = new wxTimer();
m_playing_timer->SetOwner(this); m_playing_timer->SetOwner(this);
wxPostEvent(this, wxTimerEvent());
SetSize(AMS_REFRESH_SIZE); SetSize(AMS_REFRESH_SIZE);
SetMinSize(AMS_REFRESH_SIZE); SetMinSize(AMS_REFRESH_SIZE);
SetMaxSize(AMS_REFRESH_SIZE); SetMaxSize(AMS_REFRESH_SIZE);
Refresh();
} }
void AMSrefresh::on_timer(wxTimerEvent &event) void AMSrefresh::on_timer(wxTimerEvent &event)

View File

@ -345,7 +345,7 @@ int DropDown::hoverIndex()
return hover_item; return hover_item;
int index = -1; int index = -1;
std::set<wxString> groups; std::set<wxString> groups;
for (size_t i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
auto &item = items[i]; auto &item = items[i];
// Skip by group // Skip by group
if (group.IsEmpty()) { if (group.IsEmpty()) {

View File

@ -55,7 +55,6 @@ inline wxColour darkModeColorFor2(wxColour const &color)
if (!gDarkMode) if (!gDarkMode)
return color; return color;
auto iter = gDarkColors.find(color); auto iter = gDarkColors.find(color);
wxFAIL(iter != gDarkColors.end());
if (iter != gDarkColors.end()) return iter->second; if (iter != gDarkColors.end()) return iter->second;
return color; return color;
} }
@ -71,7 +70,6 @@ wxColour StateColor::lightModeColorFor(wxColour const &color)
{ {
static std::map<wxColour, wxColour> gLightColors = revert(gDarkColors); static std::map<wxColour, wxColour> gLightColors = revert(gDarkColors);
auto iter = gLightColors.find(color); auto iter = gLightColors.find(color);
wxFAIL(iter != gLightColors.end());
if (iter != gLightColors.end()) return iter->second; if (iter != gLightColors.end()) return iter->second;
return color; return color;
} }

View File

@ -72,7 +72,7 @@ void StateHandler::update_binds()
void StateHandler::set_state(int state, int mask) void StateHandler::set_state(int state, int mask)
{ {
if (states_ & mask == state & mask) return; if ((states_ & mask) == (state & mask)) return;
int old = states_; int old = states_;
states_ = states_ & ~mask | state & mask; states_ = states_ & ~mask | state & mask;
if (old != states_ && (old | states2_) != (states_ | states2_)) { if (old != states_ && (old | states2_) != (states_ | states2_)) {

View File

@ -312,7 +312,7 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript)
}, NULL); }, NULL);
return true; return true;
#endif #endif
} catch (std::exception &e) { } catch (std::exception &/*e*/) {
return false; return false;
} }
} }