Skip to content

Commit

Permalink
Resolved support for indefinite array and map support
Browse files Browse the repository at this point in the history
  • Loading branch information
nagrawal63 committed Aug 20, 2020
1 parent 59bbe08 commit 0676032
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ bool nanocbor_at_end(const nanocbor_value_t *it)
if (_over_end(it) || /* Number of items exhausted */
/* Indefinite container and the current item is the end marker */
((nanocbor_container_indefinite(it) &&
*it->cur == (NANOCBOR_TYPE_FLOAT | NANOCBOR_SIZE_INDEFINITE))) ||
*it->cur == (NANOCBOR_TYPE_FLOAT << NANOCBOR_TYPE_OFFSET | NANOCBOR_VALUE_MASK))) ||
/* Or the remaining number of items is zero */
(nanocbor_in_container(it) && it->remaining == 0)
(!nanocbor_container_indefinite(it) && nanocbor_in_container(it) && it->remaining == 0)
) {
end = true;
}
Expand Down Expand Up @@ -226,7 +226,7 @@ int _enter_container(nanocbor_value_t *it, nanocbor_value_t *container,
container->end = it->end;
container->remaining = 0;

if (_value_match_exact(it, type | NANOCBOR_VALUE_MASK) == 1) {
if (_value_match_exact(it, (type << NANOCBOR_TYPE_OFFSET | NANOCBOR_SIZE_INDEFINITE)) == 1) {
container->flags = NANOCBOR_DECODER_FLAG_INDEFINITE |
NANOCBOR_DECODER_FLAG_CONTAINER;
container->cur = it->cur;
Expand Down

0 comments on commit 0676032

Please sign in to comment.