From e267e107f51aa4ff7150d5bfbb75dc60f863b0d4 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sun, 6 Oct 2019 23:12:50 -0700 Subject: [PATCH] Alter sdluio function signatures based on SDL version. Fixes ARM build. --- sc2/src/libs/graphics/sdl/sdluio.c | 25 +++++++++++++++++++++---- sc2/src/libs/graphics/sdl/sdluio.h | 6 ++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/sc2/src/libs/graphics/sdl/sdluio.c b/sc2/src/libs/graphics/sdl/sdluio.c index 36330cefa..5e4554d02 100644 --- a/sc2/src/libs/graphics/sdl/sdluio.c +++ b/sc2/src/libs/graphics/sdl/sdluio.c @@ -61,9 +61,14 @@ sdluio_loadImage (uio_DirHandle *dir, const char *fileName) { return result; } - +#if SDL_MAJOR_VERSION == 1 int -sdluio_seek (SDL_RWops *context, int offset, int whence) { +sdluio_seek (SDL_RWops *context, int offset, int whence) +#else +Sint64 +sdluio_seek (SDL_RWops *context, Sint64 offset, int whence) +#endif +{ if (uio_fseek ((uio_Stream *) context->hidden.unknown.data1, offset, whence) == -1) { @@ -74,8 +79,14 @@ sdluio_seek (SDL_RWops *context, int offset, int whence) { return uio_ftell ((uio_Stream *) context->hidden.unknown.data1); } +#if SDL_MAJOR_VERSION == 1 int -sdluio_read (SDL_RWops *context, void *ptr, int size, int maxnum) { +sdluio_read (SDL_RWops *context, void *ptr, int size, int maxnum) +#else +size_t +sdluio_read (SDL_RWops *context, void *ptr, size_t size, size_t maxnum) +#endif +{ size_t numRead; numRead = uio_fread (ptr, (size_t) size, (size_t) maxnum, @@ -90,8 +101,14 @@ sdluio_read (SDL_RWops *context, void *ptr, int size, int maxnum) { return (int) numRead; } +#if SDL_MAJOR_VERSION == 1 int -sdluio_write (SDL_RWops *context, const void *ptr, int size, int num) { +sdluio_write (SDL_RWops *context, const void *ptr, int size, int num) +#else +size_t +sdluio_write (SDL_RWops *context, const void *ptr, size_t size, size_t num) +#endif +{ size_t numWritten; numWritten = uio_fwrite (ptr, (size_t) size, (size_t) num, diff --git a/sc2/src/libs/graphics/sdl/sdluio.h b/sc2/src/libs/graphics/sdl/sdluio.h index 86d76fc2c..0f8c70159 100644 --- a/sc2/src/libs/graphics/sdl/sdluio.h +++ b/sc2/src/libs/graphics/sdl/sdluio.h @@ -23,9 +23,15 @@ #include SDL_INCLUDE(SDL_rwops.h) SDL_Surface *sdluio_loadImage (uio_DirHandle *dir, const char *fileName); +#if SDL_MAJOR_VERSION == 1 int sdluio_seek (SDL_RWops *context, int offset, int whence); int sdluio_read (SDL_RWops *context, void *ptr, int size, int maxnum); int sdluio_write (SDL_RWops *context, const void *ptr, int size, int num); +#else +Sint64 sdlui_seek (SDL_RWops *context, Sint64 offset, int whence); +size_t sdlui_read (SDL_RWops *context, void *ptr, size_t size, size_t maxnum); +size_t sdlui_write (SDL_RWops *contex, const void *ptr, size_t size, size_t num); +#endif int sdluio_close (SDL_RWops *context);