diff --git a/docs/mkdocs/docs/api/basic_json/binary_t.md b/docs/mkdocs/docs/api/basic_json/binary_t.md index e273d138f..64506b25f 100644 --- a/docs/mkdocs/docs/api/basic_json/binary_t.md +++ b/docs/mkdocs/docs/api/basic_json/binary_t.md @@ -13,9 +13,8 @@ is compatible with both of the binary data formats that use binary subtyping, (t incompatible with each other, and it is up to the user to translate between them). The subtype is added to `BinaryType` via the helper type [byte_container_with_subtype](../byte_container_with_subtype/index.md). -[CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type as: -> Major type 2: a byte string. The string's length in bytes is represented following the rules for positive integers -> (major type 0). +[CBOR's RFC 8949](https://www.rfc-editor.org/rfc/rfc8949.html#section-3.1) describes this type as: +> Major type 2: A byte string. The number of bytes in the string is equal to the argument. [MessagePack's documentation on the bin type family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) describes this type as: diff --git a/docs/mkdocs/docs/features/binary_formats/cbor.md b/docs/mkdocs/docs/features/binary_formats/cbor.md index d385c2a4c..5952bce39 100644 --- a/docs/mkdocs/docs/features/binary_formats/cbor.md +++ b/docs/mkdocs/docs/features/binary_formats/cbor.md @@ -7,12 +7,12 @@ extremely small code sizes, fairly small message size, and extensibility without - [CBOR Website](http://cbor.io) - the main source on CBOR - [CBOR Playground](http://cbor.me) - an interactive webpage to translate between JSON and CBOR - - [RFC 7049](https://tools.ietf.org/html/rfc7049) - the CBOR specification + - [RFC 8949](https://www.rfc-editor.org/rfc/rfc8949.html) - the CBOR specification ## Serialization The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification -([RFC 7049](https://www.rfc-editor.org/rfc/rfc7049.html)): +([RFC 8949](https://www.rfc-editor.org/rfc/rfc8949.html)): | JSON value type | value/range | CBOR type | first byte | |-----------------|--------------------------------------------|-----------------------------------|------------| diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index ad862827d..3f03dd0b3 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -896,7 +896,7 @@ class binary_reader const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); - // Code from RFC 7049, Appendix D, Figure 3: + // Code from RFC 8949, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very @@ -909,8 +909,8 @@ class binary_reader { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; - JSON_ASSERT(0 <= exp&& exp <= 32); - JSON_ASSERT(mant <= 1024); + JSON_ASSERT(exp <= 31); + JSON_ASSERT(mant <= 1023); switch (exp) { case 0: @@ -2484,7 +2484,7 @@ class binary_reader const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); - // Code from RFC 7049, Appendix D, Figure 3: + // Code from RFC 8949, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very @@ -2497,8 +2497,8 @@ class binary_reader { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; - JSON_ASSERT(0 <= exp&& exp <= 32); - JSON_ASSERT(mant <= 1024); + JSON_ASSERT(exp <= 31); + JSON_ASSERT(mant <= 1023); switch (exp) { case 0: diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 5ead5275a..2878b428a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -11445,7 +11445,7 @@ class binary_reader const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); - // Code from RFC 7049, Appendix D, Figure 3: + // Code from RFC 8949, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very @@ -11458,8 +11458,8 @@ class binary_reader { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; - JSON_ASSERT(0 <= exp&& exp <= 32); - JSON_ASSERT(mant <= 1024); + JSON_ASSERT(exp <= 31); + JSON_ASSERT(mant <= 1023); switch (exp) { case 0: @@ -13033,7 +13033,7 @@ class binary_reader const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); - // Code from RFC 7049, Appendix D, Figure 3: + // Code from RFC 8949, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very @@ -13046,8 +13046,8 @@ class binary_reader { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; - JSON_ASSERT(0 <= exp&& exp <= 32); - JSON_ASSERT(mant <= 1024); + JSON_ASSERT(exp <= 31); + JSON_ASSERT(mant <= 1023); switch (exp) { case 0: diff --git a/tests/src/unit-cbor.cpp b/tests/src/unit-cbor.cpp index af7364299..42faa9809 100644 --- a/tests/src/unit-cbor.cpp +++ b/tests/src/unit-cbor.cpp @@ -2309,7 +2309,7 @@ TEST_CASE("all CBOR first bytes") } #endif -TEST_CASE("examples from RFC 7049 Appendix A") +TEST_CASE("examples from RFC 8949 Appendix A") { SECTION("numbers") {