[ox/oc] Fix integer read for signed/unsigned
This commit is contained in:
parent
f987b02c65
commit
335d278f5e
9
deps/ox/src/ox/oc/read.hpp
vendored
9
deps/ox/src/ox/oc/read.hpp
vendored
@ -144,7 +144,11 @@ Error OrganicClawReader::field(const char *key, T *val) noexcept {
|
|||||||
if (jv.empty()) {
|
if (jv.empty()) {
|
||||||
*val = 0;
|
*val = 0;
|
||||||
} else if (rightType) {
|
} else if (rightType) {
|
||||||
*val = static_cast<T>(jv.asUInt());
|
if constexpr(ox::is_signed_v<T>) {
|
||||||
|
*val = static_cast<T>(jv.asInt64());
|
||||||
|
} else {
|
||||||
|
*val = static_cast<T>(jv.asUInt64());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
err = ox::Error(1, "Type mismatch");
|
err = ox::Error(1, "Type mismatch");
|
||||||
}
|
}
|
||||||
@ -172,7 +176,8 @@ Error OrganicClawReader::field(const char *key, T *val) noexcept {
|
|||||||
err = ox::Error(1, "Type mismatch");
|
err = ox::Error(1, "Type mismatch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Json::LogicError const&) {
|
} catch (Json::LogicError const&e) {
|
||||||
|
oxDebugf("JSON error: {}", e.what());
|
||||||
err = ox::Error(1, "error reading JSON data");
|
err = ox::Error(1, "error reading JSON data");
|
||||||
}
|
}
|
||||||
++m_fieldIt;
|
++m_fieldIt;
|
||||||
|
Loading…
Reference in New Issue
Block a user