From f3152af8a024e199fc480705589f5798bb75f127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Fri, 13 Jan 2023 20:32:34 +0000 Subject: [PATCH] MinGW: Fix -Wsign-compare --- extcap/ssh-base.c | 4 ++-- ui/win32/file_dlg_win32.cpp | 4 ++-- wsutil/win32-utils.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c index 7e735e321a..929cd8af2b 100644 --- a/extcap/ssh-base.c +++ b/extcap/ssh-base.c @@ -124,7 +124,7 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf } /* Workaround: it may happen that libssh closes socket in meantime and any next ssh_ call fails so we should detect it in advance */ - if (ssh_get_fd(sshs) != -1) { + if (ssh_get_fd(sshs) != (socket_t)-1) { /* If a password has been provided and all previous attempts failed, try to use it */ if (ssh_params->password) { ws_info("Connecting using password..."); @@ -139,7 +139,7 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf } /* Workaround: it may happen that libssh closes socket in meantime and any next ssh_ call fails so we should detect it in advance */ - if (ssh_get_fd(sshs) != -1) { + if (ssh_get_fd(sshs) != (socket_t)-1) { /* Try to authenticate using standard public key */ ws_info("Connecting using standard public key..."); if (ssh_userauth_publickey_auto(sshs, NULL, NULL) == SSH_AUTH_SUCCESS) { diff --git a/ui/win32/file_dlg_win32.cpp b/ui/win32/file_dlg_win32.cpp index 8539022a15..53e6b92c4e 100644 --- a/ui/win32/file_dlg_win32.cpp +++ b/ui/win32/file_dlg_win32.cpp @@ -988,8 +988,8 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { g_format_type = (unsigned int) SendMessage(cur_ctrl, CB_GETCURSEL, 0, 0); /* The list of file formats is sorted. Get the format by name. */ - guint label_len; - label_len = (guint) SendMessage(cur_ctrl, CB_GETLBTEXTLEN, (WPARAM) g_format_type, 0); + LRESULT label_len; + label_len = SendMessage(cur_ctrl, CB_GETLBTEXTLEN, (WPARAM) g_format_type, 0); if (label_len != CB_ERR) { TCHAR *label = g_new(TCHAR, label_len+1); SendMessage(cur_ctrl, CB_GETLBTEXT, (WPARAM) g_format_type, (LPARAM) label); diff --git a/wsutil/win32-utils.c b/wsutil/win32-utils.c index 97f586768c..7d61b2114e 100644 --- a/wsutil/win32-utils.c +++ b/wsutil/win32-utils.c @@ -149,7 +149,7 @@ win32strexception(DWORD exception) { static char errbuf[ERRBUF_SIZE+1]; static const struct exception_msg { - int code; + DWORD code; char *msg; } exceptions[] = { { EXCEPTION_ACCESS_VIOLATION, "Access violation" }, @@ -177,9 +177,8 @@ win32strexception(DWORD exception) { 0, NULL } }; #define N_EXCEPTIONS (sizeof exceptions / sizeof exceptions[0]) - int i; - for (i = 0; i < N_EXCEPTIONS; i++) { + for (size_t i = 0; i < N_EXCEPTIONS; i++) { if (exceptions[i].code == exception) return exceptions[i].msg; }