From a4120ca66cc6c0f3a8056c6ea247c15f63c7feff Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 13 Apr 2016 19:29:16 -0400 Subject: file_util: Don't expose IOFile internals through the API --- src/common/file_util.cpp | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'src/common/file_util.cpp') diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 9ada09f8a..578c673b9 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -824,13 +824,12 @@ size_t WriteStringToFile(bool text_file, const std::string &str, const char *fil size_t ReadFileToString(bool text_file, const char *filename, std::string &str) { - FileUtil::IOFile file(filename, text_file ? "r" : "rb"); - auto const f = file.GetHandle(); + IOFile file(filename, text_file ? "r" : "rb"); - if (!f) + if (!file) return false; - str.resize(static_cast(GetSize(f))); + str.resize(static_cast(file.GetSize())); return file.ReadArray(&str[0], str.size()); } @@ -880,10 +879,6 @@ IOFile::IOFile() : m_file(nullptr), m_good(true) {} -IOFile::IOFile(std::FILE* file) - : m_file(file), m_good(true) -{} - IOFile::IOFile(const std::string& filename, const char openmode[]) : m_file(nullptr), m_good(true) { @@ -935,20 +930,6 @@ bool IOFile::Close() return m_good; } -std::FILE* IOFile::ReleaseHandle() -{ - std::FILE* const ret = m_file; - m_file = nullptr; - return ret; -} - -void IOFile::SetHandle(std::FILE* file) -{ - Close(); - Clear(); - m_file = file; -} - u64 IOFile::GetSize() { if (IsOpen()) -- cgit v1.2.3