11 #include "../arrays.h" 12 #include "../bytestrings.h" 13 #include "../floats_ctrls.h" 16 #include "../strings.h" 84 #define CHECK_RES do { if (res == NULL) { ctx->creation_failed = true; return; } } while (0) 169 if (new_handle == NULL) {
174 memcpy(new_handle, data, length);
220 if (new_handle == NULL) {
225 memcpy(new_handle, data, length);
void cbor_builder_float4_callback(void *context, float value)
void cbor_set_float4(cbor_item_t *item, float value)
Assigns a float value.
cbor_item_t * cbor_new_int64()
Allocates new integer with 8B width.
void cbor_set_float2(cbor_item_t *item, float value)
Assigns a float value.
bool syntax_error
Stack expectation mismatch.
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.
union cbor_item_metadata metadata
Discriminated by type.
void cbor_set_uint16(cbor_item_t *item, uint16_t value)
Assigns the integer value.
void cbor_builder_byte_string_callback(void *context, cbor_data data, size_t length)
void cbor_builder_uint32_callback(void *context, uint32_t value)
cbor_item_t * cbor_new_int8()
Allocates new integer with 1B width.
cbor_item_t * cbor_new_indefinite_bytestring()
Creates a new indefinite byte string.
cbor_item_t * cbor_new_indefinite_string()
Creates a new indefinite string.
void cbor_builder_uint8_callback(void *context, uint8_t value)
void cbor_decref(cbor_item_t **item_ref)
Decreases the reference count by one, deallocating the item if needed.
bool cbor_isa_string(const cbor_item_t *item)
Does the item have the appropriate major type?
void cbor_builder_uint64_callback(void *context, uint64_t value)
void cbor_builder_tag_callback(void *context, uint64_t value)
cbor_item_t * cbor_new_definite_bytestring()
Creates a new definite byte string.
bool cbor_isa_bytestring(const cbor_item_t *item)
Does the item have the appropriate major type?
void cbor_builder_float2_callback(void *context, float value)
void cbor_builder_indef_break_callback(void *context)
cbor_item_t * cbor_new_undef()
Constructs new under ctrl item.
void cbor_builder_negint8_callback(void *context, uint8_t value)
bool cbor_bytestring_is_indefinite(const cbor_item_t *item)
Is the byte string indefinite?
cbor_item_t * cbor_build_bool(bool value)
Constructs new boolean ctrl item.
void cbor_set_uint8(cbor_item_t *item, uint8_t value)
Assigns the integer value.
enum _cbor_unicode_status_error status
bool _cbor_map_add_key(cbor_item_t *item, cbor_item_t *key)
Add a key to the map.
cbor_item_t * cbor_new_indefinite_array()
Create new indefinite array.
cbor_type type
Major type discriminator.
void cbor_builder_negint16_callback(void *context, uint16_t value)
void cbor_mark_negint(cbor_item_t *item)
Marks the integer item as a negative integer.
High-level decoding context.
void cbor_builder_undefined_callback(void *context)
cbor_item_t * cbor_new_definite_string()
Creates a new definite string.
void _cbor_stack_pop(struct _cbor_stack *stack)
bool cbor_array_is_definite(const cbor_item_t *item)
Is the array definite?
void cbor_builder_null_callback(void *context)
bool cbor_array_push(cbor_item_t *array, cbor_item_t *pushee)
Append to the end.
void cbor_builder_string_start_callback(void *context)
void cbor_builder_array_start_callback(void *context, size_t size)
void cbor_set_uint32(cbor_item_t *item, uint32_t value)
Assigns the integer value.
void cbor_builder_string_callback(void *context, cbor_data data, size_t length)
cbor_item_t * cbor_new_float4()
Constructs a new float item.
bool cbor_bytestring_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the bytestring.
Signals unicode validation error and possibly its location.
void cbor_builder_indef_array_start_callback(void *context)
cbor_item_t * cbor_new_float8()
Constructs a new float item.
const unsigned char * cbor_data
size_t _cbor_unicode_codepoint_count(cbor_data source, size_t source_length, struct _cbor_unicode_status *status)
void cbor_mark_uint(cbor_item_t *item)
Marks the integer item as a positive integer.
struct _cbor_stack * stack
void cbor_set_float8(cbor_item_t *item, double value)
Assigns a float value.
bool cbor_map_is_definite(const cbor_item_t *item)
Is this map definite?
cbor_item_t * cbor_move(cbor_item_t *item)
Provides CPP-like move construct.
cbor_item_t * cbor_new_null()
Constructs new null ctrl item.
void cbor_builder_negint32_callback(void *context, uint32_t value)
void cbor_builder_negint64_callback(void *context, uint64_t value)
cbor_item_t * cbor_new_float2()
Constructs a new float item.
bool _cbor_map_add_value(cbor_item_t *item, cbor_item_t *value)
Add a value to the map.
void cbor_builder_float8_callback(void *context, double value)
void cbor_bytestring_set_handle(cbor_item_t *item, cbor_mutable_data CBOR_RESTRICT_POINTER data, size_t length)
Set the handle to the binary data.
bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the string.
cbor_item_t * cbor_new_definite_array(size_t size)
Create new definite array.
cbor_item_t * cbor_new_int32()
Allocates new integer with 4B width.
void _cbor_builder_append(cbor_item_t *item, struct _cbor_decoder_context *ctx)
void cbor_builder_map_start_callback(void *context, size_t size)
struct _cbor_stack_record * _cbor_stack_push(struct _cbor_stack *stack, cbor_item_t *item, size_t subitems)
void cbor_builder_boolean_callback(void *context, bool value)
cbor_item_t * cbor_new_indefinite_map()
Create a new indefinite map.
void cbor_builder_uint16_callback(void *context, uint16_t value)
void cbor_builder_byte_string_start_callback(void *context)
cbor_item_t * cbor_new_definite_map(size_t size)
Create a new definite map.
void cbor_builder_indef_map_start_callback(void *context)
void cbor_set_uint64(cbor_item_t *item, uint64_t value)
Assigns the integer value.
cbor_item_t * cbor_new_int16()
Allocates new integer with 2B width.
struct _cbor_stack_record * top
bool cbor_string_is_indefinite(const cbor_item_t *item)
Is the string indefinite?
bool creation_failed
Callback creating the last item has failed.