Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed issues building 64-bit Windows binary

  • Loading branch information
slouken committed Sep 5, 2009
1 parent 0352ad7 commit e6ab3592e3ddda542ce914eb2b0fc8110b1bd5d0
@@ -82,8 +82,8 @@ typedef struct SDL_RWops
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_ReadLE64(SDL_RWops * src);
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++ */
@@ -67,14 +67,14 @@ DISKAUD_WaitDevice(_THIS)
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
@@ -70,7 +70,8 @@ SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max,
{
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");
@@ -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 */
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 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
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 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
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 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
{

size_t total_bytes;
DWORD byte_written, nwritten;
DWORD byte_written;
size_t nwritten;

total_bytes = size * num;

@@ -249,7 +250,7 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,

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 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
}

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 @@ mem_seek(SDL_RWops * context, long offset, int whence)
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 @@ SDL_ReadBE64(SDL_RWops * src)
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);
@@ -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 @@ __declspec(selectany)
#endif

/* Float to long */
void __declspec(naked) _ftol()
void
__declspec(naked)
_ftol()
{
/* *INDENT-OFF* */
__asm {
@@ -1342,7 +1342,7 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
}
*text = '\0';

return (text - textstart);
return (int)(text - textstart);
}
#endif
/* vi: set ts=4 sw=4 expandtab: */
@@ -515,7 +515,7 @@ compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code)
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);

@@ -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 */
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;
}
@@ -44,7 +44,7 @@ WIN_InitMouse(_THIS)
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 @@ WIN_InitMouse(_THIS)
/* 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 @@ WIN_InitMouse(_THIS)
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;
}

0 comments on commit e6ab359

Please sign in to comment.