Typo fix and ctor params reordering.
This commit is contained in:
parent
c9a99f7e99
commit
f132916a0f
2 changed files with 18 additions and 16 deletions
|
@ -9,13 +9,13 @@ namespace cloonel {
|
|||
namespace {
|
||||
///---------------------------------------------------------------------
|
||||
///---------------------------------------------------------------------
|
||||
PHYSFS_File* OpenPhysFSFile (const char* parPath, PhysycsFSFile::OpenMode parMode) {
|
||||
PHYSFS_File* OpenPhysFSFile (const char* parPath, PhysicsFSFile::OpenMode parMode) {
|
||||
switch (parMode) {
|
||||
case PhysycsFSFile::OpenMode_Read:
|
||||
case PhysicsFSFile::OpenMode_Read:
|
||||
return PHYSFS_openRead(parPath);
|
||||
case PhysycsFSFile::OpenMode_Write:
|
||||
case PhysicsFSFile::OpenMode_Write:
|
||||
return PHYSFS_openWrite(parPath);
|
||||
case PhysycsFSFile::OpenMode_Append:
|
||||
case PhysicsFSFile::OpenMode_Append:
|
||||
return PHYSFS_openAppend(parPath);
|
||||
default:
|
||||
return nullptr;
|
||||
|
@ -59,7 +59,7 @@ namespace cloonel {
|
|||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
PhysycsFSFile::PhysycsFSFile (const char* parPath, OpenMode parMode, bool parBuffered, const char* parDescCategory) :
|
||||
PhysicsFSFile::PhysicsFSFile (const char* parPath, OpenMode parMode, const char* parDescCategory, bool parBuffered) :
|
||||
m_handle(OpenPhysFSFile(parPath, parMode))
|
||||
{
|
||||
if (not m_handle) {
|
||||
|
@ -78,7 +78,7 @@ namespace cloonel {
|
|||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
PhysycsFSFile::~PhysycsFSFile() noexcept {
|
||||
PhysicsFSFile::~PhysicsFSFile() noexcept {
|
||||
if (IsOpen()) {
|
||||
PHYSFS_close(static_cast<PHYSFS_File*>(m_handle));
|
||||
}
|
||||
|
@ -86,43 +86,43 @@ namespace cloonel {
|
|||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
bool PhysycsFSFile::IsOpen() const noexcept {
|
||||
bool PhysicsFSFile::IsOpen() const noexcept {
|
||||
return (m_handle != nullptr);
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
int64_t PhysycsFSFile::Read (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||
int64_t PhysicsFSFile::Read (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||
return PHYSFS_read(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
int64_t PhysycsFSFile::Write (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||
int64_t PhysicsFSFile::Write (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||
return PHYSFS_write(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
bool PhysycsFSFile::IsEof() const noexcept {
|
||||
bool PhysicsFSFile::IsEof() const noexcept {
|
||||
return PHYSFS_eof(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
int64_t PhysycsFSFile::Tell() const {
|
||||
int64_t PhysicsFSFile::Tell() const {
|
||||
return PHYSFS_tell(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
int PhysycsFSFile::Seek (uint64_t parPos) {
|
||||
int PhysicsFSFile::Seek (uint64_t parPos) {
|
||||
return PHYSFS_seek(static_cast<PHYSFS_File*>(m_handle), parPos);
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
void PhysycsFSFile::Flush() noexcept {
|
||||
void PhysicsFSFile::Flush() noexcept {
|
||||
PHYSFS_flush(static_cast<PHYSFS_File*>(m_handle));
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#define DEF_PHYSICSFS_BUFFERED true
|
||||
|
||||
namespace cloonel {
|
||||
class PhysicsFSWrapper {
|
||||
public:
|
||||
|
@ -12,7 +14,7 @@ namespace cloonel {
|
|||
void Append ( const char* parRelativePath, const char* parMountPoint );
|
||||
};
|
||||
|
||||
class PhysycsFSFile {
|
||||
class PhysicsFSFile {
|
||||
public:
|
||||
enum OpenMode {
|
||||
OpenMode_Read,
|
||||
|
@ -20,8 +22,8 @@ namespace cloonel {
|
|||
OpenMode_Append
|
||||
};
|
||||
|
||||
PhysycsFSFile ( const char* parPath, OpenMode parMode, bool parBuffered, const char* parDescCategory );
|
||||
~PhysycsFSFile ( void ) noexcept;
|
||||
PhysicsFSFile ( const char* parPath, OpenMode parMode, const char* parDescCategory, bool parBuffered = DEF_PHYSICSFS_BUFFERED );
|
||||
~PhysicsFSFile ( void ) noexcept;
|
||||
|
||||
bool IsOpen ( void ) const noexcept;
|
||||
int64_t Read ( void* parBuff, uint32_t parSize, uint32_t parCount );
|
||||
|
|
Loading…
Reference in a new issue