From 969914ce41b3bdbe1dae847f29ca00179390e43b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 18 Jun 2023 10:23:00 -0500 Subject: [PATCH] [keel] Add convert function to bare metal build so that the symbol is available --- src/keel/typeconv.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/keel/typeconv.cpp b/src/keel/typeconv.cpp index a4e2b44e..c7b9c88f 100644 --- a/src/keel/typeconv.cpp +++ b/src/keel/typeconv.cpp @@ -10,12 +10,13 @@ namespace keel { #ifndef OX_BARE_METAL - [[nodiscard]] static ox::Result findConverter( keel::Context *ctx, - ox::CRStringView srcTypeName, int srcTypeVersion, - ox::CRStringView dstTypeName, int dstTypeVersion) noexcept { + ox::CRStringView srcTypeName, + int srcTypeVersion, + ox::CRStringView dstTypeName, + int dstTypeVersion) noexcept { for (auto &c : ctx->converters) { if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) { return c; @@ -25,9 +26,12 @@ static ox::Result findConverter( }; static ox::Result> convert( - keel::Context *ctx, const ox::Buffer &srcBuffer, - ox::CRStringView srcTypeName, int srcTypeVersion, - ox::CRStringView dstTypeName, int dstTypeVersion) noexcept { + [[maybe_unused]] keel::Context *ctx, + [[maybe_unused]] const ox::Buffer &srcBuffer, + [[maybe_unused]] ox::CRStringView srcTypeName, + [[maybe_unused]] int srcTypeVersion, + [[maybe_unused]] ox::CRStringView dstTypeName, + [[maybe_unused]] int dstTypeVersion) noexcept { // look for direct converter auto [c, err] = findConverter(ctx, srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion); if (!err) { @@ -47,16 +51,19 @@ static ox::Result> convert( } return OxError(1, "Could not convert between types"); } - -ox::Result> convert( - keel::Context *ctx, - const ox::Buffer &srcBuffer, - ox::CRStringView dstTypeName, - int dstTypeVersion) noexcept { - oxRequire(hdr, readAssetHeader(srcBuffer)); - return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion); -} - #endif +ox::Result> convert( + [[maybe_unused]] keel::Context *ctx, + [[maybe_unused]] const ox::Buffer &srcBuffer, + [[maybe_unused]] ox::CRStringView dstTypeName, + [[maybe_unused]] int dstTypeVersion) noexcept { +#ifndef OX_BARE_METAL + oxRequire(hdr, readAssetHeader(srcBuffer)); + return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion); +#else + return OxError(1, "Operation not supported on this platform"); +#endif +} + }