This repository was archived by the owner on Apr 9, 2020. It is now read-only.
Determine buffer size needed without encoding.#51
Open
sbertin-telular wants to merge 1 commit intocabo:masterfrom
Open
Determine buffer size needed without encoding.#51sbertin-telular wants to merge 1 commit intocabo:masterfrom
sbertin-telular wants to merge 1 commit intocabo:masterfrom
Conversation
If a NULL buffer is passed to cn_cbor_encoder_write, it will determine the necessary size of the buffer without doing the encoding. The buf_size parameter can still set an upper limit on the size.
sbertin-telular
commented
Apr 23, 2018
| ASSERT_NOT_NULL(cb); | ||
|
|
||
| enc_sz2 = cn_cbor_encoder_write(NULL, 0, sizeof(encoded), cb); | ||
| enc_sz = cn_cbor_encoder_write(encoded, 0, sizeof(encoded), cb); |
Author
There was a problem hiding this comment.
If #49 is merged, the size passed here could change to enc_sz2 to also test that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a NULL buffer is passed to cn_cbor_encoder_write, it will determine the necessary size of the buffer without doing the encoding. The buf_size parameter can still set an upper limit on the size.
This should address issue #24.