diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2005-08-25 15:36:29 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2005-08-25 15:36:29 +0000 |
commit | f45651f26bc3aa1b312d282c5d8c4b04be0c2505 (patch) | |
tree | 7ff95ed1ee104e776559c7885539e1ff7a39fe97 /win32/contrib | |
parent | 21c4975cc49bbbeac0067aa0847b3604ea639676 (diff) | |
download | xine-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 'win32/contrib')
-rw-r--r-- | win32/contrib/Makefile.am | 10 | ||||
-rw-r--r-- | win32/contrib/dirent/dirent.c | 136 | ||||
-rw-r--r-- | win32/contrib/dirent/dirent.h | 33 | ||||
-rw-r--r-- | win32/contrib/pthreads/Makefile.am | 2 |
4 files changed, 1 insertions, 180 deletions
diff --git a/win32/contrib/Makefile.am b/win32/contrib/Makefile.am index f38c48ac5..c052885a8 100644 --- a/win32/contrib/Makefile.am +++ b/win32/contrib/Makefile.am @@ -1,13 +1,3 @@ include $(top_srcdir)/misc/Makefile.common SUBDIRS = zlib pthreads - -noinst_HEADERS = dirent/dirent.h - -if WIN32 -win32libs = libdirent.la -endif - -noinst_LTLIBRARIES = $(win32libs) - -libdirent_la_SOURCES = dirent/dirent.c diff --git a/win32/contrib/dirent/dirent.c b/win32/contrib/dirent/dirent.c deleted file mode 100644 index 1ef58a302..000000000 --- a/win32/contrib/dirent/dirent.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - - Implementation of POSIX directory browsing functions and types for Win32. - - Kevlin Henney (mailto:kevlin@acm.org), March 1997. - - Copyright Kevlin Henney, 1997. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives, and that no charge may be made for the software and its - documentation except to cover cost of distribution. - - This software is supplied "as is" without express or implied warranty. - - But that said, if there are any problems please get in touch. - -*/ - -#include <dirent.h> -#include <errno.h> -#include <io.h> -#include <stdlib.h> -#include <string.h> - -#ifndef DIR - -struct DIR -{ - long handle; /* -1 for failed rewind */ - struct _finddata_t info; - struct dirent result; /* d_name null iff first time */ - char *name; /* NTBS */ -}; - -#endif - -DIR *opendir(const char *name) -{ - DIR *dir = 0; - - if(name && name[0]) - { - size_t base_length = strlen(name); - const char *all = /* the root directory is a special case... */ - strchr("/\\", name[base_length - 1]) ? "*" : "/*"; - - if((dir = (DIR *) malloc(sizeof *dir)) != 0 && - (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0) - { - strcat(strcpy(dir->name, name), all); - - if((dir->handle = _findfirst(dir->name, &dir->info)) != -1) - { - dir->result.d_name = 0; - } - else /* rollback */ - { - free(dir->name); - free(dir); - dir = 0; - } - } - else /* rollback */ - { - free(dir); - dir = 0; - errno = ENOMEM; - } - } - else - { - errno = EINVAL; - } - - return dir; -} - -int closedir(DIR *dir) -{ - int result = -1; - - if(dir) - { - if(dir->handle != -1) - { - result = _findclose(dir->handle); - } - - free(dir->name); - free(dir); - } - - if(result == -1) /* map all errors to EBADF */ - { - errno = EBADF; - } - - return result; -} - -struct dirent *readdir(DIR *dir) -{ - struct dirent *result = 0; - - if(dir && dir->handle != -1) - { - if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) - { - result = &dir->result; - result->d_name = dir->info.name; - result->d_reclen = strlen(dir->info.name); - } - } - else - { - errno = EBADF; - } - - return result; -} - -void rewinddir(DIR *dir) -{ - if(dir && dir->handle != -1) - { - _findclose(dir->handle); - dir->handle = _findfirst(dir->name, &dir->info); - dir->result.d_name = 0; - } - else - { - errno = EBADF; - } -} diff --git a/win32/contrib/dirent/dirent.h b/win32/contrib/dirent/dirent.h deleted file mode 100644 index 46e0ed127..000000000 --- a/win32/contrib/dirent/dirent.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - - Declaration of POSIX directory browsing functions and types for Win32. - - Kevlin Henney (mailto:kevlin@acm.org), March 1997. - - Copyright Kevlin Henney, 1997. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives, and that no charge may be made for the software and its - documentation except to cover cost of distribution. - -*/ - -#ifndef DIRENT_INCLUDED -#define DIRENT_INCLUDED - -typedef struct DIR DIR; - -struct dirent -{ - unsigned short d_reclen; - char *d_name; -}; - -DIR *opendir(const char *); -int closedir(DIR *); -struct dirent *readdir(DIR *); -void rewinddir(DIR *); - -#endif diff --git a/win32/contrib/pthreads/Makefile.am b/win32/contrib/pthreads/Makefile.am index 31a792050..6a6cb3223 100644 --- a/win32/contrib/pthreads/Makefile.am +++ b/win32/contrib/pthreads/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = -D_WIN32_WINNT=0x400 -DHAVE_CONFIG_H -DPTW32_BUILD -D__CLEANUP_C EXTRA_DIST = acconfig.h ANNOUNCE CONTRIBUTORS COPYING.LIB ChangeLog FAQ MAINTAINERS NEWS PROGRESS README README.CV README.NONPORTABLE README.WinCE TODO WinCE-PORT build.tar.gz config.h.in pthread.def pthread.dsp pthread.dsw diff_to_original.patch -if WIN32 +if HAVE_INTERNAL_WIN32_PTHREAD noinst_LTLIBRARIES = libpthread.la include_HEADERS = pthread.h sched.h noinst_HEADERS = config.h implement.h need_errno.h semaphore.h |