Make the comment for capn_size() clearer that it only applies to unpacked serialisation.

This commit is contained in:
Jason Heeris 2021-05-10 21:55:01 +08:00
parent bbc208cf04
commit a2179f48c8

View file

@ -276,9 +276,11 @@ void capn_init_malloc(struct capn *c);
int capn_init_fp(struct capn *c, FILE *f, int packed);
int capn_init_mem(struct capn *c, const uint8_t *p, size_t sz, int packed);
/* capn_size calculates the amount of memory required for the buffer passed to
* capn_write_mem. It does not calculate the size for packed serialization, but
* that will always be less than the unpacked size.
/* capn_size() calculates the amount of memory required to serialise the given
* Cap'n Proto structure in the unpacked format. It does NOT apply to packed
* serialisation, as that may (in rare cases) actually become bigger than the
* input. A buffer of this size can then be passed to capn_write_mem() without
* fear of truncation (again, only in the unpacked case).
*/
int capn_size(struct capn *c);