From a3082da9c7296bb18b7a6bc0424eb2a19d485ff6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Aug 2013 21:18:02 +0300 Subject: second part with compilation fixes for SDL2. --- src/utils/physfsrwops.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/utils') diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index ae334bfe4..62330f33a 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -28,12 +28,20 @@ #include "debug.h" -static int physfsrwops_seek(SDL_RWops *const rw, const int offset, - const int whence) +#ifdef USE_SDL2 +#define PHYSFSINT int64_t +#define PHYSFSSIZE size_t +#else +#define PHYSFSINT int32_t +#define PHYSFSSIZE int +#endif + +static PHYSFSINT physfsrwops_seek(SDL_RWops *const rw, const PHYSFSINT offset, + const int whence) { PHYSFS_file *const handle = static_cast( rw->hidden.unknown.data1); - int pos = 0; + PHYSFSINT pos = 0; if (whence == SEEK_SET) { @@ -70,7 +78,7 @@ static int physfsrwops_seek(SDL_RWops *const rw, const int offset, return -1; } /* if */ - pos = static_cast(len); + pos = static_cast(len); if (static_cast(pos) != len) { SDL_SetError("Can't fit end-of-file position in an int!"); @@ -100,8 +108,9 @@ static int physfsrwops_seek(SDL_RWops *const rw, const int offset, return pos; } /* physfsrwops_seek */ -static int physfsrwops_read(SDL_RWops *const rw, void *ptr, - const int size, const int maxnum) +static PHYSFSSIZE physfsrwops_read(SDL_RWops *const rw, void *ptr, + const PHYSFSSIZE size, + const PHYSFSSIZE maxnum) { PHYSFS_file *const handle = static_cast( rw->hidden.unknown.data1); @@ -115,8 +124,9 @@ static int physfsrwops_read(SDL_RWops *const rw, void *ptr, return static_cast(rc); } /* physfsrwops_read */ -static int physfsrwops_write(SDL_RWops *const rw, const void *ptr, - const int size, const int num) +static PHYSFSSIZE physfsrwops_write(SDL_RWops *const rw, const void *ptr, + const PHYSFSSIZE size, + const PHYSFSSIZE num) { PHYSFS_file *const handle = static_cast( rw->hidden.unknown.data1); -- cgit v1.2.3-70-g09d2