summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-18 16:44:23 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-18 16:44:23 +0300
commitc6c19ae251b6004a0972a0e5cc1750b79abaeb4a (patch)
tree921f7a1a952195b40233f8d552f27fb745f8cffe /src/utils
parent4bfeee3b4b6c2f58c0231fd5fe7e4c7c6042dc91 (diff)
downloadplus-c6c19ae251b6004a0972a0e5cc1750b79abaeb4a.tar.gz
plus-c6c19ae251b6004a0972a0e5cc1750b79abaeb4a.tar.bz2
plus-c6c19ae251b6004a0972a0e5cc1750b79abaeb4a.tar.xz
plus-c6c19ae251b6004a0972a0e5cc1750b79abaeb4a.zip
improve physfsrwops file.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/physfsrwops.cpp25
-rw-r--r--src/utils/physfsrwops.h8
2 files changed, 18 insertions, 15 deletions
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp
index 36729401a..ae334bfe4 100644
--- a/src/utils/physfsrwops.cpp
+++ b/src/utils/physfsrwops.cpp
@@ -28,7 +28,8 @@
#include "debug.h"
-static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
+static int physfsrwops_seek(SDL_RWops *const rw, const int offset,
+ const int whence)
{
PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
rw->hidden.unknown.data1);
@@ -84,7 +85,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
return -1;
} /* else */
- if ( pos < 0 )
+ if (pos < 0)
{
SDL_SetError("Attempt to seek past start of file.");
return -1;
@@ -99,7 +100,8 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
return pos;
} /* physfsrwops_seek */
-static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
+static int physfsrwops_read(SDL_RWops *const rw, void *ptr,
+ const int size, const int maxnum)
{
PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
rw->hidden.unknown.data1);
@@ -113,7 +115,8 @@ static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
return static_cast<int>(rc);
} /* physfsrwops_read */
-static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
+static int physfsrwops_write(SDL_RWops *const rw, const void *ptr,
+ const int size, const int num)
{
PHYSFS_file *const handle = static_cast<PHYSFS_file *const>(
rw->hidden.unknown.data1);
@@ -124,7 +127,7 @@ static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
return static_cast<int>(rc);
} /* physfsrwops_write */
-static int physfsrwops_close(SDL_RWops *rw)
+static int physfsrwops_close(SDL_RWops *const rw)
{
PHYSFS_file *const handle = static_cast<PHYSFS_file*>(
rw->hidden.unknown.data1);
@@ -138,7 +141,7 @@ static int physfsrwops_close(SDL_RWops *rw)
return 0;
} /* physfsrwops_close */
-static SDL_RWops *create_rwops(PHYSFS_file *handle)
+static SDL_RWops *create_rwops(PHYSFS_file *const handle)
{
SDL_RWops *retval = nullptr;
@@ -162,7 +165,7 @@ static SDL_RWops *create_rwops(PHYSFS_file *handle)
return retval;
} /* create_rwops */
-SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
+SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *const handle)
{
SDL_RWops *retval = nullptr;
if (!handle)
@@ -174,7 +177,7 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
} /* PHYSFSRWOPS_makeRWops */
#ifdef __APPLE__
-static bool checkFilePath(const char *fname)
+static bool checkFilePath(const char *const fname)
{
if (!fname || !*fname)
return false;
@@ -184,7 +187,7 @@ static bool checkFilePath(const char *fname)
}
#endif
-SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
+SDL_RWops *PHYSFSRWOPS_openRead(const char *const fname)
{
#ifdef __APPLE__
if (!checkFilePath(fname))
@@ -193,7 +196,7 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
return create_rwops(PhysFs::openRead(fname));
} /* PHYSFSRWOPS_openRead */
-SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
+SDL_RWops *PHYSFSRWOPS_openWrite(const char *const fname)
{
#ifdef __APPLE__
if (!checkFilePath(fname))
@@ -202,7 +205,7 @@ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
return create_rwops(PhysFs::openWrite(fname));
} /* PHYSFSRWOPS_openWrite */
-SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname)
+SDL_RWops *PHYSFSRWOPS_openAppend(const char *const fname)
{
#ifdef __APPLE__
if (!checkFilePath(fname))
diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h
index 6faa52a0e..c7d85bd22 100644
--- a/src/utils/physfsrwops.h
+++ b/src/utils/physfsrwops.h
@@ -41,7 +41,7 @@
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) A_WARN_UNUSED;
+SDL_RWops *PHYSFSRWOPS_openRead(const char *const fname) A_WARN_UNUSED;
/**
* Open a platform-independent filename for writing, and make it accessible
@@ -53,7 +53,7 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) A_WARN_UNUSED;
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) A_WARN_UNUSED;
+SDL_RWops *PHYSFSRWOPS_openWrite(const char *const fname) A_WARN_UNUSED;
/**
* Open a platform-independent filename for appending, and make it accessible
@@ -65,7 +65,7 @@ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) A_WARN_UNUSED;
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) A_WARN_UNUSED;
+SDL_RWops *PHYSFSRWOPS_openAppend(const char *const fname) A_WARN_UNUSED;
/**
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
@@ -77,7 +77,7 @@ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) A_WARN_UNUSED;
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle) A_WARN_UNUSED;
+SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *const handle) A_WARN_UNUSED;
#endif /* include-once blocker */