Naming consistency for encode functions; organize deprecated encode functions
This adds encode-with-string-label functions with names ending in "SZ" so all encode-with-string-label functions end is "SZ".
The former functions that didn't end in "SZ" are retained for backwards compatibility.
All the deprecated encode functions are grouped together and so marked making it easier to read the documentation of the non-deprecated encode functions.
The deprecated functions will never be removed from QCBOR as they aren't that much of a burden, and backwards compatibility is critical.
* Encode function naming consistency for string labels
* more comment fixes; tests; small rearrangement
* switch everything to non-deprecated functions
* Remove line of kruft
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/example.c b/example.c
index ed5d597..a6a0a13 100644
--- a/example.c
+++ b/example.c
@@ -162,14 +162,14 @@
/* Proceed to output all the items, letting the internal error
* tracking do its work */
QCBOREncode_OpenMap(&EncodeCtx);
- QCBOREncode_AddTextToMap(&EncodeCtx, "Manufacturer", pEngine->Manufacturer);
- QCBOREncode_AddInt64ToMap(&EncodeCtx, "NumCylinders", pEngine->uNumCylinders);
- QCBOREncode_AddInt64ToMap(&EncodeCtx, "Displacement", pEngine->uDisplacement);
- QCBOREncode_AddInt64ToMap(&EncodeCtx, "Horsepower", pEngine->uHorsePower);
+ QCBOREncode_AddTextToMapSZ(&EncodeCtx, "Manufacturer", pEngine->Manufacturer);
+ QCBOREncode_AddInt64ToMapSZ(&EncodeCtx, "NumCylinders", pEngine->uNumCylinders);
+ QCBOREncode_AddInt64ToMapSZ(&EncodeCtx, "Displacement", pEngine->uDisplacement);
+ QCBOREncode_AddInt64ToMapSZ(&EncodeCtx, "Horsepower", pEngine->uHorsePower);
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
- QCBOREncode_AddDoubleToMap(&EncodeCtx, "DesignedCompression", pEngine->dDesignedCompresion);
+ QCBOREncode_AddDoubleToMapSZ(&EncodeCtx, "DesignedCompression", pEngine->dDesignedCompresion);
#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
- QCBOREncode_OpenArrayInMap(&EncodeCtx, "Cylinders");
+ QCBOREncode_OpenArrayInMapSZ(&EncodeCtx, "Cylinders");
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
for(int64_t i = 0 ; i < pEngine->uNumCylinders; i++) {
QCBOREncode_AddDouble(&EncodeCtx,
@@ -177,7 +177,7 @@
}
#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
QCBOREncode_CloseArray(&EncodeCtx);
- QCBOREncode_AddBoolToMap(&EncodeCtx, "Turbo", pEngine->bTurboCharged);
+ QCBOREncode_AddBoolToMapSZ(&EncodeCtx, "Turbo", pEngine->bTurboCharged);
QCBOREncode_CloseMap(&EncodeCtx);
/* Get the pointer and length of the encoded output. If there was