Fixed issues building 64-bit Windows binary
authorSam Lantinga <slouken@libsdl.org>
Sat, 05 Sep 2009 23:37:35 +0000
changeset 32535d7ef5970073
parent 3252 d2465e21f103
child 3254 1a8c9a6752e5
Fixed issues building 64-bit Windows binary
include/SDL_rwops.h
src/audio/disk/SDL_diskaudio.c
src/events/SDL_mouse.c
src/file/SDL_rwops.c
src/stdlib/SDL_stdlib.c
src/stdlib/SDL_string.c
src/video/SDL_renderer_gl.c
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32mouse.c
     1.1 --- a/include/SDL_rwops.h	Sat Sep 05 21:31:50 2009 +0000
     1.2 +++ b/include/SDL_rwops.h	Sat Sep 05 23:37:35 2009 +0000
     1.3 @@ -82,8 +82,8 @@
     1.4              struct
     1.5              {
     1.6                  void *data;
     1.7 -                int size;
     1.8 -                int left;
     1.9 +                size_t size;
    1.10 +                size_t left;
    1.11              } buffer;
    1.12          } win32io;
    1.13  #endif
    1.14 @@ -147,12 +147,12 @@
    1.15  extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
    1.16  
    1.17  /* Write an item of native format to the specified endianness */
    1.18 -extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
    1.19 -extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
    1.20 -extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
    1.21 -extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
    1.22 -extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
    1.23 -extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
    1.24 +extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
    1.25 +extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
    1.26 +extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
    1.27 +extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
    1.28 +extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
    1.29 +extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
    1.30  
    1.31  
    1.32  /* Ends C function definitions when using C++ */
     2.1 --- a/src/audio/disk/SDL_diskaudio.c	Sat Sep 05 21:31:50 2009 +0000
     2.2 +++ b/src/audio/disk/SDL_diskaudio.c	Sat Sep 05 23:37:35 2009 +0000
     2.3 @@ -67,14 +67,14 @@
     2.4  static void
     2.5  DISKAUD_PlayDevice(_THIS)
     2.6  {
     2.7 -    int written;
     2.8 +    size_t written;
     2.9  
    2.10      /* Write the audio data */
    2.11      written = SDL_RWwrite(this->hidden->output,
    2.12                            this->hidden->mixbuf, 1, this->hidden->mixlen);
    2.13  
    2.14      /* If we couldn't write, assume fatal error for now */
    2.15 -    if ((Uint32) written != this->hidden->mixlen) {
    2.16 +    if (written != this->hidden->mixlen) {
    2.17          this->enabled = 0;
    2.18      }
    2.19  #ifdef DEBUG_AUDIO
     3.1 --- a/src/events/SDL_mouse.c	Sat Sep 05 21:31:50 2009 +0000
     3.2 +++ b/src/events/SDL_mouse.c	Sat Sep 05 23:37:35 2009 +0000
     3.3 @@ -70,7 +70,8 @@
     3.4  {
     3.5      SDL_Mouse **mice;
     3.6      int selected_mouse;
     3.7 -    int index, length;
     3.8 +    int index;
     3.9 +    size_t length;
    3.10  
    3.11      if (SDL_GetMouseIndexId(mouse->id) != -1) {
    3.12          SDL_SetError("Mouse ID already in use");
     4.1 --- a/src/file/SDL_rwops.c	Sat Sep 05 21:31:50 2009 +0000
     4.2 +++ b/src/file/SDL_rwops.c	Sat Sep 05 23:37:35 2009 +0000
     4.3 @@ -150,7 +150,7 @@
     4.4  
     4.5      /* FIXME: We may be able to satisfy the seek within buffered data */
     4.6      if (whence == RW_SEEK_CUR && context->hidden.win32io.buffer.left) {
     4.7 -        offset -= context->hidden.win32io.buffer.left;
     4.8 +        offset -= (long)context->hidden.win32io.buffer.left;
     4.9      }
    4.10      context->hidden.win32io.buffer.left = 0;
    4.11  
    4.12 @@ -198,7 +198,7 @@
    4.13              context->hidden.win32io.buffer.size -
    4.14              context->hidden.win32io.buffer.left;
    4.15          read_ahead =
    4.16 -            SDL_min(total_need, (size_t) context->hidden.win32io.buffer.left);
    4.17 +            SDL_min(total_need, context->hidden.win32io.buffer.left);
    4.18          SDL_memcpy(ptr, data, read_ahead);
    4.19          context->hidden.win32io.buffer.left -= read_ahead;
    4.20  
    4.21 @@ -224,7 +224,7 @@
    4.22          total_read += read_ahead;
    4.23      } else {
    4.24          if (!ReadFile
    4.25 -            (context->hidden.win32io.h, ptr, total_need, &byte_read, NULL)) {
    4.26 +            (context->hidden.win32io.h, ptr, (DWORD)total_need, &byte_read, NULL)) {
    4.27              SDL_Error(SDL_EFREAD);
    4.28              return 0;
    4.29          }
    4.30 @@ -239,7 +239,8 @@
    4.31  {
    4.32  
    4.33      size_t total_bytes;
    4.34 -    DWORD byte_written, nwritten;
    4.35 +    DWORD byte_written;
    4.36 +    size_t nwritten;
    4.37  
    4.38      total_bytes = size * num;
    4.39  
    4.40 @@ -249,7 +250,7 @@
    4.41  
    4.42      if (context->hidden.win32io.buffer.left) {
    4.43          SetFilePointer(context->hidden.win32io.h,
    4.44 -                       -context->hidden.win32io.buffer.left, NULL,
    4.45 +                       -(LONG)context->hidden.win32io.buffer.left, NULL,
    4.46                         FILE_CURRENT);
    4.47          context->hidden.win32io.buffer.left = 0;
    4.48      }
    4.49 @@ -264,7 +265,7 @@
    4.50      }
    4.51  
    4.52      if (!WriteFile
    4.53 -        (context->hidden.win32io.h, ptr, total_bytes, &byte_written, NULL)) {
    4.54 +        (context->hidden.win32io.h, ptr, (DWORD)total_bytes, &byte_written, NULL)) {
    4.55          SDL_Error(SDL_EFWRITE);
    4.56          return 0;
    4.57      }
    4.58 @@ -377,7 +378,7 @@
    4.59          newpos = context->hidden.mem.stop;
    4.60      }
    4.61      context->hidden.mem.here = newpos;
    4.62 -    return (context->hidden.mem.here - context->hidden.mem.base);
    4.63 +    return (long)(context->hidden.mem.here - context->hidden.mem.base);
    4.64  }
    4.65  
    4.66  static size_t SDLCALL
    4.67 @@ -608,42 +609,42 @@
    4.68      return (SDL_SwapBE64(value));
    4.69  }
    4.70  
    4.71 -int
    4.72 +size_t
    4.73  SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
    4.74  {
    4.75      value = SDL_SwapLE16(value);
    4.76      return (SDL_RWwrite(dst, &value, (sizeof value), 1));
    4.77  }
    4.78  
    4.79 -int
    4.80 +size_t
    4.81  SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
    4.82  {
    4.83      value = SDL_SwapBE16(value);
    4.84      return (SDL_RWwrite(dst, &value, (sizeof value), 1));
    4.85  }
    4.86  
    4.87 -int
    4.88 +size_t
    4.89  SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
    4.90  {
    4.91      value = SDL_SwapLE32(value);
    4.92      return (SDL_RWwrite(dst, &value, (sizeof value), 1));
    4.93  }
    4.94  
    4.95 -int
    4.96 +size_t
    4.97  SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
    4.98  {
    4.99      value = SDL_SwapBE32(value);
   4.100      return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   4.101  }
   4.102  
   4.103 -int
   4.104 +size_t
   4.105  SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
   4.106  {
   4.107      value = SDL_SwapLE64(value);
   4.108      return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   4.109  }
   4.110  
   4.111 -int
   4.112 +size_t
   4.113  SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
   4.114  {
   4.115      value = SDL_SwapBE64(value);
     5.1 --- a/src/stdlib/SDL_stdlib.c	Sat Sep 05 21:31:50 2009 +0000
     5.2 +++ b/src/stdlib/SDL_stdlib.c	Sat Sep 05 23:37:35 2009 +0000
     5.3 @@ -28,7 +28,7 @@
     5.4  #ifndef HAVE_LIBC
     5.5  /* These are some C runtime intrinsics that need to be defined */
     5.6  
     5.7 -#if defined(_MSC_VER)
     5.8 +#if defined(_MSC_VER) && !defined(_WIN64)
     5.9  
    5.10  #ifndef __FLTUSED__
    5.11  #define __FLTUSED__
    5.12 @@ -40,7 +40,9 @@
    5.13  #endif
    5.14  
    5.15  /* Float to long */
    5.16 -     void __declspec(naked) _ftol()
    5.17 +void
    5.18 +__declspec(naked)
    5.19 +_ftol()
    5.20  {
    5.21      /* *INDENT-OFF* */
    5.22      __asm {
     6.1 --- a/src/stdlib/SDL_string.c	Sat Sep 05 21:31:50 2009 +0000
     6.2 +++ b/src/stdlib/SDL_string.c	Sat Sep 05 23:37:35 2009 +0000
     6.3 @@ -1342,7 +1342,7 @@
     6.4      }
     6.5      *text = '\0';
     6.6  
     6.7 -    return (text - textstart);
     6.8 +    return (int)(text - textstart);
     6.9  }
    6.10  #endif
    6.11  /* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/SDL_renderer_gl.c	Sat Sep 05 21:31:50 2009 +0000
     7.2 +++ b/src/video/SDL_renderer_gl.c	Sat Sep 05 23:37:35 2009 +0000
     7.3 @@ -515,7 +515,7 @@
     7.4      data->glGenProgramsARB(1, &program);
     7.5      data->glBindProgramARB(shader_type, program);
     7.6      data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB,
     7.7 -                             SDL_strlen(code), code);
     7.8 +                             (GLsizei)SDL_strlen(code), code);
     7.9  
    7.10      SDL_free(code);
    7.11  
     8.1 --- a/src/video/win32/SDL_win32events.c	Sat Sep 05 21:31:50 2009 +0000
     8.2 +++ b/src/video/win32/SDL_win32events.c	Sat Sep 05 23:37:35 2009 +0000
     8.3 @@ -141,7 +141,7 @@
     8.4              /* if we receive such data we need to update the pressure */
     8.5              SDL_VideoData *videodata = data->videodata;
     8.6              if (videodata->wintabDLL
     8.7 -                && videodata->WTPacket((HCTX) lParam, wParam, &packet)) {
     8.8 +                && videodata->WTPacket((HCTX) lParam, (UINT) wParam, &packet)) {
     8.9                  SDL_ChangeEnd(tablet, (int) packet.pkCursor);
    8.10                  pressure = (int) packet.pkNormalPressure;
    8.11              }
     9.1 --- a/src/video/win32/SDL_win32mouse.c	Sat Sep 05 21:31:50 2009 +0000
     9.2 +++ b/src/video/win32/SDL_win32mouse.c	Sat Sep 05 23:37:35 2009 +0000
     9.3 @@ -44,7 +44,7 @@
     9.4      RAWINPUTDEVICELIST *deviceList = NULL;
     9.5      int devCount = 0;
     9.6      int i;
     9.7 -    int tmp = 0;
     9.8 +    UINT tmp = 0;
     9.9      char *buffer = NULL;
    9.10      char *tab = "wacom";        /* since windows does't give us handles to tablets, we have to detect a tablet by it's name */
    9.11      const char *rdp = "rdp_mou";
    9.12 @@ -71,8 +71,8 @@
    9.13      /* we're getting the details of the devices */
    9.14      for (i = 0; i < devCount; ++i) {
    9.15          int is_rdp = 0;
    9.16 -        int j;
    9.17 -        int k;
    9.18 +        UINT j;
    9.19 +        UINT k;
    9.20          char *default_device_name = "Pointing device xx";
    9.21          const char *reg_key_root = "System\\CurrentControlSet\\Enum\\";
    9.22          char *device_name = SDL_malloc(256 * sizeof(char));
    9.23 @@ -83,7 +83,7 @@
    9.24          DWORD regtype = REG_SZ;
    9.25          DWORD out = 256 * sizeof(char);
    9.26          SDL_Mouse mouse;
    9.27 -        int l;
    9.28 +        size_t l;
    9.29          if (deviceList[i].dwType != RIM_TYPEMOUSE) {    /* if a device isn't a mouse type we don't want it */
    9.30              continue;
    9.31          }