summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/FileHandlerARC.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-03-14 21:27:28 -0400
committerLioncash <mathew1800@gmail.com>2014-03-15 02:14:49 -0400
commitf325fc9634350f63faa7b04893805ada8d3f8816 (patch)
treeb324d2dc6c5fcbf1a16f95d920b3de3e2d04de6f /Source/Core/DiscIO/FileHandlerARC.cpp
parent63a09b76f9b7b60b8eafcef6e5cbe3725e8ec42d (diff)
Clean up FileHandlerARC.cpp/.h
- Removed parentheses from the returns. - Put the function declaration headers back on a single line. - Make FindFileInfo's parameter a const string reference.
Diffstat (limited to 'Source/Core/DiscIO/FileHandlerARC.cpp')
-rw-r--r--Source/Core/DiscIO/FileHandlerARC.cpp54
1 files changed, 23 insertions, 31 deletions
diff --git a/Source/Core/DiscIO/FileHandlerARC.cpp b/Source/Core/DiscIO/FileHandlerARC.cpp
index ee24158053..960ecaf07d 100644
--- a/Source/Core/DiscIO/FileHandlerARC.cpp
+++ b/Source/Core/DiscIO/FileHandlerARC.cpp
@@ -69,70 +69,66 @@ CARCFile::~CARCFile()
}
-bool
-CARCFile::IsInitialized()
+bool CARCFile::IsInitialized()
{
- return(m_Initialized);
+ return m_Initialized;
}
-size_t
-CARCFile::GetFileSize(const std::string& _rFullPath)
+size_t CARCFile::GetFileSize(const std::string& _rFullPath)
{
if (!m_Initialized)
{
- return(0);
+ return 0;
}
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
if (pFileInfo != nullptr)
{
- return((size_t) pFileInfo->m_FileSize);
+ return (size_t) pFileInfo->m_FileSize;
}
- return(0);
+ return 0;
}
-size_t
-CARCFile::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)
+size_t CARCFile::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)
{
if (!m_Initialized)
{
- return(0);
+ return 0;
}
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
if (pFileInfo == nullptr)
{
- return(0);
+ return 0;
}
if (pFileInfo->m_FileSize > _MaxBufferSize)
{
- return(0);
+ return 0;
}
memcpy(_pBuffer, &m_pBuffer[pFileInfo->m_Offset], (size_t)pFileInfo->m_FileSize);
- return((size_t) pFileInfo->m_FileSize);
+ return (size_t) pFileInfo->m_FileSize;
}
-bool
-CARCFile::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
+bool CARCFile::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
{
if (!m_Initialized)
{
- return(false);
+ return false;
}
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
if (pFileInfo == nullptr)
{
- return(false);
+ return false;
}
File::IOFile pFile(_rExportFilename, "wb");
@@ -141,15 +137,13 @@ CARCFile::ExportFile(const std::string& _rFullPath, const std::string& _rExportF
}
-bool
-CARCFile::ExportAllFiles(const std::string& _rFullPath)
+bool CARCFile::ExportAllFiles(const std::string& _rFullPath)
{
- return(false);
+ return false;
}
-bool
-CARCFile::ParseBuffer()
+bool CARCFile::ParseBuffer()
{
// check ID
u32 ID = Common::swap32(*(u32*)(m_pBuffer));
@@ -186,12 +180,11 @@ CARCFile::ParseBuffer()
BuildFilenames(1, m_FileInfoVector.size(), nullptr, szNameTable);
}
- return(true);
+ return true;
}
-size_t
-CARCFile::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable)
+size_t CARCFile::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable)
{
size_t CurrentIndex = _FirstIndex;
@@ -231,21 +224,20 @@ CARCFile::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, cons
}
}
- return(CurrentIndex);
+ return CurrentIndex;
}
-const SFileInfo*
-CARCFile::FindFileInfo(std::string _rFullPath) const
+const SFileInfo* CARCFile::FindFileInfo(const std::string& _rFullPath) const
{
for (auto& fileInfo : m_FileInfoVector)
{
if (!strcasecmp(fileInfo.m_FullPath, _rFullPath.c_str()))
{
- return(&fileInfo);
+ return &fileInfo;
}
}
- return(nullptr);
+ return nullptr;
}
} // namespace