mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
tinycbor's grow-and-retry contract: on buffer overflow the encoder switches to counting mode and encoding must CONTINUE for cbor_encoder_get_extra_bytes_needed() to be accurate — a nested container's tally only reaches the parent via close_container. The old code returned false on the first CborErrorOutOfMemory, so a mid- container overflow could report extra == 0 and be misread as a genuine "value not representable" failure (returning nil), or undercount and churn through multiple resize passes. Add EncOk() (NoError or OutOfMemory = keep going) around every encode call; the retry loop now distinguishes real failures (return nil) from overflow (single complete-tally resize, retry).