-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented decoding indefinite array #21
Conversation
Please rebase on latest master as this fixes the current CI issues in this PR. |
Also, please remove any commented code from your commits |
@Nishchay-sopho ping 😉 |
Yeah sure, I totally forgot about it 😅 . Will do the needful asap |
I would have expected to find the implementation in |
The latest commit resolves the issue #20 and also resolves indefinite map support. Testing :
On calling decode on this encoded buffer we get the following output:
|
You'll still need to do a |
Lint has still some issues, most of them should be fixed if you rebase. Maybe then @bergzand can take a look at this 😉 |
The lint check is giving a weird error:
More on it here All the variables in boolean operation Could you kindly let me know why this is happening? |
src/decoder.c
Outdated
@@ -279,7 +279,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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (_value_match_exact(it, (type << NANOCBOR_TYPE_OFFSET | NANOCBOR_SIZE_INDEFINITE)) == 1) { | |
if (_value_match_exact(it, (type << NANOCBOR_TYPE_OFFSET) | NANOCBOR_SIZE_INDEFINITE) == 1) { |
Does that help? (it makes it at least easier to parse for humans)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint is still not satisfied by this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I don't know either 😟 - maybe try casting it to (unsigned)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now lint is happy. This is so weird. The type
variable was already uint8_t
. 😕
Let me know if this works for you, I will then squash the commits to make them ready for merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's up to @bergzand to merge this though
Tested this locally, code looks good! Thanks for fixing |
This has the indefinite array implemented in it. Please let me know if there are any issues.