Fixed a bunch of 64-bit compatibility problems
authorSam Lantinga <slouken@libsdl.org>
Wed, 01 Mar 2006 09:43:47 +0000
changeset 145684de7511f79f
parent 1455 f487bb150acc
child 1457 337665b695d1
Fixed a bunch of 64-bit compatibility problems
VisualC.zip
configure.in
include/SDL_stdinc.h
src/audio/windib/SDL_dibaudio.c
src/cdrom/win32/SDL_syscdrom.c
src/file/SDL_rwops.c
src/stdlib/SDL_getenv.c
src/stdlib/SDL_malloc.c
src/stdlib/SDL_qsort.c
src/stdlib/SDL_string.c
src/video/SDL_RLEaccel.c
src/video/SDL_blit_A.c
src/video/SDL_surface.c
src/video/wincommon/SDL_sysevents.c
src/video/wincommon/SDL_sysmouse.c
src/video/wincommon/SDL_syswm.c
src/video/windib/SDL_dibevents.c
src/video/windx5/SDL_dx5events.c
     1.1 Binary file VisualC.zip has changed
     2.1 --- a/configure.in	Mon Feb 27 22:14:40 2006 +0000
     2.2 +++ b/configure.in	Wed Mar 01 09:43:47 2006 +0000
     2.3 @@ -116,7 +116,7 @@
     2.4      if test x$ac_cv_func_strtod = xyes; then
     2.5          AC_DEFINE(HAVE_STRTOD)
     2.6      fi
     2.7 -    AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
     2.8 +    AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
     2.9  
    2.10      AC_CHECK_LIB(m, pow, [BUILD_LDFLAGS="$BUILD_LDFLAGS -lm"])
    2.11  fi
     3.1 --- a/include/SDL_stdinc.h	Mon Feb 27 22:14:40 2006 +0000
     3.2 +++ b/include/SDL_stdinc.h	Wed Mar 01 09:43:47 2006 +0000
     3.3 @@ -446,6 +446,12 @@
     3.4  extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
     3.5  #endif
     3.6  
     3.7 +#if HAVE_STRTOUL
     3.8 +#define SDL_strtoul      strtoul
     3.9 +#else
    3.10 +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
    3.11 +#endif
    3.12 +
    3.13  #if SDL_HAS_64BIT_TYPE
    3.14  
    3.15  #if HAVE__I64TOA
    3.16 @@ -466,6 +472,12 @@
    3.17  extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
    3.18  #endif
    3.19  
    3.20 +#if HAVE_STRTOULL
    3.21 +#define SDL_strtoull     strtoull
    3.22 +#else
    3.23 +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
    3.24 +#endif
    3.25 +
    3.26  #endif /* SDL_HAS_64BIT_TYPE */
    3.27  
    3.28  #if HAVE_STRTOD
     4.1 --- a/src/audio/windib/SDL_dibaudio.c	Mon Feb 27 22:14:40 2006 +0000
     4.2 +++ b/src/audio/windib/SDL_dibaudio.c	Wed Mar 01 09:43:47 2006 +0000
     4.3 @@ -99,7 +99,7 @@
     4.4  
     4.5  
     4.6  /* The Win32 callback for filling the WAVE device */
     4.7 -static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance,
     4.8 +static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
     4.9  						DWORD dwParam1, DWORD dwParam2)
    4.10  {
    4.11  	SDL_AudioDevice *this = (SDL_AudioDevice *)dwInstance;
    4.12 @@ -118,7 +118,7 @@
    4.13  
    4.14  static void SetMMerror(char *function, MMRESULT code)
    4.15  {
    4.16 -	int len;
    4.17 +	size_t len;
    4.18  	char errbuf[MAXERRORLENGTH];
    4.19  #ifdef _WIN32_WCE
    4.20  	wchar_t werrbuf[MAXERRORLENGTH];
    4.21 @@ -132,7 +132,7 @@
    4.22  	waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH-len);
    4.23  	WideCharToMultiByte(CP_ACP,0,werrbuf,-1,errbuf+len,MAXERRORLENGTH-len,NULL,NULL);
    4.24  #else
    4.25 -	waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len);
    4.26 +	waveOutGetErrorText(code, errbuf+len, (UINT)(MAXERRORLENGTH-len));
    4.27  #endif
    4.28  
    4.29  	SDL_SetError("%s",errbuf);
    4.30 @@ -266,7 +266,7 @@
    4.31  
    4.32  	/* Open the audio device */
    4.33  	result = waveOutOpen(&sound, WAVE_MAPPER, &waveformat,
    4.34 -			(DWORD)FillSound, (DWORD)this, CALLBACK_FUNCTION);
    4.35 +			(DWORD_PTR)FillSound, (DWORD_PTR)this, CALLBACK_FUNCTION);
    4.36  	if ( result != MMSYSERR_NOERROR ) {
    4.37  		SetMMerror("waveOutOpen()", result);
    4.38  		return(-1);
     5.1 --- a/src/cdrom/win32/SDL_syscdrom.c	Mon Feb 27 22:14:40 2006 +0000
     5.2 +++ b/src/cdrom/win32/SDL_syscdrom.c	Wed Mar 01 09:43:47 2006 +0000
     5.3 @@ -111,7 +111,7 @@
     5.4  {
     5.5  	MCIERROR mci_error;
     5.6  
     5.7 -	mci_error = mciSendCommand(SDL_mciID[id], msg, flags, (DWORD)arg);
     5.8 +	mci_error = mciSendCommand(SDL_mciID[id], msg, flags, (DWORD_PTR)arg);
     5.9  	if ( mci_error ) {
    5.10  		char error[256];
    5.11  
     6.1 --- a/src/file/SDL_rwops.c	Mon Feb 27 22:14:40 2006 +0000
     6.2 +++ b/src/file/SDL_rwops.c	Wed Mar 01 09:43:47 2006 +0000
     6.3 @@ -245,8 +245,8 @@
     6.4  }
     6.5  static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
     6.6  {
     6.7 -	int total_bytes;
     6.8 -	int mem_available;
     6.9 +	size_t total_bytes;
    6.10 +	size_t mem_available;
    6.11  
    6.12  	total_bytes = (maxnum * size);
    6.13  	if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) ) {
     7.1 --- a/src/stdlib/SDL_getenv.c	Mon Feb 27 22:14:40 2006 +0000
     7.2 +++ b/src/stdlib/SDL_getenv.c	Wed Mar 01 09:43:47 2006 +0000
     7.3 @@ -33,12 +33,12 @@
     7.4  /* Note this isn't thread-safe! */
     7.5  
     7.6  static char *SDL_envmem = NULL;	/* Ugh, memory leak */
     7.7 -static DWORD SDL_envmemlen = 0;
     7.8 +static size_t SDL_envmemlen = 0;
     7.9  
    7.10  /* Put a variable of the form "name=value" into the environment */
    7.11  int SDL_putenv(const char *variable)
    7.12  {
    7.13 -	DWORD bufferlen;
    7.14 +	size_t bufferlen;
    7.15  	char *value;
    7.16  	const char *sep;
    7.17  
    7.18 @@ -67,7 +67,7 @@
    7.19  /* Retrieve a variable named "name" from the environment */
    7.20  char *SDL_getenv(const char *name)
    7.21  {
    7.22 -	DWORD bufferlen;
    7.23 +	size_t bufferlen;
    7.24  
    7.25  	bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
    7.26  	if ( bufferlen == 0 ) {
     8.1 --- a/src/stdlib/SDL_malloc.c	Mon Feb 27 22:14:40 2006 +0000
     8.2 +++ b/src/stdlib/SDL_malloc.c	Wed Mar 01 09:43:47 2006 +0000
     8.3 @@ -1647,7 +1647,7 @@
     8.4  typedef struct malloc_chunk  mchunk;
     8.5  typedef struct malloc_chunk* mchunkptr;
     8.6  typedef struct malloc_chunk* sbinptr;  /* The type of bins of chunks */
     8.7 -typedef unsigned int bindex_t;         /* Described below */
     8.8 +typedef size_t bindex_t;               /* Described below */
     8.9  typedef unsigned int binmap_t;         /* Described below */
    8.10  typedef unsigned int flag_t;           /* The type of various bit flag sets */
    8.11  
     9.1 --- a/src/stdlib/SDL_qsort.c	Mon Feb 27 22:14:40 2006 +0000
     9.2 +++ b/src/stdlib/SDL_qsort.c	Wed Mar 01 09:43:47 2006 +0000
     9.3 @@ -263,7 +263,7 @@
     9.4  
     9.5  static char * pivot_big(char *first, char *mid, char *last, size_t size,
     9.6                          int compare(const void *, const void *)) {
     9.7 -  int d=(((last-first)/size)>>3)*size;
     9.8 +  size_t d=(((last-first)/size)>>3)*size;
     9.9    char *m1,*m2,*m3;
    9.10    { char *a=first, *b=first+d, *c=first+2*d;
    9.11  #ifdef DEBUG_QSORT
    9.12 @@ -414,7 +414,7 @@
    9.13             int (*compare)(const void *, const void *)) {
    9.14  
    9.15    if (nmemb<=1) return;
    9.16 -  if (((int)base|size)&(WORD_BYTES-1))
    9.17 +  if (((uintptr_t)base|size)&(WORD_BYTES-1))
    9.18      qsort_nonaligned(base,nmemb,size,compare);
    9.19    else if (size!=WORD_BYTES)
    9.20      qsort_aligned(base,nmemb,size,compare);
    10.1 --- a/src/stdlib/SDL_string.c	Mon Feb 27 22:14:40 2006 +0000
    10.2 +++ b/src/stdlib/SDL_string.c	Wed Mar 01 09:43:47 2006 +0000
    10.3 @@ -69,7 +69,7 @@
    10.4  }
    10.5  #endif
    10.6  
    10.7 -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD)
    10.8 +#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD)
    10.9  static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
   10.10  {
   10.11      const char *textstart = text;
   10.12 @@ -100,6 +100,37 @@
   10.13  }
   10.14  #endif
   10.15  
   10.16 +#ifndef HAVE_SSCANF
   10.17 +static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
   10.18 +{
   10.19 +    const char *textstart = text;
   10.20 +    uintptr_t value = 0;
   10.21 +
   10.22 +    if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
   10.23 +        text += 2;
   10.24 +    }
   10.25 +    for ( ; ; ) {
   10.26 +        int v;
   10.27 +        if ( SDL_isdigit(*text) ) {
   10.28 +            v = *text - '0';
   10.29 +        } else if ( radix == 16 && SDL_isupperhex(*text) ) {
   10.30 +            v = 10 + (*text - 'A');
   10.31 +        } else if ( radix == 16 && SDL_islowerhex(*text) ) {
   10.32 +            v = 10 + (*text - 'a');
   10.33 +        } else {
   10.34 +            break;
   10.35 +        }
   10.36 +        value *= radix;
   10.37 +        value += v;
   10.38 +        ++text;
   10.39 +    }
   10.40 +    if ( valuep ) {
   10.41 +        *valuep = value;
   10.42 +    }
   10.43 +    return (text - textstart);
   10.44 +}
   10.45 +#endif
   10.46 +
   10.47  #ifdef SDL_HAS_64BIT_TYPE
   10.48  #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL)
   10.49  static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
   10.50 @@ -141,7 +172,7 @@
   10.51  }
   10.52  #endif
   10.53  
   10.54 -#ifndef HAVE_SSCANF
   10.55 +#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOULL)
   10.56  static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
   10.57  {
   10.58      const char *textstart = text;
   10.59 @@ -488,6 +519,20 @@
   10.60  }
   10.61  #endif
   10.62  
   10.63 +#ifndef HAVE_STRTOUL
   10.64 +unsigned long SDL_strtoul(const char *string, char **endp, int base)
   10.65 +{
   10.66 +    size_t len;
   10.67 +    unsigned long value;
   10.68 +
   10.69 +    len = SDL_ScanUnsignedLong(string, base ? base : 10, &value);
   10.70 +    if ( endp ) {
   10.71 +        *endp = (char *)string + len;
   10.72 +    }
   10.73 +    return value;
   10.74 +}
   10.75 +#endif
   10.76 +
   10.77  #ifdef SDL_HAS_64BIT_TYPE
   10.78  
   10.79  #ifndef HAVE__I64TOA
   10.80 @@ -556,6 +601,20 @@
   10.81  }
   10.82  #endif
   10.83  
   10.84 +#ifndef HAVE_STRTOULL
   10.85 +Uint64 SDL_strtoull(const char *string, char **endp, int base)
   10.86 +{
   10.87 +    size_t len;
   10.88 +    Uint64 value;
   10.89 +
   10.90 +    len = SDL_ScanUnsignedLongLong(string, base ? base : 10, &value);
   10.91 +    if ( endp ) {
   10.92 +        *endp = (char *)string + len;
   10.93 +    }
   10.94 +    return value;
   10.95 +}
   10.96 +#endif
   10.97 +
   10.98  #endif /* SDL_HAS_64BIT_TYPE */
   10.99  
  10.100  #ifndef HAVE_STRTOD
  10.101 @@ -817,8 +876,8 @@
  10.102                          break;
  10.103                      case 'p':
  10.104                          {
  10.105 -                            unsigned long value;
  10.106 -                            text += SDL_ScanUnsignedLong(text, 16, &value);
  10.107 +                            uintptr_t value;
  10.108 +                            text += SDL_ScanUintPtrT(text, 16, &value);
  10.109                              if ( ! suppress ) {
  10.110                                  void** valuep = va_arg(ap, void**);
  10.111                                  *valuep = (void*)value;
  10.112 @@ -1003,7 +1062,7 @@
  10.113      }
  10.114      return (text - textstart);
  10.115  }
  10.116 -int  SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
  10.117 +int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
  10.118  {
  10.119      char *textstart = text;
  10.120      if ( maxlen <= 0 ) {
    11.1 --- a/src/video/SDL_RLEaccel.c	Mon Feb 27 22:14:40 2006 +0000
    11.2 +++ b/src/video/SDL_RLEaccel.c	Wed Mar 01 09:43:47 2006 +0000
    11.3 @@ -587,12 +587,12 @@
    11.4  	unsigned n = (length);						\
    11.5  	Uint16 *src = (Uint16 *)(from);					\
    11.6  	Uint16 *dst = (Uint16 *)(to);					\
    11.7 -	if(((unsigned long)src ^ (unsigned long)dst) & 3) {		\
    11.8 +	if(((uintptr_t)src ^ (uintptr_t)dst) & 3) {			\
    11.9  	    /* source and destination not in phase, blit one by one */	\
   11.10  	    while(n--)							\
   11.11  		BLEND16_50(dst, src, mask);				\
   11.12  	} else {							\
   11.13 -	    if((unsigned long)src & 3) {				\
   11.14 +	    if((uintptr_t)src & 3) {					\
   11.15  		/* first odd pixel */					\
   11.16  		BLEND16_50(dst, src, mask);				\
   11.17  		n--;							\
   11.18 @@ -1055,7 +1055,7 @@
   11.19  	    } while(ofs < w);						  \
   11.20  	    /* skip padding if necessary */				  \
   11.21  	    if(sizeof(Ptype) == 2)					  \
   11.22 -		srcbuf += (unsigned long)srcbuf & 2;			  \
   11.23 +		srcbuf += (uintptr_t)srcbuf & 2;			  \
   11.24  	    /* blit translucent pixels on the same line */		  \
   11.25  	    ofs = 0;							  \
   11.26  	    do {							  \
   11.27 @@ -1147,7 +1147,7 @@
   11.28  		    } while(ofs < w);
   11.29  
   11.30  		    /* skip padding */
   11.31 -		    srcbuf += (unsigned long)srcbuf & 2;
   11.32 +		    srcbuf += (uintptr_t)srcbuf & 2;
   11.33  
   11.34  		    /* skip translucent line */
   11.35  		    ofs = 0;
   11.36 @@ -1211,7 +1211,7 @@
   11.37  		} while(ofs < w);					 \
   11.38  		/* skip padding if necessary */				 \
   11.39  		if(sizeof(Ptype) == 2)					 \
   11.40 -		    srcbuf += (unsigned long)srcbuf & 2;		 \
   11.41 +		    srcbuf += (uintptr_t)srcbuf & 2;		 	 \
   11.42  		/* blit translucent pixels on the same line */		 \
   11.43  		ofs = 0;						 \
   11.44  		do {							 \
   11.45 @@ -1547,7 +1547,7 @@
   11.46  	    } while(x < w);
   11.47  
   11.48  	    /* Make sure the next output address is 32-bit aligned */
   11.49 -	    dst += (unsigned long)dst & 2;
   11.50 +	    dst += (uintptr_t)dst & 2;
   11.51  
   11.52  	    /* Next, encode all translucent pixels of the same scan line */
   11.53  	    x = 0;
   11.54 @@ -1874,7 +1874,7 @@
   11.55  
   11.56  	/* skip padding if needed */
   11.57  	if(bpp == 2)
   11.58 -	    srcbuf += (unsigned long)srcbuf & 2;
   11.59 +	    srcbuf += (uintptr_t)srcbuf & 2;
   11.60  	
   11.61  	/* copy translucent pixels */
   11.62  	ofs = 0;
    12.1 --- a/src/video/SDL_blit_A.c	Mon Feb 27 22:14:40 2006 +0000
    12.2 +++ b/src/video/SDL_blit_A.c	Wed Mar 01 09:43:47 2006 +0000
    12.3 @@ -1442,7 +1442,7 @@
    12.4  	int dstskip = info->d_skip >> 1;
    12.5  
    12.6  	while(height--) {
    12.7 -		if(((unsigned long)srcp ^ (unsigned long)dstp) & 2) {
    12.8 +		if(((uintptr_t)srcp ^ (uintptr_t)dstp) & 2) {
    12.9  			/*
   12.10  			 * Source and destination not aligned, pipeline it.
   12.11  			 * This is mostly a win for big blits but no loss for
   12.12 @@ -1452,7 +1452,7 @@
   12.13  			int w = width;
   12.14  
   12.15  			/* handle odd destination */
   12.16 -			if((unsigned long)dstp & 2) {
   12.17 +			if((uintptr_t)dstp & 2) {
   12.18  				Uint16 d = *dstp, s = *srcp;
   12.19  				*dstp = BLEND16_50(d, s, mask);
   12.20  				dstp++;
   12.21 @@ -1499,7 +1499,7 @@
   12.22  			int w = width;
   12.23  
   12.24  			/* first odd pixel? */
   12.25 -			if((unsigned long)srcp & 2) {
   12.26 +			if((uintptr_t)srcp & 2) {
   12.27  				Uint16 d = *dstp, s = *srcp;
   12.28  				*dstp = BLEND16_50(d, s, mask);
   12.29  				srcp++;
    13.1 --- a/src/video/SDL_surface.c	Mon Feb 27 22:14:40 2006 +0000
    13.2 +++ b/src/video/SDL_surface.c	Wed Mar 01 09:43:47 2006 +0000
    13.3 @@ -604,7 +604,7 @@
    13.4  			dstrect->x*dst->format->BytesPerPixel;
    13.5  	if ( dst->format->palette || (color == 0) ) {
    13.6  		x = dstrect->w*dst->format->BytesPerPixel;
    13.7 -		if ( !color && !((long)row&3) && !(x&3) && !(dst->pitch&3) ) {
    13.8 +		if ( !color && !((uintptr_t)row&3) && !(x&3) && !(dst->pitch&3) ) {
    13.9  			int n = x >> 2;
   13.10  			for ( y=dstrect->h; y; --y ) {
   13.11  				SDL_memset4(row, 0, n);
   13.12 @@ -690,7 +690,7 @@
   13.13  				Uint16 c = (Uint16)color;
   13.14  				Uint32 cc = (Uint32)c << 16 | c;
   13.15  				int n = dstrect->w;
   13.16 -				if((unsigned long)pixels & 3) {
   13.17 +				if((uintptr_t)pixels & 3) {
   13.18  					*pixels++ = c;
   13.19  					n--;
   13.20  				}
    14.1 --- a/src/video/wincommon/SDL_sysevents.c	Mon Feb 27 22:14:40 2006 +0000
    14.2 +++ b/src/video/wincommon/SDL_sysevents.c	Wed Mar 01 09:43:47 2006 +0000
    14.3 @@ -191,7 +191,7 @@
    14.4  {
    14.5  	if ( ptme->dwFlags == TME_LEAVE ) {
    14.6  		return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100,
    14.7 -		                (TIMERPROC)TrackMouseTimerProc);
    14.8 +		                (TIMERPROC)TrackMouseTimerProc) != 0;
    14.9  	}
   14.10  	return FALSE;
   14.11  }
   14.12 @@ -247,7 +247,7 @@
   14.13  /* The main Win32 event handler
   14.14  DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it
   14.15  */
   14.16 -LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   14.17 +LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   14.18  {
   14.19  	SDL_VideoDevice *this = current_video;
   14.20  	static int mouse_pressed = 0;
    15.1 --- a/src/video/wincommon/SDL_sysmouse.c	Mon Feb 27 22:14:40 2006 +0000
    15.2 +++ b/src/video/wincommon/SDL_sysmouse.c	Wed Mar 01 09:43:47 2006 +0000
    15.3 @@ -172,7 +172,7 @@
    15.4  
    15.5  	/* Create the cursor */
    15.6  	cursor->curs = CreateCursor(
    15.7 -			(HINSTANCE)GetWindowLong(SDL_Window, GWL_HINSTANCE),
    15.8 +			(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
    15.9  					hot_x, hot_y, allowed_x, allowed_y, 
   15.10  						cursor->ands, cursor->xors);
   15.11  	if ( cursor->curs == NULL ) {
    16.1 --- a/src/video/wincommon/SDL_syswm.c	Mon Feb 27 22:14:40 2006 +0000
    16.2 +++ b/src/video/wincommon/SDL_syswm.c	Wed Mar 01 09:43:47 2006 +0000
    16.3 @@ -220,7 +220,7 @@
    16.4  	if ( screen_icn == NULL ) {
    16.5  		SDL_SetError("Couldn't create Win32 icon handle");
    16.6  	} else {
    16.7 -		SetClassLong(SDL_Window, GCL_HICON, (LONG)screen_icn);
    16.8 +		SetClassLongPtr(SDL_Window, GCL_HICON, (LONG_PTR)screen_icn);
    16.9  	}
   16.10  	SDL_stack_free(icon_win32);
   16.11  #endif /* DISABLE_ICON_SUPPORT */
    17.1 --- a/src/video/windib/SDL_dibevents.c	Mon Feb 27 22:14:40 2006 +0000
    17.2 +++ b/src/video/windib/SDL_dibevents.c	Wed Mar 01 09:43:47 2006 +0000
    17.3 @@ -84,8 +84,7 @@
    17.4  
    17.5  
    17.6  /* The main Win32 event handler */
    17.7 -LONG
    17.8 - DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    17.9 +LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   17.10  {
   17.11  	extern int posted;
   17.12  
   17.13 @@ -417,7 +416,7 @@
   17.14  		SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
   17.15  		SDL_free(windowid_t);
   17.16  #else
   17.17 -		SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0);
   17.18 +		SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);
   17.19  #endif
   17.20  		if ( SDL_Window == NULL ) {
   17.21  			SDL_SetError("Couldn't get user specified window");
   17.22 @@ -427,8 +426,8 @@
   17.23  		/* DJM: we want all event's for the user specified
   17.24  			window to be handled by SDL.
   17.25  		 */
   17.26 -		userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC);
   17.27 -		SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
   17.28 +		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
   17.29 +		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
   17.30  	} else {
   17.31  		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
   17.32                          (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
   17.33 @@ -445,7 +444,7 @@
   17.34  void DIB_DestroyWindow(_THIS)
   17.35  {
   17.36  	if ( SDL_windowid ) {
   17.37 -		SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc);
   17.38 +		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
   17.39  	} else {
   17.40  		DestroyWindow(SDL_Window);
   17.41  	}
    18.1 --- a/src/video/windx5/SDL_dx5events.c	Mon Feb 27 22:14:40 2006 +0000
    18.2 +++ b/src/video/windx5/SDL_dx5events.c	Wed Mar 01 09:43:47 2006 +0000
    18.3 @@ -476,8 +476,7 @@
    18.4  }
    18.5  
    18.6  /* The main Win32 event handler */
    18.7 -LONG
    18.8 - DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    18.9 +LRESULT DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   18.10  {
   18.11  	switch (msg) {
   18.12  #ifdef WM_ACTIVATEAPP
   18.13 @@ -503,7 +502,7 @@
   18.14  
   18.15  #ifdef WM_DISPLAYCHANGE
   18.16  		case WM_DISPLAYCHANGE: {
   18.17 -			WORD BitsPerPixel;
   18.18 +			WPARAM BitsPerPixel;
   18.19  			WORD SizeX, SizeY;
   18.20  
   18.21  			/* Ack!  The display changed size and/or depth! */
   18.22 @@ -866,7 +865,7 @@
   18.23  
   18.24  	SDL_windowid = (windowid != NULL);
   18.25  	if ( SDL_windowid ) {
   18.26 -		SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0);
   18.27 +		SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);
   18.28  		if ( SDL_Window == NULL ) {
   18.29  			SDL_SetError("Couldn't get user specified window");
   18.30  			return(-1);
   18.31 @@ -875,8 +874,8 @@
   18.32  		/* DJM: we want all event's for the user specified
   18.33  			window to be handled by SDL.
   18.34  		 */
   18.35 -		userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC);
   18.36 -		SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
   18.37 +		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
   18.38 +		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
   18.39  	} else {
   18.40  		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
   18.41                          (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
   18.42 @@ -904,7 +903,7 @@
   18.43  
   18.44  	/* Destroy our window */
   18.45  	if ( SDL_windowid ) {
   18.46 -		SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc);
   18.47 +		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
   18.48  	} else {
   18.49  		DestroyWindow(SDL_Window);
   18.50  	}