Update of /cvsroot/libexif/libexif/libexif
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16343/libexif
Modified Files:
exif-entry.c
Log Message:
libexif/exif-entry.c & configure.ac: use localtime_r when available
to be more thread safe
Index: exif-entry.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-entry.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -p -d -r1.119 -r1.120
--- exif-entry.c 18 Nov 2008 09:42:58 -0000 1.119
+++ exif-entry.c 18 Nov 2008 10:15:50 -0000 1.120
@@ -1130,8 +1130,6 @@ exif_entry_get_value (ExifEntry *e, char
void
exif_entry_initialize (ExifEntry *e, ExifTag tag)
{
- time_t t;
- struct tm *tm;
ExifRational r;
ExifByteOrder o;
@@ -1334,8 +1332,17 @@ exif_entry_initialize (ExifEntry *e, Exi
case EXIF_TAG_DATE_TIME:
case EXIF_TAG_DATE_TIME_ORIGINAL:
case EXIF_TAG_DATE_TIME_DIGITIZED:
+ {
+ time_t t;
+ struct tm tms;
+ struct tm *tm;
+
t = time (NULL);
+#ifdef HAVE_LOCALTIME_R
+ tm = localtime_r (&t, &tms);
+#else
tm = localtime (&t);
+#endif
e->components = 20;
e->format = EXIF_FORMAT_ASCII;
e->size = exif_format_get_size (e->format) * e->components;
@@ -1346,6 +1353,7 @@ exif_entry_initialize (ExifEntry *e, Exi
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
break;
+ }
/* ASCII, no default */
case EXIF_TAG_SUB_SEC_TIME:
|