diff --git a/src/keel/media.hpp b/src/keel/media.hpp index 8a4f6f3e..0f760a03 100644 --- a/src/keel/media.hpp +++ b/src/keel/media.hpp @@ -131,7 +131,7 @@ ox::Error writeObj( const ox::FileAddress &file, const T &obj, ox::ClawFormat fmt = ox::ClawFormat::Metal) noexcept { - oxRequire(objBuff, ox::writeClaw(&obj, fmt)); + oxRequire(objBuff, ox::writeClaw(obj, fmt)); return ctx->rom->write(file, objBuff.data(), objBuff.size()); } diff --git a/src/keel/pack.cpp b/src/keel/pack.cpp index c35c4450..20e74575 100644 --- a/src/keel/pack.cpp +++ b/src/keel/pack.cpp @@ -87,7 +87,7 @@ static ox::Error doTransformations(keel::Context *ctx, ox::TypeStore *ts, ox::Fi // transform FileAddresses oxRequireM(obj, keel::readAsset(ts, buff)); oxReturnError(transformFileAddressesObj(ctx, dest, &obj)); - oxReturnError(ox::writeClaw(&obj).moveTo(&buff)); + oxReturnError(ox::writeClaw(obj).moveTo(&buff)); // write file to dest oxReturnError(dest->write(s.inode, buff.data(), buff.size())); return {}; diff --git a/src/keel/typeconv.hpp b/src/keel/typeconv.hpp index e154fb29..f7e4d0e7 100644 --- a/src/keel/typeconv.hpp +++ b/src/keel/typeconv.hpp @@ -172,7 +172,7 @@ ox::Result convertBuffToBuff(keel::Context *ctx, const ox::Buffer &s static constexpr auto DstTypeName = ox::requireModelTypeName(); static constexpr auto DstTypeVersion = ox::requireModelTypeVersion(); oxRequire(out, convert(ctx, srcBuffer, DstTypeName, DstTypeVersion)); - return ox::writeClaw(wrapCast(out.get()), fmt); + return ox::writeClaw(*wrapCast(out.get()), fmt); } template diff --git a/src/studio/modlib/include/studio/configio.hpp b/src/studio/modlib/include/studio/configio.hpp index bb9822c5..2e12e88b 100644 --- a/src/studio/modlib/include/studio/configio.hpp +++ b/src/studio/modlib/include/studio/configio.hpp @@ -48,7 +48,7 @@ ox::Error writeConfig(keel::Context *ctx, ox::CRStringView name, T *data) noexce oxErrf("Could not create config directory: {}\n", toStr(err)); return err; } - oxRequireM(buff, ox::writeOC(data)); + oxRequireM(buff, ox::writeOC(*data)); buff.back().value = '\n'; if (const auto err = fs.write(path, buff.data(), buff.size())) { oxErrf("Could not read config file: {}\n", toStr(err)); diff --git a/src/studio/modlib/include/studio/project.hpp b/src/studio/modlib/include/studio/project.hpp index 12583ae3..eea2da1f 100644 --- a/src/studio/modlib/include/studio/project.hpp +++ b/src/studio/modlib/include/studio/project.hpp @@ -59,10 +59,13 @@ class Project { * Writes a MetalClaw object to the project at the given path. */ template - ox::Error writeObj(const ox::String &path, const T *obj, ox::ClawFormat fmt = ox::ClawFormat::Metal) noexcept; + ox::Error writeObj( + const ox::StringView &path, + const T *obj, + ox::ClawFormat fmt = ox::ClawFormat::Metal) noexcept; template - ox::Result loadObj(const ox::String &path) const noexcept; + ox::Result loadObj(const ox::StringView &path) const noexcept; ox::Result stat(ox::CRStringView path) const noexcept; @@ -82,7 +85,7 @@ class Project { ox::Error writeBuff(const ox::StringView &path, const ox::Buffer &buff) noexcept; - ox::Result loadBuff(const ox::String &path) const noexcept; + ox::Result loadBuff(const ox::StringView &path) const noexcept; ox::Error lsProcDir(ox::Vector *paths, ox::CRStringView path) const noexcept; @@ -102,9 +105,9 @@ class Project { }; template -ox::Error Project::writeObj(const ox::String &path, const T *obj, ox::ClawFormat fmt) noexcept { +ox::Error Project::writeObj(const ox::StringView &path, const T *obj, ox::ClawFormat fmt) noexcept { // write MetalClaw - oxRequireM(buff, ox::writeClaw(obj, fmt)); + oxRequireM(buff, ox::writeClaw(*obj, fmt)); // write to FS oxReturnError(writeBuff(path, buff)); // write type descriptor @@ -115,7 +118,7 @@ ox::Error Project::writeObj(const ox::String &path, const T *obj, ox::ClawFormat const auto descPath = ox::sfmt("/.{}/type_descriptors", m_projectDataDir); oxReturnError(mkdir(descPath)); for (const auto &t : m_typeStore.typeList()) { - oxRequireM(typeOut, ox::writeClaw(t, ox::ClawFormat::Organic)); + oxRequireM(typeOut, ox::writeClaw(*t, ox::ClawFormat::Organic)); // replace garbage last character with new line typeOut.back().value = '\n'; // write to FS @@ -127,7 +130,7 @@ ox::Error Project::writeObj(const ox::String &path, const T *obj, ox::ClawFormat } template -ox::Result Project::loadObj(const ox::String &path) const noexcept { +ox::Result Project::loadObj(const ox::StringView &path) const noexcept { oxRequire(buff, loadBuff(path)); if constexpr (ox::is_same_v) { return keel::readAsset(&m_typeStore, buff); diff --git a/src/studio/modlib/src/project.cpp b/src/studio/modlib/src/project.cpp index 55955b83..301ce476 100644 --- a/src/studio/modlib/src/project.cpp +++ b/src/studio/modlib/src/project.cpp @@ -104,7 +104,7 @@ ox::Error Project::writeBuff(const ox::StringView &path, const ox::Buffer &buff) return {}; } -ox::Result Project::loadBuff(const ox::String &path) const noexcept { +ox::Result Project::loadBuff(const ox::StringView &path) const noexcept { return m_fs->read(path); }