MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / get_cbor_binary

Method get_cbor_binary

dependencies/json/json.hpp:8651–8737  ·  view source on GitHub ↗

! @brief reads a CBOR byte array This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into the byte array. Additionally, CBOR's byte arrays with indefinite lengths are supported. @param[out] result created byte array @return whether byte array creation completed */

Source from the content-addressed store, hash-verified

8649 @return whether byte array creation completed
8650 */
8651 bool get_cbor_binary(binary_t& result)
8652 {
8653 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
8654 {
8655 return false;
8656 }
8657
8658 switch (current)
8659 {
8660 // Binary data (0x00..0x17 bytes follow)
8661 case 0x40:
8662 case 0x41:
8663 case 0x42:
8664 case 0x43:
8665 case 0x44:
8666 case 0x45:
8667 case 0x46:
8668 case 0x47:
8669 case 0x48:
8670 case 0x49:
8671 case 0x4A:
8672 case 0x4B:
8673 case 0x4C:
8674 case 0x4D:
8675 case 0x4E:
8676 case 0x4F:
8677 case 0x50:
8678 case 0x51:
8679 case 0x52:
8680 case 0x53:
8681 case 0x54:
8682 case 0x55:
8683 case 0x56:
8684 case 0x57:
8685 {
8686 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
8687 }
8688
8689 case 0x58: // Binary data (one-byte uint8_t for n follows)
8690 {
8691 std::uint8_t len{};
8692 return get_number(input_format_t::cbor, len) &&
8693 get_binary(input_format_t::cbor, len, result);
8694 }
8695
8696 case 0x59: // Binary data (two-byte uint16_t for n follow)
8697 {
8698 std::uint16_t len{};
8699 return get_number(input_format_t::cbor, len) &&
8700 get_binary(input_format_t::cbor, len, result);
8701 }
8702
8703 case 0x5A: // Binary data (four-byte uint32_t for n follow)
8704 {
8705 std::uint32_t len{};
8706 return get_number(input_format_t::cbor, len) &&
8707 get_binary(input_format_t::cbor, len, result);
8708 }

Callers

nothing calls this directly

Calls 7

getFunction · 0.70
get_token_stringFunction · 0.70
createFunction · 0.70
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
parse_errorMethod · 0.45

Tested by

no test coverage detected