changeset 27727:48c1ae64255b

Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__. This avoids a pointless indirection that only obscures what is really done.
author diego
date Mon, 13 Oct 2008 16:23:55 +0000
parents 5e3c7164f943
children b21e4615ab94
files cfg-common-opts.h cfg-common.h configure cpudetect.c get_path.c libaf/af_ladspa.c libao2/ao_sdl.c libdvdread/dvd_reader.c libdvdread/libdvdread_changes.diff libvo/video_out.c mencoder.c mplayer.c stream/cache2.c stream/stream_cddb.c stream/stream_file.c stream/stream_vcd.c subreader.c vidix/dha.c vidix/nvidia_vid.c
diffstat 19 files changed, 87 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-common-opts.h	Mon Oct 13 16:06:15 2008 +0000
+++ b/cfg-common-opts.h	Mon Oct 13 16:23:55 2008 +0000
@@ -15,7 +15,7 @@
 	{"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
 #endif
 	{"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL},
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 	{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
 #endif
 	{"noconfig", noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
--- a/cfg-common.h	Mon Oct 13 16:06:15 2008 +0000
+++ b/cfg-common.h	Mon Oct 13 16:23:55 2008 +0000
@@ -349,7 +349,7 @@
 
 };
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 struct {
   char* name;
   int prio;
@@ -366,7 +366,7 @@
   { "idle", IDLE_PRIORITY_CLASS},
   { NULL, NORMAL_PRIORITY_CLASS} /* default */
 };
-#endif /* WIN32 */
+#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
 
 extern const m_option_t noconfig_opts[];
 
--- a/configure	Mon Oct 13 16:06:15 2008 +0000
+++ b/configure	Mon Oct 13 16:23:55 2008 +0000
@@ -8227,7 +8227,7 @@
 #ifdef sun
 #define	DEFAULT_CDROM_DEVICE	"/vol/dev/aliases/cdrom0"
 #define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
-#elif defined(WIN32) || defined(__OS2__)
+#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
 #define DEFAULT_CDROM_DEVICE    "D:"
 #define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
 #elif defined(__APPLE__) || defined(__DARWIN__)
--- a/cpudetect.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/cpudetect.c	Mon Oct 13 16:23:55 2008 +0000
@@ -29,7 +29,7 @@
 #include <signal.h>
 #endif
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #include <windows.h>
 #endif
 
@@ -314,7 +314,7 @@
 }
 #endif /* __linux__ && _POSIX_SOURCE */
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
 {
    if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){
@@ -325,7 +325,7 @@
    }
    return EXCEPTION_CONTINUE_SEARCH;
 }
-#endif /* WIN32 */
+#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
 
 #ifdef __OS2__
 ULONG _System os2_sig_handler_sse( PEXCEPTIONREPORTRECORD       p1,
@@ -395,7 +395,7 @@
    gCpuCaps.hasSSE = 0;
    mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" );
 #endif
-#elif defined(WIN32)
+#elif defined(__MINGW32__) || defined(__CYGWIN__)
    LPTOP_LEVEL_EXCEPTION_FILTER exc_fil;
    if ( gCpuCaps.hasSSE ) {
       mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
--- a/get_path.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/get_path.c	Mon Oct 13 16:23:55 2008 +0000
@@ -145,7 +145,7 @@
 	return buff;
 }
 
-#if defined(WIN32) && defined(CONFIG_WIN32DLL)
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
 void set_path_env()
 {
 	/*make our codec dirs available for LoadLibraryA()*/
@@ -181,4 +181,4 @@
 	if (!SetEnvironmentVariableA("PATH", tmppath))
 		mp_msg(MSGT_WIN32, MSGL_WARN, "Cannot set PATH!");
 }
-#endif /*WIN32 && CONFIG_WIN32DLL*/
+#endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */
--- a/libaf/af_ladspa.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/libaf/af_ladspa.c	Mon Oct 13 16:23:55 2008 +0000
@@ -296,16 +296,15 @@
     size_t filenamelen;
     void *result = NULL;
 
-#   ifdef WIN32         /* for windows there's only absolute path support.
-                         * if you have a windows machine, feel free to fix
-                         * this. (path separator, shared objects extension,
-                         * et cetera).
-                         */
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+    /* For Windows there's only absolute path support.
+     * If you have a Windows machine, feel free to fix this.
+     * (path separator, shared objects extension, et cetera). */
         af_msg(AF_MSG_VERBOSE, "\ton windows, only absolute pathnames "
                 "are supported\n");
         af_msg(AF_MSG_VERBOSE, "\ttrying %s\n", filename);
         return dlopen(filename, flag);
-#   endif
+#endif
 
     filenamelen = strlen(filename);
 
--- a/libao2/ao_sdl.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/libao2/ao_sdl.c	Mon Oct 13 16:23:55 2008 +0000
@@ -52,7 +52,7 @@
 #undef USE_SDL_INTERNAL_MIXER
 
 // Samplesize used by the SDLlib AudioSpec struct
-#if defined(WIN32) || defined(__AMIGAOS4__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__AMIGAOS4__)
 #define SAMPLESIZE 2048
 #else
 #define SAMPLESIZE 1024
--- a/libdvdread/dvd_reader.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/libdvdread/dvd_reader.c	Mon Oct 13 16:23:55 2008 +0000
@@ -438,7 +438,7 @@
   
   verbose = get_verbose();
 
-#ifdef WIN32
+#if defined(__CYGWIN__) || defined(__MINGW32__)
   /* Stat doesn't work on devices under mingwin/cygwin. */
   if( path[0] && path[1] == ':' && path[2] == '\0' )
     {
@@ -495,7 +495,8 @@
     /* XXX: We should scream real loud here. */
     if( !(path_copy = strdup( path ) ) ) return 0;
 
-#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
+/* don't have fchdir, and getcwd( NULL, ... ) is strange */
+#if !(defined(__CYGWIN__) || defined(__MINGW32__))
     /* Resolve any symlinks and get the absolut dir name. */
     {
       char *new_path;
--- a/libdvdread/libdvdread_changes.diff	Mon Oct 13 16:06:15 2008 +0000
+++ b/libdvdread/libdvdread_changes.diff	Mon Oct 13 16:23:55 2008 +0000
@@ -42,6 +42,15 @@
  /* Loop over all titles and call dvdcss_title to crack the keys. */
  static int initAllCSSKeys( dvd_reader_t *dvd )
  {
+@@ -438,7 +438,7 @@
+   
+   verbose = get_verbose();
+ 
+-#ifdef WIN32
++#if defined(__CYGWIN__) || defined(__MINGW32__)
+   /* Stat doesn't work on devices under mingwin/cygwin. */
+   if( path[0] && path[1] == ':' && path[2] == '\0' )
+     {
 @@ -494,7 +488,7 @@
      char *path_copy;
  #if defined(SYS_BSD)
@@ -51,7 +60,17 @@
      FILE *mntfile;
  #endif
  
-@@ -598,7 +592,7 @@
+@@ -495,7 +495,8 @@
+     /* XXX: We should scream real loud here. */
+     if( !(path_copy = strdup( path ) ) ) return 0;
+ 
+-#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
++/* don't have fchdir, and getcwd( NULL, ... ) is strange */
++#if !(defined(__CYGWIN__) || defined(__MINGW32__))
+     /* Resolve any symlinks and get the absolut dir name. */
+     {
+       char *new_path;
+@@ -597,7 +592,7 @@
        }
        fclose( mntfile );
      }
@@ -512,3 +531,7 @@
    uint16_t next_pgc_nr;
    uint16_t prev_pgc_nr;
    uint16_t goup_pgc_nr;
+Index: libdvdread/dvd_reader.c
+===================================================================
+--- libdvdread/dvd_reader.c	(revision 27759)
++++ libdvdread/dvd_reader.c	(working copy)
--- a/libvo/video_out.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/libvo/video_out.c	Mon Oct 13 16:23:55 2008 +0000
@@ -214,7 +214,7 @@
 #ifdef CONFIG_X11
 	&video_out_xvidix,
 #endif
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
     &video_out_winvidix,
 #endif
     &video_out_cvidix,
--- a/mencoder.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/mencoder.c	Mon Oct 13 16:23:55 2008 +0000
@@ -30,7 +30,7 @@
 #define        SIGQUIT 3
 #define        SIGPIPE 13
 #endif
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #include <windows.h>
 #endif
 
@@ -143,7 +143,7 @@
 double cur_vout_time_usage=0;
 int benchmark=0;
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 char * proc_priority=NULL;
 #endif
 
@@ -456,9 +456,9 @@
 #endif
 #endif
 
-#if defined(WIN32) && defined(CONFIG_WIN32DLL)
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
   set_path_env();
-#endif /*WIN32 && CONFIG_WIN32DLL*/
+#endif
   
   InitTimer();
 
@@ -516,7 +516,7 @@
   }
 }
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
   if(proc_priority){
     int i;
     for(i=0; priority_presets_defs[i].name; i++){
--- a/mplayer.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/mplayer.c	Mon Oct 13 16:23:55 2008 +0000
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include "config.h"
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #define _UWIN 1  /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/
 #include <windows.h>
 #endif
@@ -87,7 +87,7 @@
 int quiet=0;
 int enable_mouse_movements=0;
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 char * proc_priority=NULL;
 #endif
 
@@ -688,7 +688,7 @@
 
   if (mpctx->user_muted && !mpctx->edl_muted) mixer_mute(&mpctx->mixer); 
   uninit_player(INITIALIZED_ALL);
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
   timeEndPeriod(1);
 #endif
 #ifdef CONFIG_X11
@@ -1207,7 +1207,7 @@
     width = screen_width;
   else
   width = 80;
-#if defined(WIN32) || defined(__OS2__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
   /* Windows command line is broken (MinGW's rxvt works, but we
    * should not depend on that). */
   width--;
@@ -2571,9 +2571,9 @@
   m_config_preparse_command_line(mconfig,argc,argv);
 
   print_version();
-#if defined(WIN32) && defined(CONFIG_WIN32DLL)
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
   set_path_env();
-#endif /*WIN32 && CONFIG_WIN32DLL*/
+#endif
 
 #ifdef CONFIG_TV
   stream_tv_defaults.immediate = 1;
@@ -2617,7 +2617,7 @@
     }
     }
 	
-#if defined(WIN32) && defined(CONFIG_GUI)
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI)
     void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
     if(runningmplayer && filename && use_gui){
         COPYDATASTRUCT csData;
@@ -2632,7 +2632,7 @@
     }
 #endif
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 	// request 1ms timer resolution
 	timeBeginPeriod(1);
 	if(proc_priority){
@@ -2652,7 +2652,7 @@
       use_gui=0;
     }
 #else
-#ifndef WIN32
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
     if(use_gui && !vo_init()){
       mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_GuiNeedsX);
       use_gui=0;
@@ -3085,7 +3085,7 @@
       char *buf = strdup(filename), *psub;
       char *pdot = strrchr(buf, '.');
       char *pslash = strrchr(buf, '/');
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
       if (!pslash) pslash = strrchr(buf, '\\');
 #endif
       if (pdot && (!pslash || pdot > pslash))
@@ -3096,7 +3096,7 @@
           char *bname;
           int l;
           bname = strrchr(buf,'/');
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
           if(!bname) bname = strrchr(buf,'\\');
 #endif
           if(bname) bname++;
--- a/stream/cache2.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/stream/cache2.c	Mon Oct 13 16:23:55 2008 +0000
@@ -18,7 +18,7 @@
 
 #include "osdep/shmem.h"
 #include "osdep/timer.h"
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #include <windows.h>
 #elif defined(__OS2__)
 #define INCL_DOS
@@ -239,7 +239,7 @@
 
 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 @@
   }//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 @@
 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 @@
   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 @@
      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 @@
     return 1; // parent exits
   }
   
