[poppler] glib/demo

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Sep 26 09:49:54 PDT 2008


 glib/demo/info.cc |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit a197a07728d19abc2708979c95b4ef53e88fcb55
Author: Carlo Bramini <carlo.bramix at libero.it>
Date:   Fri Sep 26 18:42:05 2008 +0200

    Compile where localtime_r is not available

diff --git a/glib/demo/info.cc b/glib/demo/info.cc
index 4176158..7e22d18 100644
--- a/glib/demo/info.cc
+++ b/glib/demo/info.cc
@@ -25,14 +25,20 @@ static gchar *
 poppler_format_date (GTime utime)
 {
 	time_t time = (time_t) utime;
-	struct tm t;
 	char s[256];
 	const char *fmt_hack = "%c";
 	size_t len;
 
+#ifdef HAVE_LOCALTIME_R
+	struct tm t;
 	if (time == 0 || !localtime_r (&time, &t)) return NULL;
-
 	len = strftime (s, sizeof (s), fmt_hack, &t);
+#else
+	struct tm *t;
+	if (time == 0 || !(t = localtime (&time)) ) return NULL;
+	len = strftime (s, sizeof (s), fmt_hack, t);
+#endif
+
 	if (len == 0 || s[0] == '\0') return NULL;
 
 	return g_locale_to_utf8 (s, -1, NULL, NULL, NULL);


More information about the poppler mailing list