Added overflow handling in JsonVariant::as<T>() and JsonVariant::is<T>()

This commit is contained in:
Benoit Blanchon
2019-03-06 15:31:37 +01:00
parent 746f2882f7
commit 576543c4b4
42 changed files with 781 additions and 434 deletions

View File

@@ -24,7 +24,8 @@ class MsgPackSerializer {
}
template <typename T>
typename enable_if<sizeof(T) == 8>::type visitFloat(T value64) {
typename enable_if<sizeof(T) == 8>::type visitFloat(T value64)
ARDUINOJSON_NO_SANITIZE("float-cast-overflow") {
float value32 = float(value64);
if (value32 == value64) {
writeByte(0xCA);