summaryrefslogtreecommitdiff
path: root/lib/os_internal.h
diff options
context:
space:
mode:
authorFrantišek Dvořák <valtri@users.sourceforge.net>2005-08-25 15:36:29 +0000
committerFrantišek Dvořák <valtri@users.sourceforge.net>2005-08-25 15:36:29 +0000
commitf45651f26bc3aa1b312d282c5d8c4b04be0c2505 (patch)
tree7ff95ed1ee104e776559c7885539e1ff7a39fe97 /lib/os_internal.h
parent21c4975cc49bbbeac0067aa0847b3604ea639676 (diff)
downloadxine-lib-f45651f26bc3aa1b312d282c5d8c4b04be0c2505.tar.gz
xine-lib-f45651f26bc3aa1b312d282c5d8c4b04be0c2505.tar.bz2
*BUGFIX*
Windows ports fixes and improvements due to my current work on toxine: - first experiments with external win32 pthreads, more portable code (pthread_t may be a struct) - headers refactored - moved dirent win32 replacement to lib/, hide it for frontends, used system version, if found, not used non-POSIX dirent->d_reclen (this item doesn't work in MinGW), fix memleak in dvb - separated settings for postproc and avcodec when using external ffmpeg - check for malloc.h in public xine.m4, used it conditionally in xine headers - replaced random() by POSIX more common rand() - prevent one segfault in directx vo plugin, if fails - M$VC port update CVS patchset: 7709 CVS date: 2005/08/25 15:36:29
Diffstat (limited to 'lib/os_internal.h')
-rw-r--r--lib/os_internal.h91
1 files changed, 86 insertions, 5 deletions
diff --git a/lib/os_internal.h b/lib/os_internal.h
index 2f6d19779..24d810ffd 100644
--- a/lib/os_internal.h
+++ b/lib/os_internal.h
@@ -1,3 +1,6 @@
+#ifndef _XINE_OS_INTERNAL_H
+#define _XINE_OS_INTERNAL_H
+
#include <stddef.h>
#include "os_types.h"
@@ -67,15 +70,93 @@ char *_xine_private_strpbrk(const char *s, const char *accept);
char *_xine_private_strsep(char **stringp, const char *delim);
#endif
-/* replacing lstat by stat */
-#ifndef HAVE_LSTAT
-# define lstat(FILENAME, BUF) stat((FILENAME), (BUF))
-#endif
-
/* macross needed for MSVC */
#ifdef _MSC_VER
# define snprintf _snprintf
# define vsnprintf _vsnprintf
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
+# define M_PI 3.14159265358979323846
+#endif
+
+#ifdef WIN32
+#include <io.h>
+# define mkdir(A, B) _mkdir((A))
+
+# ifndef S_ISDIR
+# define S_ISDIR(m) ((m) & _S_IFDIR)
+# endif
+
+# ifndef S_ISREG
+# define S_ISREG(m) ((m) & _S_IFREG)
+# endif
+
+# ifndef S_ISBLK
+# define S_ISBLK(m) 0
+# endif
+
+# ifndef S_ISCHR
+# define S_ISCHR(m) 0
+# endif
+
+# ifndef S_ISLNK
+# define S_ISLNK(mode) 0
+# endif
+
+# ifndef S_ISSOCK
+# define S_ISSOCK(mode) 0
+# endif
+
+# ifndef S_ISFIFO
+# define S_ISFIFO(mode) 0
+# endif
+
+# ifndef S_IXUSR
+# define S_IXUSR S_IEXEC
+# endif
+
+# ifndef S_IXGRP
+# define S_IXGRP S_IEXEC
+# endif
+
+# ifndef S_IXOTH
+# define S_IXOTH S_IEXEC
+# endif
+
+# if !S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+# endif
+
+#endif
+
+#ifndef HAVE_READLINK
+# define readlink(PATH, BUF, BUFSIZE) 0
+#endif
+
+/* replacing lstat by stat */
+#ifndef HAVE_LSTAT
+# define lstat(FILENAME, BUF) stat((FILENAME), (BUF))
+#endif
+
+/* replacements of dirent for MSVC platform */
+#ifndef HAVE_OPENDIR
+typedef struct DIR DIR;
+
+struct dirent {
+ unsigned short d_reclen;
+ char *d_name;
+};
+
+DIR *_xine_private_opendir(const char *);
+int _xine_private_closedir(DIR *);
+struct dirent *_xine_private_readdir(DIR *);
+void _xine_private_rewinddir(DIR *);
+
+#define opendir(DIRENT_NAME) _xine_private_opendir((DIRENT_NAME))
+#define closedir(DIRENT_DIR) _xine_private_closedir((DIRENT_DIR))
+#define readdir(DIRENT_DIR) _xine_private_readdir((DIRENT_DIR))
+#define rewinddir(DIRENT_DIR) _xine_private_rewinddir((DIRENT_DIR))
+
+#endif
+
#endif