From c971969a7352ee59d2477816afa506ff08e32497 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 9 May 2017 11:48:58 -0500 Subject: [PATCH] Fix FS read by type to read byte by byte --- deps/ox/src/ox/fs/filestore.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/fs/filestore.hpp b/deps/ox/src/ox/fs/filestore.hpp index f7193609..aaa380d4 100644 --- a/deps/ox/src/ox/fs/filestore.hpp +++ b/deps/ox/src/ox/fs/filestore.hpp @@ -647,9 +647,13 @@ int FileStore
::read(Inode *inode, typename Header::FsSize_t readStart, } readSize /= sizeof(T); - T *it = (T*) &(inode->getData()[readStart]); + uint8_t *it = &(inode->getData()[readStart]); for (typename Header::FsSize_t i = 0; i < readSize; i++) { - *(data++) = *(it++); + T val; + for (size_t i = 0; i < sizeof(T); i++) { + ((uint8_t*) (&val))[i] = *(it++); + } + *(data++) = val; } return 0; }