asn1c: How do I know how big a buffer to allocate before using ‘uper_encode_to_new_buffer’?

The following post is for the (repository:

There is no need to compute the space needed.

If you pass the address to a pointer that is NULL pointer as the last parameter of uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) , then it will allocate by itself the required space.

void *buffer = NULL;
asn_per_constraints_s *constraints = NULL;
ssize_t ec = uper_encode_to_new_buffer(&asn_DEF_Image, constraints, image, &buffer);

This post is also available in: Αγγλικα


Αυτός ο ιστότοπος χρησιμοποιεί το Akismet για να μειώσει τα ανεπιθύμητα σχόλια. Μάθετε πώς υφίστανται επεξεργασία τα δεδομένα των σχολίων σας.