diff options
| author | rimio <vasi.vilvoiu@gmail.com> | 2018-02-27 23:03:16 +0200 |
|---|---|---|
| committer | rimio <vasi.vilvoiu@gmail.com> | 2018-02-27 23:03:16 +0200 |
| commit | 657b61d3a96c68c7f1882ceb0632ecfd6461fb51 (patch) | |
| tree | 4c1e772b6acdf4cc4d99af3db018f3e607dd57d0 /include | |
| parent | e0c212617784172a2bd73a456e43b53b1828ced5 (diff) | |
Fix storage size computation
Diffstat (limited to 'include')
| -rw-r--r-- | include/ecbor.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/ecbor.h b/include/ecbor.h index 1712537..c3befb8 100644 --- a/include/ecbor.h +++ b/include/ecbor.h @@ -37,6 +37,7 @@ typedef enum { ECBOR_ERR_END_OF_NODE_BUFFER = 51, ECBOR_ERR_EMPTY_NODE_BUFFER = 52, ECBOR_ERR_INDEX_OUT_OF_BOUNDS = 53, + ECBOR_ERR_WONT_RETURN_INDEFINITE = 54, /* semantic errors */ ECBOR_ERR_CURRENTLY_NOT_SUPPORTED = 100, @@ -86,15 +87,21 @@ typedef struct { uint64_t tag_value; const uint8_t *child; } tag; - const uint8_t *string; + struct { + const uint8_t *str; + uint64_t n_chunks; + } string; const uint8_t *items; } value; - /* storage size of value, in bytes */ + /* storage size (serialized) of item, in bytes */ uint64_t size; - /* number of chunks in value, in case it is indefinite */ - uint64_t n_chunks; + /* length of value; can mean different things: + * - payload (value) size, in bytes, for ints and strings + * - number of items in arrays and maps + */ + uint64_t length; /* non-zero if size is indefinite (for strings, maps and arrays) */ uint8_t is_indefinite; |
