]> git.sesse.net Git - vlc/blobdiff - include/vlc_fs.h
decoder: fix comment
[vlc] / include / vlc_fs.h
index 3c5c7a90fa53bada304294ab542bbd3c22de8497..533aa9bc91d51d0dbad6d79118a0ed8de3b3506e 100644 (file)
@@ -45,12 +45,26 @@ VLC_API int vlc_unlink( const char *filename );
 VLC_API int vlc_rename( const char *oldpath, const char *newpath );
 VLC_API char *vlc_getcwd( void ) VLC_USED;
 
-#if defined( WIN32 )
+#if defined( _WIN32 )
+typedef struct vlc_DIR
+{
+    _WDIR *wdir; /* MUST be first, see <vlc_fs.h> */
+    char *entry;
+    union
+    {
+        DWORD drives;
+        bool insert_dot_dot;
+    } u;
+} vlc_DIR;
+
 static inline int vlc_closedir( DIR *dir )
 {
-    _WDIR *wdir = *(_WDIR **)dir;
-    free( dir );
-    return wdir ? _wclosedir( wdir ) : 0;
+    vlc_DIR *vdir = (vlc_DIR *)dir;
+    _WDIR *wdir = vdir->wdir;
+
+    free( vdir->entry );
+    free( vdir );
+    return (wdir != NULL) ? _wclosedir( wdir ) : 0;
 }
 # undef closedir
 # define closedir vlc_closedir
@@ -63,6 +77,22 @@ static inline void vlc_rewinddir( DIR *dir )
 }
 # undef rewinddir
 # define rewinddir vlc_rewinddir
+
+# include <sys/stat.h>
+# ifndef stat
+#  define stat _stati64
+# endif
+# ifndef fstat
+#  define fstat _fstati64
+# endif
+# ifndef _MSC_VER
+#  undef lseek
+#  define lseek _lseeki64
+# endif
+#endif
+
+#ifdef __ANDROID__
+# define lseek lseek64
 #endif
 
 struct stat;