Minor bug fix for QCBOREncode_GetErrorState()
diff --git a/src/qcbor_encode.c b/src/qcbor_encode.c
index c652f79..c6b2a6f 100644
--- a/src/qcbor_encode.c
+++ b/src/qcbor_encode.c
@@ -569,14 +569,12 @@
}
-
-
/*
Public functions to finish and get the encoded result. See header qcbor.h
*/
QCBORError QCBOREncode_Finish(QCBOREncodeContext *me, UsefulBufC *pEncodedCBOR)
{
- QCBORError uReturn = me->uError;
+ QCBORError uReturn = QCBOREncode_GetErrorState(me);
if(uReturn != QCBOR_SUCCESS) {
goto Done;
@@ -587,17 +585,6 @@
goto Done;
}
- if(UsefulOutBuf_GetError(&(me->OutBuf))) {
- // Items didn't fit in the buffer.
- // This check catches this condition for all the appends and inserts
- // so checks aren't needed when the appends and inserts are performed.
- // And of course UsefulBuf will never overrun the input buffer given
- // to it. No complex analysis of the error handling in this file is
- // needed to know that is true. Just read the UsefulBuf code.
- uReturn = QCBOR_ERR_BUFFER_TOO_SMALL;
- goto Done;
- }
-
*pEncodedCBOR = UsefulOutBuf_OutUBuf(&(me->OutBuf));
Done:
@@ -605,6 +592,7 @@
}
+
/*
Public functions to finish and get the encoded result. See header qcbor.h
*/