-
Notifications
You must be signed in to change notification settings - Fork 47
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
QCBOREncode_Tell and QCBOREncode_SubString #251
Conversation
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.
Even with my comment above, the addition of QCBOREncode_RetrieveOutputStorage()
and QCBOREncode_Tell()
fits my needs.
* | ||
* See important usage WARNING in QCBOREncode_Tell() | ||
*/ | ||
UsefulBufC |
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.
Since this is the encoder side and the original buffer is mutable anyway, could this return a non-const UsefulBuf
?
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.
That would be counter to the UsefulBuf convention of UsefulBuf's with data always be const and empty buffers not const. I think that convention is upheld everywhere (including t_cose).
I don't mean to be pedantic about it, but I'd like to keep it as for consistency with the convention.
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.
That's fair and my need can use overall Tell offsets where modifying the encoded form is needed for efficiency.
This doesn't fully address #248. For the decoder there could be a public API similar to |
You want the thus-far-encoded CBOR, right? You can get that by passing 0 as the start to SubString(). Finish() can also be called multiple times, but it errors if there are open arrays or maps, where SubString doesn't. (If you look inside the implementation of Finish and SubString are almost the same too) Thanks for your feedback. |
Ahh, but you are talking about QCBORDecode() aren't you. That's fine. Got too focused on encode. |
Yes it didn't help that I had a typo in my comment. This is about a similar interface for the decoder. |
Address #247 and #248
(initial PR; testing still needed)