-#if defined(WIN32) || defined(__OS2__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
 }
 
 static void ThreadProc( void *s ){
--- a/stream/stream_cddb.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/stream/stream_cddb.c	Mon Oct 13 16:23:55 2008 +0000
@@ -22,7 +22,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <limits.h>
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #ifdef __MINGW32__
 #define mkdir(a,b) mkdir(a)
 #endif
@@ -44,7 +44,7 @@
 	#include <linux/cdrom.h>
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 	#include <sys/cdio.h>
-#elif defined(WIN32)
+#elif defined(__MINGW32__) || defined(__CYGWIN__)
         #include <ddk/ntddcdrm.h>
 #elif (__bsdi__)
         #include <dvd.h>
@@ -72,7 +72,7 @@
 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 @@
 	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
 	);
--- a/stream/stream_file.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/stream/stream_file.c	Mon Oct 13 16:23:55 2008 +0000
@@ -113,7 +113,7 @@
     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++;
--- a/stream/stream_vcd.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/stream/stream_vcd.c	Mon Oct 13 16:23:55 2008 +0000
@@ -1,7 +1,7 @@
 
 #include "config.h"
 
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #include <windows.h>
 #endif
 
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
-#ifndef WIN32
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 #include <sys/ioctl.h>
 #endif
 #include <errno.h>
