document disabling of encode guards
diff --git a/README.md b/README.md
index 1a01b42..906bf41 100644
--- a/README.md
+++ b/README.md
@@ -230,9 +230,9 @@
| | smallest | largest |
|---------------|----------|---------|
- | encode only | 900 | 2100 |
- | decode only | 2800 | 13500 |
- | combined | 3700 | 15600 |
+ | encode only | 850 | 2100 |
+ | decode only | 2900 | 13500 |
+ | combined | 3750 | 15600 |
From the table above, one can see that the amount of code pulled in
from the QCBOR library varies a lot, ranging from 1KB to 15KB. The
@@ -271,11 +271,10 @@
carefully written to be defensive.
Disable features with defines like
- QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA (saves about 400 bytes) and
+ QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA (saves about 400 bytes)
+ QCBOR_DISABLE_ENCODE_USAGE_GUARDS (saves about 150), and
QCBOR_DISABLE_PREFERRED_FLOAT (saves about 900 bytes). More of these
- defines are planned than are currently implemented (they are a little
- complex to implement because all the combination configurations must
- be tested).
+ defines are planned than are currently implemented.
If QCBOR is installed as a shared library, then of course only one
copy of the code is in memory no matter how many applications use it.
diff --git a/inc/qcbor/qcbor_encode.h b/inc/qcbor/qcbor_encode.h
index ae5027a..54a3635 100644
--- a/inc/qcbor/qcbor_encode.h
+++ b/inc/qcbor/qcbor_encode.h
@@ -229,6 +229,19 @@
[RFC 8742] (https://tools.ietf.org/html/rfc8742). This encoder supports
either just by whether the first item added is an array, map or other.
+ If QCBOR is compiled with QCBOR_DISABLE_ENCODE_USAGE_GUARDS defined,
+ the errors QCBOR_ERR_CLOSE_MISMATCH, QCBOR_ERR_ARRAY_TOO_LONG,
+ QCBOR_ERR_TOO_MANY_CLOSES, QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN, and
+ QCBOR_ERR_ENCODE_UNSUPPORTED will never be returned. It is up to the
+ caller to make sure that opened maps, arrays and byte-string wrapping
+ is closed correctly and that QCBOREncode_AddType7() is called
+ correctly. With this defined, it is easier to make a mistake when
+ authoring the encoding of a protocol that will output not well formed
+ CBOR, but as long as the calling code is correct, it is safe to
+ disable these checks. Bounds checking that prevents security issues
+ in the code is still enforced. This define reduces the size of
+ encoding object code by about 150 bytes.
+
@anchor Tags-Overview
## Tags Overview