diff options
| author | 2018-12-06 20:23:44 -0500 | |
|---|---|---|
| committer | 2018-12-27 00:16:55 -0500 | |
| commit | 4a6ba5807343b668861efbd8367e39640cafc9f4 (patch) | |
| tree | 147acc388b7b63cc8c85ddefa623dcd86464fedf /src | |
| parent | Merge pull request #1946 from lioncash/decl (diff) | |
| download | yuzu-4a6ba5807343b668861efbd8367e39640cafc9f4.tar.gz yuzu-4a6ba5807343b668861efbd8367e39640cafc9f4.tar.xz yuzu-4a6ba5807343b668861efbd8367e39640cafc9f4.zip | |
vfs: Add reinterpret_casts to WriteArray and Object
Allows these functions to compile when T is not u8.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/vfs.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index e5641b255..954094772 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h | |||
| @@ -150,7 +150,7 @@ public: | |||
| 150 | template <typename T> | 150 | template <typename T> |
| 151 | std::size_t WriteArray(const T* data, std::size_t number_elements, std::size_t offset = 0) { | 151 | std::size_t WriteArray(const T* data, std::size_t number_elements, std::size_t offset = 0) { |
| 152 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); | 152 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 153 | return Write(data, number_elements * sizeof(T), offset); | 153 | return Write(reinterpret_cast<const u8*>(data), number_elements * sizeof(T), offset); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | // Writes size bytes starting at memory location data to offset in file. | 156 | // Writes size bytes starting at memory location data to offset in file. |
| @@ -166,7 +166,7 @@ public: | |||
| 166 | template <typename T> | 166 | template <typename T> |
| 167 | std::size_t WriteObject(const T& data, std::size_t offset = 0) { | 167 | std::size_t WriteObject(const T& data, std::size_t offset = 0) { |
| 168 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); | 168 | static_assert(std::is_trivially_copyable_v<T>, "Data type must be trivially copyable."); |
| 169 | return Write(&data, sizeof(T), offset); | 169 | return Write(reinterpret_cast<const u8*>(&data), sizeof(T), offset); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | // Renames the file to name. Returns whether or not the operation was successsful. | 172 | // Renames the file to name. Returns whether or not the operation was successsful. |