ifdefs for disabling tests
diff --git a/inc/qcbor/qcbor_spiffy_decode.h b/inc/qcbor/qcbor_spiffy_decode.h
index 71ecd6d..748e110 100644
--- a/inc/qcbor/qcbor_spiffy_decode.h
+++ b/inc/qcbor/qcbor_spiffy_decode.h
@@ -745,8 +745,6 @@
sets the traversal cursor to the beginning of the one most recently
entered.
- TODO: implement this for byte strings.
-
If no map or array has been entered, this resets the
traversal cursor to the beginning of the input CBOR.
@@ -1532,6 +1530,9 @@
CBOR. QCBORDecode_ExitBstrWrapped() must be called to resume processing
CBOR outside the wrapped CBOR.
+ This does not (currently) work on indefinite-length strings. The
+ (confusing) error @ref QCBOR_ERR_INPUT_TOO_LARGE will be set.
+
If @c pBstr is not @c NULL the pointer and length of the wrapped
CBOR will be returned. This is usually not needed, but sometimes
useful, particularly in the case of verifying signed data like the
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 0056b6e..a8001e9 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -1771,7 +1771,7 @@
}
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
-
+
// Iterate until there is an error of some sort error
QCBORItem Item;
do {
@@ -6985,11 +6985,20 @@
/*
-An array of an integer and an array. The second array contains a bstr-wrapped map.
-
- [7, [h'A36D666972737420696E7465676572182A77616E206172726179206F662074776F20737472696E67738267737472696E673167737472696E67326C6D617020696E2061206D6170A467627974657320314478787878676279746573203244797979796B616E6F7468657220696E74186266746578742032781E6C6965732C2064616D6E206C69657320616E642073746174697374696373']]
-
- {"first integer": 42, "an array of two strings": ["string1", "string2"], "map in a map": {"bytes 1": h'78787878', "bytes 2": h'79797979', "another int": 98, "text 2": "lies, damn lies and statistics"}}
+ * An array of an integer and an array. The second array contains
+ * a bstr-wrapped map.
+ *
+ * [7, [h'A36D6669... (see next lines) 73']]
+ *
+ * {"first integer": 42,
+ * "an array of two strings": ["string1", "string2"],
+ * "map in a map":
+ * { "bytes 1": h'78787878',
+ * "bytes 2": h'79797979',
+ * "another int": 98,
+ * "text 2": "lies, damn lies and statistics"
+ * }
+ * }
*/
static const uint8_t pValidWrappedMapEncoded[] = {
@@ -7040,10 +7049,12 @@
static const uint8_t pWithEmptyMap[] = {0x82, 0x18, 0x64, 0xa0};
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
static const uint8_t pWithEmptyMapInDef[] = {0x9f, 0x18, 0x64, 0xbf, 0xff, 0xff};
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
-
-static const uint8_t yy[] = {
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+static const uint8_t pWrappedByIndefiniteLength[] = {
0x81,
0xd8, 0x18,
0x5f,
@@ -7053,6 +7064,8 @@
0x42, 0x18, 0x2C,
0xff
};
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
int32_t PeekAndRewindTest()
{
@@ -7579,6 +7592,7 @@
}
// Rewind an empty indefinite length map
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pWithEmptyMapInDef), 0);
QCBORDecode_EnterArray(&DCtx, NULL);
QCBORDecode_GetUInt64(&DCtx, &i);
@@ -7612,10 +7626,13 @@
if(QCBORDecode_GetError(&DCtx)){
return 7830;
}
-
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
// Rewind an indefnite length byte-string wrapped sequence
- QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(yy), 0);
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+ QCBORDecode_Init(&DCtx,
+ UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pWrappedByIndefiniteLength),
+ 0);
UsefulBuf_MAKE_STACK_UB(Pool, 100);
QCBORDecode_SetMemPool(&DCtx, Pool, 0);
@@ -7638,7 +7655,7 @@
if(i != 42) {
return 7220;
}*/
-
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
// Rewind an indefnite length byte-string wrapped sequence