From 0741bd9e680b39a01621dd3aba32753b60526c37 Mon Sep 17 00:00:00 2001 From: RoboSchmied Date: Mon, 25 Mar 2024 19:18:34 +0100 Subject: [PATCH] Fix typo in "endianness" Ported from 0d43e51d48ac3425ff0fc31989bb7efefb079c8e Closes #2071 --- .../tests/MsgPackDeserializer/doubleToFloat.cpp | 2 +- src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp | 10 +++++----- src/ArduinoJson/MsgPack/MsgPackSerializer.hpp | 4 ++-- .../MsgPack/{endianess.hpp => endianness.hpp} | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) rename src/ArduinoJson/MsgPack/{endianess.hpp => endianness.hpp} (56%) diff --git a/extras/tests/MsgPackDeserializer/doubleToFloat.cpp b/extras/tests/MsgPackDeserializer/doubleToFloat.cpp index fb2c25d09..794a37ed0 100644 --- a/extras/tests/MsgPackDeserializer/doubleToFloat.cpp +++ b/extras/tests/MsgPackDeserializer/doubleToFloat.cpp @@ -13,7 +13,7 @@ static void check(const char* input, T expected) { uint8_t* f = reinterpret_cast(&actual); const uint8_t* d = reinterpret_cast(input); doubleToFloat(d, f); - fixEndianess(actual); + fixEndianness(actual); CHECK(actual == expected); } diff --git a/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp b/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp index 41934295b..9e419f9c0 100644 --- a/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp +++ b/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include @@ -258,7 +258,7 @@ class MsgPackDeserializer { if (err) return err; - fixEndianess(value); + fixEndianness(value); return DeserializationError::Ok; } @@ -287,7 +287,7 @@ class MsgPackDeserializer { if (err) return err; - fixEndianess(value); + fixEndianness(value); variant->setFloat(value); return DeserializationError::Ok; @@ -303,7 +303,7 @@ class MsgPackDeserializer { if (err) return err; - fixEndianess(value); + fixEndianness(value); variant->setFloat(value); return DeserializationError::Ok; @@ -322,7 +322,7 @@ class MsgPackDeserializer { return err; doubleToFloat(i, o); - fixEndianess(value); + fixEndianness(value); variant->setFloat(value); return DeserializationError::Ok; diff --git a/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp b/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp index 6125330c2..347d59f8b 100644 --- a/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp +++ b/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include #include #include @@ -190,7 +190,7 @@ class MsgPackSerializer : public Visitor { template void writeInteger(T value) { - fixEndianess(value); + fixEndianness(value); writeBytes(reinterpret_cast(&value), sizeof(value)); } diff --git a/src/ArduinoJson/MsgPack/endianess.hpp b/src/ArduinoJson/MsgPack/endianness.hpp similarity index 56% rename from src/ArduinoJson/MsgPack/endianess.hpp rename to src/ArduinoJson/MsgPack/endianness.hpp index bb2dadd31..197584d6f 100644 --- a/src/ArduinoJson/MsgPack/endianess.hpp +++ b/src/ArduinoJson/MsgPack/endianness.hpp @@ -15,32 +15,32 @@ inline void swapBytes(uint8_t& a, uint8_t& b) { b = t; } -inline void fixEndianess(uint8_t* p, integral_constant) { +inline void fixEndianness(uint8_t* p, integral_constant) { swapBytes(p[0], p[7]); swapBytes(p[1], p[6]); swapBytes(p[2], p[5]); swapBytes(p[3], p[4]); } -inline void fixEndianess(uint8_t* p, integral_constant) { +inline void fixEndianness(uint8_t* p, integral_constant) { swapBytes(p[0], p[3]); swapBytes(p[1], p[2]); } -inline void fixEndianess(uint8_t* p, integral_constant) { +inline void fixEndianness(uint8_t* p, integral_constant) { swapBytes(p[0], p[1]); } -inline void fixEndianess(uint8_t*, integral_constant) {} +inline void fixEndianness(uint8_t*, integral_constant) {} template -inline void fixEndianess(T& value) { - fixEndianess(reinterpret_cast(&value), - integral_constant()); +inline void fixEndianness(T& value) { + fixEndianness(reinterpret_cast(&value), + integral_constant()); } #else template -inline void fixEndianess(T&) {} +inline void fixEndianness(T&) {} #endif ARDUINOJSON_END_PRIVATE_NAMESPACE