summaryrefslogtreecommitdiff
path: root/src/utils/physfsrwops.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-04 19:11:53 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-04 19:11:53 +0300
commit3a407bb6b73a186eafd99bcec570f88097c4b2e1 (patch)
treeea57a752c348ba0a883294855ad3c62c16e9749d /src/utils/physfsrwops.cpp
parent872fc368f7b253f26714fc47323064f270b62b40 (diff)
downloadmv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.gz
mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.bz2
mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.xz
mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.zip
Add const to more classes.
Diffstat (limited to 'src/utils/physfsrwops.cpp')
-rw-r--r--src/utils/physfsrwops.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp
index 1afedf2a3..95ba7db82 100644
--- a/src/utils/physfsrwops.cpp
+++ b/src/utils/physfsrwops.cpp
@@ -32,7 +32,8 @@
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
{
- PHYSFS_file *handle = static_cast<PHYSFS_file *>(rw->hidden.unknown.data1);
+ PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
+ rw->hidden.unknown.data1);
int pos = 0;
if (whence == SEEK_SET)
@@ -41,7 +42,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
} /* if */
else if (whence == SEEK_CUR)
{
- PHYSFS_sint64 current = PHYSFS_tell(handle);
+ const PHYSFS_sint64 current = PHYSFS_tell(handle);
if (current == -1)
{
SDL_SetError("Can't find position in file: %s",
@@ -63,7 +64,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
} /* else if */
else if (whence == SEEK_END)
{
- PHYSFS_sint64 len = PHYSFS_fileLength(handle);
+ const PHYSFS_sint64 len = PHYSFS_fileLength(handle);
if (len == -1)
{
SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
@@ -102,8 +103,9 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
{
- PHYSFS_file *handle = static_cast<PHYSFS_file*>(rw->hidden.unknown.data1);
- PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
+ PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
+ rw->hidden.unknown.data1);
+ const PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
{
if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
@@ -115,8 +117,9 @@ static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
{
- PHYSFS_file *handle = static_cast<PHYSFS_file*>(rw->hidden.unknown.data1);
- PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
+ PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
+ rw->hidden.unknown.data1);
+ const PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());