diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-05-28 17:45:36 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-05-29 07:06:53 -0400 |
| commit | eb475025b85686f4793bb83bac377033c17fbd2d (patch) | |
| tree | 3a5c8e36cab1dae1e4e36ef243d44f540f2c55f1 /Source/Core | |
| parent | 992c8bfc4e2394ad5786f5116f5e62ae595b5c44 (diff) | |
Common/FileUtil: Make WriteStringToFile consistent with ReadFileToString
Makes the parameter ordering consistent and less error-prone.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Common/FileUtil.h | 2 | ||||
| -rw-r--r-- | Source/Core/Core/DSP/DSPCodeUtil.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/UICommon/GameFile.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/UpdaterCommon/UpdaterCommon.cpp | 6 |
5 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 7030c9dc25..826d430b62 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -887,7 +887,7 @@ std::string GetThemeDir(const std::string& theme_name) return GetSysDirectory() + THEMES_DIR "/" DEFAULT_THEME_DIR "/"; } -bool WriteStringToFile(const std::string& str, const std::string& filename) +bool WriteStringToFile(const std::string& filename, const std::string& str) { return File::IOFile(filename, "wb").WriteBytes(str.data(), str.size()); } diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 71e9709da3..cccb28e218 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -198,7 +198,7 @@ std::string GetBundleDirectory(); std::string GetExePath(); std::string GetExeDirectory(); -bool WriteStringToFile(const std::string& str, const std::string& filename); +bool WriteStringToFile(const std::string& filename, const std::string& str); bool ReadFileToString(const std::string& filename, std::string& str); // To deal with Windows being dumb at unicode: diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp index ed2c38d9e3..d71da68c14 100644 --- a/Source/Core/Core/DSP/DSPCodeUtil.cpp +++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp @@ -141,7 +141,7 @@ bool SaveBinary(const std::vector<u16>& code, const std::string& filename) { const std::string buffer = CodeToBinaryStringBE(code); - return File::WriteStringToFile(buffer, filename); + return File::WriteStringToFile(filename, buffer); } bool DumpDSPCode(const u8* code_be, int size_in_bytes, u32 crc) @@ -166,7 +166,7 @@ bool DumpDSPCode(const u8* code_be, int size_in_bytes, u32 crc) if (!Disassemble(code, true, text)) return false; - return File::WriteStringToFile(text, text_file); + return File::WriteStringToFile(text_file, text); } } // namespace DSP diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp index 4e5ad6f9c2..fb8c3d0a67 100644 --- a/Source/Core/UICommon/GameFile.cpp +++ b/Source/Core/UICommon/GameFile.cpp @@ -265,7 +265,7 @@ void GameFile::DownloadDefaultCover() if (!response) return; - File::WriteStringToFile(std::string(response->begin(), response->end()), png_path); + File::WriteStringToFile(png_path, std::string(response->begin(), response->end())); } bool GameFile::DefaultCoverChanged() diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp index 77fb317040..9ec2c79edb 100644 --- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp +++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp @@ -255,7 +255,7 @@ bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download, std::optional<std::string> maybe_decompressed = GzipInflate(contents); if (!maybe_decompressed) return false; - std::string decompressed = std::move(*maybe_decompressed); + const std::string decompressed = std::move(*maybe_decompressed); // Check that the downloaded contents have the right hash. Manifest::Hash contents_hash = ComputeHash(decompressed); @@ -265,8 +265,8 @@ bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download, return false; } - std::string out = temp_path + DIR_SEP + hash_filename; - if (!File::WriteStringToFile(decompressed, out)) + const std::string out = temp_path + DIR_SEP + hash_filename; + if (!File::WriteStringToFile(out, decompressed)) { fprintf(log_fp, "Could not write cache file %s.\n", out.c_str()); return false; |
