# HG changeset patch # User Sam Lantinga # Date 1252193855 0 # Node ID 5d7ef5970073ff46142f45315c36a2ae037359e0 # Parent d2465e21f103c43045032b15c02cb73a8accaf0e Fixed issues building 64-bit Windows binary diff -r d2465e21f103 -r 5d7ef5970073 include/SDL_rwops.h --- a/include/SDL_rwops.h Sat Sep 05 21:31:50 2009 +0000 +++ b/include/SDL_rwops.h Sat Sep 05 23:37:35 2009 +0000 @@ -82,8 +82,8 @@ struct { void *data; - int size; - int left; + size_t size; + size_t left; } buffer; } win32io; #endif @@ -147,12 +147,12 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); /* Write an item of native format to the specified endianness */ -extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); -extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); -extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); -extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); -extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); -extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); /* Ends C function definitions when using C++ */ diff -r d2465e21f103 -r 5d7ef5970073 src/audio/disk/SDL_diskaudio.c --- a/src/audio/disk/SDL_diskaudio.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/audio/disk/SDL_diskaudio.c Sat Sep 05 23:37:35 2009 +0000 @@ -67,14 +67,14 @@ static void DISKAUD_PlayDevice(_THIS) { - int written; + size_t written; /* Write the audio data */ written = SDL_RWwrite(this->hidden->output, this->hidden->mixbuf, 1, this->hidden->mixlen); /* If we couldn't write, assume fatal error for now */ - if ((Uint32) written != this->hidden->mixlen) { + if (written != this->hidden->mixlen) { this->enabled = 0; } #ifdef DEBUG_AUDIO diff -r d2465e21f103 -r 5d7ef5970073 src/events/SDL_mouse.c --- a/src/events/SDL_mouse.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/events/SDL_mouse.c Sat Sep 05 23:37:35 2009 +0000 @@ -70,7 +70,8 @@ { SDL_Mouse **mice; int selected_mouse; - int index, length; + int index; + size_t length; if (SDL_GetMouseIndexId(mouse->id) != -1) { SDL_SetError("Mouse ID already in use"); diff -r d2465e21f103 -r 5d7ef5970073 src/file/SDL_rwops.c --- a/src/file/SDL_rwops.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/file/SDL_rwops.c Sat Sep 05 23:37:35 2009 +0000 @@ -150,7 +150,7 @@ /* FIXME: We may be able to satisfy the seek within buffered data */ if (whence == RW_SEEK_CUR && context->hidden.win32io.buffer.left) { - offset -= context->hidden.win32io.buffer.left; + offset -= (long)context->hidden.win32io.buffer.left; } context->hidden.win32io.buffer.left = 0; @@ -198,7 +198,7 @@ context->hidden.win32io.buffer.size - context->hidden.win32io.buffer.left; read_ahead = - SDL_min(total_need, (size_t) context->hidden.win32io.buffer.left); + SDL_min(total_need, context->hidden.win32io.buffer.left); SDL_memcpy(ptr, data, read_ahead); context->hidden.win32io.buffer.left -= read_ahead; @@ -224,7 +224,7 @@ total_read += read_ahead; } else { if (!ReadFile - (context->hidden.win32io.h, ptr, total_need, &byte_read, NULL)) { + (context->hidden.win32io.h, ptr, (DWORD)total_need, &byte_read, NULL)) { SDL_Error(SDL_EFREAD); return 0; } @@ -239,7 +239,8 @@ { size_t total_bytes; - DWORD byte_written, nwritten; + DWORD byte_written; + size_t nwritten; total_bytes = size * num; @@ -249,7 +250,7 @@ if (context->hidden.win32io.buffer.left) { SetFilePointer(context->hidden.win32io.h, - -context->hidden.win32io.buffer.left, NULL, + -(LONG)context->hidden.win32io.buffer.left, NULL, FILE_CURRENT); context->hidden.win32io.buffer.left = 0; } @@ -264,7 +265,7 @@ } if (!WriteFile - (context->hidden.win32io.h, ptr, total_bytes, &byte_written, NULL)) { + (context->hidden.win32io.h, ptr, (DWORD)total_bytes, &byte_written, NULL)) { SDL_Error(SDL_EFWRITE); return 0; } @@ -377,7 +378,7 @@ newpos = context->hidden.mem.stop; } context->hidden.mem.here = newpos; - return (context->hidden.mem.here - context->hidden.mem.base); + return (long)(context->hidden.mem.here - context->hidden.mem.base); } static size_t SDLCALL @@ -608,42 +609,42 @@ return (SDL_SwapBE64(value)); } -int +size_t SDL_WriteLE16(SDL_RWops * dst, Uint16 value) { value = SDL_SwapLE16(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); } -int +size_t SDL_WriteBE16(SDL_RWops * dst, Uint16 value) { value = SDL_SwapBE16(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); } -int +size_t SDL_WriteLE32(SDL_RWops * dst, Uint32 value) { value = SDL_SwapLE32(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); } -int +size_t SDL_WriteBE32(SDL_RWops * dst, Uint32 value) { value = SDL_SwapBE32(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); } -int +size_t SDL_WriteLE64(SDL_RWops * dst, Uint64 value) { value = SDL_SwapLE64(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); } -int +size_t SDL_WriteBE64(SDL_RWops * dst, Uint64 value) { value = SDL_SwapBE64(value); diff -r d2465e21f103 -r 5d7ef5970073 src/stdlib/SDL_stdlib.c --- a/src/stdlib/SDL_stdlib.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/stdlib/SDL_stdlib.c Sat Sep 05 23:37:35 2009 +0000 @@ -28,7 +28,7 @@ #ifndef HAVE_LIBC /* These are some C runtime intrinsics that need to be defined */ -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(_WIN64) #ifndef __FLTUSED__ #define __FLTUSED__ @@ -40,7 +40,9 @@ #endif /* Float to long */ - void __declspec(naked) _ftol() +void +__declspec(naked) +_ftol() { /* *INDENT-OFF* */ __asm { diff -r d2465e21f103 -r 5d7ef5970073 src/stdlib/SDL_string.c --- a/src/stdlib/SDL_string.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/stdlib/SDL_string.c Sat Sep 05 23:37:35 2009 +0000 @@ -1342,7 +1342,7 @@ } *text = '\0'; - return (text - textstart); + return (int)(text - textstart); } #endif /* vi: set ts=4 sw=4 expandtab: */ diff -r d2465e21f103 -r 5d7ef5970073 src/video/SDL_renderer_gl.c --- a/src/video/SDL_renderer_gl.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/video/SDL_renderer_gl.c Sat Sep 05 23:37:35 2009 +0000 @@ -515,7 +515,7 @@ data->glGenProgramsARB(1, &program); data->glBindProgramARB(shader_type, program); data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB, - SDL_strlen(code), code); + (GLsizei)SDL_strlen(code), code); SDL_free(code); diff -r d2465e21f103 -r 5d7ef5970073 src/video/win32/SDL_win32events.c --- a/src/video/win32/SDL_win32events.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/video/win32/SDL_win32events.c Sat Sep 05 23:37:35 2009 +0000 @@ -141,7 +141,7 @@ /* if we receive such data we need to update the pressure */ SDL_VideoData *videodata = data->videodata; if (videodata->wintabDLL - && videodata->WTPacket((HCTX) lParam, wParam, &packet)) { + && videodata->WTPacket((HCTX) lParam, (UINT) wParam, &packet)) { SDL_ChangeEnd(tablet, (int) packet.pkCursor); pressure = (int) packet.pkNormalPressure; } diff -r d2465e21f103 -r 5d7ef5970073 src/video/win32/SDL_win32mouse.c --- a/src/video/win32/SDL_win32mouse.c Sat Sep 05 21:31:50 2009 +0000 +++ b/src/video/win32/SDL_win32mouse.c Sat Sep 05 23:37:35 2009 +0000 @@ -44,7 +44,7 @@ RAWINPUTDEVICELIST *deviceList = NULL; int devCount = 0; int i; - int tmp = 0; + UINT tmp = 0; char *buffer = NULL; char *tab = "wacom"; /* since windows does't give us handles to tablets, we have to detect a tablet by it's name */ const char *rdp = "rdp_mou"; @@ -71,8 +71,8 @@ /* we're getting the details of the devices */ for (i = 0; i < devCount; ++i) { int is_rdp = 0; - int j; - int k; + UINT j; + UINT k; char *default_device_name = "Pointing device xx"; const char *reg_key_root = "System\\CurrentControlSet\\Enum\\"; char *device_name = SDL_malloc(256 * sizeof(char)); @@ -83,7 +83,7 @@ DWORD regtype = REG_SZ; DWORD out = 256 * sizeof(char); SDL_Mouse mouse; - int l; + size_t l; if (deviceList[i].dwType != RIM_TYPEMOUSE) { /* if a device isn't a mouse type we don't want it */ continue; }