[ox/fs] Add separate case for write in FileLocation model
This commit is contained in:
parent
fd89a9abb0
commit
6b9d9c50c7
@ -145,11 +145,15 @@ constexpr Error model(T *io, CommonPtrWith<FileAddress> auto *fa) noexcept {
|
|||||||
int8_t type = 0;
|
int8_t type = 0;
|
||||||
oxReturnError(io->field("type", &type));
|
oxReturnError(io->field("type", &type));
|
||||||
oxReturnError(io->field("data", UnionView(&fa->m_data, 0)));
|
oxReturnError(io->field("data", UnionView(&fa->m_data, 0)));
|
||||||
} else {
|
} else if constexpr(ox_strcmp(T::opType(), OpType::Read) == 0) {
|
||||||
auto type = static_cast<int8_t>(fa->m_type);
|
auto type = static_cast<int8_t>(fa->m_type);
|
||||||
oxReturnError(io->field("type", &type));
|
oxReturnError(io->field("type", &type));
|
||||||
fa->m_type = static_cast<FileAddressType>(type);
|
fa->m_type = static_cast<FileAddressType>(type);
|
||||||
oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast<int>(fa->m_type))));
|
oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast<int>(fa->m_type))));
|
||||||
|
} else if constexpr(ox_strcmp(T::opType(), OpType::Write) == 0) {
|
||||||
|
auto type = static_cast<int8_t>(fa->m_type);
|
||||||
|
oxReturnError(io->field("type", &type));
|
||||||
|
oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast<int>(fa->m_type))));
|
||||||
}
|
}
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user