66 memcpy(content, handle, length);
104 size_t new_chunk_capacity =
111 if (new_chunks_data == NULL) {
115 data->
chunks = new_chunks_data;
_cbor_malloc_t _cbor_malloc
bool cbor_bytestring_is_definite(const cbor_item_t *item)
Is the byte string definite?
bool cbor_bytestring_is_indefinite(const cbor_item_t *item)
Is the byte string indefinite?
cbor_item_t * cbor_new_definite_bytestring(void)
Creates a new definite byte string.
bool cbor_bytestring_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the bytestring.
size_t cbor_bytestring_length(const cbor_item_t *item)
Returns the length of the binary data.
cbor_item_t ** cbor_bytestring_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
cbor_item_t * cbor_new_indefinite_bytestring(void)
Creates a new indefinite byte string.
cbor_item_t * cbor_build_bytestring(cbor_data handle, size_t length)
Creates a new byte string and initializes it.
size_t cbor_bytestring_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
unsigned char * cbor_bytestring_handle(const cbor_item_t *item)
Get the handle to the binary data.
void cbor_bytestring_set_handle(cbor_item_t *item, cbor_mutable_data data, size_t length)
Set the handle to the binary data.
cbor_item_t * cbor_incref(cbor_item_t *item)
Increases the item's reference count by one.
bool cbor_isa_bytestring(const cbor_item_t *item)
Does the item have the appropriate major type?
#define _CBOR_DEPENDENT_NOTNULL(cbor_item, pointer)
#define CBOR_RESTRICT_POINTER
#define _CBOR_NOTNULL(cbor_item)
const unsigned char * cbor_data
@ CBOR_TYPE_BYTESTRING
2 - byte strings
@ _CBOR_METADATA_DEFINITE
@ _CBOR_METADATA_INDEFINITE
unsigned char * cbor_mutable_data
void * _cbor_realloc_multiple(void *pointer, size_t item_size, size_t item_count)
Overflow-proof contiguous array reallocation.
bool _cbor_safe_to_multiply(size_t a, size_t b)
Can a and b be multiplied without overflowing size_t?
Defines cbor_item_t::data structure for indefinite strings and bytestrings.
unsigned char * data
Raw data block - interpretation depends on metadata.
union cbor_item_metadata metadata
Discriminated by type.