rename config macro QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/README.md b/README.md
index 4f9906f..e8f51f4 100644
--- a/README.md
+++ b/README.md
@@ -275,7 +275,7 @@
carefully written to be defensive.
Disable features with defines like:
- QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA (saves about 400 bytes)
+ QCBOR_DISABLE_EXP_AND_MANTISSA (saves about 400 bytes)
QCBOR_DISABLE_ENCODE_USAGE_GUARDS (saves about 150), and
QCBOR_DISABLE_PREFERRED_FLOAT (saves about 900 bytes), and
QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS (saves about 400 bytes).
diff --git a/inc/qcbor/qcbor_common.h b/inc/qcbor/qcbor_common.h
index 853de87..d8021da 100644
--- a/inc/qcbor/qcbor_common.h
+++ b/inc/qcbor/qcbor_common.h
@@ -49,6 +49,14 @@
#define QCBOR_SPIFFY_DECODE
+/* It was originally defined as QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA,
+ * but this is incosistent with all the other QCBOR_DISABLE_
+ * #defines, so the name was changed and this was added for backwards
+ * compatibility
+ */
+#ifdef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#define QCBOR_DISABLE_EXP_AND_MANTISSA
+#endif
/* Standard CBOR Major type for positive integers of various lengths */
diff --git a/inc/qcbor/qcbor_decode.h b/inc/qcbor/qcbor_decode.h
index 63e94cb..1fcbc5d 100644
--- a/inc/qcbor/qcbor_decode.h
+++ b/inc/qcbor/qcbor_decode.h
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -318,7 +318,7 @@
UsefulBufC bigNum;
/** The integer value for unknown simple types. */
uint8_t uSimple;
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/** @anchor expAndMantissa
The value for bigfloats and decimal fractions. The use of the
@@ -348,7 +348,7 @@
UsefulBufC bigNum;
} Mantissa;
} expAndMantissa;
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
uint64_t uTagV; // Used internally during decoding
} val;
diff --git a/inc/qcbor/qcbor_encode.h b/inc/qcbor/qcbor_encode.h
index 884ddaa..ba654ee 100644
--- a/inc/qcbor/qcbor_encode.h
+++ b/inc/qcbor/qcbor_encode.h
@@ -920,7 +920,7 @@
UsefulBufC Bytes);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/**
@brief Add a decimal fraction to the encoded output.
@@ -1162,7 +1162,7 @@
UsefulBufC Mantissa,
bool bIsNegative,
int64_t nBase2Exponent);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/**
@@ -2392,7 +2392,7 @@
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
static inline void
QCBOREncode_AddTDecimalFraction(QCBOREncodeContext *pMe,
@@ -2685,7 +2685,7 @@
{
QCBOREncode_AddTBigFloatBigNumToMapN(pMe, nLabel, QCBOR_ENCODE_AS_TAG, Mantissa, bIsNegative, nBase2Exponent);
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
static inline void
diff --git a/inc/qcbor/qcbor_spiffy_decode.h b/inc/qcbor/qcbor_spiffy_decode.h
index d1a391d..8b90be5 100644
--- a/inc/qcbor/qcbor_spiffy_decode.h
+++ b/inc/qcbor/qcbor_spiffy_decode.h
@@ -1,7 +1,7 @@
/*============================================================================
qcbor_spiffy_decode.h -- higher-level easier-to-use CBOR decoding.
- Copyright (c) 2020, Laurence Lundblade. All rights reserved.
+ Copyright (c) 2020-2021, Laurence Lundblade. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
@@ -1074,7 +1074,7 @@
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/**
@brief Decode the next item as a decimal fraction.
@@ -1272,7 +1272,7 @@
UsefulBufC *pMantissa,
bool *pbMantissaIsNegative,
int64_t *pnExponent);
-#endif /* #ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* #ifndef QCBOR_DISABLE_EXP_AND_MANTISSA */
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 6b63eaa..76540c5 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -1987,7 +1987,7 @@
}
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/**
* @brief Decode decimal fractions and big floats.
*
@@ -2098,7 +2098,7 @@
Done:
return uReturn;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
@@ -2255,11 +2255,11 @@
} else if(uTagToProcess == CBOR_TAG_DATE_EPOCH) {
uReturn = DecodeDateEpoch(pDecodedItem);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
} else if(uTagToProcess == CBOR_TAG_DECIMAL_FRACTION ||
uTagToProcess == CBOR_TAG_BIGFLOAT) {
uReturn = QCBORDecode_MantissaAndExponent(pMe, pDecodedItem);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
} else if(uTagToProcess == CBOR_TAG_MIME ||
uTagToProcess == CBOR_TAG_BINARY_MIME) {
@@ -4008,7 +4008,7 @@
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
typedef QCBORError (*fExponentiator)(uint64_t uMantissa, int64_t nExponent, uint64_t *puResult);
@@ -4155,7 +4155,7 @@
return (*pfExp)(uMantissa, nExponent, puResult);
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
@@ -4393,7 +4393,7 @@
}
break;
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
case QCBOR_TYPE_DECIMAL_FRACTION:
if(uConvertTypes & QCBOR_CONVERT_TYPE_DECIMAL_FRACTION) {
return ExponentiateNN(pItem->val.expAndMantissa.Mantissa.nInt,
@@ -4483,7 +4483,7 @@
return QCBOR_ERR_UNEXPECTED_TYPE;
}
break;
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
default:
@@ -4738,7 +4738,7 @@
}
break;
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
case QCBOR_TYPE_DECIMAL_FRACTION:
if(uConvertTypes & QCBOR_CONVERT_TYPE_DECIMAL_FRACTION) {
@@ -4811,7 +4811,7 @@
return QCBOR_ERR_UNEXPECTED_TYPE;
}
break;
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
default:
return QCBOR_ERR_UNEXPECTED_TYPE;
}
@@ -5057,7 +5057,7 @@
*/
switch(pItem->uDataType) {
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
case QCBOR_TYPE_DECIMAL_FRACTION:
if(uConvertTypes & QCBOR_CONVERT_TYPE_DECIMAL_FRACTION) {
// Underflow gives 0, overflow gives infinity
@@ -5077,7 +5077,7 @@
return QCBOR_ERR_UNEXPECTED_TYPE;
}
break;
-#endif /* ndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ndef QCBOR_DISABLE_EXP_AND_MANTISSA */
case QCBOR_TYPE_POSBIGNUM:
if(uConvertTypes & QCBOR_CONVERT_TYPE_BIG_NUM) {
@@ -5095,7 +5095,7 @@
}
break;
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
case QCBOR_TYPE_DECIMAL_FRACTION_POS_BIGNUM:
if(uConvertTypes & QCBOR_CONVERT_TYPE_DECIMAL_FRACTION) {
double dMantissa = ConvertBigNumToDouble(pItem->val.expAndMantissa.Mantissa.bigNum);
@@ -5131,7 +5131,7 @@
return QCBOR_ERR_UNEXPECTED_TYPE;
}
break;
-#endif /* ndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ndef QCBOR_DISABLE_EXP_AND_MANTISSA */
default:
return QCBOR_ERR_UNEXPECTED_TYPE;
@@ -5228,7 +5228,7 @@
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
static inline UsefulBufC ConvertIntToBigNum(uint64_t uInt, UsefulBuf Buffer)
{
while((uInt & 0xff00000000000000UL) == 0) {
@@ -5779,4 +5779,4 @@
pnExponent);
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
diff --git a/src/qcbor_encode.c b/src/qcbor_encode.c
index 654bda9..59c420b 100644
--- a/src/qcbor_encode.c
+++ b/src/qcbor_encode.c
@@ -734,7 +734,7 @@
}
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
* Semi-public function. It is exposed to the user of the interface,
* but one of the inline wrappers will usually be called rather than
@@ -775,7 +775,7 @@
}
QCBOREncode_CloseArray(pMe);
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/*
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 689d275..6e1cc3b 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -3027,7 +3027,7 @@
4([1,3])
*/
uError = QCBORDecode_GetNext(&DCtx, &Item);
-#ifdef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifdef QCBOR_DISABLE_EXP_AND_MANTISSA
if(uError != QCBOR_SUCCESS ||
Item.uDataType != QCBOR_TYPE_ARRAY ||
!QCBORDecode_IsTagged(&DCtx, &Item, CBOR_TAG_DECIMAL_FRACTION) ||
@@ -3043,7 +3043,7 @@
uError = QCBORDecode_GetNext(&DCtx, &Item);
uError = QCBORDecode_GetNext(&DCtx, &Item);
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
if(uError != QCBOR_SUCCESS ||
Item.uDataType != QCBOR_TYPE_DECIMAL_FRACTION ||
QCBORDecode_GetNthTag(&DCtx, &Item, 0) != CBOR_TAG_INVALID64 ||
@@ -3053,7 +3053,7 @@
QCBORDecode_GetNthTag(&DCtx, &Item, 4) != CBOR_TAG_INVALID64 ) {
return -5;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/*
More than 4 tags on an item 225(226(227(228(229([])))))
@@ -4491,7 +4491,7 @@
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/* exponent, mantissa
[
@@ -4796,7 +4796,7 @@
struct FailInput));
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
@@ -5583,61 +5583,61 @@
"Decimal Fraction with positive bignum 257 * 10e3",
{(uint8_t[]){0xC4, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC2, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
257000,
QCBOR_SUCCESS,
257000,
QCBOR_SUCCESS,
257000.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"bigfloat with negative bignum -258 * 2e3",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC3, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
-2064,
QCBOR_SUCCESS,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-2064.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"bigfloat with positive bignum 257 * 2e3",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC2, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
2056,
QCBOR_SUCCESS,
2056,
QCBOR_SUCCESS,
2056.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"negative bignum 0xc349010000000000000000 -18446744073709551617",
@@ -5665,60 +5665,60 @@
"Decimal Fraction with neg bignum [9223372036854775807, -4759477275222530853137]",
{(uint8_t[]){0xC4, 0x82, 0x1B, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xC3, 0x4A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,}, 23},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"big float [9223372036854775806, 9223372036854775806]",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, 20},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"Big float 3 * 2^^2",
{(uint8_t[]){0xC5, 0x82, 0x02, 0x03}, 4},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
12,
QCBOR_SUCCESS,
12,
QCBOR_SUCCESS,
12.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"Positive integer 18446744073709551615",
@@ -5828,21 +5828,21 @@
{
"Decimal fraction 3/10",
{(uint8_t[]){0xC4, 0x82, 0x20, 0x03}, 4},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0.30000000000000004,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"+inifinity",
@@ -6004,21 +6004,21 @@
0xC5, 0x82,
0x3B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, 20},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
@@ -6027,21 +6027,21 @@
0xC5, 0x82,
0x1B, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC3, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
};
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index c2a4165..53f6bd2 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -247,7 +247,7 @@
int32_t SetUpAllocatorTest(void);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Test decoding of decimal fractions and big floats, both of which are
made up of an exponent and mantissa.
@@ -259,7 +259,7 @@
Hostile input tests for decimal fractions and big floats.
*/
int32_t ExponentAndMantissaDecodeFailTests(void);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
int32_t EnterMapTest(void);
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index c3e7315..6655aed 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -96,7 +96,7 @@
#endif
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Returns 0 if UsefulBufs are equal
Returns 1000000 + offeset if they are not equal.
@@ -130,7 +130,7 @@
return 0;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
// One big buffer that is used by all the tests to encode into
@@ -2513,7 +2513,7 @@
}
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
[
4([-1, 3]),
@@ -2711,7 +2711,7 @@
return 0;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
int32_t QCBORHeadTest()
diff --git a/test/qcbor_encode_tests.h b/test/qcbor_encode_tests.h
index e54168a..ae64f7d 100644
--- a/test/qcbor_encode_tests.h
+++ b/test/qcbor_encode_tests.h
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -165,13 +165,13 @@
int32_t CoseSign1TBSTest(void);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Test encoding of decimal fractions and big floats, both of which are
made up of an exponent and mantissa
*/
int32_t ExponentAndMantissaEncodeTests(void);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/*
diff --git a/test/run_tests.c b/test/run_tests.c
index 314525c..cc9c70b 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -1,7 +1,7 @@
/*==============================================================================
run_tests.c -- test aggregator and results reporting
- Copyright (c) 2018-2020, Laurence Lundblade. All rights reserved.
+ Copyright (c) 2018-2021, Laurence Lundblade. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
@@ -20,6 +20,12 @@
#include "UsefulBuf_Tests.h"
+
+// For size printing and some conditionals
+#include "qcbor/qcbor_encode.h"
+#include "qcbor/qcbor_decode.h"
+#include "qcbor/qcbor_spiffy_decode.h"
+
/*
Test configuration
*/
@@ -124,12 +130,12 @@
TEST_ENTRY(IntToTests),
TEST_ENTRY(DecodeTaggedTypeTests),
TEST_ENTRY(PeekAndRewindTest),
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
TEST_ENTRY(EncodeLengthThirtyoneTest),
TEST_ENTRY(ExponentAndMantissaDecodeTests),
TEST_ENTRY(ExponentAndMantissaDecodeFailTests),
TEST_ENTRY(ExponentAndMantissaEncodeTests),
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
TEST_ENTRY(ParseEmptyMapInMapTest),
};
@@ -296,10 +302,6 @@
}
-// For size printing
-#include "qcbor/qcbor_encode.h"
-#include "qcbor/qcbor_decode.h"
-#include "qcbor/qcbor_spiffy_decode.h"
/*