summaryrefslogtreecommitdiff
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
authorGravatar fearlessTobi2018-09-15 15:21:06 +0200
committerGravatar fearlessTobi2018-09-15 15:21:06 +0200
commit63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch)
tree8a90e8ef2804f147dff7225a543a8740ecf7160c /src/common/file_util.cpp
parentMerge pull request #1310 from lioncash/kernel-ns (diff)
downloadyuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz
yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz
yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip
Port #4182 from Citra: "Prefix all size_t with std::"
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r--src/common/file_util.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index baa721481..21a0b9738 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -76,7 +76,7 @@ namespace FileUtil {
76// Modifies argument. 76// Modifies argument.
77static void StripTailDirSlashes(std::string& fname) { 77static void StripTailDirSlashes(std::string& fname) {
78 if (fname.length() > 1) { 78 if (fname.length() > 1) {
79 size_t i = fname.length(); 79 std::size_t i = fname.length();
80 while (i > 0 && fname[i - 1] == DIR_SEP_CHR) 80 while (i > 0 && fname[i - 1] == DIR_SEP_CHR)
81 --i; 81 --i;
82 fname.resize(i); 82 fname.resize(i);
@@ -201,7 +201,7 @@ bool CreateFullPath(const std::string& fullPath) {
201 return true; 201 return true;
202 } 202 }
203 203
204 size_t position = 0; 204 std::size_t position = 0;
205 while (true) { 205 while (true) {
206 // Find next sub path 206 // Find next sub path
207 position = fullPath.find(DIR_SEP_CHR, position); 207 position = fullPath.find(DIR_SEP_CHR, position);
@@ -299,7 +299,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
299 std::array<char, 1024> buffer; 299 std::array<char, 1024> buffer;
300 while (!feof(input.get())) { 300 while (!feof(input.get())) {
301 // read input 301 // read input
302 size_t rnum = fread(buffer.data(), sizeof(char), buffer.size(), input.get()); 302 std::size_t rnum = fread(buffer.data(), sizeof(char), buffer.size(), input.get());
303 if (rnum != buffer.size()) { 303 if (rnum != buffer.size()) {
304 if (ferror(input.get()) != 0) { 304 if (ferror(input.get()) != 0) {
305 LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}", 305 LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}",
@@ -309,7 +309,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
309 } 309 }
310 310
311 // write output 311 // write output
312 size_t wnum = fwrite(buffer.data(), sizeof(char), rnum, output.get()); 312 std::size_t wnum = fwrite(buffer.data(), sizeof(char), rnum, output.get());
313 if (wnum != rnum) { 313 if (wnum != rnum) {
314 LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename, 314 LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename,
315 destFilename, GetLastErrorMsg()); 315 destFilename, GetLastErrorMsg());
@@ -756,11 +756,11 @@ std::string GetNANDRegistrationDir(bool system) {
756 return GetUserPath(UserPath::NANDDir) + "user/Contents/registered/"; 756 return GetUserPath(UserPath::NANDDir) + "user/Contents/registered/";
757} 757}
758 758
759size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) { 759std::size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) {
760 return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size()); 760 return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
761} 761}
762 762
763size_t ReadFileToString(bool text_file, const char* filename, std::string& str) { 763std::size_t ReadFileToString(bool text_file, const char* filename, std::string& str) {
764 IOFile file(filename, text_file ? "r" : "rb"); 764 IOFile file(filename, text_file ? "r" : "rb");
765 765
766 if (!file.IsOpen()) 766 if (!file.IsOpen())
@@ -829,7 +829,7 @@ std::vector<std::string> SplitPathComponents(std::string_view filename) {
829std::string_view GetParentPath(std::string_view path) { 829std::string_view GetParentPath(std::string_view path) {
830 const auto name_bck_index = path.rfind('\\'); 830 const auto name_bck_index = path.rfind('\\');
831 const auto name_fwd_index = path.rfind('/'); 831 const auto name_fwd_index = path.rfind('/');
832 size_t name_index; 832 std::size_t name_index;
833 833
834 if (name_bck_index == std::string_view::npos || name_fwd_index == std::string_view::npos) { 834 if (name_bck_index == std::string_view::npos || name_fwd_index == std::string_view::npos) {
835 name_index = std::min(name_bck_index, name_fwd_index); 835 name_index = std::min(name_bck_index, name_fwd_index);
@@ -868,7 +868,7 @@ std::string_view GetFilename(std::string_view path) {
868} 868}
869 869
870std::string_view GetExtensionFromFilename(std::string_view name) { 870std::string_view GetExtensionFromFilename(std::string_view name) {
871 const size_t index = name.rfind('.'); 871 const std::size_t index = name.rfind('.');
872 872
873 if (index == std::string_view::npos) { 873 if (index == std::string_view::npos) {
874 return {}; 874 return {};