Fixed couple of compiler warnings

This commit is contained in:
Lukas Matena 2024-03-28 11:03:23 +01:00
parent c88a1d7c16
commit 137340f70f
10 changed files with 17 additions and 14 deletions

View File

@ -9,6 +9,6 @@ std::string GetDataDir()
inDomain:NSUserDomainMask
appropriateForURL:nil create:NO error:nil];
return std::string([(CFStringRef)url.path UTF8String]);
return std::string([url.path UTF8String]);
}

View File

@ -475,7 +475,7 @@ std::string load_full_print_config(const std::string& print_preset_name,
check_material(material_preset_names_in.front(), errors);
if (material_preset_names_in.size() > 1) {
for (int idx = 1; idx < material_preset_names_in.size(); idx++) {
for (size_t idx = 1; idx < material_preset_names_in.size(); idx++) {
if (material_preset_names_in[idx] != material_preset_names_in.front())
check_material(material_preset_names_in[idx], errors);
}
@ -494,14 +494,14 @@ std::string load_full_print_config(const std::string& print_preset_name,
}
if (printer_technology == ptFFF) {
const int extruders_count = static_cast<const ConfigOptionFloats*>(printer_preset->config.option("nozzle_diameter"))->values.size();
const int extruders_count = int(static_cast<const ConfigOptionFloats*>(printer_preset->config.option("nozzle_diameter"))->values.size());
if (extruders_count > material_preset_names.size()) {
BOOST_LOG_TRIVIAL(warning) << "Note: Less than needed filament profiles were entered. Missed filament profiles will be filled with first material.";
material_preset_names.reserve(extruders_count);
for (int i = extruders_count - material_preset_names.size(); i > 0; i--)
material_preset_names.push_back(material_preset_names.front());
}
else if (extruders_count < material_preset_names.size()) {
else if (extruders_count < int(material_preset_names.size())) {
BOOST_LOG_TRIVIAL(warning) << "Note: More than needed filament profiles were entered. Extras filament profiles will be ignored.";
material_preset_names.resize(extruders_count);
}
@ -529,7 +529,7 @@ std::string load_full_print_config(const std::string& print_preset_name,
check_material_preset_compatibility(material_preset_names.front(), errors);
if (material_preset_names.size() > 1) {
for (int idx = 1; idx < material_preset_names.size(); idx++) {
for (size_t idx = 1; idx < material_preset_names.size(); idx++) {
if (material_preset_names[idx] != material_preset_names.front())
check_material_preset_compatibility(material_preset_names[idx], errors);
}

View File

@ -1579,7 +1579,7 @@ static bool is_focused(HWND hWnd)
}
#endif
static bool is_default(wxWindow* win)
[[maybe_unused]] static bool is_default(wxWindow* win)
{
wxTopLevelWindow* tlw = find_toplevel_parent(win);
if (!tlw)

View File

@ -909,7 +909,7 @@ void MainFrame::set_printer_webview_tab_url(const wxString& url)
}
m_printer_webview->clear();
m_printer_webview->set_default_url(url);
if (m_tabpanel->GetSelection() == m_tabpanel->GetPageCount() - 1) {
if (m_tabpanel->GetSelection() == int(m_tabpanel->GetPageCount() - 1)) {
m_printer_webview->load_url(url);
} else {
m_printer_webview->load_default_url_delayed();
@ -1903,9 +1903,10 @@ void MainFrame::export_configbundle(bool export_physical_printers /*= false*/)
file = dlg.GetPath();
if (!file.IsEmpty()) {
// Export the config bundle.
#if wxUSE_SECRETSTORE
bool passwords_to_plain = false;
bool passwords_dialog_shown = false;
#endif
// callback function thats going to be passed to preset bundle (so preset bundle doesnt have to include WX secret lib)
std::function<bool(const std::string&, const std::string&, std::string&)> load_password = [&](const std::string& printer_id, const std::string& opt, std::string& out_psswd)->bool{
out_psswd = std::string();

View File

@ -228,7 +228,6 @@ void TopBarItemsCtrl::CreateAccountMenu()
m_connect_dummy_menu_item = append_menu_item(&m_account_menu, wxID_ANY, _L("PrusaConnect Printers"), "",
[](wxCommandEvent&) { wxGetApp().plater()->get_user_account()->enqueue_connect_printers_action(); },
"", nullptr, []() { return wxGetApp().plater()->get_user_account()->is_logged(); }, this->GetParent());
#endif // 0
wxMenuItem* remember_me_menu_item = append_menu_check_item(&m_account_menu, wxID_ANY, _L("Remember me"), ""
, [](wxCommandEvent&) { wxGetApp().plater()->get_user_account()->toggle_remember_session(); }
@ -236,6 +235,7 @@ void TopBarItemsCtrl::CreateAccountMenu()
, []() { return wxGetApp().plater()->get_user_account() ? wxGetApp().plater()->get_user_account()->is_logged() : false; }
, []() { return wxGetApp().plater()->get_user_account() ? wxGetApp().plater()->get_user_account()->get_remember_session() : false; }
, this->GetParent());
#endif // 0
m_login_menu_item = append_menu_item(&m_account_menu, wxID_ANY, "", "",
[](wxCommandEvent&) {

View File

@ -310,7 +310,7 @@ void UserAccountCommunication::enqueue_connect_user_data_action()
}
wakeup_session_thread();
}
#endif 0
#endif // 0
void UserAccountCommunication::enqueue_connect_printers_action()
{
@ -422,7 +422,7 @@ std::string CodeChalengeGenerator::generate_code_verifier(size_t length)
std::mt19937 gen(rd());
std::uniform_int_distribution<int> distribution(0, chars.size() - 1);
std::string code_verifier;
for (int i = 0; i < length; ++i) {
for (size_t i = 0; i < length; ++i) {
code_verifier += chars[distribution(gen)];
}
return code_verifier;

View File

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

View File

@ -650,7 +650,8 @@ void WebViewDialog::run_script(const wxString& javascript)
{
if (!m_browser)
return;
bool res = WebView::run_script(m_browser, javascript);
// dk_FIXME: Is it ok to discard the return value?
/*bool res = */ WebView::run_script(m_browser, javascript);
}
PrinterPickWebViewDialog::PrinterPickWebViewDialog(wxWindow* parent, std::string& ret_val)

View File

@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <AppKit/NSScreen.h>
#import <WebKit/WebKit.h>
@interface MacDarkMode : NSObject {}
@end

View File

@ -71,7 +71,7 @@ bool PrusaConnectNew::test(wxString& curl_msg) const
res = false;
curl_msg = format_error(body, error, status);
})
.on_complete([&, this](std::string body, unsigned) {
.on_complete([&](std::string body, unsigned) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Got files/raw: %2%") % name % body;
})
.perform_sync();