43 size_t len = strlen(val);
45 memcpy(handle, val, len);
54 memcpy(handle, val, length);
96 if (new_chunks_data == NULL) {
100 data->
chunks = new_chunks_data;
struct cbor_item_t cbor_item_t
The item handle.
void cbor_string_set_handle(cbor_item_t *item, cbor_mutable_data CBOR_RESTRICT_POINTER data, size_t length)
Set the handle to the underlying string.
cbor_item_t * cbor_build_stringn(const char *val, size_t length)
Creates a new string and initializes it.
union cbor_item_metadata metadata
Discriminated by type.
unsigned char * cbor_string_handle(const cbor_item_t *item)
Get the handle to the underlying string.
void * _cbor_realloc_multiple(void *pointer, size_t item_size, size_t item_count)
Overflow-proof contiguous array reallocation.
cbor_item_t * cbor_new_indefinite_string()
Creates a new indefinite string.
bool cbor_isa_string(const cbor_item_t *item)
Does the item have the appropriate major type?
cbor_item_t ** cbor_string_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
#define CBOR_RESTRICT_POINTER
size_t refcount
Reference count - initialize to 0.
cbor_item_t * cbor_new_definite_string()
Creates a new definite string.
unsigned char * cbor_mutable_data
size_t cbor_string_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
cbor_item_t * cbor_incref(cbor_item_t *item)
Increases the reference count by one.
Defines cbor_item_t::data structure for indefinite strings and bytestrings.
cbor_item_t * cbor_build_string(const char *val)
Creates a new string and initializes it.
size_t cbor_string_codepoint_count(const cbor_item_t *item)
The number of codepoints in this string.
bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the string.
bool cbor_string_is_definite(const cbor_item_t *item)
Is the string definite?
unsigned char * data
Raw data block - interpretation depends on metadata.
size_t cbor_string_length(const cbor_item_t *item)
Returns the length of the underlying string.
bool _cbor_safe_to_multiply(size_t a, size_t b)
Can a and b be multiplied without overflowing size_t?
bool cbor_string_is_indefinite(const cbor_item_t *item)
Is the string indefinite?