MCPcopy Create free account
hub / github.com/X-Profiler/xprofiler / get_msgpack_binary

Method get_msgpack_binary

src/library/json.hpp:10734–10839  ·  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

10732 @return whether byte array creation completed
10733 */
10734 bool get_msgpack_binary(binary_t& result)
10735 {
10736 // helper function to set the subtype
10737 auto assign_and_return_true = [&result](std::int8_t subtype)
10738 {
10739 result.set_subtype(static_cast<std::uint8_t>(subtype));
10740 return true;
10741 };
10742
10743 switch (current)
10744 {
10745 case 0xC4: // bin 8
10746 {
10747 std::uint8_t len{};
10748 return get_number(input_format_t::msgpack, len) &&
10749 get_binary(input_format_t::msgpack, len, result);
10750 }
10751
10752 case 0xC5: // bin 16
10753 {
10754 std::uint16_t len{};
10755 return get_number(input_format_t::msgpack, len) &&
10756 get_binary(input_format_t::msgpack, len, result);
10757 }
10758
10759 case 0xC6: // bin 32
10760 {
10761 std::uint32_t len{};
10762 return get_number(input_format_t::msgpack, len) &&
10763 get_binary(input_format_t::msgpack, len, result);
10764 }
10765
10766 case 0xC7: // ext 8
10767 {
10768 std::uint8_t len{};
10769 std::int8_t subtype{};
10770 return get_number(input_format_t::msgpack, len) &&
10771 get_number(input_format_t::msgpack, subtype) &&
10772 get_binary(input_format_t::msgpack, len, result) &&
10773 assign_and_return_true(subtype);
10774 }
10775
10776 case 0xC8: // ext 16
10777 {
10778 std::uint16_t len{};
10779 std::int8_t subtype{};
10780 return get_number(input_format_t::msgpack, len) &&
10781 get_number(input_format_t::msgpack, subtype) &&
10782 get_binary(input_format_t::msgpack, len, result) &&
10783 assign_and_return_true(subtype);
10784 }
10785
10786 case 0xC9: // ext 32
10787 {
10788 std::uint32_t len{};
10789 std::int8_t subtype{};
10790 return get_number(input_format_t::msgpack, len) &&
10791 get_number(input_format_t::msgpack, subtype) &&

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected