diff --git a/components/core/src/clp/ffi/ir_stream/Serializer.cpp b/components/core/src/clp/ffi/ir_stream/Serializer.cpp index 463387472..4222ff537 100644 --- a/components/core/src/clp/ffi/ir_stream/Serializer.cpp +++ b/components/core/src/clp/ffi/ir_stream/Serializer.cpp @@ -145,7 +145,7 @@ auto get_schema_tree_node_type_from_msgpack_val(msgpack::object const& val ret_val.emplace(SchemaTreeNode::Type::Int); break; case msgpack::type::FLOAT32: - case msgpack::type::FLOAT: + case msgpack::type::FLOAT64: ret_val.emplace(SchemaTreeNode::Type::Float); break; case msgpack::type::STR: @@ -286,14 +286,15 @@ auto Serializer::serialize_msgpack_map(msgpack::object const working_stack.pop_back(); continue; } + auto const& [key, val]{curr.get_next_child()}; auto const opt_schema_tree_node_type{get_schema_tree_node_type_from_msgpack_val(val)}; if (false == opt_schema_tree_node_type.has_value()) { failure = true; break; } - auto const schema_tree_node_type{opt_schema_tree_node_type.value()}; + SchemaTree::NodeLocator const locator{ curr.get_parent_id(), key.as(), @@ -377,6 +378,7 @@ auto Serializer::serialize_schema_tree_node( // Unknown type return false; } + auto const parent_id{locator.get_parent_id()}; if (parent_id <= UINT8_MAX) { m_schema_tree_node_buf.push_back(cProtocol::Payload::SchemaTreeNodeParentIdUByte); @@ -388,6 +390,7 @@ auto Serializer::serialize_schema_tree_node( // Out of range return false; } + return serialize_string_packet(locator.get_key_name(), m_schema_tree_node_buf); } @@ -395,7 +398,7 @@ template auto Serializer::serialize_key(SchemaTreeNode::id_t id) -> bool { if (id <= UINT8_MAX) { m_key_group_buf.push_back(cProtocol::Payload::KeyIdUByte); - m_key_group_buf.push_back(static_cast(static_cast(id))); + m_key_group_buf.push_back(bit_cast(static_cast(id))); } else if (id <= UINT16_MAX) { m_key_group_buf.push_back(cProtocol::Payload::KeyIdUShort); serialize_int(static_cast(id), m_key_group_buf); diff --git a/components/core/src/clp/ffi/ir_stream/encoding_methods.hpp b/components/core/src/clp/ffi/ir_stream/encoding_methods.hpp index 778b4cd30..a60bf51d9 100644 --- a/components/core/src/clp/ffi/ir_stream/encoding_methods.hpp +++ b/components/core/src/clp/ffi/ir_stream/encoding_methods.hpp @@ -46,7 +46,7 @@ bool serialize_log_event( * @param message * @param logtype * @param ir_buf - * @return true on success, false otherwise + * @return Whether the message was serialized successfully. */ bool serialize_message(std::string_view message, std::string& logtype, std::vector& ir_buf); } // namespace eight_byte_encoding diff --git a/components/core/src/clp/ffi/ir_stream/utils.cpp b/components/core/src/clp/ffi/ir_stream/utils.cpp index 00cac3bcd..5cfe08a5a 100644 --- a/components/core/src/clp/ffi/ir_stream/utils.cpp +++ b/components/core/src/clp/ffi/ir_stream/utils.cpp @@ -35,7 +35,7 @@ auto serialize_string_packet(std::string_view str, std::vector& buf) -> auto const length{str.length()}; if (length <= UINT8_MAX) { buf.push_back(cProtocol::Payload::StrPacketLenUByte); - buf.push_back(static_cast(static_cast(length))); + buf.push_back(bit_cast(static_cast(length))); } else if (length <= UINT16_MAX) { buf.push_back(cProtocol::Payload::StrPacketLenUShort); serialize_int(static_cast(length), buf);