diff --git a/src/nostalgia/tools/pack.cpp b/src/nostalgia/tools/pack.cpp index 92153979..f6752d12 100644 --- a/src/nostalgia/tools/pack.cpp +++ b/src/nostalgia/tools/pack.cpp @@ -21,7 +21,7 @@ using namespace ox; using namespace nostalgia::core; using namespace nostalgia::common; -ox::ValErr> loadFileBuff(std::string path, ::size_t *sizeOut = nullptr) { +[[nodiscard]] ox::ValErr> loadFileBuff(std::string path, ::size_t *sizeOut = nullptr) { auto file = fopen(path.c_str(), "rb"); if (file) { fseek(file, 0, SEEK_END); @@ -39,7 +39,7 @@ ox::ValErr> loadFileBuff(std::string path, ::size_t *sizeOu } } -ox::Error run(ClArgs args) { +[[nodiscard]] ox::Error run(ClArgs args) { std::string argSrc = args.getString("src").c_str(); std::string argDst = args.getString("dst").c_str(); if (argSrc == "") { @@ -51,7 +51,7 @@ ox::Error run(ClArgs args) { return OxError(1); } std::vector buff(32 * ox::units::MB); - ox::FileSystem32::format(buff.data(), buff.size()); + oxReturnError(ox::FileSystem32::format(buff.data(), buff.size())); ox::PassThroughFS src(argSrc.c_str()); ox::FileSystem32 dst(ox::FileStore32(buff.data(), buff.size())); auto err = nostalgia::pack(&src, &dst); diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index 5e261c0f..4e7f9a5f 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -27,20 +27,20 @@ namespace { * @return error * stub for now */ -ox::Error pathToInode(std::vector*) { +[[nodiscard]] ox::Error pathToInode(std::vector*) { return OxError(0); } // stub for now -ox::Error toMetalClaw(std::vector*) { +[[nodiscard]] ox::Error toMetalClaw(std::vector*) { return OxError(0); } // claw file transformations are broken out because path to inode // transformations need to be done after the copy to the new FS is complete -ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) { +[[nodiscard]] ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) { // copy - dest->ls(path.c_str(), [dest, path](const char *name, ox::InodeId_t) { + return dest->ls(path.c_str(), [dest, path](const char *name, ox::InodeId_t) { auto [stat, err] = dest->stat(path.c_str()); oxReturnError(err); if (stat.fileType == ox::FileType_Directory) { @@ -61,7 +61,6 @@ ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) { } return OxError(0); }); - return OxError(0); } [[nodiscard]] ox::Error verifyFile(ox::FileSystem32 *fs, const std::string &path, const std::vector &expected) noexcept { @@ -70,7 +69,7 @@ ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) { return buff == expected ? 0 : OxError(1); } -ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { +[[nodiscard]] ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { std::cout << "copying directory: " << path << '\n'; // copy return src->ls(path.c_str(), [src, dest, path](const char *name, ox::InodeId_t) { @@ -107,7 +106,7 @@ ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) } -ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { +[[nodiscard]] ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { oxReturnError(copy(src, dest, path)); oxReturnError(transformClaw(dest, path)); return OxError(0);