summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrimio <vasi.vilvoiu@gmail.com>2018-03-02 00:46:34 +0200
committerrimio <vasi.vilvoiu@gmail.com>2018-03-02 00:46:34 +0200
commit85f4b2274c7ed2107dd56329c3421c15272e67a5 (patch)
treeebfd50ded07ab0eebabcdd5208a3945c1816fbd0 /src
parente1c8564af2b02122e442503dd2c0fb77d2b935e4 (diff)
Small fix to arrays and maps; added test case answers
Diffstat (limited to 'src')
-rw-r--r--src/ecbor_decoder.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ecbor_decoder.c b/src/ecbor_decoder.c
index 437698d..249d04f 100644
--- a/src/ecbor_decoder.c
+++ b/src/ecbor_decoder.c
@@ -367,14 +367,14 @@ ecbor_decode_next_internal (ecbor_decode_context_t *context,
*/
case ECBOR_TYPE_ARRAY:
case ECBOR_TYPE_MAP:
- /* keep buffer pointer from current pointer */
- item->value.items = context->in_position;
-
/* discriminate between definite and indefinite maps and arrays */
if (additional == ECBOR_ADDITIONAL_INDEFINITE) {
/* mark accordingly */
item->is_indefinite = true;
item->size = 1; /* already processed first byte */
+
+ /* keep buffer pointer from current pointer */
+ item->value.items = context->in_position;
if (context->mode != ECBOR_MODE_DECODE_STREAMED) {
/* we have an indefinite map or array and we're not in streamed mode;
@@ -419,6 +419,9 @@ ecbor_decode_next_internal (ecbor_decode_context_t *context,
if (rc != ECBOR_OK) {
return rc;
}
+
+ /* keep buffer pointer from current pointer */
+ item->value.items = context->in_position;
if (item->type == ECBOR_TYPE_MAP) {
/* we keep the total number of items in length, yet the map has the