tidy up the length manipulation functions in UsefulInputBuf
diff --git a/SpiffyDiffs.md b/SpiffyDiffs.md
new file mode 100644
index 0000000..64e53d4
--- /dev/null
+++ b/SpiffyDiffs.md
@@ -0,0 +1,2 @@
+# <#Title#>
+
diff --git a/inc/qcbor/UsefulBuf.h b/inc/qcbor/UsefulBuf.h
index 2c74f88..6fe33a1 100644
--- a/inc/qcbor/UsefulBuf.h
+++ b/inc/qcbor/UsefulBuf.h
@@ -1493,6 +1493,19 @@
/**
+ @brief Gets the input buffer length.
+
+ @param[in] pUInBuf Pointer to the @ref UsefulInputBuf.
+
+ @return The length of the input buffer.
+
+ This returns the length of th input buffer from UsefulInputBuf_Init()
+ of from UsefulInputBuf_SetBufferLength().
+ */
+static inline size_t UsefulInputBuf_GetBufferLength(UsefulInputBuf *pUInBuf);
+
+
+/**
@brief Sets the input buffer length (use with caution)
@param[in] pUInBuf Pointer to the @ref UsefulInputBuf.
@@ -1502,14 +1515,14 @@
to handle CBOR that is wrapped and embedded in CBOR.
Since this allows setting the length beyond the length of the
- original input buffer it allows the overall safety to
- be undermined.
+ original input buffer it allows the overall safety of UsefulInputBug to
+ be undermined. Use it carefully.
The new length given here should always be equal to or less than
the length given when UsefulInputBuf_Init() was called.
*/
-static void UsefulInputBuf_SetBufferLen(UsefulInputBuf *pUInBuf, size_t uNewLen);
+static void UsefulInputBuf_SetBufferLength(UsefulInputBuf *pUInBuf, size_t uNewLen);
/*----------------------------------------------------------
@@ -1934,7 +1947,7 @@
}
-static inline size_t UsefulInputBuf_GetLength(UsefulInputBuf *pMe)
+static inline size_t UsefulInputBuf_GetBufferLength(UsefulInputBuf *pMe)
{
return pMe->UB.len;
}
@@ -2153,7 +2166,7 @@
}
-static inline void UsefulInputBuf_SetBufferLen(UsefulInputBuf *pMe, size_t uNewLen)
+static inline void UsefulInputBuf_SetBufferLength(UsefulInputBuf *pMe, size_t uNewLen)
{
pMe->UB.len = uNewLen;
}
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index e903317..a34c1d0 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -3196,7 +3196,7 @@
*pBstr = pItem->val.string;
}
- const size_t uPreviousLength = UsefulInputBuf_GetLength(&(pMe->InBuf));
+ const size_t uPreviousLength = UsefulInputBuf_GetBufferLength(&(pMe->InBuf));
// Need to move UIB input cursor to the right place.
// Most of these calls are simple inline accessors so this doesn't
@@ -3207,7 +3207,7 @@
goto Done;
}
UsefulInputBuf_Seek(&(pMe->InBuf), uEndOfBstr - pItem->val.string.len);
- UsefulInputBuf_SetBufferLen(&(pMe->InBuf), uEndOfBstr);
+ UsefulInputBuf_SetBufferLength(&(pMe->InBuf), uEndOfBstr);
// Casts are OK because of checks against QCBOR_MAX_DECODE_INPUT_SIZE above.
uError = DecodeNesting_DescendIntoBstrWrapped(&(pMe->nesting),
@@ -3293,7 +3293,7 @@
Reset the length of the UsefulInputBuf to what it was before
the bstr wrapped CBOR was entered.
*/
- UsefulInputBuf_SetBufferLen(&(pMe->InBuf),
+ UsefulInputBuf_SetBufferLength(&(pMe->InBuf),
DecodeNesting_GetPreviousBoundedEnd(&(pMe->nesting)));