commit 03066f1d7ce736a062f2a0d387ea9a70dc35b9c2
parent ac96dc8c627fe91a6c5596f23a4fee71c27567a6
Author: Jonathan Boeing <jonathan@claws-mail.org>
Date: Mon, 13 Sep 2021 02:02:18 -0700
Fix time_t format specifier warnings
Diffstat:
9 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -174,6 +174,19 @@ esac
AC_MSG_RESULT([$env_cygwin])
AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
+AC_MSG_CHECKING([for time_t format specifier])
+case "$host" in
+ x86_64-w64-mingw32)
+ time_t_fmt=lld
+ ;;
+ *)
+ time_t_fmt=ld
+ ;;
+esac
+AC_MSG_RESULT([$time_t_fmt])
+AC_DEFINE_UNQUOTED([CM_TIME_FORMAT], ["$time_t_fmt"],
+ [Define printf format specifier for time_t])
+
if test "$GCC" = "yes"
then
CFLAGS="$CFLAGS -Wno-unused-function"
diff --git a/src/matcher.c b/src/matcher.c
@@ -951,11 +951,11 @@ static gboolean matcherprop_match(MatcherProp *prop,
&& prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
if (ret) {
log_print(LOG_DEBUG_FILTERING,
- "message date [ %"G_GSIZE_FORMAT" ] is after [ %d ]\n",
+ "message date [ %" CM_TIME_FORMAT " ] is after [ %d ]\n",
info->date_t, prop->value);
} else {
log_print(LOG_DEBUG_FILTERING,
- "message date [ %ld ] is not after [ %d ]\n",
+ "message date [ %" CM_TIME_FORMAT " ] is not after [ %d ]\n",
info->date_t, prop->value);
}
}
@@ -999,11 +999,11 @@ static gboolean matcherprop_match(MatcherProp *prop,
&& prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
if (ret) {
log_print(LOG_DEBUG_FILTERING,
- "message date [ %ld ] is before [ %d ]\n",
+ "message date [ %" CM_TIME_FORMAT " ] is before [ %d ]\n",
info->date_t, prop->value);
} else {
log_print(LOG_DEBUG_FILTERING,
- "message date [ %ld ] is not before [ %d ]\n",
+ "message date [ %" CM_TIME_FORMAT " ] is not before [ %d ]\n",
info->date_t, prop->value);
}
}
diff --git a/src/mh.c b/src/mh.c
@@ -1468,6 +1468,6 @@ static void mh_set_mtime(Folder *folder, FolderItem *item)
}
item->mtime = s.st_mtime;
- debug_print("MH: forced mtime of %s to %"G_GSIZE_FORMAT"\n", item->name?item->name:"(null)", item->mtime);
+ debug_print("MH: forced mtime of %s to %"CM_TIME_FORMAT"\n", item->name?item->name:"(null)", item->mtime);
g_free(path);
}
diff --git a/src/plugins/libravatar/libravatar_missing.c b/src/plugins/libravatar/libravatar_missing.c
@@ -83,7 +83,7 @@ close_exit:
static void missing_save_item(gpointer key, gpointer value, gpointer data)
{
FILE *file = (FILE *)data;
- gchar *line = g_strdup_printf("%s %"G_GSIZE_FORMAT"\n", (gchar *)key, *(time_t *)value);
+ gchar *line = g_strdup_printf("%s %"CM_TIME_FORMAT"\n", (gchar *)key, *(time_t *)value);
if (claws_fputs(line, file) < 0)
g_warning("error saving missing item");
g_free(line);
@@ -138,10 +138,10 @@ void missing_add_md5(GHashTable *table, const gchar *md5)
seen = g_malloc0(sizeof(time_t));
*seen = t;
g_hash_table_insert(table, g_strdup(md5), seen);
- debug_print("New md5 %s added with time %"G_GSIZE_FORMAT"\n", md5, t);
+ debug_print("New md5 %s added with time %"CM_TIME_FORMAT"\n", md5, t);
} else {
*seen = t; /* just update */
- debug_print("Updated md5 %s with time %"G_GSIZE_FORMAT"\n", md5, t);
+ debug_print("Updated md5 %s with time %"CM_TIME_FORMAT"\n", md5, t);
}
}
diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c
@@ -138,7 +138,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
/* Last-Seen timestamp */
if( !strcmp(line[0], "X-RSSyl-Last-Seen") ) {
ctx->last_seen = atol(line[1]);
- debug_print("RSSyl: got last_seen timestamp %"G_GSIZE_FORMAT"\n", ctx->last_seen);
+ debug_print("RSSyl: got last_seen timestamp %"CM_TIME_FORMAT"\n", ctx->last_seen);
}
/* ID */
diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c
@@ -314,13 +314,13 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
/* If one of the timestamps is empty, set it to value of the other one. */
if( feed_item_get_date_modified(feed_item) == -1 &&
feed_item_get_date_published(feed_item) >= 0 ) {
- debug_print("RSSyl: setting missing moddate to pubdate %"G_GSIZE_FORMAT"\n",
+ debug_print("RSSyl: setting missing moddate to pubdate %"CM_TIME_FORMAT"\n",
feed_item_get_date_published(feed_item));
feed_item_set_date_modified(feed_item,
feed_item_get_date_published(feed_item));
} else if( feed_item_get_date_published(feed_item) == -1 &&
feed_item_get_date_modified(feed_item) >= 0 ) {
- debug_print("RSSyl: setting missing pubdate to modddate %"G_GSIZE_FORMAT"\n",
+ debug_print("RSSyl: setting missing pubdate to modddate %"CM_TIME_FORMAT"\n",
feed_item_get_date_modified(feed_item));
feed_item_set_date_published(feed_item,
feed_item_get_date_modified(feed_item));
@@ -328,7 +328,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
feed_item_get_date_published(feed_item) == -1 &&
feed_item_get_sourcedate(feed_item) >= 0 ) {
/* If neither item date is set, use date from source (Atom only). */
- debug_print("RSSyl: setting missing pubdate and moddate to feed source date %"G_GSIZE_FORMAT"\n",
+ debug_print("RSSyl: setting missing pubdate and moddate to feed source date %"CM_TIME_FORMAT"\n",
feed_item_get_sourcedate(feed_item));
feed_item_set_date_modified(feed_item,
feed_item_get_sourcedate(feed_item));
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
@@ -1170,7 +1170,7 @@ static void vcal_set_mtime(Folder *folder, FolderItem *item)
}
item->mtime = s.st_mtime;
- debug_print("VCAL: forced mtime of %s to %"G_GSIZE_FORMAT"\n",
+ debug_print("VCAL: forced mtime of %s to %"CM_TIME_FORMAT"\n",
item->name?item->name:"(null)", item->mtime);
g_free(path);
}
diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c
@@ -926,7 +926,7 @@ void vcal_manager_save_event (VCalEvent *event, gboolean export_after)
xml_tag_add_attr(tag, xml_attr_new("type", tmp));
g_free(tmp);
- tmp = g_strdup_printf("%"G_GSIZE_FORMAT, event->postponed);
+ tmp = g_strdup_printf("%"CM_TIME_FORMAT, event->postponed);
xml_tag_add_attr(tag, xml_attr_new("postponed", tmp));
g_free(tmp);
diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1824,7 +1824,7 @@ void multisync_export(void)
list = vcal_folder_get_waiting_events();
for (cur = list; cur; cur = cur->next) {
VCalEvent *event = (VCalEvent *)cur->data;
- file = g_strdup_printf("multisync%"G_GSIZE_FORMAT"-%d",
+ file = g_strdup_printf("multisync%"CM_TIME_FORMAT"-%d",
time(NULL), i);
i++;