From 4d644f513c841eaf4617edffb348338a798d37be Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 13 Oct 2008 16:23:55 +0000 Subject: Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__. This avoids a pointless indirection that only obscures what is really done. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27761 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 20 ++++++++++---------- stream/stream_cddb.c | 8 ++++---- stream/stream_file.c | 2 +- stream/stream_vcd.c | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index 37889acaa0..dd2423d765 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -18,7 +18,7 @@ #include "osdep/shmem.h" #include "osdep/timer.h" -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #elif defined(__OS2__) #define INCL_DOS @@ -239,7 +239,7 @@ static void cache_execute_control(cache_vars_t *s) { cache_vars_t* cache_init(int size,int sector){ int num; -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) cache_vars_t* s=shmem_alloc(sizeof(cache_vars_t)); #else cache_vars_t* s=malloc(sizeof(cache_vars_t)); @@ -253,14 +253,14 @@ cache_vars_t* cache_init(int size,int sector){ }//32kb min_size s->buffer_size=num*sector; s->sector_size=sector; -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) s->buffer=shmem_alloc(s->buffer_size); #else s->buffer=malloc(s->buffer_size); #endif if(s->buffer == NULL){ -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) shmem_free(s,sizeof(cache_vars_t)); #else free(s); @@ -276,7 +276,7 @@ cache_vars_t* cache_init(int size,int sector){ void cache_uninit(stream_t *s) { cache_vars_t* c = s->cache_data; if(!s->cache_pid) return; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) TerminateThread((HANDLE)s->cache_pid,0); #elif defined(__OS2__) DosKillThread( s->cache_pid ); @@ -286,7 +286,7 @@ void cache_uninit(stream_t *s) { waitpid(s->cache_pid,NULL,0); #endif if(!c) return; -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) free(c->stream); free(c->buffer); free(s->cache_data); @@ -327,17 +327,17 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ min = s->buffer_size - s->fill_limit; } -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) if((stream->cache_pid=fork())){ #else { -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) DWORD threadId; #endif stream_t* stream2=malloc(sizeof(stream_t)); memcpy(stream2,s->stream,sizeof(stream_t)); s->stream=stream2; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) stream->cache_pid = CreateThread(NULL,0,ThreadProc,s,0,&threadId); #else // OS2 stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s ); @@ -359,7 +359,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ return 1; // parent exits } -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) } static void ThreadProc( void *s ){ diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 5236a4ca9c..4702f86d8c 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -22,7 +22,7 @@ #include #include #include -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #ifdef __MINGW32__ #define mkdir(a,b) mkdir(a) #endif @@ -44,7 +44,7 @@ #include #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include -#elif defined(WIN32) +#elif defined(__MINGW32__) || defined(__CYGWIN__) #include #elif (__bsdi__) #include @@ -72,7 +72,7 @@ int read_toc(const char *dev) { int first = 0, last = -1; int i; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) HANDLE drive; DWORD r; CDROM_TOC toc; @@ -326,7 +326,7 @@ cddb_read_cache(cddb_data_t *cddb_data) { sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); file_fd = open(file_name, O_RDONLY -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) | O_BINARY #endif ); diff --git a/stream/stream_file.c b/stream/stream_file.c index 9b21d80d04..1abc2e1c9e 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -113,7 +113,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) { return STREAM_ERROR; } -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) // extract '/' from '/x:/path' if( filename[ 0 ] == '/' && filename[ 1 ] && filename[ 2 ] == ':' ) filename++; diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 4202a9786d..34844bcea9 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -1,7 +1,7 @@ #include "config.h" -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #endif @@ -14,7 +14,7 @@ #include #include #include -#ifndef WIN32 +#if !defined(__MINGW32__) && !defined(__CYGWIN__) #include #endif #include @@ -23,7 +23,7 @@ #include "vcd_read_fbsd.h" #elif defined(__APPLE__) #include "vcd_read_darwin.h" -#elif defined(WIN32) +#elif defined(__MINGW32__) || defined(__CYGWIN__) #include "vcd_read_win32.h" #else #include "vcd_read.h" @@ -81,13 +81,13 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int bsize = VCD_SECTOR_SIZE; #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) HANDLE hd; char device[] = "\\\\.\\?:"; #endif if(mode != STREAM_READ -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) || GetVersion() > 0x80000000 // Win9x #endif ) { @@ -102,7 +102,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { p->device = strdup(DEFAULT_CDROM_DEVICE); } -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) device[4] = p->device[0]; /* open() can't be used for devices so do it the complicated way */ hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL, -- cgit v1.2.3