Compare commits

...

2 Commits

4 changed files with 7 additions and 7 deletions

View File

@@ -76,15 +76,15 @@ template<typename T>
ox::Error writeClawHeader(Writer_c auto &writer, const T *t, ClawFormat fmt) noexcept { ox::Error writeClawHeader(Writer_c auto &writer, const T *t, ClawFormat fmt) noexcept {
switch (fmt) { switch (fmt) {
case ClawFormat::Metal: case ClawFormat::Metal:
oxReturnError(write(&writer, "M2;")); oxReturnError(write(writer, "M2;"));
break; break;
case ClawFormat::Organic: case ClawFormat::Organic:
oxReturnError(write(&writer, "O1;")); oxReturnError(write(writer, "O1;"));
break; break;
default: default:
return OxError(1); return OxError(1);
} }
oxReturnError(write(&writer, detail::getTypeName(t))); oxReturnError(write(writer, detail::getTypeName(t)));
oxReturnError(writer.put(';')); oxReturnError(writer.put(';'));
const auto tn = detail::getTypeVersion(t); const auto tn = detail::getTypeVersion(t);
if (tn > -1) { if (tn > -1) {

View File

@@ -341,8 +341,8 @@ constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, CRStringVi
return out; return out;
} }
constexpr auto write(Writer_c auto *writer, ox::CRStringView sv) noexcept { constexpr auto write(Writer_c auto &writer, ox::CRStringView sv) noexcept {
return writer->write(sv.data(), sv.bytes()); return writer.write(sv.data(), sv.bytes());
} }
#ifdef OX_USE_STDLIB #ifdef OX_USE_STDLIB

View File

@@ -17,7 +17,7 @@ ox::Result<ox::UUID> readUuidHeader(const ox::Buffer &buff) noexcept;
ox::Result<ox::UUID> readUuidHeader(const char *buff, std::size_t buffLen) noexcept; ox::Result<ox::UUID> readUuidHeader(const char *buff, std::size_t buffLen) noexcept;
ox::Error writeUuidHeader(ox::Writer_c auto *writer, const ox::UUID &uuid) noexcept { ox::Error writeUuidHeader(ox::Writer_c auto &writer, const ox::UUID &uuid) noexcept {
const auto hdr = ox::sfmt<ox::BString<K1HdrSz>>("K1;{};", uuid.toString()); const auto hdr = ox::sfmt<ox::BString<K1HdrSz>>("K1;{};", uuid.toString());
return write(writer, hdr); return write(writer, hdr);
} }

View File

@@ -90,7 +90,7 @@ ox::Error Project::writeBuff(const ox::StringView &path, const ox::Buffer &buff)
ox::BufferWriter writer(&outBuff); ox::BufferWriter writer(&outBuff);
const auto [uuid, err] = m_ctx->pathToUuid.at(path); const auto [uuid, err] = m_ctx->pathToUuid.at(path);
if (!err) { if (!err) {
oxReturnError(keel::writeUuidHeader(&writer, *uuid)); oxReturnError(keel::writeUuidHeader(writer, *uuid));
} }
oxReturnError(writer.write(buff.data(), buff.size())); oxReturnError(writer.write(buff.data(), buff.size()));
const auto newFile = m_fs->stat(path).error != 0; const auto newFile = m_fs->stat(path).error != 0;