47 size_t len = strlen(val);
50 memcpy(handle, val, len);
60 memcpy(handle, val, length);
73 size_t codepoint_count =
105 size_t new_chunk_capacity =
111 if (new_chunks_data == NULL) {
116 data->
chunks = new_chunks_data;
_cbor_malloc_t _cbor_malloc
bool cbor_isa_string(const cbor_item_t *item)
Does the item have the appropriate major type?
cbor_item_t * cbor_incref(cbor_item_t *item)
Increases the item's reference count by one.
#define _CBOR_DEPENDENT_NOTNULL(cbor_item, pointer)
#define CBOR_RESTRICT_POINTER
#define _CBOR_NOTNULL(cbor_item)
@ CBOR_TYPE_STRING
3 - 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?
cbor_item_t * cbor_new_definite_string(void)
Creates a new definite string.
void cbor_string_set_handle(cbor_item_t *item, cbor_mutable_data data, size_t length)
Set the handle to the underlying string.
cbor_item_t * cbor_build_string(const char *val)
Creates a new string and initializes it.
bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the string.
cbor_item_t * cbor_new_indefinite_string(void)
Creates a new indefinite string.
size_t cbor_string_codepoint_count(const cbor_item_t *item)
The number of codepoints in this string.
cbor_item_t * cbor_build_stringn(const char *val, size_t length)
Creates a new string and initializes it.
size_t cbor_string_length(const cbor_item_t *item)
Returns the length of the underlying string in bytes.
bool cbor_string_is_indefinite(const cbor_item_t *item)
Is the string indefinite?
bool cbor_string_is_definite(const cbor_item_t *item)
Is the string definite?
cbor_item_t ** cbor_string_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
unsigned char * cbor_string_handle(const cbor_item_t *item)
Get the handle to the underlying string.
size_t cbor_string_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
Signals unicode validation error and possibly its location.
enum _cbor_unicode_status_error status
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.
size_t _cbor_unicode_codepoint_count(cbor_data source, size_t source_length, struct _cbor_unicode_status *status)