rename QCBOREncode_Finish and QCBOREncode_Finish2
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 70beff5..217a599 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -454,7 +454,7 @@
// calucate the length so buffer can be allocated correctly,
// and last with the buffer to do the actual encoding
do {
- QCBOREncode_Init(&ECtx, (UsefulBuf){*pEncoded, *pEncodedLen});
+ QCBOREncode_Init(&ECtx, (UsefulBuf){*pEncoded, *pEncodedLen});
QCBOREncode_OpenArray(&ECtx);
QCBOREncode_AddInt64(&ECtx, nInt1);
QCBOREncode_AddInt64(&ECtx, nInt2);
@@ -462,14 +462,16 @@
QCBOREncode_AddBytes(&ECtx, ((UsefulBufC) {"haven token", 11}));
QCBOREncode_CloseArray(&ECtx);
- if(QCBOREncode_Finish(&ECtx, pEncodedLen))
+ UsefulBufC Encoded;
+ if(QCBOREncode_Finish(&ECtx, &Encoded))
goto Done;
if(*pEncoded != NULL) {
+ *pEncodedLen = Encoded.len;
nReturn = 0;
goto Done;
}
- *pEncoded = malloc(*pEncodedLen);
+ *pEncoded = malloc(Encoded.len);
if(*pEncoded == NULL) {
nReturn = -1;
goto Done;