Skip to content

Commit

Permalink
fix(ffi): Correct `clp::ffi::ir_stream::Deserializer::deserialize_nex…
Browse files Browse the repository at this point in the history
…t_ir_unit`'s return value when failing to read the next IR unit's type tag. (y-scope#579)
  • Loading branch information
LinZhihao-723 authored Nov 8, 2024
1 parent 9154949 commit 31de766
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions components/core/src/clp/ffi/ir_stream/Deserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -172,8 +171,8 @@ auto Deserializer<IrUnitHandler>::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)};
Expand Down

0 comments on commit 31de766

Please sign in to comment.