From 195df6d0e87cfb553b89f6df717b5a43ec594835 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 12 Jan 2024 03:09:49 +0100 Subject: [PATCH] FileSystem: fix bug in tools implementation Should read element count of bytes instead of element count of file size, else this always returns 1 instead of the actual number of bytes read/written. --- r5dev/filesystem/filesystem_std.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r5dev/filesystem/filesystem_std.cpp b/r5dev/filesystem/filesystem_std.cpp index f7229605..67eda9b6 100644 --- a/r5dev/filesystem/filesystem_std.cpp +++ b/r5dev/filesystem/filesystem_std.cpp @@ -8,12 +8,12 @@ ssize_t CBaseFileSystem::Read(void* pOutput, ssize_t size, FileHandle_t file) { - return fread(pOutput, size, 1, (FILE*)file); + return fread(pOutput, sizeof(uint8_t), size, (FILE*)file); } ssize_t CBaseFileSystem::Write(void const* pInput, ssize_t size, FileHandle_t file) { - return fwrite(pInput, size, 1, (FILE*)file); + return fwrite(pInput, sizeof(uint8_t), size, (FILE*)file); } FileHandle_t CBaseFileSystem::Open(const char* pFileName, const char* pOptions, const char* pPathID, int64_t unknown) @@ -295,7 +295,7 @@ ssize_t CBaseFileSystem::ReadEx(void* pOutput, ssize_t /*destSize*/, ssize_t siz return 0; } - const ssize_t nRet = fread(pOutput, 1, size, (FILE*)file); + const ssize_t nRet = fread(pOutput, sizeof(uint8_t), size, (FILE*)file); return nRet; }