From 31de766ecc3175b1fa472d12881587e3673294de Mon Sep 17 00:00:00 2001 From: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com> Date: Fri, 8 Nov 2024 03:58:28 -0500 Subject: [PATCH] fix(ffi): Correct `clp::ffi::ir_stream::Deserializer::deserialize_next_ir_unit`'s return value when failing to read the next IR unit's type tag. (#579) --- components/core/src/clp/ffi/ir_stream/Deserializer.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/core/src/clp/ffi/ir_stream/Deserializer.hpp b/components/core/src/clp/ffi/ir_stream/Deserializer.hpp index 45cca8f26..3418a39ae 100644 --- a/components/core/src/clp/ffi/ir_stream/Deserializer.hpp +++ b/components/core/src/clp/ffi/ir_stream/Deserializer.hpp @@ -14,7 +14,6 @@ #include "../../ReaderInterface.hpp" #include "../../time_types.hpp" -#include "../KeyValuePairLogEvent.hpp" #include "../SchemaTree.hpp" #include "decoding_methods.hpp" #include "ir_unit_deserialization_methods.hpp" @@ -66,8 +65,8 @@ class Deserializer { /** * Deserializes the stream from the given reader up to and including the next log event IR unit. * @param reader - * @return std::errc::no_message_available if no tag bytes can be read to determine the next IR - * unit type. + * @return Forwards `deserialize_tag`s return values if no tag bytes can be read to determine + * the next IR unit type. * @return std::errc::protocol_not_supported if the IR unit type is not supported. * @return std::errc::operation_not_permitted if the deserializer already reached the end of * stream by deserializing an end-of-stream IR unit in the previous calls. @@ -172,8 +171,8 @@ auto Deserializer::deserialize_next_ir_unit(ReaderInterface& read } encoded_tag_t tag{}; - if (IRErrorCode::IRErrorCode_Success != deserialize_tag(reader, tag)) { - return std::errc::no_message_available; + if (auto const err{deserialize_tag(reader, tag)}; IRErrorCode::IRErrorCode_Success != err) { + return ir_error_code_to_errc(err); } auto const optional_ir_unit_type{get_ir_unit_type_from_tag(tag)};