diff --git a/deps/ox/src/ox/claw/read.cpp b/deps/ox/src/ox/claw/read.cpp index 58d5f0b7..4b2ab9c1 100644 --- a/deps/ox/src/ox/claw/read.cpp +++ b/deps/ox/src/ox/claw/read.cpp @@ -59,10 +59,10 @@ Result readHeader(const char *buff, std::size_t buffLen) noexcept { } -Result> stripClawHeader(const char *buff, std::size_t buffLen) noexcept { +Result stripClawHeader(const char *buff, std::size_t buffLen) noexcept { auto header = detail::readHeader(buff, buffLen); oxReturnError(header); - Vector out(header.value.dataSize); + Buffer out(header.value.dataSize); ox_memcpy(out.data(), header.value.data, out.size()); return ox::move(out); } diff --git a/deps/ox/src/ox/claw/read.hpp b/deps/ox/src/ox/claw/read.hpp index 79eb2ae7..e39b0117 100644 --- a/deps/ox/src/ox/claw/read.hpp +++ b/deps/ox/src/ox/claw/read.hpp @@ -12,8 +12,8 @@ #ifdef OX_USE_STDLIB #include #endif +#include #include -#include #include "format.hpp" @@ -33,7 +33,7 @@ Result readHeader(const char *buff, std::size_t buffLen) noexcept; } -Result> stripClawHeader(const char *buff, std::size_t buffLen) noexcept; +Result stripClawHeader(const char *buff, std::size_t buffLen) noexcept; template Error readClaw(const char *buff, std::size_t buffLen, T *val) { @@ -65,7 +65,7 @@ Result readClaw(const char *buff, std::size_t buffLen) { } template -Result readClaw(const Vector &buff) { +Result readClaw(const Buffer &buff) { return readClaw(buff.data(), buff.size()); } diff --git a/deps/ox/src/ox/claw/write.hpp b/deps/ox/src/ox/claw/write.hpp index ee133830..6234dc61 100644 --- a/deps/ox/src/ox/claw/write.hpp +++ b/deps/ox/src/ox/claw/write.hpp @@ -12,8 +12,8 @@ #ifdef OX_USE_STDLIB #include #endif +#include #include -#include #include "format.hpp" @@ -40,15 +40,6 @@ struct TypeInfoCatcher { }; -template -[[nodiscard]] constexpr int getTypeVersion(int version = T::TypeVersion) noexcept { - return version; -} - -[[nodiscard]] constexpr int getTypeVersion(...) noexcept { - return -1; -} - template struct type_version { static constexpr auto value = -1; @@ -92,12 +83,10 @@ Result writeClawHeader(T *t, ClawFormat fmt) noexcept { } template -Result> writeClaw(T *t, ClawFormat fmt) { - auto [header, headerErr] = detail::writeClawHeader(t, fmt); - oxReturnError(headerErr); - const auto [data, dataErr] = fmt == ClawFormat::Metal ? writeMC(t) : writeOC(t); - oxReturnError(dataErr); - ox::Vector out(header.len() + data.size()); +Result writeClaw(T *t, ClawFormat fmt) { + oxRequire(header, detail::writeClawHeader(t, fmt)); + oxRequire(data, fmt == ClawFormat::Metal ? writeMC(t) : writeOC(t)); + Buffer out(header.len() + data.size()); memcpy(out.data(), header.data(), header.len()); memcpy(out.data() + header.len(), data.data(), data.size()); return out;