From 58d8bc86c57a54d0f93452490b920d5f4f63e589 Mon Sep 17 00:00:00 2001 From: adrian17 Date: Sat, 28 Sep 2013 23:05:36 +0200 Subject: [PATCH] Removed two functions as they are also in Native/file. Also, removed TabsToSpaces() from the header as it no longer exists. --- Common/FileUtil.cpp | 29 ----------------------------- Common/FileUtil.h | 3 --- Common/StringUtils.h | 2 -- headless/Compare.cpp | 4 ++-- 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index 6bcf21d3d4..cba169bd8d 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -715,35 +715,6 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath) return paths[DirIDX]; } -bool WriteStringToFile(bool text_file, const std::string &str, const char *filename) -{ - FILE *f = OpenCFile(filename, text_file ? "w" : "wb"); - if (!f) - return false; - size_t len = str.size(); - if (len != fwrite(str.data(), 1, str.size(), f)) // TODO: string::data() may not be contiguous - { - fclose(f); - return false; - } - fclose(f); - return true; -} - -bool ReadFileToString(bool text_file, const char *filename, std::string &str) -{ - FILE *f = OpenCFile(filename, text_file ? "r" : "rb"); - if (!f) - return false; - size_t len = (size_t)GetSize(f); - char *buf = new char[len + 1]; - buf[fread(buf, 1, len, f)] = 0; - str = std::string(buf, len); - fclose(f); - delete [] buf; - return true; -} - IOFile::IOFile() : m_file(NULL), m_good(true) {} diff --git a/Common/FileUtil.h b/Common/FileUtil.h index 7ab2d010cc..a3306588fc 100644 --- a/Common/FileUtil.h +++ b/Common/FileUtil.h @@ -128,9 +128,6 @@ std::string GetBundleDirectory(); std::string &GetExeDirectory(); #endif -bool WriteStringToFile(bool text_file, const std::string &str, const char *filename); -bool ReadFileToString(bool text_file, const char *filename, std::string &str); - // simple wrapper for cstdlib file functions to // hopefully will make error checking easier // and make forgetting an fclose() harder diff --git a/Common/StringUtils.h b/Common/StringUtils.h index d9ef8d44b4..40267ed996 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -52,8 +52,6 @@ std::string ThousandSeparate(I value, int spaces = 0) return oss.str(); } -std::string TabsToSpaces(int tab_size, const std::string &in); - // "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe" bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension); diff --git a/headless/Compare.cpp b/headless/Compare.cpp index fa69f70415..c5f1710f4e 100644 --- a/headless/Compare.cpp +++ b/headless/Compare.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "headless/Compare.h" -#include "Common/FileUtil.h" +#include "file/file_util.h" #include "Core/Host.h" #include @@ -250,7 +250,7 @@ bool CompareOutput(const std::string &bootFilename, const std::string &output, b printf("%s", output.c_str()); printf("============== expected output:\n"); std::string fullExpected; - if (File::ReadFileToString(true, expect_filename.c_str(), fullExpected)) + if (readFileToString(true, expect_filename.c_str(), fullExpected)) printf("%s", fullExpected.c_str()); printf("===============================\n"); }