make bitflags for integer conversion an enum
diff --git a/example.c b/example.c
index 473e989..99944ff 100644
--- a/example.c
+++ b/example.c
@@ -14,7 +14,7 @@
#include <stdio.h>
#include "example.h"
#include "qcbor/qcbor_encode.h"
-#include "qcbor/qcbor_decode.h"
+#include "qcbor/qcbor_main_decode.h"
#include "qcbor/qcbor_spiffy_decode.h"
#include "qcbor/qcbor_number_decode.h"
diff --git a/inc/qcbor/qcbor_number_decode.h b/inc/qcbor/qcbor_number_decode.h
index d431c4f..9d2615d 100644
--- a/inc/qcbor/qcbor_number_decode.h
+++ b/inc/qcbor/qcbor_number_decode.h
@@ -31,21 +31,32 @@
* @file qcbor_number_decode.h
*/
-/** Conversion will proceed if the CBOR item to be decoded is an
- * integer or either type 0 (unsigned) or type 1 (negative). */
-#define QCBOR_CONVERT_TYPE_XINT64 0x01
-/** Conversion will proceed if the CBOR item to be decoded is either
- * double, single or half-precision floating-point (major type 7). */
-#define QCBOR_CONVERT_TYPE_FLOAT 0x02
-/** Conversion will proceed if the CBOR item to be decoded is a big
- * number, positive or negative (tag 2 or tag 3). */
-#define QCBOR_CONVERT_TYPE_BIG_NUM 0x04
-/** Conversion will proceed if the CBOR item to be decoded is a
- * decimal fraction (tag 4). */
-#define QCBOR_CONVERT_TYPE_DECIMAL_FRACTION 0x08
-/** Conversion will proceed if the CBOR item to be decoded is a big
- * float (tag 5). */
-#define QCBOR_CONVERT_TYPE_BIGFLOAT 0x10
+
+/** Bit flags to indicate what types of number conversions should be
+ performed. */
+enum QCBORDecodeNumberConvert {
+
+ /** Conversion will proceed if the CBOR item to be decoded is an
+ * integer or either type 0 (unsigned) or type 1 (negative). */
+ QCBOR_CONVERT_TYPE_XINT64 = 0x01,
+
+ /** Conversion will proceed if the CBOR item to be decoded is
+ * either double, single or half-precision floating-point (major
+ * type 7). */
+ QCBOR_CONVERT_TYPE_FLOAT = 0x02,
+
+ /** Conversion will proceed if the CBOR item to be decoded is a
+ * big number, positive or negative (tag 2 or tag 3). */
+ QCBOR_CONVERT_TYPE_BIG_NUM = 0x04,
+
+ /** Conversion will proceed if the CBOR item to be decoded is a
+ * decimal fraction (tag 4). */
+ QCBOR_CONVERT_TYPE_DECIMAL_FRACTION = 0x08,
+
+ /** Conversion will proceed if the CBOR item to be decoded is a
+ * big float (tag 5). */
+ QCBOR_CONVERT_TYPE_BIGFLOAT = 0x10
+};
@@ -90,7 +101,7 @@
* @brief Decode next item into a signed 64-bit integer with basic conversions.
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue The returned 64-bit signed integer.
*
* @c uConvertTypes controls what conversions this will perform and
@@ -124,21 +135,21 @@
* object code to your executable.
*/
static void
-QCBORDecode_GetInt64Convert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64Convert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
static void
-QCBORDecode_GetInt64ConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64ConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
static void
-QCBORDecode_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
@@ -147,7 +158,7 @@
* @brief Decode next item into a signed 64-bit integer with conversions.
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue The returned 64-bit signed integer.
*
* This is the same as QCBORDecode_GetInt64Convert() but additionally
@@ -181,21 +192,21 @@
* number types this decodes are tags).
*/
void
-QCBORDecode_GetInt64ConvertAll(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64ConvertAll(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
void
-QCBORDecode_GetInt64ConvertAllInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64ConvertAllInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
void
-QCBORDecode_GetInt64ConvertAllInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue);
+QCBORDecode_GetInt64ConvertAllInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue);
/**
@@ -234,7 +245,7 @@
* conversions.
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] puValue The returned 64-bit unsigned integer.
*
* This is the same as QCBORDecode_GetInt64Convert(), but returns an
@@ -255,28 +266,28 @@
* QCBORDecode_GetUInt64ConvertAll().
*/
static void
-QCBORDecode_GetUInt64Convert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64Convert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
static void
-QCBORDecode_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
static void
-QCBORDecode_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
/**
* @brief Decode next item into an unsigned 64-bit integer with conversions
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes TSee @ref QCBORDecodeNumberConvert.
* @param[out] puValue The returned 64-bit unsigned integer.
*
* This is the same as QCBORDecode_GetInt64ConvertAll(), but returns
@@ -286,21 +297,21 @@
* See also QCBORDecode_GetUInt64() and QCBORDecode_GetUInt64Convert().
*/
void
-QCBORDecode_GetUInt64ConvertAll(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64ConvertAll(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
void
-QCBORDecode_GetUInt64ConvertAllInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64ConvertAllInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
void
-QCBORDecode_GetUInt64ConvertAllInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue);
+QCBORDecode_GetUInt64ConvertAllInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue);
@@ -346,7 +357,7 @@
* @brief Decode next item into a double floating-point with basic conversion.
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The returned floating-point value.
*
* This will decode CBOR integer and floating-point numbers, returning
@@ -375,28 +386,28 @@
* See also QCBORDecode_GetDouble() and QCBORDecode_GetDoubleConvertAll().
*/
static void
-QCBORDecode_GetDoubleConvert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
static void
-QCBORDecode_GetDoubleConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
static void
-QCBORDecode_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
/**
* @brief Decode next item as a double floating-point value with conversion.
*
* @param[in] pCtx The decode context.
- * @param[in] uConvertTypes The integer conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The returned floating-point value.
*
* This is the same as QCBORDecode_GetDoubleConvert() but supports
@@ -416,21 +427,21 @@
* See also QCBORDecode_GetDoubleConvert() and QCBORDecode_GetDoubleConvert().
*/
void
-QCBORDecode_GetDoubleConvertAll(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvertAll(QCBORDecodeContext *pCtx,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
void
-QCBORDecode_GetDoubleConvertAllInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvertAllInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
void
-QCBORDecode_GetDoubleConvertAllInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- double *pdValue);
+QCBORDecode_GetDoubleConvertAllInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue);
#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
/**
@@ -1410,92 +1421,92 @@
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetUInt64Convert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- uint64_t *puValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetUInt64Convert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- uint64_t *puValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetInt64Convert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- int64_t *pnValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetInt64Convert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetInt64ConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetInt64ConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- int64_t *pnValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue,
+ QCBORItem *pItem);
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetDoubleConvert(QCBORDecodeContext *pCtx,
- uint32_t uConvertTypes,
- double *pValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetDoubleConvert(QCBORDecodeContext *pCtx,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetDoubleConvertInMapN(QCBORDecodeContext *pCtx,
- int64_t nLabel,
- uint32_t uConvertTypes,
- double *pdValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetDoubleConvertInMapN(QCBORDecodeContext *pCtx,
+ int64_t nLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue,
+ QCBORItem *pItem);
/* Semi-private. See qcbor_number_decode.c */
void
-QCBORDecode_Private_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
- const char *szLabel,
- uint32_t uConvertTypes,
- double *pdValue,
- QCBORItem *pItem);
+QCBORDecode_Private_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
+ const char *szLabel,
+ enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue,
+ QCBORItem *pItem);
#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
static inline void
-QCBORDecode_GetUInt64Convert(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64Convert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
QCBORDecode_Private_GetUInt64Convert(pMe, uConvertTypes, puValue, &Item);
}
static inline void
-QCBORDecode_GetUInt64ConvertInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64ConvertInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
QCBORDecode_Private_GetUInt64ConvertInMapN(pMe,
@@ -1506,10 +1517,10 @@
}
static inline void
-QCBORDecode_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
QCBORDecode_Private_GetUInt64ConvertInMapSZ(pMe,
@@ -1550,19 +1561,19 @@
static inline void
-QCBORDecode_GetInt64Convert(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64Convert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
QCBORDecode_Private_GetInt64Convert(pMe, uConvertTypes, pnValue, &Item);
}
static inline void
-QCBORDecode_GetInt64ConvertInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64ConvertInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
QCBORDecode_Private_GetInt64ConvertInMapN(pMe,
@@ -1573,10 +1584,10 @@
}
static inline void
-QCBORDecode_GetInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
QCBORDecode_Private_GetInt64ConvertInMapSZ(pMe,
@@ -1618,19 +1629,19 @@
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
static inline void
-QCBORDecode_GetDoubleConvert(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
QCBORDecode_Private_GetDoubleConvert(pMe, uConvertTypes, pdValue, &Item);
}
static inline void
-QCBORDecode_GetDoubleConvertInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvertInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
QCBORDecode_Private_GetDoubleConvertInMapN(pMe,
@@ -1641,10 +1652,10 @@
}
static inline void
-QCBORDecode_GetDoubleConvertInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvertInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
QCBORDecode_Private_GetDoubleConvertInMapSZ(pMe,
diff --git a/src/qcbor_number_decode.c b/src/qcbor_number_decode.c
index 912d2f2..17bb300 100644
--- a/src/qcbor_number_decode.c
+++ b/src/qcbor_number_decode.c
@@ -88,7 +88,7 @@
* @brief Convert integers and floats to an int64_t.
*
* @param[in] pItem The item to convert.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue The resulting converted value.
*
* @retval QCBOR_ERR_UNEXPECTED_TYPE Conversion, possible, but not requested
@@ -98,9 +98,9 @@
* or too small.
*/
static QCBORError
-QCBOR_Private_ConvertInt64(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBOR_Private_ConvertInt64(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
switch(pItem->uDataType) {
case QCBOR_TYPE_FLOAT:
@@ -169,17 +169,17 @@
* @brief Almost-public method to decode a number and convert to int64_t (semi-private).
*
* @param[in] pMe The decode context.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
* See QCBORDecode_GetInt64Convert().
*/
void
-QCBORDecode_Private_GetInt64Convert(QCBORDecodeContext *pMe,
- uint32_t uConvertTypes,
- int64_t *pnValue,
- QCBORItem *pItem)
+QCBORDecode_Private_GetInt64Convert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue,
+ QCBORItem *pItem)
{
QCBORDecode_VGetNext(pMe, pItem);
if(pMe->uLastError) {
@@ -196,7 +196,7 @@
*
* @param[in] pMe The decode context.
* @param[in] nLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -204,8 +204,8 @@
*/
void
QCBORDecode_Private_GetInt64ConvertInMapN(QCBORDecodeContext *pMe,
- int64_t nLabel,
- uint32_t uConvertTypes,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
int64_t *pnValue,
QCBORItem *pItem)
{
@@ -224,7 +224,7 @@
*
* @param[in] pMe The decode context.
* @param[in] szLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -232,8 +232,8 @@
*/
void
QCBORDecode_Private_GetInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
- const char * szLabel,
- uint32_t uConvertTypes,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
int64_t *pnValue,
QCBORItem *pItem)
{
@@ -252,7 +252,7 @@
* @brief Convert many number types to an uint64_t.
*
* @param[in] pItem The item to convert.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] puValue The resulting converted value.
*
* @retval QCBOR_ERR_UNEXPECTED_TYPE Conversion, possible, but not requested
@@ -262,9 +262,9 @@
* or too small.
*/
static QCBORError
-QCBOR_Private_ConvertUInt64(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBOR_Private_ConvertUInt64(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
switch(pItem->uDataType) {
case QCBOR_TYPE_DOUBLE:
@@ -355,17 +355,17 @@
* @brief Almost-public method to decode a number and convert to uint64_t (semi-private).
*
* @param[in] pMe The decode context.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] puValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
* See QCBORDecode_GetUInt64Convert().
*/
void
-QCBORDecode_Private_GetUInt64Convert(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- uint64_t *puValue,
- QCBORItem *pItem)
+QCBORDecode_Private_GetUInt64Convert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue,
+ QCBORItem *pItem)
{
QCBORDecode_VGetNext(pMe, pItem);
if(pMe->uLastError) {
@@ -383,7 +383,7 @@
*
* @param[in] pMe The decode context.
* @param[in] nLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes BSee @ref QCBORDecodeNumberConvert.
* @param[out] puValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -392,7 +392,7 @@
void
QCBORDecode_Private_GetUInt64ConvertInMapN(QCBORDecodeContext *pMe,
const int64_t nLabel,
- const uint32_t uConvertTypes,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
uint64_t *puValue,
QCBORItem *pItem)
{
@@ -412,7 +412,7 @@
*
* @param[in] pMe The decode context.
* @param[in] szLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] puValue Result of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -421,7 +421,7 @@
void
QCBORDecode_Private_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pMe,
const char *szLabel,
- const uint32_t uConvertTypes,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
uint64_t *puValue,
QCBORItem *pItem)
{
@@ -441,7 +441,7 @@
* @brief Basic conversions to a double.
*
* @param[in] pItem The item to convert
- * @param[in] uConvertTypes Bit flags indicating source types for conversion
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The value converted to a double
*
* This does the conversions that don't need much object code,
@@ -451,9 +451,9 @@
* of conversions.
*/
static QCBORError
-QCBOR_Private_ConvertDouble(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBOR_Private_ConvertDouble(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
switch(pItem->uDataType) {
case QCBOR_TYPE_FLOAT:
@@ -538,10 +538,10 @@
* See QCBORDecode_GetDoubleConvert().
*/
void
-QCBORDecode_Private_GetDoubleConvert(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- double *pdValue,
- QCBORItem *pItem)
+QCBORDecode_Private_GetDoubleConvert(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue,
+ QCBORItem *pItem)
{
QCBORDecode_VGetNext(pMe, pItem);
if(pMe->uLastError) {
@@ -559,7 +559,7 @@
*
* @param[in] pMe The decode context.
* @param[in] nLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The output of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -568,7 +568,7 @@
void
QCBORDecode_Private_GetDoubleConvertInMapN(QCBORDecodeContext *pMe,
const int64_t nLabel,
- const uint32_t uConvertTypes,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
double *pdValue,
QCBORItem *pItem)
{
@@ -588,7 +588,7 @@
*
* @param[in] pMe The decode context.
* @param[in] szLabel Label to find in map.
- * @param[in] uConvertTypes Bit mask list of conversion options
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The output of the conversion.
* @param[in,out] pItem Temporary space to store Item, returned item.
*
@@ -597,7 +597,7 @@
void
QCBORDecode_Private_GetDoubleConvertInMapSZ(QCBORDecodeContext *pMe,
const char *szLabel,
- const uint32_t uConvertTypes,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
double *pdValue,
QCBORItem *pItem)
{
@@ -1173,7 +1173,7 @@
* @brief Convert many number types to an int64_t.
*
* @param[in] pItem The item to convert.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pnValue The resulting converted value.
*
* @retval QCBOR_ERR_UNEXPECTED_TYPE Conversion, possible, but not requested
@@ -1183,9 +1183,9 @@
* or too small.
*/
static QCBORError
-QCBOR_Private_Int64ConvertAll(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBOR_Private_Int64ConvertAll(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
switch(pItem->uDataType) {
@@ -1306,9 +1306,9 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetInt64ConvertAll(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64ConvertAll(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
@@ -1332,10 +1332,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetInt64ConvertAllInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64ConvertAllInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
@@ -1363,10 +1363,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetInt64ConvertAllInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- int64_t *pnValue)
+QCBORDecode_GetInt64ConvertAllInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ int64_t *pnValue)
{
QCBORItem Item;
QCBORDecode_Private_GetInt64ConvertInMapSZ(pMe,
@@ -1396,7 +1396,7 @@
* @brief Convert many number types to an unt64_t.
*
* @param[in] pItem The item to convert.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] puValue The resulting converted value.
*
* @retval QCBOR_ERR_UNEXPECTED_TYPE Conversion, possible, but not requested
@@ -1406,9 +1406,9 @@
* or too small.
*/
static QCBORError
-QCBOR_Private_UInt64ConvertAll(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBOR_Private_UInt64ConvertAll(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
switch(pItem->uDataType) { /* -Wmaybe-uninitialized falsly warns here */
@@ -1511,9 +1511,9 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetUInt64ConvertAll(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64ConvertAll(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
@@ -1537,10 +1537,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetUInt64ConvertAllInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64ConvertAllInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
@@ -1568,10 +1568,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetUInt64ConvertAllInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- uint64_t *puValue)
+QCBORDecode_GetUInt64ConvertAllInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ uint64_t *puValue)
{
QCBORItem Item;
QCBORDecode_Private_GetUInt64ConvertInMapSZ(pMe,
@@ -1603,7 +1603,7 @@
* @brief Convert many number types to a double.
*
* @param[in] pItem The item to convert.
- * @param[in] uConvertTypes Bit mask list of conversion options.
+ * @param[in] uConvertTypes See @ref QCBORDecodeNumberConvert.
* @param[out] pdValue The resulting converted value.
*
* @retval QCBOR_ERR_UNEXPECTED_TYPE Conversion, possible, but not requested
@@ -1613,9 +1613,9 @@
* or too small.
*/
static QCBORError
-QCBOR_Private_DoubleConvertAll(const QCBORItem *pItem,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBOR_Private_DoubleConvertAll(const QCBORItem *pItem,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
#ifndef QCBOR_DISABLE_FLOAT_HW_USE
/*
@@ -1719,9 +1719,9 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetDoubleConvertAll(QCBORDecodeContext *pMe,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvertAll(QCBORDecodeContext *pMe,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
@@ -1746,10 +1746,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetDoubleConvertAllInMapN(QCBORDecodeContext *pMe,
- const int64_t nLabel,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvertAllInMapN(QCBORDecodeContext *pMe,
+ const int64_t nLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
@@ -1776,10 +1776,10 @@
/* Public function, see qcbor/qcbor_number_decode.h */
void
-QCBORDecode_GetDoubleConvertAllInMapSZ(QCBORDecodeContext *pMe,
- const char *szLabel,
- const uint32_t uConvertTypes,
- double *pdValue)
+QCBORDecode_GetDoubleConvertAllInMapSZ(QCBORDecodeContext *pMe,
+ const char *szLabel,
+ const enum QCBORDecodeNumberConvert uConvertTypes,
+ double *pdValue)
{
QCBORItem Item;
QCBORDecode_Private_GetDoubleConvertInMapSZ(pMe,
diff --git a/src/qcbor_tag_decode.c b/src/qcbor_tag_decode.c
index 46da8a9..1b8fa8c 100644
--- a/src/qcbor_tag_decode.c
+++ b/src/qcbor_tag_decode.c
@@ -11,7 +11,7 @@
* ========================================================================== */
#include "qcbor/qcbor_tag_decode.h"
-#include "qcbor/qcbor_spiffy_decode.h"
+#include "qcbor/qcbor_spiffy_decode.h" /* For MapSearch and exit bounded */
#include "decode_nesting.h"
#include <math.h> /* For isnan() */
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 99d2643..bc6f3c1 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -33,7 +33,7 @@
#include "qcbor_decode_tests.h"
#include "qcbor/qcbor_encode.h"
-#include "qcbor/qcbor_decode.h"
+#include "qcbor/qcbor_main_decode.h"
#include "qcbor/qcbor_spiffy_decode.h"
#include "qcbor/qcbor_number_decode.h"
#include "qcbor/qcbor_tag_decode.h"