summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-07-13 20:43:34 -0300
committerGravatar Yuri Kunde Schlesner2015-07-13 21:10:12 -0300
commita1f08788d9626434c6f743b1cf2a9a4e59dbc741 (patch)
tree275321ce3675c38581e51a431cea63f67b7912cc
parentLoader: Remove unnecessary pointer indirection to IOFile (diff)
downloadyuzu-a1f08788d9626434c6f743b1cf2a9a4e59dbc741.tar.gz
yuzu-a1f08788d9626434c6f743b1cf2a9a4e59dbc741.tar.xz
yuzu-a1f08788d9626434c6f743b1cf2a9a4e59dbc741.zip
Archive: Correct a few incorrect types in function signatures
Buffer lengths should be size_t, and file offsets should be u64.
-rw-r--r--src/core/file_sys/disk_archive.cpp8
-rw-r--r--src/core/file_sys/disk_archive.h8
-rw-r--r--src/core/file_sys/file_backend.h8
-rw-r--r--src/core/file_sys/ivfc_archive.cpp10
-rw-r--r--src/core/file_sys/ivfc_archive.h8
-rw-r--r--src/core/hle/service/fs/archive.cpp2
6 files changed, 22 insertions, 22 deletions
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 85151a311..1096fd34d 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -105,12 +105,12 @@ bool DiskFile::Open() {
105 return true; 105 return true;
106} 106}
107 107
108size_t DiskFile::Read(const u64 offset, const u32 length, u8* buffer) const { 108size_t DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const {
109 file->Seek(offset, SEEK_SET); 109 file->Seek(offset, SEEK_SET);
110 return file->ReadBytes(buffer, length); 110 return file->ReadBytes(buffer, length);
111} 111}
112 112
113size_t DiskFile::Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const { 113size_t DiskFile::Write(const u64 offset, const size_t length, const bool flush, const u8* buffer) const {
114 file->Seek(offset, SEEK_SET); 114 file->Seek(offset, SEEK_SET);
115 size_t written = file->WriteBytes(buffer, length); 115 size_t written = file->WriteBytes(buffer, length);
116 if (flush) 116 if (flush)
@@ -118,8 +118,8 @@ size_t DiskFile::Write(const u64 offset, const u32 length, const u32 flush, cons
118 return written; 118 return written;
119} 119}
120 120
121size_t DiskFile::GetSize() const { 121u64 DiskFile::GetSize() const {
122 return static_cast<size_t>(file->GetSize()); 122 return file->GetSize();
123} 123}
124 124
125bool DiskFile::SetSize(const u64 size) const { 125bool DiskFile::SetSize(const u64 size) const {
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index 5cfcddf6c..c5da07508 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -55,10 +55,10 @@ public:
55 DiskFile(const DiskArchive& archive, const Path& path, const Mode mode); 55 DiskFile(const DiskArchive& archive, const Path& path, const Mode mode);
56 56
57 bool Open() override; 57 bool Open() override;
58 size_t Read(const u64 offset, const u32 length, u8* buffer) const override; 58 size_t Read(u64 offset, size_t length, u8* buffer) const override;
59 size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const override; 59 size_t Write(u64 offset, size_t length, bool flush, const u8* buffer) const override;
60 size_t GetSize() const override; 60 u64 GetSize() const override;
61 bool SetSize(const u64 size) const override; 61 bool SetSize(u64 size) const override;
62 bool Close() const override; 62 bool Close() const override;
63 63
64 void Flush() const override { 64 void Flush() const override {
diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h
index f5f72c722..df7165df3 100644
--- a/src/core/file_sys/file_backend.h
+++ b/src/core/file_sys/file_backend.h
@@ -31,7 +31,7 @@ public:
31 * @param buffer Buffer to read data into 31 * @param buffer Buffer to read data into
32 * @return Number of bytes read 32 * @return Number of bytes read
33 */ 33 */
34 virtual size_t Read(const u64 offset, const u32 length, u8* buffer) const = 0; 34 virtual size_t Read(u64 offset, size_t length, u8* buffer) const = 0;
35 35
36 /** 36 /**
37 * Write data to the file 37 * Write data to the file
@@ -41,20 +41,20 @@ public:
41 * @param buffer Buffer to read data from 41 * @param buffer Buffer to read data from
42 * @return Number of bytes written 42 * @return Number of bytes written
43 */ 43 */
44 virtual size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const = 0; 44 virtual size_t Write(u64 offset, size_t length, bool flush, const u8* buffer) const = 0;
45 45
46 /** 46 /**
47 * Get the size of the file in bytes 47 * Get the size of the file in bytes
48 * @return Size of the file in bytes 48 * @return Size of the file in bytes
49 */ 49 */
50 virtual size_t GetSize() const = 0; 50 virtual u64 GetSize() const = 0;
51 51
52 /** 52 /**
53 * Set the size of the file in bytes 53 * Set the size of the file in bytes
54 * @param size New size of the file 54 * @param size New size of the file
55 * @return true if successful 55 * @return true if successful
56 */ 56 */
57 virtual bool SetSize(const u64 size) const = 0; 57 virtual bool SetSize(u64 size) const = 0;
58 58
59 /** 59 /**
60 * Close the file 60 * Close the file
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp
index 2b88b1d5d..e16aa1491 100644
--- a/src/core/file_sys/ivfc_archive.cpp
+++ b/src/core/file_sys/ivfc_archive.cpp
@@ -61,21 +61,21 @@ std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) c
61 61
62//////////////////////////////////////////////////////////////////////////////////////////////////// 62////////////////////////////////////////////////////////////////////////////////////////////////////
63 63
64size_t IVFCFile::Read(const u64 offset, const u32 length, u8* buffer) const { 64size_t IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
65 LOG_TRACE(Service_FS, "called offset=%llu, length=%d", offset, length); 65 LOG_TRACE(Service_FS, "called offset=%llu, length=%d", offset, length);
66 romfs_file->Seek(data_offset + offset, SEEK_SET); 66 romfs_file->Seek(data_offset + offset, SEEK_SET);
67 u32 read_length = (u32)std::min((u64)length, data_size - offset); 67 size_t read_length = (size_t)std::min((u64)length, data_size - offset);
68 68
69 return romfs_file->ReadBytes(buffer, read_length); 69 return romfs_file->ReadBytes(buffer, read_length);
70} 70}
71 71
72size_t IVFCFile::Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const { 72size_t IVFCFile::Write(const u64 offset, const size_t length, const bool flush, const u8* buffer) const {
73 LOG_ERROR(Service_FS, "Attempted to write to IVFC file"); 73 LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
74 return 0; 74 return 0;
75} 75}
76 76
77size_t IVFCFile::GetSize() const { 77u64 IVFCFile::GetSize() const {
78 return data_size; // TODO: return value will overflow on 32-bit machines 78 return data_size;
79} 79}
80 80
81bool IVFCFile::SetSize(const u64 size) const { 81bool IVFCFile::SetSize(const u64 size) const {
diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h
index c25666223..c15a6c4ae 100644
--- a/src/core/file_sys/ivfc_archive.h
+++ b/src/core/file_sys/ivfc_archive.h
@@ -55,10 +55,10 @@ public:
55 : romfs_file(file), data_offset(offset), data_size(size) {} 55 : romfs_file(file), data_offset(offset), data_size(size) {}
56 56
57 bool Open() override { return true; } 57 bool Open() override { return true; }
58 size_t Read(const u64 offset, const u32 length, u8* buffer) const override; 58 size_t Read(u64 offset, size_t length, u8* buffer) const override;
59 size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const override; 59 size_t Write(u64 offset, size_t length, bool flush, const u8* buffer) const override;
60 size_t GetSize() const override; 60 u64 GetSize() const override;
61 bool SetSize(const u64 size) const override; 61 bool SetSize(u64 size) const override;
62 bool Close() const override { return false; } 62 bool Close() const override { return false; }
63 void Flush() const override { } 63 void Flush() const override { }
64 64
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index ba272f05f..6c0df67c3 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -116,7 +116,7 @@ ResultVal<bool> File::SyncRequest() {
116 u32 address = cmd_buff[6]; 116 u32 address = cmd_buff[6];
117 LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", 117 LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
118 GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush); 118 GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
119 cmd_buff[2] = static_cast<u32>(backend->Write(offset, length, flush, Memory::GetPointer(address))); 119 cmd_buff[2] = static_cast<u32>(backend->Write(offset, length, flush != 0, Memory::GetPointer(address)));
120 break; 120 break;
121 } 121 }
122 122