From 819959745d27a4a0937bcf774c0bf3bff1053104 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 8 May 2020 21:32:56 -0500 Subject: [PATCH] [ox] Fix Mac build and fix MC to increment field counter on empty string --- deps/ox/src/ox/fs/filesystem/filelocation.hpp | 3 ++- deps/ox/src/ox/mc/read.hpp | 3 ++- deps/ox/src/ox/oc/read.hpp | 2 +- deps/ox/src/ox/oc/write.hpp | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/ox/src/ox/fs/filesystem/filelocation.hpp index cef93d64..f7f29255 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.hpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.hpp @@ -29,7 +29,6 @@ class FileAddress { static constexpr auto TypeName = "ox::FileAddress"; static constexpr auto Fields = 2; - protected: union Data { static constexpr auto TypeName = "ox::FileAddress::Data"; static constexpr auto Fields = 3; @@ -37,6 +36,8 @@ class FileAddress { const char *constPath; uint64_t inode; }; + + protected: FileAddressType m_type = FileAddressType::None; Data m_data; diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 1dea8b37..a9713330 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -225,12 +225,13 @@ Error MetalClawReader::field(const char*, Handler handler) { template Error MetalClawReader::field(const char* name, ox::Vector *val) { if (m_unionIdx == -1 || m_unionIdx == m_field) { + // set size of val if the field is present, don't worry about it if not if (m_fieldPresence.get(m_field)) { const auto [len, err] = arrayLength(name, false); oxReturnError(err); val->resize(len); - return field(name, val->data(), val->size()); } + return field(name, val->data(), val->size()); } return OxError(0); } diff --git a/deps/ox/src/ox/oc/read.hpp b/deps/ox/src/ox/oc/read.hpp index f2a0dc76..28460540 100644 --- a/deps/ox/src/ox/oc/read.hpp +++ b/deps/ox/src/ox/oc/read.hpp @@ -155,7 +155,7 @@ Error OrganicClawReader::field(const char *key, T *val, std::size_t valLen) { template Error OrganicClawReader::field(const char *key, ox::Vector *val) { - return field(nullptr, val->data(), val->size()); + return field(key, val->data(), val->size()); } template diff --git a/deps/ox/src/ox/oc/write.hpp b/deps/ox/src/ox/oc/write.hpp index b954a617..bf181880 100644 --- a/deps/ox/src/ox/oc/write.hpp +++ b/deps/ox/src/ox/oc/write.hpp @@ -83,7 +83,7 @@ class OrganicClawWriter { template Error OrganicClawWriter::field(const char *key, T *val, std::size_t len) { if (targetValid()) { - OrganicClawWriter w(Json::Value(Json::arrayValue)); + OrganicClawWriter w((Json::Value(Json::arrayValue))); for (std::size_t i = 0; i < len; ++i) { oxReturnError(w.field("", &val[i])); }