[ox] Fix Mac build and fix MC to increment field counter on empty string
This commit is contained in:
parent
f91874182e
commit
819959745d
@ -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;
|
||||
|
||||
|
3
deps/ox/src/ox/mc/read.hpp
vendored
3
deps/ox/src/ox/mc/read.hpp
vendored
@ -225,12 +225,13 @@ Error MetalClawReader::field(const char*, Handler handler) {
|
||||
template<typename T>
|
||||
Error MetalClawReader::field(const char* name, ox::Vector<T> *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);
|
||||
}
|
||||
|
2
deps/ox/src/ox/oc/read.hpp
vendored
2
deps/ox/src/ox/oc/read.hpp
vendored
@ -155,7 +155,7 @@ Error OrganicClawReader::field(const char *key, T *val, std::size_t valLen) {
|
||||
|
||||
template<typename T>
|
||||
Error OrganicClawReader::field(const char *key, ox::Vector<T> *val) {
|
||||
return field(nullptr, val->data(), val->size());
|
||||
return field(key, val->data(), val->size());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
2
deps/ox/src/ox/oc/write.hpp
vendored
2
deps/ox/src/ox/oc/write.hpp
vendored
@ -83,7 +83,7 @@ class OrganicClawWriter {
|
||||
template<typename T>
|
||||
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]));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user