From 8eb73298f547f0fac22a3887c31056a533efe5ce Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 10 Apr 2017 23:17:39 -0500 Subject: [PATCH] Put the current inode space usage back into the spaceNeeded method --- src/ox/fs/filestore.hpp | 7 +------ src/ox/fs/oxfstool.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 8 deletions(-) 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];