MCPcopy Create free account
hub / github.com/M4THYOU/TokenDagger / get_msgpack_binary

Method get_msgpack_binary

src/nlohmann/json.hpp:10804–10909  ·  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

10802 @return whether byte array creation completed
10803 */
10804 bool get_msgpack_binary(binary_t& result)
10805 {
10806 // helper function to set the subtype
10807 auto assign_and_return_true = [&result](std::int8_t subtype)
10808 {
10809 result.set_subtype(static_cast<std::uint8_t>(subtype));
10810 return true;
10811 };
10812
10813 switch (current)
10814 {
10815 case 0xC4: // bin 8
10816 {
10817 std::uint8_t len{};
10818 return get_number(input_format_t::msgpack, len) &&
10819 get_binary(input_format_t::msgpack, len, result);
10820 }
10821
10822 case 0xC5: // bin 16
10823 {
10824 std::uint16_t len{};
10825 return get_number(input_format_t::msgpack, len) &&
10826 get_binary(input_format_t::msgpack, len, result);
10827 }
10828
10829 case 0xC6: // bin 32
10830 {
10831 std::uint32_t len{};
10832 return get_number(input_format_t::msgpack, len) &&
10833 get_binary(input_format_t::msgpack, len, result);
10834 }
10835
10836 case 0xC7: // ext 8
10837 {
10838 std::uint8_t len{};
10839 std::int8_t subtype{};
10840 return get_number(input_format_t::msgpack, len) &&
10841 get_number(input_format_t::msgpack, subtype) &&
10842 get_binary(input_format_t::msgpack, len, result) &&
10843 assign_and_return_true(subtype);
10844 }
10845
10846 case 0xC8: // ext 16
10847 {
10848 std::uint16_t len{};
10849 std::int8_t subtype{};
10850 return get_number(input_format_t::msgpack, len) &&
10851 get_number(input_format_t::msgpack, subtype) &&
10852 get_binary(input_format_t::msgpack, len, result) &&
10853 assign_and_return_true(subtype);
10854 }
10855
10856 case 0xC9: // ext 32
10857 {
10858 std::uint32_t len{};
10859 std::int8_t subtype{};
10860 return get_number(input_format_t::msgpack, len) &&
10861 get_number(input_format_t::msgpack, subtype) &&

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected