MinGW: Fix -Wsign-compare

This commit is contained in:
João Valverde 2023-01-13 20:32:34 +00:00
parent 6870449734
commit f3152af8a0
3 changed files with 6 additions and 7 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}