From: Florian Forster Date: Thu, 14 Jan 2010 17:40:45 +0000 (+0100) Subject: src/physfs/physfs_sdl.cpp: Add SDL 1.3 compatibility code. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=59f8db0e91a23a90aef922b92c2d6143290de523;p=supertux.git src/physfs/physfs_sdl.cpp: Add SDL 1.3 compatibility code. --- diff --git a/src/physfs/physfs_sdl.cpp b/src/physfs/physfs_sdl.cpp index 82c786997..2ad5b36ac 100644 --- a/src/physfs/physfs_sdl.cpp +++ b/src/physfs/physfs_sdl.cpp @@ -23,10 +23,19 @@ #include "util/log.hpp" -static int funcSeek(struct SDL_RWops* context, int offset, int whence) +#if SDL_VERSION_ATLEAST(1,3,0) +typedef size_t st_read_t; +typedef long st_seek_t; +#else +typedef int st_read_t; +typedef int st_seek_t; +#endif + +static st_seek_t funcSeek(struct SDL_RWops* context, + st_seek_t offset, int whence) { PHYSFS_file* file = (PHYSFS_file*) context->hidden.unknown.data1; - int res; + st_seek_t res; switch(whence) { case SEEK_SET: res = PHYSFS_seek(file, offset); @@ -47,14 +56,15 @@ static int funcSeek(struct SDL_RWops* context, int offset, int whence) return -1; } - return (int) PHYSFS_tell(file); + return (st_seek_t) PHYSFS_tell(file); } -static int funcRead(struct SDL_RWops* context, void* ptr, int size, int maxnum) +static st_read_t funcRead(struct SDL_RWops* context, void* ptr, + st_read_t size, st_read_t maxnum) { PHYSFS_file* file = (PHYSFS_file*) context->hidden.unknown.data1; - int res = PHYSFS_read(file, ptr, size, maxnum); + st_read_t res = PHYSFS_read(file, ptr, size, maxnum); return res; }