@@ -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 @@
 #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 @@
       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,
--- a/subreader.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/subreader.c	Mon Oct 13 16:23:55 2008 +0000
@@ -1836,7 +1836,7 @@
     subcnt = 0;
     
     tmp = strrchr(fname,'/');
-#if defined(WIN32) || defined(__OS2__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
     if(!tmp)tmp = strrchr(fname,'\\');
     if(!tmp)tmp = strrchr(fname,':');
 #endif
--- a/vidix/dha.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/vidix/dha.c	Mon Oct 13 16:23:55 2008 +0000
@@ -48,7 +48,7 @@
 #endif
 #include <unistd.h>
 
-#if defined(WIN32)
+#if defined(__MINGW32__) || defined(__CYGWIN__)
 #include "sysdep/libdha_win32.c"
 #elif defined (__EMX__)
 #include "sysdep/libdha_os2.c"
--- a/vidix/nvidia_vid.c	Mon Oct 13 16:06:15 2008 +0000
+++ b/vidix/nvidia_vid.c	Mon Oct 13 16:23:55 2008 +0000
@@ -614,13 +614,14 @@
 	switch (info->depth) {
 	case 15:
 		key = ((r >> 3) << 10) | ((g >> 3) << 5) | ((b >> 3));
-#ifndef WIN32
+
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
         key = key | 0x00008000;
 #endif       
 		break;
 	case 16: // XXX unchecked
 		key = ((r >> 3) << 11) | ((g >> 2) << 5) | ((b >> 3));
-#ifndef WIN32
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
         key = key | 0x00008000;
 #endif       
 		break;
@@ -629,7 +630,7 @@
 		break;
 	case 32:
 		key = chromakey;
-#ifndef WIN32
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
         key = key | 0x80000000;
 #endif       
 		break;