You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for binary data defined with the '!!binary' YAML tag #175
Hello,
would it be possible to implement a support for loading data defined using the YAML tag 'binary' defined here? Does the underlying libyaml library handle those tags in any way that can be leveraged in cyaml?
It would be nice to simply define a uint8_t pointer and size_t value in an user structure and have it automatically populated by this library without having to base64 decode it manually.
Once we have CYAML_BINARY, the YAML !!binary tag becomes redundant.
It would be simple to implement CYAML_BINARY in the same way as CYAML_SEQUENCE is implemented at the moment. However, CYAML_SEQUENCE has the limitation that you can't have a CYAML_SEQUENCE directly inside a CYAML_SEQUENCE. The same restriction would apply here, so a CYAML_BINARY would not be allowed directly inside a CYAML_SEQUENCE.
That means the following would not be possible:
- !!binary "DEADBEEF"- !!binary "CAFEF00D"
It would to be a sequence of mappings containing the binary data, for example:
Activity
tlsa commentedon Nov 16, 2021
That's a good idea, I could make a
CYAML_BINARYtype that does that.At the moment, it would load as a string, and you would need to base64 decode manually.
I'll have a bit more of a think about it and get back to you. I want to avoid breaking the ABI if I can.
tlsa commentedon Nov 16, 2021
Once we have
CYAML_BINARY, the YAML!!binarytag becomes redundant.It would be simple to implement
CYAML_BINARYin the same way asCYAML_SEQUENCEis implemented at the moment. However,CYAML_SEQUENCEhas the limitation that you can't have aCYAML_SEQUENCEdirectly inside aCYAML_SEQUENCE. The same restriction would apply here, so aCYAML_BINARYwould not be allowed directly inside aCYAML_SEQUENCE.That means the following would not be possible:
It would to be a sequence of mappings containing the binary data, for example:
This is because the mapping allows a structure to be used, which allows the data length to be stored in a structure.
So for an array of binaries, the client data structure would need to be something like:
tlsa commentedon Nov 14, 2026
Done in #237.