summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Riemann <friemann@gnome.org>2017-03-29 20:56:11 +0200
committerFelix Riemann <friemann@gnome.org>2017-04-10 20:34:56 +0200
commitd91cf5bc7f712d36fbc6dfb1b73130ea489931b1 (patch)
treed4bc43ab098efb6aee3f9b3a798479d2fb3f0ec4
parent24d7db48431ebc8e9dd1afdbebe66b539706fc96 (diff)
downloadeog-d91cf5bc7f712d36fbc6dfb1b73130ea489931b1.tar.gz
EogExifUtil: Fix build with older GCCs
Older GCCs don't support pragma diagnostic in functions. Move the pragmas outside to fix the build with these compilers. https://bugzilla.gnome.org/show_bug.cgi?id=780675
-rw-r--r--src/eog-exif-util.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/eog-exif-util.c b/src/eog-exif-util.c
index d75087fd..b77a5a2b 100644
--- a/src/eog-exif-util.c
+++ b/src/eog-exif-util.c
@@ -95,6 +95,12 @@ _calculate_wday_yday (struct tm *tm)
tm->tm_yday = tmp_tm.tm_yday;
}
+/* Older GCCs don't support pragma diagnostic inside functions.
+ * Put these here to avoid problems with the strftime format strings
+ * without breaking the build for these older GCCs */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
#ifdef HAVE_STRPTIME
static gchar *
eog_exif_util_format_date_with_strptime (const gchar *date, const gchar* format)
@@ -118,11 +124,9 @@ eog_exif_util_format_date_with_strptime (const gchar *date, const gchar* format)
if (!GPOINTER_TO_BOOLEAN (strptime_updates_wday.retval))
_calculate_wday_yday (&tm);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
/* A strftime-formatted string, to display the date the image was taken. */
dlen = strftime (tmp_date, DATE_BUF_SIZE * sizeof(gchar), format, &tm);
-#pragma GCC diagnostic pop
+
new_date = g_strndup (tmp_date, dlen);
}
@@ -156,10 +160,8 @@ eog_exif_util_format_date_by_hand (const gchar *date, const gchar* format)
tm.tm_sec = result < 6 ? 0 : seconds;
tm.tm_min = result < 5 ? 0 : minutes;
tm.tm_hour = result < 4 ? 0 : hour;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
dlen = strftime (tmp_date, DATE_BUF_SIZE * sizeof(gchar), format, &tm);
-#pragma GCC diagnostic pop
if (dlen == 0)
return NULL;
@@ -170,6 +172,8 @@ eog_exif_util_format_date_by_hand (const gchar *date, const gchar* format)
}
#endif /* HAVE_STRPTIME */
+#pragma GCC diagnostic pop
+
/**
* eog_exif_util_format_date:
* @date: a date string following Exif specifications