From f132916a0fb3487974a952f41227ab4978d68388 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Thu, 20 Feb 2014 22:27:42 +0100 Subject: [PATCH] Typo fix and ctor params reordering. --- src/physicsfswrapper.cpp | 26 +++++++++++++------------- src/physicsfswrapper.hpp | 8 +++++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/physicsfswrapper.cpp b/src/physicsfswrapper.cpp index eca7a79..69fc332 100644 --- a/src/physicsfswrapper.cpp +++ b/src/physicsfswrapper.cpp @@ -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(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(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(m_handle), parBuff, parSize, parCount); } ///------------------------------------------------------------------------- ///------------------------------------------------------------------------- - bool PhysycsFSFile::IsEof() const noexcept { + bool PhysicsFSFile::IsEof() const noexcept { return PHYSFS_eof(static_cast(const_cast(m_handle))); } ///------------------------------------------------------------------------- ///------------------------------------------------------------------------- - int64_t PhysycsFSFile::Tell() const { + int64_t PhysicsFSFile::Tell() const { return PHYSFS_tell(static_cast(const_cast(m_handle))); } ///------------------------------------------------------------------------- ///------------------------------------------------------------------------- - int PhysycsFSFile::Seek (uint64_t parPos) { + int PhysicsFSFile::Seek (uint64_t parPos) { return PHYSFS_seek(static_cast(m_handle), parPos); } ///------------------------------------------------------------------------- ///------------------------------------------------------------------------- - void PhysycsFSFile::Flush() noexcept { + void PhysicsFSFile::Flush() noexcept { PHYSFS_flush(static_cast(m_handle)); } } //namespace cloonel diff --git a/src/physicsfswrapper.hpp b/src/physicsfswrapper.hpp index 9ae766f..c8d5ed0 100644 --- a/src/physicsfswrapper.hpp +++ b/src/physicsfswrapper.hpp @@ -3,6 +3,8 @@ #include +#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 );