[evolution] calendar: do not assume time_t is long
- From: Antoine Jacoutot <ajacoutot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] calendar: do not assume time_t is long
- Date: Wed, 11 Sep 2013 07:19:05 +0000 (UTC)
commit 44a2cb9886223df8ee497f5ecd19123f7a3ca5ea
Author: Antoine Jacoutot <antoine mtier org>
Date: Wed Sep 11 09:17:14 2013 +0200
calendar: do not assume time_t is long
On Linux time_t is long, on OpenBSD time_t is long long... so printf
statements using %lu on 32-bit platforms will break on !Linux.
The only portable way to print a time_t is using a cast and casting to
"long long" (gint64) is probably the most portable way.
https://bugzilla.gnome.org/show_bug.cgi?id=707829
calendar/alarm-notify/alarm.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/calendar/alarm-notify/alarm.c b/calendar/alarm-notify/alarm.c
index 99d3dd6..670aab6 100644
--- a/calendar/alarm-notify/alarm.c
+++ b/calendar/alarm-notify/alarm.c
@@ -97,7 +97,7 @@ alarm_ready_cb (gpointer data)
if (ar->trigger > now)
break;
- debug (("Process alarm with trigger %lu", ar->trigger));
+ debug (("Process alarm with trigger %" G_GINT64_FORMAT, (gint64)ar->trigger));
notify_id = ar;
ar_copy = *ar;
@@ -153,8 +153,8 @@ setup_timeout (void)
/* Add the time out */
debug (
- ("Setting timeout for %d.%2d (from now) %lu %lu",
- diff / 60, diff % 60, ar->trigger, now));
+ ("Setting timeout for %d.%2d (from now) %" G_GINT64_FORMAT "%" G_GINT64_FORMAT,
+ diff / 60, diff % 60, (gint64)ar->trigger, (gint64)now));
debug ((" %s", ctime (&ar->trigger)));
debug ((" %s", ctime (&now)));
timeout_id = g_timeout_add_seconds (diff, alarm_ready_cb, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]