From badd07e27f8bb1beedac0df84cc21ed89a66d5f3 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 25 Oct 2021 19:12:36 -0500 Subject: [PATCH] [nostalgia/tools/pack] Make toMetalClaw ensure data portion is in fact MetalClaw --- src/nostalgia/tools/pack/pack.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index a3a072e0..2ba305c3 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -14,18 +14,22 @@ namespace nostalgia { /** - * Convert path references to inodes to save space + * Convert path references in Claw data to inodes to save space * @param buff buffer holding file * @return error * stub for now */ static ox::Result pathToInode(const ox::Buffer &buff) noexcept { - return ox::move(buff); + return std::move(buff); } // just strip header for now... static ox::Result toMetalClaw(const ox::Buffer &buff) noexcept { - return ox::stripClawHeader(buff.data(), buff.size()); + oxRequire(hdr, ox::readClawHeader(buff)); + if (hdr.fmt != ox::ClawFormat::Metal) { + return OxError(1, "Cannot convert from Claw to MetalClaw, data portion must already be MetalClaw"); + } + return ox::stripClawHeader(buff); } static ox::Error doTransformations(ox::FileSystem *dest, const ox::String &filePath) noexcept {