Skip to content

I found bug in the current release #23

@tansioe

Description

@tansioe

My types are as follow:

struct RackInfoEntry
{
std::int16_t rack_number{ 0 };
std::uint16_t deck_level{ 0 };
bool irregular{ true };
std::uint32_t next_board_offset{ 0 };
std::uint32_t pos{ 0 };
std::uint32_t top_layer_height{ 0 };
std::uint32_t width{ 0 };

template
void pack(T& pack)
{
pack(rack_number, deck_level, irregular, next_board_offset, pos, top_layer_height, width);
}
};

using RackInfoEntries = std::vector;

struct UpdateRackInfoRequest
{
RackInfoEntries racks_list;

template
void pack(T& pack)
{
pack(racks_list);
}
};

RackInfoEntries entries{
{ .rack_number = -1, .deck_level = 2, .irregular = true, .next_board_offset = 300,
.pos = 30, .top_layer_height = 200, .width = 100 }
};
UpdateRackInfoRequest payload{ .racks_list = entries };
auto payload_bytes = msgpack::pack(payload);
Message msg{ .type = static_caststd::uint16_t(MsgType::kUpdateRackInfoRequest),
.data = payload_bytes };

auto tx_data = msgpack::pack(msg);

const auto rx_data = msgpack::unpack(tx_data);
auto req_data = msgpack::unpack(rx_data.data);
std::cout << std::format("RackNo: {}, DeckLvl: {}, Irregular: {}, NextBoardOffset: {}, Pos: {}",
req_data.racks_list[0].rack_number,
req_data.racks_list[0].deck_level,
req_data.racks_list[0].irregular,
req_data.racks_list[0].next_board_offset,
req_data.racks_list[0].pos) << std::endl;

From the above example, the rack_number is incorrectly deserialised? the original value was set to -1, but get deserialised to 255

I believe it is a bug in the deserialiser. Any suggestion how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions