summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasile Vilvoiu <vasi@vilvoiu.ro>2021-11-28 17:49:05 +0200
committerVasile Vilvoiu <vasi@vilvoiu.ro>2021-11-28 17:49:05 +0200
commitb52bc66a8fca254100c6f5dad338add2cc5428e7 (patch)
treefb3c5788b2d922e08c604dfe6d89df29a82c4405
parent2a53efebd80d4687f3137345d5680e29a79f208b (diff)
Add documentation entries for new API.
-rw-r--r--README.md10
1 files 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
+```