MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / get_cbor_binary

Method get_cbor_binary

external/tinygltf/json.hpp:9378–9464  ·  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

9376 @return whether byte array creation completed
9377 */
9378 bool get_cbor_binary(binary_t& result)
9379 {
9380 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary")))
9381 {
9382 return false;
9383 }
9384
9385 switch (current)
9386 {
9387 // Binary data (0x00..0x17 bytes follow)
9388 case 0x40:
9389 case 0x41:
9390 case 0x42:
9391 case 0x43:
9392 case 0x44:
9393 case 0x45:
9394 case 0x46:
9395 case 0x47:
9396 case 0x48:
9397 case 0x49:
9398 case 0x4A:
9399 case 0x4B:
9400 case 0x4C:
9401 case 0x4D:
9402 case 0x4E:
9403 case 0x4F:
9404 case 0x50:
9405 case 0x51:
9406 case 0x52:
9407 case 0x53:
9408 case 0x54:
9409 case 0x55:
9410 case 0x56:
9411 case 0x57:
9412 {
9413 return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
9414 }
9415
9416 case 0x58: // Binary data (one-byte uint8_t for n follows)
9417 {
9418 std::uint8_t len{};
9419 return get_number(input_format_t::cbor, len) &&
9420 get_binary(input_format_t::cbor, len, result);
9421 }
9422
9423 case 0x59: // Binary data (two-byte uint16_t for n follow)
9424 {
9425 std::uint16_t len{};
9426 return get_number(input_format_t::cbor, len) &&
9427 get_binary(input_format_t::cbor, len, result);
9428 }
9429
9430 case 0x5A: // Binary data (four-byte uint32_t for n follow)
9431 {
9432 std::uint32_t len{};
9433 return get_number(input_format_t::cbor, len) &&
9434 get_binary(input_format_t::cbor, len, result);
9435 }

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected