From fa722d5ac39d63a65db0b7383494997b7e3fc70e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 6 Oct 2018 16:26:47 +0200 Subject: [PATCH] :rotating_light: fixed another linter warning --- include/nlohmann/detail/input/binary_reader.hpp | 7 +++++-- single_include/nlohmann/json.hpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 05ab36f3..6d72cbf0 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -392,17 +392,20 @@ class binary_reader case 0xF9: // Half-Precision Float (two-byte IEEE 754) { - const int byte1 = get(); + const int byte1_raw = get(); if (JSON_UNLIKELY(not unexpect_eof())) { return false; } - const int byte2 = get(); + const int byte2_raw = get(); if (JSON_UNLIKELY(not unexpect_eof())) { return false; } + const unsigned char byte1 = static_cast(byte1_raw); + const unsigned char byte2 = static_cast(byte2_raw); + // code from RFC 7049, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index d62638bd..a1a3d697 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6354,17 +6354,20 @@ class binary_reader case 0xF9: // Half-Precision Float (two-byte IEEE 754) { - const int byte1 = get(); + const int byte1_raw = get(); if (JSON_UNLIKELY(not unexpect_eof())) { return false; } - const int byte2 = get(); + const int byte2_raw = get(); if (JSON_UNLIKELY(not unexpect_eof())) { return false; } + const unsigned char byte1 = static_cast(byte1_raw); + const unsigned char byte2 = static_cast(byte2_raw); + // code from RFC 7049, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often