]> git.sesse.net Git - vlc/blobdiff - include/vlc_fixups.h
Xml 2.6.32 patch modification.
[vlc] / include / vlc_fixups.h
index 4008ce8411ca34702137bd9894ce6c2faba55411..98b6174a805c279f0a40aa8bc7b63fc075889259 100644 (file)
@@ -24,6 +24,9 @@
  * This file is a collection of portability fixes
  */
 
+#ifndef LIBVLC_FIXUPS_H
+# define LIBVLC_FIXUPS_H 1
+
 #ifndef HAVE_STRDUP
 # define strdup vlc_strdup
 #endif
 # endif
 #endif
 
+#ifndef HAVE_LOCALTIME_R
+/* If localtime_r() is not provided, we assume localtime() uses
+ * thread-specific storage. */
+# include <time.h>
+static inline struct tm *localtime_r (const time_t *timep, struct tm *result)
+{
+    struct tm *s = localtime (timep);
+    if (s == NULL)
+        return NULL;
+
+    *result = *s;
+    return result;
+}
+static inline struct tm *gmtime_r (const time_t *timep, struct tm *result)
+{
+    struct tm *s = gmtime (timep);
+    if (s == NULL)
+        return NULL;
+
+    *result = *s;
+    return result;
+}
+#endif
+
+#ifndef HAVE_DIRENT_H
+typedef void DIR;
+#   ifndef FILENAME_MAX
+#       define FILENAME_MAX (260)
+#   endif
+struct dirent
+{
+    long            d_ino;          /* Always zero. */
+    unsigned short  d_reclen;       /* Always zero. */
+    unsigned short  d_namlen;       /* Length of name in d_name. */
+    char            d_name[FILENAME_MAX]; /* File name. */
+};
+#   define opendir vlc_opendir
+#   define readdir vlc_readdir
+#   define closedir vlc_closedir
+#   define rewinddir vlc_rewindir
+#   define seekdir vlc_seekdir
+#   define telldir vlc_telldir
+VLC_EXPORT( void *, vlc_opendir, ( const char * ) );
+VLC_EXPORT( void *, vlc_readdir, ( void * ) );
+VLC_EXPORT( int, vlc_closedir, ( void * ) );
+VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
+VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
+VLC_INTERNAL( long, vlc_telldir, ( void * ) );
+#endif
+
+#endif /* !LIBVLC_FIXUPS_H */