]> git.sesse.net Git - vlc/commitdiff
Add a bug. Fix compilation on Win32.
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 9 Nov 2006 18:06:21 +0000 (18:06 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 9 Nov 2006 18:06:21 +0000 (18:06 +0000)
modules/access_filter/dump.c

index ccbeaed25c99b2b800055bf97ee4665de41eea1d..cd1664b40405474e9cee368c2f64dc429ad589b3 100644 (file)
@@ -233,10 +233,21 @@ static int Seek (access_t *access, int64_t offset)
 }
 
 
-#ifdef WIN32
+#ifndef HAVE_LOCALTIME_R
 static inline struct tm *localtime_r (const time_t *now, struct tm *res)
 {
-    return _localtime_s (res, now) ? NULL : res;
+    struct tm *unsafe = localtime (now);
+    /*
+     * This is not thread-safe. Blame your C library.
+     * On Win32 there SHOULD be _localtime_s instead, but of course
+     * Cygwin and Mingw32 don't know about it. You're on your own if you
+     * this platform.
+     */
+    if (unsafe == NULL)
+        return NULL;
+
+    memcpy (res, unsafe, sizeof (*res));
+    return res;
 }
 #endif