]> git.sesse.net Git - vlc/blobdiff - include/vlc_common.h
- since DIR* on win32 is mapped to a private data type, rewinddir(), seekdir() and...
[vlc] / include / vlc_common.h
index f829027432a5c5fc4043be6406d8268e2273fa5b..e42488805705e35813dc53a9c0135805c75e91f0 100644 (file)
@@ -24,7 +24,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-
 /**
  * \file
  * This file is a collection of common definitions and types
@@ -449,7 +448,11 @@ typedef struct meta_engine_t meta_engine_t;
 
 /* stat/lstat/fstat */
 #ifdef WIN32
+#include <sys/stat.h>
 struct _stati64;
+#define stat _stati64
+#define fstat _fstati64
+/* You should otherwise use utf8_stat and utf8_lstat. */
 #else
 struct stat;
 #endif
@@ -467,7 +470,7 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
  * Plug-in stuff
  *****************************************************************************/
 
-#include "modules_inner.h"
+#include "vlc_modules_macros.h"
 
 #if !defined (__PLUGIN__) || defined (HAVE_SHARED_LIBVLC)
 #   ifdef __cplusplus
@@ -645,6 +648,8 @@ static int64_t GCD( int64_t a, int64_t b )
 
 #define EMPTY_STR(str) (!str || !*str)
 
+VLC_EXPORT( char const *, vlc_error, ( int ) );
+
 #include <vlc_arrays.h>
 
 /* MSB (big endian)/LSB (little endian) conversions - network order is always
@@ -866,7 +871,8 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
 #   define vlc_strtoll NULL
 #endif
 
-#if defined(SYS_BEOS)
+#if defined(SYS_BEOS) \
+ || (defined (__FreeBSD__) && (__FreeBSD__ < 5))
     typedef struct {
         long long quot; /* Quotient. */
         long long rem;  /* Remainder. */
@@ -952,9 +958,15 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
 #   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 * ) );
 #else
     struct dirent;  /* forward declaration for vlc_symbols.h */
 #   if !defined(__PLUGIN__)
@@ -964,9 +976,23 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
 #   endif
 #endif
 
-    VLC_EXPORT( void *, vlc_opendir_wrapper, ( const char * ) );
-    VLC_EXPORT( struct dirent *, vlc_readdir_wrapper, ( void * ) );
-    VLC_EXPORT( int, vlc_closedir_wrapper, ( void * ) );
+#if defined (WIN32)
+#   include <dirent.h>
+VLC_INTERNAL( void *, vlc_wopendir, ( const wchar_t * ) );
+VLC_INTERNAL( struct _wdirent *, vlc_wreaddir, ( void * ) );
+VLC_INTERNAL( int, vlc_wclosedir, ( void * ) );
+VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
+VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
+VLC_INTERNAL( long, vlc_telldir, ( void * ) );
+#   define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
+#   define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
+#   define closedir vlc_wclosedir
+#   define _wopendir vlc_wopendir
+#   define _wreaddir vlc_wreaddir
+#   define rewinddir vlc_rewinddir
+#   define seekdir vlc_seekdir
+#   define telldir vlc_telldir
+#endif
 
 /* Format type specifiers for 64 bits numbers */
 #if defined(__CYGWIN32__) || (!defined(WIN32) && !defined(UNDER_CE))
@@ -1144,20 +1170,31 @@ VLC_EXPORT( const char *, VLC_Error, ( int ) );
  * Additional vlc stuff
  *****************************************************************************/
 #ifndef HAVE_SHARED_LIBVLC
+#   ifdef HAVE_DIRENT_H
+#   include <dirent.h>  /* for DIR typedef in vlc_symbols.h */
+#   endif
 VLC_EXPORT( const char *, VLC_Changeset, ( void ) );
 #   include "vlc_symbols.h"
 #else
 #   define VLC_Changeset( ) ("exported")
 #endif
-#include "os_specific.h"
+#include "vlc_os_specific.h"
 #include "vlc_messages.h"
-#include "variables.h"
+#include "vlc_variables.h"
 #include "vlc_objects.h"
 #include "vlc_threads_funcs.h"
-#include "mtime.h"
-#include "modules.h"
+#include "vlc_mtime.h"
+#include "vlc_modules.h"
 #include "main.h"
-#include "configuration.h"
+#include "vlc_configuration.h"
+
+/** The global thread var for msg stack context
+ *  We store this as a static global variable so we don't need a vlc_object_t
+ *  everywhere.
+ *  This key is created in vlc_threads_init and is therefore ready to use at
+ *  the very beginning of the universe */
+extern vlc_threadvar_t msg_context_global_key;
+
 
 #if defined( __BORLANDC__ )
 #   undef PACKAGE