From 1bff4a0727c3e9e33418965205b127b956e7717e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Sat, 27 Jan 2024 13:30:59 +0100
Subject: [PATCH 1/4] fix incompatible pointer warnings
---
libsylph/utils.c | 8 ++++----
libsylph/utils.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libsylph/utils.c b/libsylph/utils.c
index aabce066..7a9d1b61 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -4047,7 +4047,7 @@ static gchar **argv_utf8_to_locale(gchar **argv)
}
#endif
-gint execute_async(gchar *const argv[])
+gint execute_async(gchar * argv[])
{
#if defined(G_OS_WIN32) && !GLIB_CHECK_VERSION(2, 8, 2)
gchar **cp_argv;
@@ -4077,7 +4077,7 @@ gint execute_async(gchar *const argv[])
return 0;
}
-gint execute_sync(gchar *const argv[])
+gint execute_sync(gchar * argv[])
{
gint status;
#if defined(G_OS_WIN32) && !GLIB_CHECK_VERSION(2, 8, 2)
@@ -4247,7 +4247,7 @@ gint execute_open_file(const gchar *file, const gchar *content_type)
return 0;
}
#elif defined(__APPLE__)
- const gchar *argv[3] = {"open", NULL, NULL};
+ gchar *argv[3] = {"open", NULL, NULL};
g_return_val_if_fail(file != NULL, -1);
@@ -4256,7 +4256,7 @@ gint execute_open_file(const gchar *file, const gchar *content_type)
argv[1] = file;
execute_async(argv);
#else
- const gchar *argv[3] = {"xdg-open", NULL, NULL};
+ gchar *argv[3] = {"xdg-open", NULL, NULL};
g_return_val_if_fail(file != NULL, -1);
diff --git a/libsylph/utils.h b/libsylph/utils.h
index 9ac65cf4..97496049 100644
--- a/libsylph/utils.h
+++ b/libsylph/utils.h
@@ -513,8 +513,8 @@ gchar *file_read_to_str (const gchar *file);
gchar *file_read_stream_to_str (FILE *fp);
/* process execution */
-gint execute_async (gchar *const argv[]);
-gint execute_sync (gchar *const argv[]);
+gint execute_async (gchar * argv[]);
+gint execute_sync (gchar * argv[]);
gint execute_command_line (const gchar *cmdline,
gboolean async);
gint execute_command_line_async_wait
--
2.43.0
From 1ae0b7e973e5da02190cfd5aeb145e6604af1e37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Sat, 27 Jan 2024 13:31:38 +0100
Subject: [PATCH 2/4] fix pointer to int cast
---
libsylph/account.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsylph/account.c b/libsylph/account.c
index 2431bf3d..7067af3d 100644
--- a/libsylph/account.c
+++ b/libsylph/account.c
@@ -276,7 +276,7 @@ gboolean account_address_exist(const gchar *address)
}
}
- return (gboolean)g_hash_table_lookup(address_table, address);
+ return g_hash_table_lookup(address_table, address) != NULL;
}
void account_foreach(AccountFunc func, gpointer user_data)
--
2.43.0
From 5427f4108a08c32869af0a3b56f13cb8a545fc7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Sat, 27 Jan 2024 13:32:13 +0100
Subject: [PATCH 3/4] fix format for size_t argument
---
libsylph/codeconv.c | 2 +-
libsylph/procmime.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libsylph/codeconv.c b/libsylph/codeconv.c
index 49d1b3d3..6cad90d5 100644
--- a/libsylph/codeconv.c
+++ b/libsylph/codeconv.c
@@ -2722,7 +2722,7 @@ CharSet conv_check_file_encoding(const gchar *file)
if ((size = fread(buf, 2, BUFFSIZE / 2, fp)) > 0) {
CharSet guess_enc = C_AUTO;
- debug_print("conv_check_file_encoding: check first %d bytes of file %s\n", size * 2, file);
+ debug_print("conv_check_file_encoding: check first %zd bytes of file %s\n", size * 2, file);
/* BOM check */
if ((buf[0] & 0xff) == 0xfe && (buf[1] & 0xff) == 0xff) {
diff --git a/libsylph/procmime.c b/libsylph/procmime.c
index 4c3a90c6..0c101920 100644
--- a/libsylph/procmime.c
+++ b/libsylph/procmime.c
@@ -1890,7 +1890,7 @@ EncodingType procmime_get_encoding_for_text_file(const gchar *file)
octet_percentage = 0.0;
debug_print("procmime_get_encoding_for_text_file(): "
- "8bit chars: %d / %d (%f%%)\n", octet_chars, total_len,
+ "8bit chars: %zd / %zd (%f%%)\n", octet_chars, total_len,
100.0 * octet_percentage);
if (octet_percentage > 0.20) {
@@ -1926,7 +1926,7 @@ EncodingType procmime_get_encoding_for_str(const gchar *str)
octet_percentage = 0.0;
debug_print("procmime_get_encoding_for_str(): "
- "8bit chars: %d / %d (%f%%)\n", octet_chars, total_len,
+ "8bit chars: %zd / %zd (%f%%)\n", octet_chars, total_len,
100.0 * octet_percentage);
if (octet_percentage > 0.20) {
--
2.43.0
From 7aba8dcfe69ed08b3484464d8424ef16220d792c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Sat, 27 Jan 2024 14:26:33 +0100
Subject: [PATCH 4/4] fix format for glib types
---
libsylph/filter.c | 4 ++--
libsylph/folder.c | 2 +-
libsylph/pop.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libsylph/filter.c b/libsylph/filter.c
index c58f8fc9..9607ccfb 100644
--- a/libsylph/filter.c
+++ b/libsylph/filter.c
@@ -566,10 +566,10 @@ static gboolean filter_match_cond(FilterCond *cond, MsgInfo *msginfo,
debug_print("filter-log: %s: CMD_TEST, str_value: [%s]%s\n", G_STRFUNC, sv, nm);
break;
case FLT_COND_SIZE_GREATER:
- debug_print("filter-log: %s: SIZE_GREATER: %u %s %d (KB)%s\n", G_STRFUNC, msginfo->size, not_match ? "<=" : ">", cond->int_value, nm);
+ debug_print("filter-log: %s: SIZE_GREATER: %" G_GSIZE_FORMAT " %s %d (KB)%s\n", G_STRFUNC, msginfo->size, not_match ? "<=" : ">", cond->int_value, nm);
break;
case FLT_COND_AGE_GREATER:
- debug_print("filter-log: %s: AGE_GREATER: %lld (sec) %s %d (day)%s\n", G_STRFUNC, timediff, not_match ? "<=" : ">", cond->int_value, nm);
+ debug_print("filter-log: %s: AGE_GREATER: %" G_GINT64_FORMAT " (sec) %s %d (day)%s\n", G_STRFUNC, timediff, not_match ? "<=" : ">", cond->int_value, nm);
break;
case FLT_COND_UNREAD:
debug_print("filter-log: %s: UNREAD%s\n", G_STRFUNC, nm);
diff --git a/libsylph/folder.c b/libsylph/folder.c
index 6fffe2dc..c1487e11 100644
--- a/libsylph/folder.c
+++ b/libsylph/folder.c
@@ -1945,7 +1945,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
}
fprintf(fp,
- " mtime=\"%lld\" new=\"%d\" unread=\"%d\" total=\"%d\"",
+ " mtime=\"%" G_GINT64_FORMAT "\" new=\"%d\" unread=\"%d\" total=\"%d\"",
(gint64)item->mtime, item->new, item->unread, item->total);
if (item->account)
diff --git a/libsylph/pop.c b/libsylph/pop.c
index 8cb7f5cb..7108b7a6 100644
--- a/libsylph/pop.c
+++ b/libsylph/pop.c
@@ -195,7 +195,7 @@ gint pop3_getrange_stat_send(Pop3Session *session)
gint pop3_getrange_stat_recv(Pop3Session *session, const gchar *msg)
{
- if (sscanf(msg, "%d %lld", &session->count, &session->total_bytes) != 2) {
+ if (sscanf(msg, "%d %" G_GINT64_FORMAT "", &session->count, &session->total_bytes) != 2) {
log_warning(_("POP3 protocol error\n"));
session->error_val = PS_PROTOCOL;
return PS_PROTOCOL;
--
2.43.0
|