Commit d036689a authored by Sam Lantinga's avatar Sam Lantinga

Fixed issues building 64-bit Windows binary

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403783
parent d4dca0db
...@@ -82,8 +82,8 @@ typedef struct SDL_RWops ...@@ -82,8 +82,8 @@ typedef struct SDL_RWops
struct struct
{ {
void *data; void *data;
int size; size_t size;
int left; size_t left;
} buffer; } buffer;
} win32io; } win32io;
#endif #endif
...@@ -147,12 +147,12 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); ...@@ -147,12 +147,12 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
/* Write an item of native format to the specified endianness */ /* Write an item of native format to the specified endianness */
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); extern DECLSPEC size_t 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_WriteBE64(SDL_RWops * dst, Uint64 value);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
......
...@@ -67,14 +67,14 @@ DISKAUD_WaitDevice(_THIS) ...@@ -67,14 +67,14 @@ DISKAUD_WaitDevice(_THIS)
static void static void
DISKAUD_PlayDevice(_THIS) DISKAUD_PlayDevice(_THIS)
{ {
int written; size_t written;
/* Write the audio data */ /* Write the audio data */
written = SDL_RWwrite(this->hidden->output, written = SDL_RWwrite(this->hidden->output,
this->hidden->mixbuf, 1, this->hidden->mixlen); this->hidden->mixbuf, 1, this->hidden->mixlen);
/* If we couldn't write, assume fatal error for now */ /* If we couldn't write, assume fatal error for now */
if ((Uint32) written != this->hidden->mixlen) { if (written != this->hidden->mixlen) {
this->enabled = 0; this->enabled = 0;
} }
#ifdef DEBUG_AUDIO #ifdef DEBUG_AUDIO
......
...@@ -70,7 +70,8 @@ SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max, ...@@ -70,7 +70,8 @@ SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max,
{ {
SDL_Mouse **mice; SDL_Mouse **mice;
int selected_mouse; int selected_mouse;
int index, length; int index;
size_t length;
if (SDL_GetMouseIndexId(mouse->id) != -1) { if (SDL_GetMouseIndexId(mouse->id) != -1) {
SDL_SetError("Mouse ID already in use"); SDL_SetError("Mouse ID already in use");
......
...@@ -150,7 +150,7 @@ win32_file_seek(SDL_RWops * context, long offset, int whence) ...@@ -150,7 +150,7 @@ win32_file_seek(SDL_RWops * context, long offset, int whence)
/* FIXME: We may be able to satisfy the seek within buffered data */ /* FIXME: We may be able to satisfy the seek within buffered data */
if (whence == RW_SEEK_CUR && context->hidden.win32io.buffer.left) { 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; context->hidden.win32io.buffer.left = 0;
...@@ -198,7 +198,7 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) ...@@ -198,7 +198,7 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
context->hidden.win32io.buffer.size - context->hidden.win32io.buffer.size -
context->hidden.win32io.buffer.left; context->hidden.win32io.buffer.left;
read_ahead = 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); SDL_memcpy(ptr, data, read_ahead);
context->hidden.win32io.buffer.left -= read_ahead; context->hidden.win32io.buffer.left -= read_ahead;
...@@ -224,7 +224,7 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) ...@@ -224,7 +224,7 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
total_read += read_ahead; total_read += read_ahead;
} else { } else {
if (!ReadFile 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); SDL_Error(SDL_EFREAD);
return 0; return 0;
} }
...@@ -239,7 +239,8 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size, ...@@ -239,7 +239,8 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
{ {
size_t total_bytes; size_t total_bytes;
DWORD byte_written, nwritten; DWORD byte_written;
size_t nwritten;
total_bytes = size * num; total_bytes = size * num;
...@@ -249,7 +250,7 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size, ...@@ -249,7 +250,7 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
if (context->hidden.win32io.buffer.left) { if (context->hidden.win32io.buffer.left) {
SetFilePointer(context->hidden.win32io.h, SetFilePointer(context->hidden.win32io.h,
-context->hidden.win32io.buffer.left, NULL, -(LONG)context->hidden.win32io.buffer.left, NULL,
FILE_CURRENT); FILE_CURRENT);
context->hidden.win32io.buffer.left = 0; context->hidden.win32io.buffer.left = 0;
} }
...@@ -264,7 +265,7 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size, ...@@ -264,7 +265,7 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
} }
if (!WriteFile 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); SDL_Error(SDL_EFWRITE);
return 0; return 0;
} }
...@@ -377,7 +378,7 @@ mem_seek(SDL_RWops * context, long offset, int whence) ...@@ -377,7 +378,7 @@ mem_seek(SDL_RWops * context, long offset, int whence)
newpos = context->hidden.mem.stop; newpos = context->hidden.mem.stop;
} }
context->hidden.mem.here = newpos; 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 static size_t SDLCALL
...@@ -608,42 +609,42 @@ SDL_ReadBE64(SDL_RWops * src) ...@@ -608,42 +609,42 @@ SDL_ReadBE64(SDL_RWops * src)
return (SDL_SwapBE64(value)); return (SDL_SwapBE64(value));
} }
int size_t
SDL_WriteLE16(SDL_RWops * dst, Uint16 value) SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
{ {
value = SDL_SwapLE16(value); value = SDL_SwapLE16(value);
return (SDL_RWwrite(dst, &value, (sizeof value), 1)); return (SDL_RWwrite(dst, &value, (sizeof value), 1));
} }
int size_t
SDL_WriteBE16(SDL_RWops * dst, Uint16 value) SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
{ {
value = SDL_SwapBE16(value); value = SDL_SwapBE16(value);
return (SDL_RWwrite(dst, &value, (sizeof value), 1)); return (SDL_RWwrite(dst, &value, (sizeof value), 1));
} }
int size_t
SDL_WriteLE32(SDL_RWops * dst, Uint32 value) SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
{ {
value = SDL_SwapLE32(value); value = SDL_SwapLE32(value);
return (SDL_RWwrite(dst, &value, (sizeof value), 1)); return (SDL_RWwrite(dst, &value, (sizeof value), 1));
} }
int size_t
SDL_WriteBE32(SDL_RWops * dst, Uint32 value) SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
{ {
value = SDL_SwapBE32(value); value = SDL_SwapBE32(value);
return (SDL_RWwrite(dst, &value, (sizeof value), 1)); return (SDL_RWwrite(dst, &value, (sizeof value), 1));
} }
int size_t
SDL_WriteLE64(SDL_RWops * dst, Uint64 value) SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
{ {
value = SDL_SwapLE64(value); value = SDL_SwapLE64(value);
return (SDL_RWwrite(dst, &value, (sizeof value), 1)); return (SDL_RWwrite(dst, &value, (sizeof value), 1));
} }
int size_t
SDL_WriteBE64(SDL_RWops * dst, Uint64 value) SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
{ {
value = SDL_SwapBE64(value); value = SDL_SwapBE64(value);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#ifndef HAVE_LIBC #ifndef HAVE_LIBC
/* These are some C runtime intrinsics that need to be defined */ /* These are some C runtime intrinsics that need to be defined */
#if defined(_MSC_VER) #if defined(_MSC_VER) && !defined(_WIN64)
#ifndef __FLTUSED__ #ifndef __FLTUSED__
#define __FLTUSED__ #define __FLTUSED__
...@@ -40,7 +40,9 @@ __declspec(selectany) ...@@ -40,7 +40,9 @@ __declspec(selectany)
#endif #endif
/* Float to long */ /* Float to long */
void __declspec(naked) _ftol() void
__declspec(naked)
_ftol()
{ {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
__asm { __asm {
......
...@@ -1342,7 +1342,7 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) ...@@ -1342,7 +1342,7 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
} }
*text = '\0'; *text = '\0';
return (text - textstart); return (int)(text - textstart);
} }
#endif #endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -515,7 +515,7 @@ compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code) ...@@ -515,7 +515,7 @@ compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code)
data->glGenProgramsARB(1, &program); data->glGenProgramsARB(1, &program);
data->glBindProgramARB(shader_type, program); data->glBindProgramARB(shader_type, program);
data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB, data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB,
SDL_strlen(code), code); (GLsizei)SDL_strlen(code), code);
SDL_free(code); SDL_free(code);
......
...@@ -141,7 +141,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -141,7 +141,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* if we receive such data we need to update the pressure */ /* if we receive such data we need to update the pressure */
SDL_VideoData *videodata = data->videodata; SDL_VideoData *videodata = data->videodata;
if (videodata->wintabDLL if (videodata->wintabDLL
&& videodata->WTPacket((HCTX) lParam, wParam, &packet)) { && videodata->WTPacket((HCTX) lParam, (UINT) wParam, &packet)) {
SDL_ChangeEnd(tablet, (int) packet.pkCursor); SDL_ChangeEnd(tablet, (int) packet.pkCursor);
pressure = (int) packet.pkNormalPressure; pressure = (int) packet.pkNormalPressure;
} }
......
...@@ -44,7 +44,7 @@ WIN_InitMouse(_THIS) ...@@ -44,7 +44,7 @@ WIN_InitMouse(_THIS)
RAWINPUTDEVICELIST *deviceList = NULL; RAWINPUTDEVICELIST *deviceList = NULL;
int devCount = 0; int devCount = 0;
int i; int i;
int tmp = 0; UINT tmp = 0;
char *buffer = NULL; 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 */ 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"; const char *rdp = "rdp_mou";
...@@ -71,8 +71,8 @@ WIN_InitMouse(_THIS) ...@@ -71,8 +71,8 @@ WIN_InitMouse(_THIS)
/* we're getting the details of the devices */ /* we're getting the details of the devices */
for (i = 0; i < devCount; ++i) { for (i = 0; i < devCount; ++i) {
int is_rdp = 0; int is_rdp = 0;
int j; UINT j;
int k; UINT k;
char *default_device_name = "Pointing device xx"; char *default_device_name = "Pointing device xx";
const char *reg_key_root = "System\\CurrentControlSet\\Enum\\"; const char *reg_key_root = "System\\CurrentControlSet\\Enum\\";
char *device_name = SDL_malloc(256 * sizeof(char)); char *device_name = SDL_malloc(256 * sizeof(char));
...@@ -83,7 +83,7 @@ WIN_InitMouse(_THIS) ...@@ -83,7 +83,7 @@ WIN_InitMouse(_THIS)
DWORD regtype = REG_SZ; DWORD regtype = REG_SZ;
DWORD out = 256 * sizeof(char); DWORD out = 256 * sizeof(char);
SDL_Mouse mouse; 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 */ if (deviceList[i].dwType != RIM_TYPEMOUSE) { /* if a device isn't a mouse type we don't want it */
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment