Make file system type read byte by byte

The GBA (and other platforms?) seems to have possible alignment issues
with reading from ROM when it's not byte by byte.
This commit is contained in:
Gary Talent 2017-05-07 21:26:22 -05:00
parent a243a38d4d
commit c4da8394d2

View File

@ -647,9 +647,14 @@ int FileStore<Header>::read(Inode *inode, typename Header::FsSize_t readStart,
} }
readSize /= sizeof(T); 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++) { for (typename Header::FsSize_t i = 0; i < readSize; i++) {
*(data++) = *(it++); T val;
ox_memset(&val, 0, sizeof(T));
for (size_t i = 0; i < sizeof(T); i++) {
((uint8_t*) (&val))[i] = *(it++);
}
*(data++) = val;
} }
return 0; return 0;
} }