MCPcopy Create free account
hub / github.com/Huntereb/Awoo-Installer / get_msgpack_binary

Method get_msgpack_binary

include/util/json.hpp:11444–11549  ·  view source on GitHub ↗

! @brief reads a MessagePack byte array This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into a byte array. @param[out] result created byte array @return whether byte array creation completed */

Source from the content-addressed store, hash-verified

11442 @return whether byte array creation completed
11443 */
11444 bool get_msgpack_binary(binary_t& result)
11445 {
11446 // helper function to set the subtype
11447 auto assign_and_return_true = [&result](std::int8_t subtype)
11448 {
11449 result.set_subtype(static_cast<std::uint8_t>(subtype));
11450 return true;
11451 };
11452
11453 switch (current)
11454 {
11455 case 0xC4: // bin 8
11456 {
11457 std::uint8_t len{};
11458 return get_number(input_format_t::msgpack, len) &&
11459 get_binary(input_format_t::msgpack, len, result);
11460 }
11461
11462 case 0xC5: // bin 16
11463 {
11464 std::uint16_t len{};
11465 return get_number(input_format_t::msgpack, len) &&
11466 get_binary(input_format_t::msgpack, len, result);
11467 }
11468
11469 case 0xC6: // bin 32
11470 {
11471 std::uint32_t len{};
11472 return get_number(input_format_t::msgpack, len) &&
11473 get_binary(input_format_t::msgpack, len, result);
11474 }
11475
11476 case 0xC7: // ext 8
11477 {
11478 std::uint8_t len{};
11479 std::int8_t subtype{};
11480 return get_number(input_format_t::msgpack, len) &&
11481 get_number(input_format_t::msgpack, subtype) &&
11482 get_binary(input_format_t::msgpack, len, result) &&
11483 assign_and_return_true(subtype);
11484 }
11485
11486 case 0xC8: // ext 16
11487 {
11488 std::uint16_t len{};
11489 std::int8_t subtype{};
11490 return get_number(input_format_t::msgpack, len) &&
11491 get_number(input_format_t::msgpack, subtype) &&
11492 get_binary(input_format_t::msgpack, len, result) &&
11493 assign_and_return_true(subtype);
11494 }
11495
11496 case 0xC9: // ext 32
11497 {
11498 std::uint32_t len{};
11499 std::int8_t subtype{};
11500 return get_number(input_format_t::msgpack, len) &&
11501 get_number(input_format_t::msgpack, subtype) &&

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected