diff --git a/VisualC.zip b/VisualC.zip index a9db1f643..9e5f6e255 100644 Binary files a/VisualC.zip and b/VisualC.zip differ diff --git a/configure.in b/configure.in index 0d48a180c..e5465e109 100644 --- a/configure.in +++ b/configure.in @@ -116,7 +116,7 @@ if test x$enable_libc = xyes; then if test x$ac_cv_func_strtod = xyes; then AC_DEFINE(HAVE_STRTOD) fi - 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) + 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) AC_CHECK_LIB(m, pow, [BUILD_LDFLAGS="$BUILD_LDFLAGS -lm"]) fi diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index e03bf43f2..557bf38a4 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -446,6 +446,12 @@ extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); #endif +#if HAVE_STRTOUL +#define SDL_strtoul strtoul +#else +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); +#endif + #if SDL_HAS_64BIT_TYPE #if HAVE__I64TOA @@ -466,6 +472,12 @@ extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); #endif +#if HAVE_STRTOULL +#define SDL_strtoull strtoull +#else +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); +#endif + #endif /* SDL_HAS_64BIT_TYPE */ #if HAVE_STRTOD diff --git a/src/audio/windib/SDL_dibaudio.c b/src/audio/windib/SDL_dibaudio.c index 37fc42498..9c10db52d 100644 --- a/src/audio/windib/SDL_dibaudio.c +++ b/src/audio/windib/SDL_dibaudio.c @@ -99,7 +99,7 @@ AudioBootStrap WAVEOUT_bootstrap = { /* The Win32 callback for filling the WAVE device */ -static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, +static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD dwParam1, DWORD dwParam2) { SDL_AudioDevice *this = (SDL_AudioDevice *)dwInstance; @@ -118,7 +118,7 @@ static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, static void SetMMerror(char *function, MMRESULT code) { - int len; + size_t len; char errbuf[MAXERRORLENGTH]; #ifdef _WIN32_WCE wchar_t werrbuf[MAXERRORLENGTH]; @@ -132,7 +132,7 @@ static void SetMMerror(char *function, MMRESULT code) waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH-len); WideCharToMultiByte(CP_ACP,0,werrbuf,-1,errbuf+len,MAXERRORLENGTH-len,NULL,NULL); #else - waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len); + waveOutGetErrorText(code, errbuf+len, (UINT)(MAXERRORLENGTH-len)); #endif SDL_SetError("%s",errbuf); @@ -266,7 +266,7 @@ int DIB_OpenAudio(_THIS, SDL_AudioSpec *spec) /* Open the audio device */ result = waveOutOpen(&sound, WAVE_MAPPER, &waveformat, - (DWORD)FillSound, (DWORD)this, CALLBACK_FUNCTION); + (DWORD_PTR)FillSound, (DWORD_PTR)this, CALLBACK_FUNCTION); if ( result != MMSYSERR_NOERROR ) { SetMMerror("waveOutOpen()", result); return(-1); diff --git a/src/cdrom/win32/SDL_syscdrom.c b/src/cdrom/win32/SDL_syscdrom.c index 17d02ddc0..7523e7b97 100644 --- a/src/cdrom/win32/SDL_syscdrom.c +++ b/src/cdrom/win32/SDL_syscdrom.c @@ -111,7 +111,7 @@ static int SDL_SYS_CDioctl(int id, UINT msg, DWORD flags, void *arg) { MCIERROR mci_error; - mci_error = mciSendCommand(SDL_mciID[id], msg, flags, (DWORD)arg); + mci_error = mciSendCommand(SDL_mciID[id], msg, flags, (DWORD_PTR)arg); if ( mci_error ) { char error[256]; diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index 4e284b24e..c09718a29 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -245,8 +245,8 @@ static int mem_seek(SDL_RWops *context, int offset, int whence) } static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum) { - int total_bytes; - int mem_available; + size_t total_bytes; + size_t mem_available; total_bytes = (maxnum * size); if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) ) { diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c index 01fd0ece5..c2d0bb967 100644 --- a/src/stdlib/SDL_getenv.c +++ b/src/stdlib/SDL_getenv.c @@ -33,12 +33,12 @@ /* Note this isn't thread-safe! */ static char *SDL_envmem = NULL; /* Ugh, memory leak */ -static DWORD SDL_envmemlen = 0; +static size_t SDL_envmemlen = 0; /* Put a variable of the form "name=value" into the environment */ int SDL_putenv(const char *variable) { - DWORD bufferlen; + size_t bufferlen; char *value; const char *sep; @@ -67,7 +67,7 @@ int SDL_putenv(const char *variable) /* Retrieve a variable named "name" from the environment */ char *SDL_getenv(const char *name) { - DWORD bufferlen; + size_t bufferlen; bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen); if ( bufferlen == 0 ) { diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 37bfff31f..550937c9c 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -1647,7 +1647,7 @@ struct malloc_chunk { typedef struct malloc_chunk mchunk; typedef struct malloc_chunk* mchunkptr; typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ -typedef unsigned int bindex_t; /* Described below */ +typedef size_t bindex_t; /* Described below */ typedef unsigned int binmap_t; /* Described below */ typedef unsigned int flag_t; /* The type of various bit flag sets */ diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c index a3419d421..9278d2579 100644 --- a/src/stdlib/SDL_qsort.c +++ b/src/stdlib/SDL_qsort.c @@ -263,7 +263,7 @@ typedef struct { char * first; char * last; } stack_entry; static char * pivot_big(char *first, char *mid, char *last, size_t size, int compare(const void *, const void *)) { - int d=(((last-first)/size)>>3)*size; + size_t d=(((last-first)/size)>>3)*size; char *m1,*m2,*m3; { char *a=first, *b=first+d, *c=first+2*d; #ifdef DEBUG_QSORT @@ -414,7 +414,7 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { if (nmemb<=1) return; - if (((int)base|size)&(WORD_BYTES-1)) + if (((uintptr_t)base|size)&(WORD_BYTES-1)) qsort_nonaligned(base,nmemb,size,compare); else if (size!=WORD_BYTES) qsort_aligned(base,nmemb,size,compare); diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 54ca1d6ee..9c533fe02 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -69,7 +69,7 @@ static size_t SDL_ScanLong(const char *text, int radix, long *valuep) } #endif -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD) +#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) { const char *textstart = text; @@ -100,6 +100,37 @@ static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *v } #endif +#ifndef HAVE_SSCANF +static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep) +{ + const char *textstart = text; + uintptr_t value = 0; + + if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) { + text += 2; + } + for ( ; ; ) { + int v; + if ( SDL_isdigit(*text) ) { + v = *text - '0'; + } else if ( radix == 16 && SDL_isupperhex(*text) ) { + v = 10 + (*text - 'A'); + } else if ( radix == 16 && SDL_islowerhex(*text) ) { + v = 10 + (*text - 'a'); + } else { + break; + } + value *= radix; + value += v; + ++text; + } + if ( valuep ) { + *valuep = value; + } + return (text - textstart); +} +#endif + #ifdef SDL_HAS_64BIT_TYPE #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL) static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep) @@ -141,7 +172,7 @@ static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep) } #endif -#ifndef HAVE_SSCANF +#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOULL) static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep) { const char *textstart = text; @@ -488,6 +519,20 @@ long SDL_strtol(const char *string, char **endp, int base) } #endif +#ifndef HAVE_STRTOUL +unsigned long SDL_strtoul(const char *string, char **endp, int base) +{ + size_t len; + unsigned long value; + + len = SDL_ScanUnsignedLong(string, base ? base : 10, &value); + if ( endp ) { + *endp = (char *)string + len; + } + return value; +} +#endif + #ifdef SDL_HAS_64BIT_TYPE #ifndef HAVE__I64TOA @@ -556,6 +601,20 @@ Sint64 SDL_strtoll(const char *string, char **endp, int base) } #endif +#ifndef HAVE_STRTOULL +Uint64 SDL_strtoull(const char *string, char **endp, int base) +{ + size_t len; + Uint64 value; + + len = SDL_ScanUnsignedLongLong(string, base ? base : 10, &value); + if ( endp ) { + *endp = (char *)string + len; + } + return value; +} +#endif + #endif /* SDL_HAS_64BIT_TYPE */ #ifndef HAVE_STRTOD @@ -817,8 +876,8 @@ int SDL_sscanf(const char *text, const char *fmt, ...) break; case 'p': { - unsigned long value; - text += SDL_ScanUnsignedLong(text, 16, &value); + uintptr_t value; + text += SDL_ScanUintPtrT(text, 16, &value); if ( ! suppress ) { void** valuep = va_arg(ap, void**); *valuep = (void*)value; @@ -1003,7 +1062,7 @@ static size_t SDL_PrintString(char *text, const char *string, size_t maxlen) } return (text - textstart); } -int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) +int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) { char *textstart = text; if ( maxlen <= 0 ) { diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c index cba9ace76..cf33352ba 100644 --- a/src/video/SDL_RLEaccel.c +++ b/src/video/SDL_RLEaccel.c @@ -587,12 +587,12 @@ do { \ unsigned n = (length); \ Uint16 *src = (Uint16 *)(from); \ Uint16 *dst = (Uint16 *)(to); \ - if(((unsigned long)src ^ (unsigned long)dst) & 3) { \ + if(((uintptr_t)src ^ (uintptr_t)dst) & 3) { \ /* source and destination not in phase, blit one by one */ \ while(n--) \ BLEND16_50(dst, src, mask); \ } else { \ - if((unsigned long)src & 3) { \ + if((uintptr_t)src & 3) { \ /* first odd pixel */ \ BLEND16_50(dst, src, mask); \ n--; \ @@ -1055,7 +1055,7 @@ static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *dst, } while(ofs < w); \ /* skip padding if necessary */ \ if(sizeof(Ptype) == 2) \ - srcbuf += (unsigned long)srcbuf & 2; \ + srcbuf += (uintptr_t)srcbuf & 2; \ /* blit translucent pixels on the same line */ \ ofs = 0; \ do { \ @@ -1147,7 +1147,7 @@ int SDL_RLEAlphaBlit(SDL_Surface *src, SDL_Rect *srcrect, } while(ofs < w); /* skip padding */ - srcbuf += (unsigned long)srcbuf & 2; + srcbuf += (uintptr_t)srcbuf & 2; /* skip translucent line */ ofs = 0; @@ -1211,7 +1211,7 @@ int SDL_RLEAlphaBlit(SDL_Surface *src, SDL_Rect *srcrect, } while(ofs < w); \ /* skip padding if necessary */ \ if(sizeof(Ptype) == 2) \ - srcbuf += (unsigned long)srcbuf & 2; \ + srcbuf += (uintptr_t)srcbuf & 2; \ /* blit translucent pixels on the same line */ \ ofs = 0; \ do { \ @@ -1547,7 +1547,7 @@ static int RLEAlphaSurface(SDL_Surface *surface) } while(x < w); /* Make sure the next output address is 32-bit aligned */ - dst += (unsigned long)dst & 2; + dst += (uintptr_t)dst & 2; /* Next, encode all translucent pixels of the same scan line */ x = 0; @@ -1874,7 +1874,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface) /* skip padding if needed */ if(bpp == 2) - srcbuf += (unsigned long)srcbuf & 2; + srcbuf += (uintptr_t)srcbuf & 2; /* copy translucent pixels */ ofs = 0; diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index e94fdf66e..e66836bbc 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -1442,7 +1442,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask) int dstskip = info->d_skip >> 1; while(height--) { - if(((unsigned long)srcp ^ (unsigned long)dstp) & 2) { + if(((uintptr_t)srcp ^ (uintptr_t)dstp) & 2) { /* * Source and destination not aligned, pipeline it. * This is mostly a win for big blits but no loss for @@ -1452,7 +1452,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask) int w = width; /* handle odd destination */ - if((unsigned long)dstp & 2) { + if((uintptr_t)dstp & 2) { Uint16 d = *dstp, s = *srcp; *dstp = BLEND16_50(d, s, mask); dstp++; @@ -1499,7 +1499,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask) int w = width; /* first odd pixel? */ - if((unsigned long)srcp & 2) { + if((uintptr_t)srcp & 2) { Uint16 d = *dstp, s = *srcp; *dstp = BLEND16_50(d, s, mask); srcp++; diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 578401ac7..7ef8565cb 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -604,7 +604,7 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) dstrect->x*dst->format->BytesPerPixel; if ( dst->format->palette || (color == 0) ) { x = dstrect->w*dst->format->BytesPerPixel; - if ( !color && !((long)row&3) && !(x&3) && !(dst->pitch&3) ) { + if ( !color && !((uintptr_t)row&3) && !(x&3) && !(dst->pitch&3) ) { int n = x >> 2; for ( y=dstrect->h; y; --y ) { SDL_memset4(row, 0, n); @@ -690,7 +690,7 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) Uint16 c = (Uint16)color; Uint32 cc = (Uint32)c << 16 | c; int n = dstrect->w; - if((unsigned long)pixels & 3) { + if((uintptr_t)pixels & 3) { *pixels++ = c; n--; } diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index 1f7b32995..b26e48867 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -191,7 +191,7 @@ static BOOL WINAPI WIN_TrackMouseEvent(TRACKMOUSEEVENT *ptme) { if ( ptme->dwFlags == TME_LEAVE ) { return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100, - (TIMERPROC)TrackMouseTimerProc); + (TIMERPROC)TrackMouseTimerProc) != 0; } return FALSE; } @@ -247,7 +247,7 @@ static void WIN_GetKeyboardState(void) /* The main Win32 event handler DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it */ -LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { SDL_VideoDevice *this = current_video; static int mouse_pressed = 0; diff --git a/src/video/wincommon/SDL_sysmouse.c b/src/video/wincommon/SDL_sysmouse.c index f7138eda0..0f7c8f395 100644 --- a/src/video/wincommon/SDL_sysmouse.c +++ b/src/video/wincommon/SDL_sysmouse.c @@ -172,7 +172,7 @@ WMcursor *WIN_CreateWMCursor(_THIS, /* Create the cursor */ cursor->curs = CreateCursor( - (HINSTANCE)GetWindowLong(SDL_Window, GWL_HINSTANCE), + (HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE), hot_x, hot_y, allowed_x, allowed_y, cursor->ands, cursor->xors); if ( cursor->curs == NULL ) { diff --git a/src/video/wincommon/SDL_syswm.c b/src/video/wincommon/SDL_syswm.c index 85046b12a..73b27bc0b 100644 --- a/src/video/wincommon/SDL_syswm.c +++ b/src/video/wincommon/SDL_syswm.c @@ -220,7 +220,7 @@ void WIN_SetWMIcon(_THIS, SDL_Surface *icon, Uint8 *mask) if ( screen_icn == NULL ) { SDL_SetError("Couldn't create Win32 icon handle"); } else { - SetClassLong(SDL_Window, GCL_HICON, (LONG)screen_icn); + SetClassLongPtr(SDL_Window, GCL_HICON, (LONG_PTR)screen_icn); } SDL_stack_free(icon_win32); #endif /* DISABLE_ICON_SUPPORT */ diff --git a/src/video/windib/SDL_dibevents.c b/src/video/windib/SDL_dibevents.c index 25986495c..177d4993c 100644 --- a/src/video/windib/SDL_dibevents.c +++ b/src/video/windib/SDL_dibevents.c @@ -84,8 +84,7 @@ WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) /* The main Win32 event handler */ -LONG - DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { extern int posted; @@ -417,7 +416,7 @@ int DIB_CreateWindow(_THIS) SDL_Window = (HWND)wcstol(windowid_t, NULL, 0); SDL_free(windowid_t); #else - SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0); + SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0); #endif if ( SDL_Window == NULL ) { SDL_SetError("Couldn't get user specified window"); @@ -427,8 +426,8 @@ int DIB_CreateWindow(_THIS) /* DJM: we want all event's for the user specified window to be handled by SDL. */ - userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC); - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); + userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC); + SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage); } else { SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), @@ -445,7 +444,7 @@ int DIB_CreateWindow(_THIS) void DIB_DestroyWindow(_THIS) { if ( SDL_windowid ) { - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc); + SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc); } else { DestroyWindow(SDL_Window); } diff --git a/src/video/windx5/SDL_dx5events.c b/src/video/windx5/SDL_dx5events.c index 659577014..bebc45147 100644 --- a/src/video/windx5/SDL_dx5events.c +++ b/src/video/windx5/SDL_dx5events.c @@ -476,8 +476,7 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf) } /* The main Win32 event handler */ -LONG - DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { #ifdef WM_ACTIVATEAPP @@ -503,7 +502,7 @@ LONG #ifdef WM_DISPLAYCHANGE case WM_DISPLAYCHANGE: { - WORD BitsPerPixel; + WPARAM BitsPerPixel; WORD SizeX, SizeY; /* Ack! The display changed size and/or depth! */ @@ -866,7 +865,7 @@ int DX5_CreateWindow(_THIS) SDL_windowid = (windowid != NULL); if ( SDL_windowid ) { - SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0); + SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0); if ( SDL_Window == NULL ) { SDL_SetError("Couldn't get user specified window"); return(-1); @@ -875,8 +874,8 @@ int DX5_CreateWindow(_THIS) /* DJM: we want all event's for the user specified window to be handled by SDL. */ - userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC); - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); + userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC); + SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage); } else { SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), @@ -904,7 +903,7 @@ void DX5_DestroyWindow(_THIS) /* Destroy our window */ if ( SDL_windowid ) { - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc); + SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc); } else { DestroyWindow(SDL_Window); }