diff --git a/src/ox/fs/filestore.hpp b/src/ox/fs/filestore.hpp index 6176ab42d..928e8b0a5 100644 --- a/src/ox/fs/filestore.hpp +++ b/src/ox/fs/filestore.hpp @@ -571,12 +571,7 @@ typename FileStore
::StatInfo FileStore
::stat(InodeId_t id) { template typename Header::FsSize_t FileStore
::spaceNeeded(InodeId_t id, typename Header::FsSize_t size) { - typename Header::FsSize_t needed = sizeof(Inode) + size;; - auto inode = getInode(ptr(m_header.getRootInode()), id); - if (inode) { - needed -= inode->size(); - } - return needed; + return sizeof(Inode) + size; } template diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index 235d1e14a..d49af7a07 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -30,8 +30,7 @@ const static auto usage = "usage:\n" "\toxfs compact \n" "\toxfs version\n"; -char *loadFileBuff(const char *path, ::size_t *sizeOut = nullptr) { - auto file = fopen(path, "rb"); +char *loadFileBuff(FILE *file, ::size_t *sizeOut = nullptr) { if (file) { fseek(file, 0, SEEK_END); const auto size = ftell(file); @@ -48,6 +47,10 @@ char *loadFileBuff(const char *path, ::size_t *sizeOut = nullptr) { } } +char *loadFileBuff(const char *path, ::size_t *sizeOut = nullptr) { + return loadFileBuff(fopen(path, "rb"), sizeOut); +} + size_t bytes(const char *str) { auto size = ::ox_strlen(str); const auto lastChar = str[size-1];