MCPcopy Create free account
hub / github.com/FeJQ/AUPK / get_msgpack_binary

Method get_msgpack_binary

art/runtime/json.hpp:9568–9673  ·  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

9566 @return whether byte array creation completed
9567 */
9568 bool get_msgpack_binary(binary_t& result)
9569 {
9570 // helper function to set the subtype
9571 auto assign_and_return_true = [&result](std::int8_t subtype)
9572 {
9573 result.set_subtype(static_cast<std::uint8_t>(subtype));
9574 return true;
9575 };
9576
9577 switch (current)
9578 {
9579 case 0xC4: // bin 8
9580 {
9581 std::uint8_t len{};
9582 return get_number(input_format_t::msgpack, len) &&
9583 get_binary(input_format_t::msgpack, len, result);
9584 }
9585
9586 case 0xC5: // bin 16
9587 {
9588 std::uint16_t len{};
9589 return get_number(input_format_t::msgpack, len) &&
9590 get_binary(input_format_t::msgpack, len, result);
9591 }
9592
9593 case 0xC6: // bin 32
9594 {
9595 std::uint32_t len{};
9596 return get_number(input_format_t::msgpack, len) &&
9597 get_binary(input_format_t::msgpack, len, result);
9598 }
9599
9600 case 0xC7: // ext 8
9601 {
9602 std::uint8_t len{};
9603 std::int8_t subtype{};
9604 return get_number(input_format_t::msgpack, len) &&
9605 get_number(input_format_t::msgpack, subtype) &&
9606 get_binary(input_format_t::msgpack, len, result) &&
9607 assign_and_return_true(subtype);
9608 }
9609
9610 case 0xC8: // ext 16
9611 {
9612 std::uint16_t len{};
9613 std::int8_t subtype{};
9614 return get_number(input_format_t::msgpack, len) &&
9615 get_number(input_format_t::msgpack, subtype) &&
9616 get_binary(input_format_t::msgpack, len, result) &&
9617 assign_and_return_true(subtype);
9618 }
9619
9620 case 0xC9: // ext 32
9621 {
9622 std::uint32_t len{};
9623 std::int8_t subtype{};
9624 return get_number(input_format_t::msgpack, len) &&
9625 get_number(input_format_t::msgpack, subtype) &&

Callers

nothing calls this directly

Calls 1

set_subtypeMethod · 0.80

Tested by

no test coverage detected