Skip to content
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

API to get data size needed to serialize cbor item #42

Closed
kyursen opened this issue Dec 21, 2016 · 1 comment
Closed

API to get data size needed to serialize cbor item #42

kyursen opened this issue Dec 21, 2016 · 1 comment

Comments

@kyursen
Copy link
Contributor

kyursen commented Dec 21, 2016

cbor_serialize returns 0 if data size was insufficient.

It would be useful to also get some report of how many more bytes should be supplied to finish serialization.

Or maybe additional function (something like size_t cbor_calculate(const cbor_item *)) should be added that calculates required data size.

cbor_serialize_alloc provides something similar, but it does it in another way. What I want is to alloc only once, and exactly as many bytes as it is required to store serialized data.

@PJK
Copy link
Owner

PJK commented Feb 19, 2023

cbor_serialized_size is available since v0.10 (#250)

@PJK PJK closed this as completed Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants