From b52bc66a8fca254100c6f5dad338add2cc5428e7 Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Sun, 28 Nov 2021 17:49:05 +0200 Subject: Add documentation entries for new API. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1bec0ca..09046b2 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,13 @@ ecbor_item_t item = ecbor_stop_code (); but the user must subsequently encode the correct amount of child items (for definite-size arrays and maps) or the stop code (for indefinite arrays and maps). -Once all the items have been encoded, the length of the output buffer can be obtained from `BUFFER_SIZE - context.bytes_left`. +Once all the items have been encoded, the length of the output buffer can be obtained either by calling +```c +size_t sz; +ecbor_error_t rc = ecbor_get_encoded_buffer_size(&context, &sz); +``` + +or by using the `ECBOR_GET_ENCODED_BUFFER_SIZE` macro. ### Decoder @@ -362,4 +368,4 @@ And finally, in order to retrieve the length of arrays, maps, strings: ```c ecbor_item_t item; size_t len = ECBOR_GET_LENGTH(&item) -``` \ No newline at end of file +``` -- cgit v1.2.3