summaryrefslogtreecommitdiff
path: root/src/utils/physfsrwops.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-21 21:18:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-24 21:08:15 +0300
commita3082da9c7296bb18b7a6bc0424eb2a19d485ff6 (patch)
treecd07d091f69f5a3000aaddcbc8911d472b9137e7 /src/utils/physfsrwops.cpp
parent84189722a64c0794fbd918b4e6412908be2b7394 (diff)
downloadmv-a3082da9c7296bb18b7a6bc0424eb2a19d485ff6.tar.gz
mv-a3082da9c7296bb18b7a6bc0424eb2a19d485ff6.tar.bz2
mv-a3082da9c7296bb18b7a6bc0424eb2a19d485ff6.tar.xz
mv-a3082da9c7296bb18b7a6bc0424eb2a19d485ff6.zip
second part with compilation fixes for SDL2.
Diffstat (limited to 'src/utils/physfsrwops.cpp')
-rw-r--r--src/utils/physfsrwops.cpp26
1 files changed, 18 insertions, 8 deletions
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<PHYSFS_file *const>(
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<int>(len);
+ pos = static_cast<PHYSFSINT>(len);
if (static_cast<PHYSFS_sint64>(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<PHYSFS_file *const>(
rw->hidden.unknown.data1);
@@ -115,8 +124,9 @@ static int physfsrwops_read(SDL_RWops *const rw, void *ptr,
return static_cast<int>(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<PHYSFS_file *const>(
rw->hidden.unknown.data1);