Fixed a bunch of 64-bit compatibility problems
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401460
This commit is contained in:
parent
e539f5ab85
commit
a9ee23bb9f
18 changed files with 117 additions and 48 deletions
BIN
VisualC.zip
BIN
VisualC.zip
Binary file not shown.
|
@ -116,7 +116,7 @@ if test x$enable_libc = xyes; then
|
||||||
if test x$ac_cv_func_strtod = xyes; then
|
if test x$ac_cv_func_strtod = xyes; then
|
||||||
AC_DEFINE(HAVE_STRTOD)
|
AC_DEFINE(HAVE_STRTOD)
|
||||||
fi
|
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"])
|
AC_CHECK_LIB(m, pow, [BUILD_LDFLAGS="$BUILD_LDFLAGS -lm"])
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -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);
|
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
|
||||||
#endif
|
#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 SDL_HAS_64BIT_TYPE
|
||||||
|
|
||||||
#if HAVE__I64TOA
|
#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);
|
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
|
||||||
#endif
|
#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 */
|
#endif /* SDL_HAS_64BIT_TYPE */
|
||||||
|
|
||||||
#if HAVE_STRTOD
|
#if HAVE_STRTOD
|
||||||
|
|
|
@ -99,7 +99,7 @@ AudioBootStrap WAVEOUT_bootstrap = {
|
||||||
|
|
||||||
|
|
||||||
/* The Win32 callback for filling the WAVE device */
|
/* 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)
|
DWORD dwParam1, DWORD dwParam2)
|
||||||
{
|
{
|
||||||
SDL_AudioDevice *this = (SDL_AudioDevice *)dwInstance;
|
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)
|
static void SetMMerror(char *function, MMRESULT code)
|
||||||
{
|
{
|
||||||
int len;
|
size_t len;
|
||||||
char errbuf[MAXERRORLENGTH];
|
char errbuf[MAXERRORLENGTH];
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
wchar_t werrbuf[MAXERRORLENGTH];
|
wchar_t werrbuf[MAXERRORLENGTH];
|
||||||
|
@ -132,7 +132,7 @@ static void SetMMerror(char *function, MMRESULT code)
|
||||||
waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH-len);
|
waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH-len);
|
||||||
WideCharToMultiByte(CP_ACP,0,werrbuf,-1,errbuf+len,MAXERRORLENGTH-len,NULL,NULL);
|
WideCharToMultiByte(CP_ACP,0,werrbuf,-1,errbuf+len,MAXERRORLENGTH-len,NULL,NULL);
|
||||||
#else
|
#else
|
||||||
waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len);
|
waveOutGetErrorText(code, errbuf+len, (UINT)(MAXERRORLENGTH-len));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_SetError("%s",errbuf);
|
SDL_SetError("%s",errbuf);
|
||||||
|
@ -266,7 +266,7 @@ int DIB_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
||||||
|
|
||||||
/* Open the audio device */
|
/* Open the audio device */
|
||||||
result = waveOutOpen(&sound, WAVE_MAPPER, &waveformat,
|
result = waveOutOpen(&sound, WAVE_MAPPER, &waveformat,
|
||||||
(DWORD)FillSound, (DWORD)this, CALLBACK_FUNCTION);
|
(DWORD_PTR)FillSound, (DWORD_PTR)this, CALLBACK_FUNCTION);
|
||||||
if ( result != MMSYSERR_NOERROR ) {
|
if ( result != MMSYSERR_NOERROR ) {
|
||||||
SetMMerror("waveOutOpen()", result);
|
SetMMerror("waveOutOpen()", result);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
|
@ -111,7 +111,7 @@ static int SDL_SYS_CDioctl(int id, UINT msg, DWORD flags, void *arg)
|
||||||
{
|
{
|
||||||
MCIERROR mci_error;
|
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 ) {
|
if ( mci_error ) {
|
||||||
char error[256];
|
char error[256];
|
||||||
|
|
||||||
|
|
|
@ -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)
|
static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
|
||||||
{
|
{
|
||||||
int total_bytes;
|
size_t total_bytes;
|
||||||
int mem_available;
|
size_t mem_available;
|
||||||
|
|
||||||
total_bytes = (maxnum * size);
|
total_bytes = (maxnum * size);
|
||||||
if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) ) {
|
if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) ) {
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
/* Note this isn't thread-safe! */
|
/* Note this isn't thread-safe! */
|
||||||
|
|
||||||
static char *SDL_envmem = NULL; /* Ugh, memory leak */
|
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 */
|
/* Put a variable of the form "name=value" into the environment */
|
||||||
int SDL_putenv(const char *variable)
|
int SDL_putenv(const char *variable)
|
||||||
{
|
{
|
||||||
DWORD bufferlen;
|
size_t bufferlen;
|
||||||
char *value;
|
char *value;
|
||||||
const char *sep;
|
const char *sep;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ int SDL_putenv(const char *variable)
|
||||||
/* Retrieve a variable named "name" from the environment */
|
/* Retrieve a variable named "name" from the environment */
|
||||||
char *SDL_getenv(const char *name)
|
char *SDL_getenv(const char *name)
|
||||||
{
|
{
|
||||||
DWORD bufferlen;
|
size_t bufferlen;
|
||||||
|
|
||||||
bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
|
bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
|
||||||
if ( bufferlen == 0 ) {
|
if ( bufferlen == 0 ) {
|
||||||
|
|
|
@ -1647,7 +1647,7 @@ struct malloc_chunk {
|
||||||
typedef struct malloc_chunk mchunk;
|
typedef struct malloc_chunk mchunk;
|
||||||
typedef struct malloc_chunk* mchunkptr;
|
typedef struct malloc_chunk* mchunkptr;
|
||||||
typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */
|
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 binmap_t; /* Described below */
|
||||||
typedef unsigned int flag_t; /* The type of various bit flag sets */
|
typedef unsigned int flag_t; /* The type of various bit flag sets */
|
||||||
|
|
||||||
|
|
|
@ -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,
|
static char * pivot_big(char *first, char *mid, char *last, size_t size,
|
||||||
int compare(const void *, const void *)) {
|
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 *m1,*m2,*m3;
|
||||||
{ char *a=first, *b=first+d, *c=first+2*d;
|
{ char *a=first, *b=first+d, *c=first+2*d;
|
||||||
#ifdef DEBUG_QSORT
|
#ifdef DEBUG_QSORT
|
||||||
|
@ -414,7 +414,7 @@ void qsort(void *base, size_t nmemb, size_t size,
|
||||||
int (*compare)(const void *, const void *)) {
|
int (*compare)(const void *, const void *)) {
|
||||||
|
|
||||||
if (nmemb<=1) return;
|
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);
|
qsort_nonaligned(base,nmemb,size,compare);
|
||||||
else if (size!=WORD_BYTES)
|
else if (size!=WORD_BYTES)
|
||||||
qsort_aligned(base,nmemb,size,compare);
|
qsort_aligned(base,nmemb,size,compare);
|
||||||
|
|
|
@ -69,7 +69,7 @@ static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
|
||||||
{
|
{
|
||||||
const char *textstart = text;
|
const char *textstart = text;
|
||||||
|
@ -100,6 +100,37 @@ static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *v
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef SDL_HAS_64BIT_TYPE
|
||||||
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL)
|
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL)
|
||||||
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
|
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
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_SSCANF
|
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOULL)
|
||||||
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
|
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
|
||||||
{
|
{
|
||||||
const char *textstart = text;
|
const char *textstart = text;
|
||||||
|
@ -488,6 +519,20 @@ long SDL_strtol(const char *string, char **endp, int base)
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef SDL_HAS_64BIT_TYPE
|
||||||
|
|
||||||
#ifndef HAVE__I64TOA
|
#ifndef HAVE__I64TOA
|
||||||
|
@ -556,6 +601,20 @@ Sint64 SDL_strtoll(const char *string, char **endp, int base)
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
#endif /* SDL_HAS_64BIT_TYPE */
|
||||||
|
|
||||||
#ifndef HAVE_STRTOD
|
#ifndef HAVE_STRTOD
|
||||||
|
@ -817,8 +876,8 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
{
|
{
|
||||||
unsigned long value;
|
uintptr_t value;
|
||||||
text += SDL_ScanUnsignedLong(text, 16, &value);
|
text += SDL_ScanUintPtrT(text, 16, &value);
|
||||||
if ( ! suppress ) {
|
if ( ! suppress ) {
|
||||||
void** valuep = va_arg(ap, void**);
|
void** valuep = va_arg(ap, void**);
|
||||||
*valuep = (void*)value;
|
*valuep = (void*)value;
|
||||||
|
|
|
@ -587,12 +587,12 @@ do { \
|
||||||
unsigned n = (length); \
|
unsigned n = (length); \
|
||||||
Uint16 *src = (Uint16 *)(from); \
|
Uint16 *src = (Uint16 *)(from); \
|
||||||
Uint16 *dst = (Uint16 *)(to); \
|
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 */ \
|
/* source and destination not in phase, blit one by one */ \
|
||||||
while(n--) \
|
while(n--) \
|
||||||
BLEND16_50(dst, src, mask); \
|
BLEND16_50(dst, src, mask); \
|
||||||
} else { \
|
} else { \
|
||||||
if((unsigned long)src & 3) { \
|
if((uintptr_t)src & 3) { \
|
||||||
/* first odd pixel */ \
|
/* first odd pixel */ \
|
||||||
BLEND16_50(dst, src, mask); \
|
BLEND16_50(dst, src, mask); \
|
||||||
n--; \
|
n--; \
|
||||||
|
@ -1055,7 +1055,7 @@ static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *dst,
|
||||||
} while(ofs < w); \
|
} while(ofs < w); \
|
||||||
/* skip padding if necessary */ \
|
/* skip padding if necessary */ \
|
||||||
if(sizeof(Ptype) == 2) \
|
if(sizeof(Ptype) == 2) \
|
||||||
srcbuf += (unsigned long)srcbuf & 2; \
|
srcbuf += (uintptr_t)srcbuf & 2; \
|
||||||
/* blit translucent pixels on the same line */ \
|
/* blit translucent pixels on the same line */ \
|
||||||
ofs = 0; \
|
ofs = 0; \
|
||||||
do { \
|
do { \
|
||||||
|
@ -1147,7 +1147,7 @@ int SDL_RLEAlphaBlit(SDL_Surface *src, SDL_Rect *srcrect,
|
||||||
} while(ofs < w);
|
} while(ofs < w);
|
||||||
|
|
||||||
/* skip padding */
|
/* skip padding */
|
||||||
srcbuf += (unsigned long)srcbuf & 2;
|
srcbuf += (uintptr_t)srcbuf & 2;
|
||||||
|
|
||||||
/* skip translucent line */
|
/* skip translucent line */
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
|
@ -1211,7 +1211,7 @@ int SDL_RLEAlphaBlit(SDL_Surface *src, SDL_Rect *srcrect,
|
||||||
} while(ofs < w); \
|
} while(ofs < w); \
|
||||||
/* skip padding if necessary */ \
|
/* skip padding if necessary */ \
|
||||||
if(sizeof(Ptype) == 2) \
|
if(sizeof(Ptype) == 2) \
|
||||||
srcbuf += (unsigned long)srcbuf & 2; \
|
srcbuf += (uintptr_t)srcbuf & 2; \
|
||||||
/* blit translucent pixels on the same line */ \
|
/* blit translucent pixels on the same line */ \
|
||||||
ofs = 0; \
|
ofs = 0; \
|
||||||
do { \
|
do { \
|
||||||
|
@ -1547,7 +1547,7 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||||
} while(x < w);
|
} while(x < w);
|
||||||
|
|
||||||
/* Make sure the next output address is 32-bit aligned */
|
/* 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 */
|
/* Next, encode all translucent pixels of the same scan line */
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -1874,7 +1874,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface)
|
||||||
|
|
||||||
/* skip padding if needed */
|
/* skip padding if needed */
|
||||||
if(bpp == 2)
|
if(bpp == 2)
|
||||||
srcbuf += (unsigned long)srcbuf & 2;
|
srcbuf += (uintptr_t)srcbuf & 2;
|
||||||
|
|
||||||
/* copy translucent pixels */
|
/* copy translucent pixels */
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
|
|
|
@ -1442,7 +1442,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask)
|
||||||
int dstskip = info->d_skip >> 1;
|
int dstskip = info->d_skip >> 1;
|
||||||
|
|
||||||
while(height--) {
|
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.
|
* Source and destination not aligned, pipeline it.
|
||||||
* This is mostly a win for big blits but no loss for
|
* 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;
|
int w = width;
|
||||||
|
|
||||||
/* handle odd destination */
|
/* handle odd destination */
|
||||||
if((unsigned long)dstp & 2) {
|
if((uintptr_t)dstp & 2) {
|
||||||
Uint16 d = *dstp, s = *srcp;
|
Uint16 d = *dstp, s = *srcp;
|
||||||
*dstp = BLEND16_50(d, s, mask);
|
*dstp = BLEND16_50(d, s, mask);
|
||||||
dstp++;
|
dstp++;
|
||||||
|
@ -1499,7 +1499,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask)
|
||||||
int w = width;
|
int w = width;
|
||||||
|
|
||||||
/* first odd pixel? */
|
/* first odd pixel? */
|
||||||
if((unsigned long)srcp & 2) {
|
if((uintptr_t)srcp & 2) {
|
||||||
Uint16 d = *dstp, s = *srcp;
|
Uint16 d = *dstp, s = *srcp;
|
||||||
*dstp = BLEND16_50(d, s, mask);
|
*dstp = BLEND16_50(d, s, mask);
|
||||||
srcp++;
|
srcp++;
|
||||||
|
|
|
@ -604,7 +604,7 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
|
||||||
dstrect->x*dst->format->BytesPerPixel;
|
dstrect->x*dst->format->BytesPerPixel;
|
||||||
if ( dst->format->palette || (color == 0) ) {
|
if ( dst->format->palette || (color == 0) ) {
|
||||||
x = dstrect->w*dst->format->BytesPerPixel;
|
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;
|
int n = x >> 2;
|
||||||
for ( y=dstrect->h; y; --y ) {
|
for ( y=dstrect->h; y; --y ) {
|
||||||
SDL_memset4(row, 0, n);
|
SDL_memset4(row, 0, n);
|
||||||
|
@ -690,7 +690,7 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
|
||||||
Uint16 c = (Uint16)color;
|
Uint16 c = (Uint16)color;
|
||||||
Uint32 cc = (Uint32)c << 16 | c;
|
Uint32 cc = (Uint32)c << 16 | c;
|
||||||
int n = dstrect->w;
|
int n = dstrect->w;
|
||||||
if((unsigned long)pixels & 3) {
|
if((uintptr_t)pixels & 3) {
|
||||||
*pixels++ = c;
|
*pixels++ = c;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ static BOOL WINAPI WIN_TrackMouseEvent(TRACKMOUSEEVENT *ptme)
|
||||||
{
|
{
|
||||||
if ( ptme->dwFlags == TME_LEAVE ) {
|
if ( ptme->dwFlags == TME_LEAVE ) {
|
||||||
return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100,
|
return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100,
|
||||||
(TIMERPROC)TrackMouseTimerProc);
|
(TIMERPROC)TrackMouseTimerProc) != 0;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ static void WIN_GetKeyboardState(void)
|
||||||
/* The main Win32 event handler
|
/* The main Win32 event handler
|
||||||
DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it
|
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;
|
SDL_VideoDevice *this = current_video;
|
||||||
static int mouse_pressed = 0;
|
static int mouse_pressed = 0;
|
||||||
|
|
|
@ -172,7 +172,7 @@ WMcursor *WIN_CreateWMCursor(_THIS,
|
||||||
|
|
||||||
/* Create the cursor */
|
/* Create the cursor */
|
||||||
cursor->curs = CreateCursor(
|
cursor->curs = CreateCursor(
|
||||||
(HINSTANCE)GetWindowLong(SDL_Window, GWL_HINSTANCE),
|
(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
|
||||||
hot_x, hot_y, allowed_x, allowed_y,
|
hot_x, hot_y, allowed_x, allowed_y,
|
||||||
cursor->ands, cursor->xors);
|
cursor->ands, cursor->xors);
|
||||||
if ( cursor->curs == NULL ) {
|
if ( cursor->curs == NULL ) {
|
||||||
|
|
|
@ -220,7 +220,7 @@ void WIN_SetWMIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
|
||||||
if ( screen_icn == NULL ) {
|
if ( screen_icn == NULL ) {
|
||||||
SDL_SetError("Couldn't create Win32 icon handle");
|
SDL_SetError("Couldn't create Win32 icon handle");
|
||||||
} else {
|
} else {
|
||||||
SetClassLong(SDL_Window, GCL_HICON, (LONG)screen_icn);
|
SetClassLongPtr(SDL_Window, GCL_HICON, (LONG_PTR)screen_icn);
|
||||||
}
|
}
|
||||||
SDL_stack_free(icon_win32);
|
SDL_stack_free(icon_win32);
|
||||||
#endif /* DISABLE_ICON_SUPPORT */
|
#endif /* DISABLE_ICON_SUPPORT */
|
||||||
|
|
|
@ -84,8 +84,7 @@ WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction)
|
||||||
|
|
||||||
|
|
||||||
/* The main Win32 event handler */
|
/* The main Win32 event handler */
|
||||||
LONG
|
LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
extern int posted;
|
extern int posted;
|
||||||
|
|
||||||
|
@ -417,7 +416,7 @@ int DIB_CreateWindow(_THIS)
|
||||||
SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
|
SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
|
||||||
SDL_free(windowid_t);
|
SDL_free(windowid_t);
|
||||||
#else
|
#else
|
||||||
SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0);
|
SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
if ( SDL_Window == NULL ) {
|
if ( SDL_Window == NULL ) {
|
||||||
SDL_SetError("Couldn't get user specified window");
|
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
|
/* DJM: we want all event's for the user specified
|
||||||
window to be handled by SDL.
|
window to be handled by SDL.
|
||||||
*/
|
*/
|
||||||
userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC);
|
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
|
||||||
SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
|
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
|
||||||
} else {
|
} else {
|
||||||
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
||||||
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
||||||
|
@ -445,7 +444,7 @@ int DIB_CreateWindow(_THIS)
|
||||||
void DIB_DestroyWindow(_THIS)
|
void DIB_DestroyWindow(_THIS)
|
||||||
{
|
{
|
||||||
if ( SDL_windowid ) {
|
if ( SDL_windowid ) {
|
||||||
SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc);
|
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
|
||||||
} else {
|
} else {
|
||||||
DestroyWindow(SDL_Window);
|
DestroyWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,8 +476,7 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The main Win32 event handler */
|
/* The main Win32 event handler */
|
||||||
LONG
|
LRESULT DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
#ifdef WM_ACTIVATEAPP
|
#ifdef WM_ACTIVATEAPP
|
||||||
|
@ -503,7 +502,7 @@ LONG
|
||||||
|
|
||||||
#ifdef WM_DISPLAYCHANGE
|
#ifdef WM_DISPLAYCHANGE
|
||||||
case WM_DISPLAYCHANGE: {
|
case WM_DISPLAYCHANGE: {
|
||||||
WORD BitsPerPixel;
|
WPARAM BitsPerPixel;
|
||||||
WORD SizeX, SizeY;
|
WORD SizeX, SizeY;
|
||||||
|
|
||||||
/* Ack! The display changed size and/or depth! */
|
/* Ack! The display changed size and/or depth! */
|
||||||
|
@ -866,7 +865,7 @@ int DX5_CreateWindow(_THIS)
|
||||||
|
|
||||||
SDL_windowid = (windowid != NULL);
|
SDL_windowid = (windowid != NULL);
|
||||||
if ( SDL_windowid ) {
|
if ( SDL_windowid ) {
|
||||||
SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0);
|
SDL_Window = (HWND)SDL_strtoull(windowid, NULL, 0);
|
||||||
if ( SDL_Window == NULL ) {
|
if ( SDL_Window == NULL ) {
|
||||||
SDL_SetError("Couldn't get user specified window");
|
SDL_SetError("Couldn't get user specified window");
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -875,8 +874,8 @@ int DX5_CreateWindow(_THIS)
|
||||||
/* DJM: we want all event's for the user specified
|
/* DJM: we want all event's for the user specified
|
||||||
window to be handled by SDL.
|
window to be handled by SDL.
|
||||||
*/
|
*/
|
||||||
userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC);
|
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
|
||||||
SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
|
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
|
||||||
} else {
|
} else {
|
||||||
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
||||||
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
||||||
|
@ -904,7 +903,7 @@ void DX5_DestroyWindow(_THIS)
|
||||||
|
|
||||||
/* Destroy our window */
|
/* Destroy our window */
|
||||||
if ( SDL_windowid ) {
|
if ( SDL_windowid ) {
|
||||||
SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc);
|
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
|
||||||
} else {
|
} else {
|
||||||
DestroyWindow(SDL_Window);
|
DestroyWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue