From 4a6ba5807343b668861efbd8367e39640cafc9f4 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 6 Dec 2018 20:23:44 -0500 Subject: [PATCH] vfs: Add reinterpret_casts to WriteArray and Object Allows these functions to compile when T is not u8. --- src/core/file_sys/vfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index e5641b2554..9540947729 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h @@ -150,7 +150,7 @@ public: template std::size_t WriteArray(const T* data, std::size_t number_elements, std::size_t offset = 0) { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); - return Write(data, number_elements * sizeof(T), offset); + return Write(reinterpret_cast(data), number_elements * sizeof(T), offset); } // Writes size bytes starting at memory location data to offset in file. @@ -166,7 +166,7 @@ public: template std::size_t WriteObject(const T& data, std::size_t offset = 0) { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); - return Write(&data, sizeof(T), offset); + return Write(reinterpret_cast(&data), sizeof(T), offset); } // Renames the file to name. Returns whether or not the operation was successsful.