Merge branch 'master' into DecodeTidy
diff --git a/QCBOR.xcodeproj/project.pbxproj b/QCBOR.xcodeproj/project.pbxproj
index 9733eb7..783af79 100644
--- a/QCBOR.xcodeproj/project.pbxproj
+++ b/QCBOR.xcodeproj/project.pbxproj
@@ -69,6 +69,19 @@
 		E7FDBF0E256C969D007138A8 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
 		E7FDBF0F256C969D007138A8 /* example.c in Sources */ = {isa = PBXBuildFile; fileRef = E743D0E124AC516D0017899F /* example.c */; };
 		E7FDBF10256C969D007138A8 /* UsefulBuf_Tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEBC216DE31700BA646B /* UsefulBuf_Tests.c */; };
+		E7FDBF1A257A6C1F007138A8 /* qcbor_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08C214AE07400E67947 /* qcbor_encode.c */; };
+		E7FDBF1B257A6C1F007138A8 /* ieee754.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57582161CA690080D658 /* ieee754.c */; };
+		E7FDBF1C257A6C1F007138A8 /* qcbor_err_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = E7864765252CE63100A0C11B /* qcbor_err_to_str.c */; };
+		E7FDBF1D257A6C1F007138A8 /* half_to_double_from_rfc7049.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575D2161CA7C0080D658 /* half_to_double_from_rfc7049.c */; };
+		E7FDBF1E257A6C1F007138A8 /* run_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57632161F8F70080D658 /* run_tests.c */; };
+		E7FDBF1F257A6C1F007138A8 /* qcbor_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08E214AE07500E67947 /* qcbor_decode.c */; };
+		E7FDBF20257A6C1F007138A8 /* float_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575A2161CA7C0080D658 /* float_tests.c */; };
+		E7FDBF21257A6C1F007138A8 /* qcbor_decode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB5216CE6CA00BA646B /* qcbor_decode_tests.c */; };
+		E7FDBF22257A6C1F007138A8 /* UsefulBuf.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08D214AE07500E67947 /* UsefulBuf.c */; };
+		E7FDBF23257A6C1F007138A8 /* qcbor_encode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB8216DC7AD00BA646B /* qcbor_encode_tests.c */; };
+		E7FDBF24257A6C1F007138A8 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
+		E7FDBF25257A6C1F007138A8 /* example.c in Sources */ = {isa = PBXBuildFile; fileRef = E743D0E124AC516D0017899F /* example.c */; };
+		E7FDBF26257A6C1F007138A8 /* UsefulBuf_Tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEBC216DE31700BA646B /* UsefulBuf_Tests.c */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -117,6 +130,15 @@
 			);
 			runOnlyForDeploymentPostprocessing = 1;
 		};
+		E7FDBF28257A6C1F007138A8 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
@@ -157,6 +179,7 @@
 		E78C91E0240C90C100F4CECE /* qcbor_private.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_private.h; path = inc/qcbor/qcbor_private.h; sourceTree = "<group>"; tabWidth = 3; };
 		E78C91E1240C90C100F4CECE /* qcbor_encode.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_encode.h; path = inc/qcbor/qcbor_encode.h; sourceTree = "<group>"; tabWidth = 3; };
 		E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = QCBOR_Disable_Indef; sourceTree = BUILT_PRODUCTS_DIR; };
+		E7FDBF2C257A6C1F007138A8 /* QCBOR_Disable_Indef_array */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = QCBOR_Disable_Indef_array; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -195,6 +218,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		E7FDBF27257A6C1F007138A8 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
@@ -230,6 +260,7 @@
 				E743D11B24DD4EF50017899F /* QCBOR_Disable_HW_Float */,
 				E743D13124DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
 				E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */,
+				E7FDBF2C257A6C1F007138A8 /* QCBOR_Disable_Indef_array */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -369,6 +400,23 @@
 			productReference = E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */;
 			productType = "com.apple.product-type.tool";
 		};
+		E7FDBF18257A6C1F007138A8 /* QCBOR_Disable_Indef_array */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = E7FDBF29257A6C1F007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef_array" */;
+			buildPhases = (
+				E7FDBF19257A6C1F007138A8 /* Sources */,
+				E7FDBF27257A6C1F007138A8 /* Frameworks */,
+				E7FDBF28257A6C1F007138A8 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = QCBOR_Disable_Indef_array;
+			productName = QCBOR;
+			productReference = E7FDBF2C257A6C1F007138A8 /* QCBOR_Disable_Indef_array */;
+			productType = "com.apple.product-type.tool";
+		};
 /* End PBXNativeTarget section */
 
 /* Begin PBXProject section */
@@ -401,6 +449,7 @@
 				E743D10924DD4EF50017899F /* QCBOR_Disable_HW_Float */,
 				E743D11E24DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
 				E7FDBF02256C969D007138A8 /* QCBOR_Disable_Indef */,
+				E7FDBF18257A6C1F007138A8 /* QCBOR_Disable_Indef_array */,
 			);
 		};
 /* End PBXProject section */
@@ -503,6 +552,26 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		E7FDBF19257A6C1F007138A8 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E7FDBF1A257A6C1F007138A8 /* qcbor_encode.c in Sources */,
+				E7FDBF1B257A6C1F007138A8 /* ieee754.c in Sources */,
+				E7FDBF1C257A6C1F007138A8 /* qcbor_err_to_str.c in Sources */,
+				E7FDBF1D257A6C1F007138A8 /* half_to_double_from_rfc7049.c in Sources */,
+				E7FDBF1E257A6C1F007138A8 /* run_tests.c in Sources */,
+				E7FDBF1F257A6C1F007138A8 /* qcbor_decode.c in Sources */,
+				E7FDBF20257A6C1F007138A8 /* float_tests.c in Sources */,
+				E7FDBF21257A6C1F007138A8 /* qcbor_decode_tests.c in Sources */,
+				E7FDBF22257A6C1F007138A8 /* UsefulBuf.c in Sources */,
+				E7FDBF23257A6C1F007138A8 /* qcbor_encode_tests.c in Sources */,
+				E7FDBF24257A6C1F007138A8 /* cmd_line_main.c in Sources */,
+				E7FDBF25257A6C1F007138A8 /* example.c in Sources */,
+				E7FDBF26257A6C1F007138A8 /* UsefulBuf_Tests.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin XCBuildConfiguration section */
@@ -768,6 +837,35 @@
 			};
 			name = Release;
 		};
+		E7FDBF2A257A6C1F007138A8 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+				CODE_SIGN_STYLE = Automatic;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_WARN_PEDANTIC = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = inc;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		E7FDBF2B257A6C1F007138A8 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+				CODE_SIGN_STYLE = Automatic;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_WARN_PEDANTIC = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = inc;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
@@ -825,6 +923,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		E7FDBF29257A6C1F007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef_array" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				E7FDBF2A257A6C1F007138A8 /* Debug */,
+				E7FDBF2B257A6C1F007138A8 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = E776E074214ADF7F00E67947 /* Project object */;
diff --git a/README.md b/README.md
index db69417..072705b 100644
--- a/README.md
+++ b/README.md
@@ -10,10 +10,6 @@
 which defines a CBOR sequence.
 
 ## New Version With Spiffy Decode
-**A major new version of QCBOR that makes decoding implementations much**
-**easier is available in the SpiffyDecode branch of this repository.**
-**Your CBOR decoding implementation may be many times fewer lines of code!**
-**The old version is available in the BeforeSpiffyDecode branch.**
 
 This new version of QCBOR adds a more powerful decoding API
 called Spiffy Decode. 
@@ -239,8 +235,8 @@
     |               | smallest | largest |  
     |---------------|----------|---------|
     | encode only   |      850 |    2100 |
-    | decode only   |     2350 |   13500 |
-    | combined      |     3200 |   15600 |
+    | decode only   |     2150 |   13500 |
+    | combined      |     3000 |   15600 |
     
  From the table above, one can see that the amount of code pulled in
  from the QCBOR library varies a lot, ranging from 1KB to 15KB.  The
diff --git a/inc/qcbor/qcbor_common.h b/inc/qcbor/qcbor_common.h
index 1dd418b..48afbf6 100644
--- a/inc/qcbor/qcbor_common.h
+++ b/inc/qcbor/qcbor_common.h
@@ -472,6 +472,10 @@
        indefinite length string in the input CBOR. */
    QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED = 43,
 
+   /** Indefinite length arrays and maps handling are disabled and there is an
+       indefinite length map or array in the input CBOR. */
+   QCBOR_ERR_INDEF_LEN_ARRAYS_DISABLED = 44,
+
    /* This is stored in uint8_t; never add values > 255 */
 } QCBORError;
 
diff --git a/inc/qcbor/qcbor_decode.h b/inc/qcbor/qcbor_decode.h
index 77670d6..960e810 100644
--- a/inc/qcbor/qcbor_decode.h
+++ b/inc/qcbor/qcbor_decode.h
@@ -348,7 +348,7 @@
             UsefulBufC bigNum;
          } Mantissa;
       } expAndMantissa;
-#endif
+#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
       uint64_t    uTagV;  // Used internally during decoding
 
    } val;
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 1158402..4cb499f 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -36,11 +36,14 @@
 #include "ieee754.h" /* Does not use math.h */
 
 #ifndef QCBOR_DISABLE_FLOAT_HW_USE
+
 #include <math.h> /* For isnan(), llround(), llroudf(), round(), roundf(),
                    * pow(), exp2()
                    */
 #include <fenv.h> /* feclearexcept(), fetestexcept() */
-#endif
+
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
+
 
 
 /*
@@ -79,6 +82,7 @@
 static inline bool
 QCBORItem_IsIndefiniteLengthMapOrArray(const QCBORItem *pMe)
 {
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    if(!QCBORItem_IsMapOrArray(pMe)){
       return false;
    }
@@ -87,6 +91,10 @@
       return false;
    }
    return true;
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+   (void)pMe;
+   return false;
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 }
 
 
@@ -158,15 +166,19 @@
       /* Not a map or array */
       return false;
    }
+
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    if(pNesting->pCurrent->u.ma.uCountTotal == QCBOR_COUNT_INDICATES_INDEFINITE_LENGTH) {
       /* Is indefinite */
       return false;
    }
+
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+
    /* All checks passed; is a definte length map or array */
    return true;
 }
 
-
 static inline bool
 DecodeNesting_IsCurrentBstrWrapped(const QCBORDecodeNesting *pNesting)
 {
@@ -328,9 +340,11 @@
     * just to mark it in bounded mode.
     *
     * Check against QCBOR_MAX_DECODE_INPUT_SIZE make sure that
-    * uOffset doesn't collide with QCBOR_NON_BOUNDED_OFFSET
+    * uOffset doesn't collide with QCBOR_NON_BOUNDED_OFFSET.
+    *
+    * Cast of uOffset to uint32_t for cases where SIZE_MAX < UINT32_MAX.
     */
-   if(uOffset >= QCBOR_MAX_DECODE_INPUT_SIZE) {
+   if((uint32_t)uOffset >= QCBOR_MAX_DECODE_INPUT_SIZE) {
       return QCBOR_ERR_INPUT_TOO_LARGE;
    }
 
@@ -780,9 +794,9 @@
          // was 16 bits. It was widened to 64 bits to be passed in here.
          pDecodedItem->val.dfnum = IEEE754_HalfToDouble((uint16_t)uNumber);
          pDecodedItem->uDataType = QCBOR_TYPE_DOUBLE;
-#else
+#else /* QCBOR_DISABLE_PREFERRED_FLOAT */
          nReturn = QCBOR_ERR_HALF_PRECISION_DISABLED;
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
          break;
       case SINGLE_PREC_FLOAT: // 26
          // Single precision is normally returned as a double
@@ -799,7 +813,7 @@
             // In the normal case, use HW to convert float to double.
             pDecodedItem->val.dfnum = (double)f;
             pDecodedItem->uDataType = QCBOR_TYPE_DOUBLE;
-#else
+#else /* QCBOR_DISABLE_FLOAT_HW_USE */
             // Use of float HW is disabled, return as a float.
             pDecodedItem->val.fnum = f;
             pDecodedItem->uDataType = QCBOR_TYPE_FLOAT;
@@ -808,7 +822,7 @@
             // as a double, but it adds object code and most likely
             // anyone disabling FLOAT HW use doesn't care about
             // floats and wants to save object code.
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
          }
          break;
 
@@ -1012,7 +1026,12 @@
             goto Done;
          }
          if(nAdditionalInfo == LEN_IS_INDEFINITE) {
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
             pDecodedItem->val.uCount = QCBOR_COUNT_INDICATES_INDEFINITE_LENGTH;
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+            nReturn = QCBOR_ERR_INDEF_LEN_ARRAYS_DISABLED;
+            break;
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
          } else {
             // type conversion OK because of check above
             pDecodedItem->val.uCount = (uint16_t)uNumber;
@@ -1413,6 +1432,7 @@
 }
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 /*
  See if next item is a CBOR break. If it is, it is consumed,
  if not it is not consumed.
@@ -1438,32 +1458,47 @@
 
    return QCBOR_SUCCESS;
 }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
 /*
- An item was just consumed, now figure out if it was the
- end of an array or map that can be closed out. That
- may in turn close out another map or array.
+ * An item was just consumed, now figure out if it was the
+ * end of an array/map map that can be closed out. That
+ * may in turn close out the above array/map...
 */
 static QCBORError NestLevelAscender(QCBORDecodeContext *pMe, bool bMarkEnd)
 {
    QCBORError uReturn;
 
-   /* This loops ascending nesting levels as long as there is ascending to do */
+   /* Loop ascending nesting levels as long as there is ascending to do */
    while(!DecodeNesting_IsCurrentAtTop(&(pMe->nesting))) {
 
-      if(DecodeNesting_IsCurrentDefiniteLength(&(pMe->nesting))) {
-         /* Decrement count for definite length maps / arrays */
+      if(DecodeNesting_IsCurrentBstrWrapped(&(pMe->nesting))) {
+         /* Nesting level is bstr-wrapped CBOR */
+
+         /* Ascent for bstr-wrapped CBOR is always by explicit call
+          * so no further ascending can happen.
+          */
+         break;
+
+      } else if(DecodeNesting_IsCurrentDefiniteLength(&(pMe->nesting))) {
+         /* Level is a definite-length array/map */
+
+         /* Decrement the item count the definite-length array/map */
          DecodeNesting_DecrementDefiniteLengthMapOrArrayCount(&(pMe->nesting));
          if(!DecodeNesting_IsEndOfDefiniteLengthMapOrArray(&(pMe->nesting))) {
-             /* Didn't close out map or array, so all work here is done */
+             /* Didn't close out array/map, so all work here is done */
              break;
           }
-          /* All of a definite length array was consumed; fall through to
-             ascend */
+          /* All items in a definite length array were consumed so it
+           * is time to ascend one level. This happens below.
+           */
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
       } else {
-         /* If not definite length, have to check for a CBOR break */
+         /* Level is an indefinite-length array/map. */
+
+         /* Check for a break which is what ends indefinite-length arrays/maps */
          bool bIsBreak = false;
          uReturn = NextIsBreak(&(pMe->InBuf), &bIsBreak);
          if(uReturn != QCBOR_SUCCESS) {
@@ -1471,33 +1506,28 @@
          }
 
          if(!bIsBreak) {
-            /* It's not a break so nothing closes out and all work is done */
+            /* Not a break so array/map does not close out. All work is done */
             break;
          }
 
-         if(DecodeNesting_IsCurrentBstrWrapped(&(pMe->nesting))) {
-            /*
-             Break occurred inside a bstr-wrapped CBOR or
-             in the top level sequence. This is always an
-             error because neither are an indefinte length
-             map/array.
-             */
-            uReturn = QCBOR_ERR_BAD_BREAK;
-            goto Done;
-         }
+         /* It was a break in an indefinite length map / array so
+          * it is time to ascend one level.
+          */
 
-         /* It was a break in an indefinite length map / array */
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
       }
 
-      /* All items in the map/array level have been consumed. */
+
+      /* All items in the array/map have been consumed. */
 
       /* But ascent in bounded mode is only by explicit call to
-         QCBORDecode_ExitBoundedMode() */
+       * QCBORDecode_ExitBoundedMode().
+       */
       if(DecodeNesting_IsCurrentBounded(&(pMe->nesting))) {
          /* Set the count to zero for definite length arrays to indicate
-            cursor is at end of bounded map / array */
+         * cursor is at end of bounded array/map */
          if(bMarkEnd) {
-            // Used for definite and indefinite to signal end
+            /* Used for definite and indefinite to signal end */
             DecodeNesting_ZeroMapOrArrayCount(&(pMe->nesting));
 
          }
@@ -1510,7 +1540,10 @@
 
    uReturn = QCBOR_SUCCESS;
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 Done:
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+
    return uReturn;
 }
 
@@ -1573,15 +1606,15 @@
 
    /*
     Check to see if at the end of a bounded definite length map or
-    array. The check for the end of an indefinite length array is
-    later.
+    array. The check for a break ending indefinite length array is
+    later in NestLevelAscender().
     */
    if(DecodeNesting_IsAtEndOfBoundedLevel(&(me->nesting))) {
       uReturn = QCBOR_ERR_NO_MORE_ITEMS;
       goto Done;
    }
 
-   /* ==== Next: not at the end so get another item ==== */
+   /* ==== Next: not at the end, so get another item ==== */
    uReturn = GetNext_MapEntry(me, pDecodedItem);
    if(QCBORDecode_IsUnrecoverableError(uReturn)) {
       /* Error is so bad that traversal is not possible. */
@@ -1589,8 +1622,8 @@
    }
 
    /*
-    Breaks ending arrays/maps are always processed at the end of this
-    function. They should never show up here.
+    Breaks ending arrays/maps are processed later in the call to
+    NestLevelAscender(). They should never show up here.
     */
    if(pDecodedItem->uDataType == QCBOR_TYPE_BREAK) {
       uReturn = QCBOR_ERR_BAD_BREAK;
@@ -1635,7 +1668,7 @@
        QCBORItem_IsIndefiniteLengthMapOrArray(pDecodedItem)) {
       /*
        The following cases are handled here:
-         - A non-aggregate like an integer or string
+         - A non-aggregate item like an integer or string
          - An empty definite length map or array
          - An indefinite length map or array that might be empty or might not.
 
@@ -2742,7 +2775,8 @@
    // Check here makes sure that this won't accidentally be
    // QCBOR_MAP_OFFSET_CACHE_INVALID which is larger than
    // QCBOR_MAX_DECODE_INPUT_SIZE.
-   if(uEndOffset >= QCBOR_MAX_DECODE_INPUT_SIZE) {
+   // Cast to uint32_t to possibly address cases where SIZE_MAX < UINT32_MAX
+   if((uint32_t)uEndOffset >= QCBOR_MAX_DECODE_INPUT_SIZE) {
       uReturn = QCBOR_ERR_INPUT_TOO_LARGE;
       goto Done;
    }
@@ -3297,8 +3331,9 @@
    //
    // Most of these calls are simple inline accessors so this doesn't
    // amount to much code.
+   // Cast of uPreviousLength to uint32_t for cases where SIZE_MAX < UINT32_MAX.
    const size_t uPreviousLength = UsefulInputBuf_GetBufferLength(&(pMe->InBuf));
-   if(uPreviousLength >= QCBOR_MAX_DECODE_INPUT_SIZE) {
+   if((uint32_t)uPreviousLength >= QCBOR_MAX_DECODE_INPUT_SIZE) {
       uError = QCBOR_ERR_INPUT_TOO_LARGE;
       goto Done;
    }
@@ -4538,7 +4573,7 @@
             return QCBOR_ERR_UNEXPECTED_TYPE;
          }
          break;
-#endif
+#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
       default:
          return QCBOR_ERR_UNEXPECTED_TYPE;
    }
@@ -4644,9 +4679,9 @@
                return QCBOR_ERR_UNEXPECTED_TYPE;
             }
          }
-#else
+#else /* QCBOR_DISABLE_FLOAT_HW_USE */
          return QCBOR_ERR_HW_FLOAT_DISABLED;
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
          break;
 
       case QCBOR_TYPE_DOUBLE:
diff --git a/src/qcbor_encode.c b/src/qcbor_encode.c
index e04e21b..c0ca257 100644
--- a/src/qcbor_encode.c
+++ b/src/qcbor_encode.c
@@ -467,7 +467,7 @@
    if(pBufferEnd - pByte > 9 || pBufferEnd - pByte < 1 || pByte < (uint8_t *)buffer.ptr) {
       return NULLUsefulBufC;
    }
-#endif
+#endif /* EXTRA_ENCODE_HEAD_CHECK */
 
    /* Length will not go negative because the loops run for at most 8 decrements
     * of pByte, only one other decrement is made, and the array is sized
@@ -702,9 +702,9 @@
    const IEEE754_union uNum = IEEE754_DoubleToSmallest(dNum);
 
    QCBOREncode_AddType7(me, uNum.uSize, uNum.uValue);
-#else
+#else /* QCBOR_DISABLE_PREFERRED_FLOAT */
    QCBOREncode_AddDoubleNoPreferred(me, dNum);
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
 }
 
 
@@ -728,9 +728,9 @@
    const IEEE754_union uNum = IEEE754_FloatToSmallest(fNum);
 
    QCBOREncode_AddType7(me, uNum.uSize, uNum.uValue);
-#else
+#else /* QCBOR_DISABLE_PREFERRED_FLOAT */
    QCBOREncode_AddFloatNoPreferred(me, fNum);
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
 }
 
 
@@ -900,9 +900,9 @@
          return;
       }
    }
-#else
+#else /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
    (void) uMajorType;
-#endif
+#endif /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
 
    /* Append the break marker (0xff for both arrays and maps) */
    AppendCBORHead(me, CBOR_MAJOR_NONE_TYPE_SIMPLE_BREAK, CBOR_SIMPLE_BREAK, 0);
@@ -926,7 +926,7 @@
       uReturn = QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN;
       goto Done;
    }
-#endif
+#endif /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
 
    *pEncodedCBOR = UsefulOutBuf_OutUBuf(&(me->OutBuf));
 
diff --git a/test/float_tests.c b/test/float_tests.c
index 3f8ec1a..12f34fd 100644
--- a/test/float_tests.c
+++ b/test/float_tests.c
@@ -1182,4 +1182,4 @@
 
     return 0;
 }
-#endif
+#endif /* NAN_EXPERIMENT */
diff --git a/test/not_well_formed_cbor.h b/test/not_well_formed_cbor.h
index 5c6e26a..6734e93 100644
--- a/test/not_well_formed_cbor.h
+++ b/test/not_well_formed_cbor.h
@@ -26,9 +26,9 @@
 
 static const struct someBinaryBytes paNotWellFormedCBOR[] = {
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
     // Indefinite length strings must be closed off
 
-#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
     // An indefinite length byte string not closed off
     {(uint8_t[]){0x5f, 0x41, 0x00}, 3},
     // An indefinite length text string not closed off
@@ -76,6 +76,7 @@
     {(uint8_t[]){0xa2, 0x01, 0x02}, 3},
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
     // Indefinte length maps and arrays must be ended by a break
 
     // Indefinite length array with zero items and no break
@@ -102,6 +103,7 @@
     {(uint8_t[]){0x9f, 0x81, 0x9f, 0x81, 0x9f, 0x9f, 0xff, 0xff, 0xff}, 9},
     // Mixed nesting with definite unclosed
     {(uint8_t[]){0x9f, 0x82, 0x9f, 0x81, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff}, 10},
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
     // The "argument" for the data item is missing bytes
@@ -165,8 +167,10 @@
     {(uint8_t[]){0xff}, 1},
     // A bare break after a zero length definite length array
     {(uint8_t[]){0x80, 0xff}, 2},
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
     // A bare break after a zero length indefinite length map
     {(uint8_t[]){0x9f, 0xff, 0xff}, 3},
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
     // Forbidden two-byte encodings of simple types
@@ -318,10 +322,12 @@
     {(uint8_t[]){0xa1, 0x00}, 2},
     // Map with 3 item when it should have 4
     {(uint8_t[]){0xa2, 0x00, 0x00, 0x00}, 2},
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
     // Map with 1 item when it should have 2
     {(uint8_t[]){0xbf, 0x00, 0xff}, 3},
     // Map with 3 item when it should have 4
     {(uint8_t[]){0xbf, 0x00, 0x00, 0x00, 0xff}, 5},
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 };
 
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index f524849..fbc292f 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -60,8 +60,59 @@
 
    fflush(stdout);
 }
-#endif
+#endif /* PRINT_FUNCTIONS_FOR_DEBUGGING */
 
+/*
+   [
+      -9223372036854775808,
+      -4294967297,
+      -4294967296,
+      -4294967295,
+      -4294967294,
+      -2147483648,
+      -2147483647,
+      -65538,
+      -65537,
+      -65536,
+      -65535,
+      -65534,
+      -257,
+      -256,
+      -255,
+      -254,
+      -25,
+      -24,
+      -23,
+      -1,
+      0,
+      0,
+      1,
+      22,
+      23,
+      24,
+      25,
+      26,
+      254,
+      255,
+      256,
+      257,
+      65534,
+      65535,
+      65536,
+      65537,
+      65538,
+      2147483647,
+      2147483647,
+      2147483648,
+      2147483649,
+      4294967294,
+      4294967295,
+      4294967296,
+      4294967297,
+      9223372036854775807,
+      18446744073709551615
+    ]
+ */
 
 static const uint8_t spExpectedEncodedInts[] = {
    0x98, 0x2f, 0x3b, 0x7f, 0xff, 0xff, 0xff, 0xff,
@@ -419,8 +470,10 @@
 }
 
 
-// One less than the smallest negative integer allowed in C. Decoding
-// this should fail.
+/* One less than the smallest negative integer allowed in C. Decoding
+   this should fail.
+   -9223372036854775809
+ */
 static const uint8_t spTooSmallNegative[] = {
    0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
@@ -514,54 +567,65 @@
  Some basic CBOR with map and array used in a lot of tests.
  The map labels are all strings
 
- {"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"
+   {
+      "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 pValidMapEncoded[] = {
-   0xa3, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x69, 0x6e,
-   0x74, 0x65, 0x67, 0x65, 0x72, 0x18, 0x2a, 0x77, 0x61, 0x6e,
-   0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20,
-   0x74, 0x77, 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
-   0x73, 0x82, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x31,
-   0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x32, 0x6c, 0x6d,
-   0x61, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61,
-   0x70, 0xa4, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
-   0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79, 0x74, 0x65,
-   0x73, 0x20, 0x32, 0x44, 0x79, 0x79, 0x79, 0x79, 0x6b, 0x61,
-   0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74,
-   0x18, 0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
-   0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64, 0x61, 0x6d,
-   0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64,
-   0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
-   0x73 };
+   0xa3, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20,
+   0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18,
+   0x2a, 0x77, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72,
+   0x61, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x77,
+   0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+   0x73, 0x82, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+   0x67, 0x31, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+   0x67, 0x32, 0x6c, 0x6d, 0x61, 0x70, 0x20, 0x69,
+   0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70, 0xa4,
+   0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
+   0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79,
+   0x74, 0x65, 0x73, 0x20, 0x32, 0x44, 0x79, 0x79,
+   0x79, 0x79, 0x6b, 0x61, 0x6e, 0x6f, 0x74, 0x68,
+   0x65, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x18, 0x62,
+   0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
+   0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64,
+   0x61, 0x6d, 0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73,
+   0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x61,
+   0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73 };
 
+
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 // Same as above, but with indefinite lengths.
 static const uint8_t pValidMapIndefEncoded[] = {
-0xbf, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x69, 0x6e,
-0x74, 0x65, 0x67, 0x65, 0x72, 0x18, 0x2a, 0x77, 0x61, 0x6e,
-0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20,
-0x74, 0x77, 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
-0x73, 0x9f, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x31,
-0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x32, 0xff, 0x6c, 0x6d,
-0x61, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61,
-0x70, 0xbf, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
-0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79, 0x74, 0x65,
-0x73, 0x20, 0x32, 0x44, 0x79, 0x79, 0x79, 0x79, 0x6b, 0x61,
-0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74,
-0x18, 0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
-0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64, 0x61, 0x6d,
-0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64,
-0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
-0x73, 0xff, 0xff};
+   0xbf, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20,
+   0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18,
+   0x2a, 0x77, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72,
+   0x61, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x77,
+   0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+   0x73, 0x9f, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+   0x67, 0x31, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+   0x67, 0x32, 0xff, 0x6c, 0x6d, 0x61, 0x70, 0x20,
+   0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70,
+   0xbf, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20,
+   0x31, 0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62,
+   0x79, 0x74, 0x65, 0x73, 0x20, 0x32, 0x44, 0x79,
+   0x79, 0x79, 0x79, 0x6b, 0x61, 0x6e, 0x6f, 0x74,
+   0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x18,
+   0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32,
+   0x78, 0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20,
+   0x64, 0x61, 0x6d, 0x6e, 0x20, 0x6c, 0x69, 0x65,
+   0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74,
+   0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73,
+   0xff, 0xff};
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
 static int32_t ParseOrderedArray(const uint8_t *pEncoded,
@@ -674,11 +738,13 @@
     ]
  ]
  */
-static uint8_t sEmpties[] = {0x83, 0x00, 0x80, 0x84, 0x80, 0x81, 0x00, 0xa0,
-                             0xa3, 0x01, 0xa0, 0x02, 0xa0, 0x03, 0x80};
+static uint8_t sEmpties[] = {
+   0x83, 0x00, 0x80, 0x84, 0x80, 0x81, 0x00, 0xa0,
+   0xa3, 0x01, 0xa0, 0x02, 0xa0, 0x03, 0x80};
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 /* Same as above, but with indefinte lengths */
-static uint8_t sEmptiesIndef[] = {
+static const uint8_t sEmptiesIndef[] = {
 0x9F,
    0x00,
    0x9F,
@@ -704,7 +770,7 @@
          0xFF,
       0xFF,
    0xFF};
-
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
 static int32_t CheckEmpties(UsefulBufC input, bool bCheckCounts)
@@ -840,19 +906,22 @@
       return nResult;
    }
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    nResult = CheckEmpties(UsefulBuf_FROM_BYTE_ARRAY_LITERAL(sEmptiesIndef),
                      false);
 
    if(nResult) {
       return nResult -100;
    }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
    return 0;
 }
 
-
-static uint8_t spDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
-                                 0x81, 0x81, 0x81, 0x80};
+/* [[[[[[[[[[]]]]]]]]]] */
+static const uint8_t spDeepArrays[] = {
+   0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+   0x81, 0x80};
 
 int32_t ParseDeepArrayTest()
 {
@@ -878,11 +947,14 @@
    return(nReturn);
 }
 
-// Big enough to test nesting to the depth of 24
-static uint8_t spTooDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
-                                    0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
-                                    0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
-                                    0x81, 0x81, 0x81, 0x80};
+/* Big enough to test nesting to the depth of 24
+ [[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]
+ */
+static const uint8_t spTooDeepArrays[] = {
+   0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+   0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+   0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+   0x80};
 
 int32_t ParseTooDeepArrayTest()
 {
@@ -1551,9 +1623,11 @@
 }
 
 
-static uint8_t spSimpleValues[] = {0x8a, 0xf4, 0xf5, 0xf6, 0xf7, 0xff,
-                                   0xe0, 0xf3, 0xf8, 0x00, 0xf8, 0x13,
-                                   0xf8, 0x1f, 0xf8, 0x20, 0xf8, 0xff};
+/* The simple-values including some not well formed */
+static const uint8_t spSimpleValues[] = {
+   0x8a, 0xf4, 0xf5, 0xf6, 0xf7, 0xff, 0xe0, 0xf3,
+   0xf8, 0x00, 0xf8, 0x13, 0xf8, 0x1f, 0xf8, 0x20,
+   0xf8, 0xff};
 
 int32_t ParseSimpleTest()
 {
@@ -1678,9 +1752,9 @@
 };
 
 
-static int32_t ProcessFailures(struct FailInput *pFailInputs, size_t nNumFails)
+static int32_t ProcessFailures(const struct FailInput *pFailInputs, size_t nNumFails)
 {
-   for(struct FailInput *pF = pFailInputs; pF < pFailInputs + nNumFails; pF++) {
+   for(const struct FailInput *pF = pFailInputs; pF < pFailInputs + nNumFails; pF++) {
       QCBORDecodeContext DCtx;
       QCBORError         uCBORError;
 
@@ -1724,7 +1798,7 @@
 }
 
 
-struct FailInput  Failures[] = {
+static const struct FailInput Failures[] = {
    // Most of this is copied from not_well_formed.h. Here the error code
    // returned is also checked.
 
@@ -1801,7 +1875,7 @@
    // A definte length map that is supposed to have s item, but has only 1
    { {(uint8_t[]){0xa2, 0x01, 0x02}, 3}, QCBOR_ERR_NO_MORE_ITEMS },
 
-
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    // Indefinte length maps and arrays must be ended by a break
    // Indefinite length array with zero items and no break
    { {(uint8_t[]){0x9f}, 1}, QCBOR_ERR_NO_MORE_ITEMS },
@@ -1844,7 +1918,7 @@
    { {(uint8_t[]){0x81, 0x82, 0xbf, 0xff, 0xbf}, 5}, QCBOR_ERR_NO_MORE_ITEMS},
    // Unclosed definite length map in indefinite length arrays
    { {(uint8_t[]){0x9f, 0x9f, 0xa1}, 3}, QCBOR_ERR_NO_MORE_ITEMS},
-
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
    // The "argument" for the data item is incomplete
    // Positive integer missing 1 byte argument
@@ -1908,12 +1982,14 @@
    { {(uint8_t[]){0xff}, 1}, QCBOR_ERR_BAD_BREAK },
    // A bare break after a zero length definite length array
    { {(uint8_t[]){0x80, 0xff}, 2}, QCBOR_ERR_BAD_BREAK },
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    // A bare break after a zero length indefinite length map
    { {(uint8_t[]){0x9f, 0xff, 0xff}, 3}, QCBOR_ERR_BAD_BREAK },
    // A break inside a definite length array inside an indefenite length array
    { {(uint8_t[]){0x9f, 0x81, 0xff}, 3}, QCBOR_ERR_BAD_BREAK },
    // Complicated mixed nesting with break outside indefinite length array
    { {(uint8_t[]){0x9f, 0x82, 0x9f, 0x81, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff}, 10}, QCBOR_ERR_BAD_BREAK },
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
    // Forbidden two byte encodings of simple types
@@ -2065,10 +2141,12 @@
    { {(uint8_t[]){0xa1, 0x00}, 2}, QCBOR_ERR_HIT_END },
    // Map with 3 item when it should have 4
    { {(uint8_t[]){0xa2, 0x00, 0x00, 0x00}, 2}, QCBOR_ERR_HIT_END },
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    // Map with 1 item when it should have 2
    { {(uint8_t[]){0xbf, 0x00, 0xff}, 3}, QCBOR_ERR_BAD_BREAK },
    // Map with 3 item when it should have 4
    { {(uint8_t[]){0xbf, 0x00, 0x00, 0x00, 0xff}, 5}, QCBOR_ERR_BAD_BREAK },
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
    // In addition to not-well-formed, some invalid CBOR
@@ -2209,7 +2287,7 @@
 }
 
 
-static uint8_t spDateTestInput[] = {
+static const uint8_t spDateTestInput[] = {
    0xc0, // tag for string date
    0x6a, '1','9','8','5','-','0','4','-','1','2', // Date string
 
@@ -2374,9 +2452,9 @@
    if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_HALF_PRECISION_DISABLED) {
       return -18;
    }
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
 
-#else
+#else /* QCBOR_DISABLE_FLOAT_HW_USE */
    if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_FLOAT_DATE_DISABLED) {
       return -19;
    }
@@ -2403,9 +2481,9 @@
    if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_HALF_PRECISION_DISABLED) {
       return -26;
    }
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
 
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
 
    return 0;
 }
@@ -2438,7 +2516,7 @@
 
    Untagged values
  */
-static uint8_t spSpiffyDateTestInput[] = {
+static const uint8_t spSpiffyDateTestInput[] = {
    0x86,
 
    0xc1,
@@ -2451,12 +2529,12 @@
    0xf9, 0xfc, 0x00, // Half-precision -Infinity
 
    0xc1, // tag for epoch date
-   0x9f, 0xff, // Erroneous empty array as content for date
+   0x80, // Erroneous empty array as content for date
 
    0xc0, // tag for string date
-   0xbf, 0xff, // Erroneous empty map as content for date
+   0xa0, // Erroneous empty map as content for date
 
-   0xbf, // Open a map for tests involving labels.
+   0xa9, // Open a map for tests involving labels.
 
    0x00,
    0xc0, // tag for string date
@@ -2495,8 +2573,6 @@
    // Untagged half-precision float with value -2
    0x09,
    0xF9, 0xC0, 0x00,
-
-   0xff,
 };
 
 int32_t SpiffyDateDecodeTest()
@@ -2525,7 +2601,7 @@
    if(uError != QCBOR_ERR_FLOAT_DATE_DISABLED) {
       return 1112;
    }
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
 
    // Too-large integer
    QCBORDecode_GetEpochDate(&DC, QCBOR_TAG_REQUIREMENT_TAG, &nEpochDateFail);
@@ -2727,7 +2803,7 @@
 
 
 // Input for one of the tagging tests
-static uint8_t spTagInput[] = {
+static const uint8_t spTagInput[] = {
    0xd9, 0xd9, 0xf7, // CBOR magic number
        0x81, // Array of one
           0xd8, 0x04, // non-preferred serialization of tag 4, decimal fraction
@@ -2789,7 +2865,7 @@
  DB 9192939495969798 # tag(10489608748473423768)
    80                # array(0)
  */
-static uint8_t spEncodedLargeTag[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95,
+static const uint8_t spEncodedLargeTag[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95,
                                       0x96, 0x97, 0x98, 0x80};
 
 /*
@@ -2799,7 +2875,7 @@
          C7         # tag(7)
             80      # array(0)
 */
-static uint8_t spLotsOfTags[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+static const uint8_t spLotsOfTags[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
                                  0x97, 0x98, 0xd8, 0x88, 0xc6, 0xc7, 0x80};
 
 /*
@@ -2824,7 +2900,7 @@
       })
    })))
  */
-static uint8_t spCSRWithTags[] = {
+static const uint8_t spCSRWithTags[] = {
    0xd9, 0xd9, 0xf7, 0xd9, 0xd9, 0xf7, 0xd9, 0xd9, 0xf7, 0xa2,
       0xc6, 0xc7, 0x36,
       0xdb, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0xc7, 0xa2,
@@ -2861,8 +2937,8 @@
       0xc8, 0x22};
 
 
-static uint8_t spSpiffyTagInput[] = {
-   0x9f, // Open indefinite array
+static const uint8_t spSpiffyTagInput[] = {
+   0x85, // Open array
 
    0xc0, // tag for string date
    0x6a, '1','9','8','5','-','0','4','-','1','2', // Date string
@@ -2876,8 +2952,6 @@
 
    0xc0, // tag for string date
    0x4a, '1','9','8','5','-','0','4','-','1','2', // Date string in byte string
-
-   0xff
 };
 
 
@@ -2927,7 +3001,7 @@
    uError = QCBORDecode_GetNext(&DCtx, &Item);
    uError = QCBORDecode_GetNext(&DCtx, &Item);
 
-#else
+#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
    if(uError != QCBOR_SUCCESS ||
       Item.uDataType != QCBOR_TYPE_DECIMAL_FRACTION ||
       QCBORDecode_GetNthTag(&DCtx, &Item, 0) != CBOR_TAG_INVALID64 ||
@@ -2937,7 +3011,7 @@
       QCBORDecode_GetNthTag(&DCtx, &Item, 4) != CBOR_TAG_INVALID64 ) {
       return -5;
    }
-#endif
+#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
 
    /*
     More than 4 tags on an item 225(226(227(228(229([])))))
@@ -3361,7 +3435,7 @@
 
 
 
-static uint8_t spBigNumInput[] = {
+static const uint8_t spBigNumInput[] = {
  0x83,
    0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -3375,8 +3449,10 @@
     0x38, 0x3F,
        0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
-
-static uint8_t spBigNum[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+/* The expected big num */
+static const uint8_t spBigNum[] = {
+   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00};
 
 
 int32_t BignumParseTest()
@@ -3523,7 +3599,6 @@
 
 
 /*
-// cbor.me decoded output
 {
     -23: {
         -20: {
@@ -3544,10 +3619,8 @@
         -5: -3
     }
 }
- */
-
-
-static uint8_t spCSRInput[] = {
+*/
+static const uint8_t spCSRInput[] = {
    0xa2, 0x36, 0xa2, 0x33, 0xa5, 0x31, 0x6c, 0x4f,
    0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
    0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
@@ -3558,6 +3631,20 @@
    0x29, 0x4a, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
    0x07, 0x08, 0x09, 0x0a, 0x35, 0xa1, 0x24, 0x22};
 
+// Same map as above, but using indefinite lengths
+static const uint8_t spCSRInputIndefLen[] = {
+   0xbf, 0x36, 0xbf, 0x33, 0xbf, 0x31, 0x6c, 0x4f,
+   0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
+   0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
+   0x2e, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x75, 0x73,
+   0x69, 0x6f, 0x6e, 0x2f, 0x69, 0x53, 0x61, 0x6e,
+   0x20, 0x44, 0x69, 0x65, 0x67, 0x6f, 0x2d, 0x62,
+   0x55, 0x53, 0xff, 0x32, 0xbf, 0x2a, 0xbf, 0x28,
+   0x26, 0xff, 0x29, 0x4a, 0x01, 0x02, 0x03, 0x04,
+   0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0xff, 0xff,
+   0x35, 0xbf, 0x24, 0x22, 0xff, 0xff};
+
+
 int32_t NestedMapTest()
 {
    QCBORDecodeContext DCtx;
@@ -3598,18 +3685,6 @@
 }
 
 
-// Same map as above, but using indefinite lengths
-static uint8_t spCSRInputIndefLen[] = {
-   0xbf, 0x36, 0xbf, 0x33, 0xbf, 0x31, 0x6c, 0x4f,
-   0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
-   0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
-   0x2e, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x75, 0x73,
-   0x69, 0x6f, 0x6e, 0x2f, 0x69, 0x53, 0x61, 0x6e,
-   0x20, 0x44, 0x69, 0x65, 0x67, 0x6f, 0x2d, 0x62,
-   0x55, 0x53, 0xff, 0x32, 0xbf, 0x2a, 0xbf, 0x28,
-   0x26, 0xff, 0x29, 0x4a, 0x01, 0x02, 0x03, 0x04,
-   0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0xff, 0xff,
-   0x35, 0xbf, 0x24, 0x22, 0xff, 0xff};
 
 int32_t NestedMapTestIndefLen()
 {
@@ -4386,9 +4461,8 @@
     5([-9223372036854775807, -4759477275222530853137])
     5([ 9223372036854775806, -4759477275222530853137])
     5([ 9223372036854775806,  9223372036854775806])]
- ]
+  ]
  */
-
 static const uint8_t spExpectedExponentsAndMantissas[] = {
    0x88,
    0xC4, 0x82, 0x20,
@@ -4632,7 +4706,7 @@
 }
 
 
-static struct FailInput ExponentAndMantissaFailures[] = {
+static const struct FailInput ExponentAndMantissaFailures[] = {
    // Exponent > INT64_MAX
    { {(uint8_t[]){0xC4, 0x82, 0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                   0xFF, 0xFF, 0x1B, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -4655,8 +4729,13 @@
    { {(uint8_t[]){0xC4, 0x82, 0x1f, 0x01}, 4}, QCBOR_ERR_BAD_INT},
    // 3 items in array
    { {(uint8_t[]){0xC4, 0x83, 0x03, 0x01, 02}, 5}, QCBOR_ERR_BAD_EXP_AND_MANTISSA},
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    // unterminated indefinite length array
    { {(uint8_t[]){0xC4, 0x9f, 0x03, 0x01, 0x02}, 5}, QCBOR_ERR_BAD_EXP_AND_MANTISSA},
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+   // unterminated indefinite length array
+   { {(uint8_t[]){0xC4, 0x9f, 0x03, 0x01, 0x02}, 5}, QCBOR_ERR_INDEF_LEN_ARRAYS_DISABLED},
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
    // Empty array
    { {(uint8_t[]){0xC4, 0x80}, 2}, QCBOR_ERR_NO_MORE_ITEMS},
    // Second is not an integer
@@ -4791,34 +4870,39 @@
 }
 
 /*
- {
-   -75008: h'05083399',
-   88: [
-     ],
-   100100: {
-     "sub1": {
-       10: [
-         0
-       ],
-       -75009: h'A46823990001',
-       100100: {
-         "json": "{ \"ueid\", \"xyz\"}",
-         "subsub": {
-           100002: h'141813191001'
+   {
+      -75008: h'05083399',
+      88: [],
+      100100: {
+         "sub1": {
+            10: [
+               0
+            ],
+            -75009: h'A46823990001',
+            100100: {
+               "json": "{ \"ueid\", \"xyz\"}",
+               "subsub": {
+                  100002: h'141813191001'
+               }
+            }
          }
-       }
-     }
+      }
    }
- }
  */
 
 static const uint8_t spNestedCBOR[] = {
-0xa3, 0x3a, 0x00, 0x01, 0x24, 0xff, 0x44, 0x05, 0x08, 0x33, 0x99, 0x18, 0x58, 0x80, 0x1a, 0x00,
-0x01, 0x87, 0x04, 0xa1, 0x64, 0x73, 0x75, 0x62, 0x31, 0xa3, 0x0a, 0x81, 0x00, 0x3a, 0x00, 0x01,
-0x25, 0x00, 0x46, 0xa4, 0x68, 0x23, 0x99, 0x00, 0x01, 0x1a, 0x00, 0x01, 0x87, 0x04, 0xa2, 0x64,
-0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x7b, 0x20, 0x22, 0x75, 0x65, 0x69, 0x64, 0x22, 0x2c, 0x20, 0x22,
-0x78, 0x79, 0x7a, 0x22, 0x7d, 0x66, 0x73, 0x75, 0x62, 0x73, 0x75, 0x62, 0xa1, 0x1a, 0x00, 0x01,
-0x86, 0xa2, 0x46, 0x14, 0x18, 0x13, 0x19, 0x10, 0x01
+   0xa3, 0x3a, 0x00, 0x01, 0x24, 0xff, 0x44, 0x05,
+   0x08, 0x33, 0x99, 0x18, 0x58, 0x80, 0x1a, 0x00,
+   0x01, 0x87, 0x04, 0xa1, 0x64, 0x73, 0x75, 0x62,
+   0x31, 0xa3, 0x0a, 0x81, 0x00, 0x3a, 0x00, 0x01,
+   0x25, 0x00, 0x46, 0xa4, 0x68, 0x23, 0x99, 0x00,
+   0x01, 0x1a, 0x00, 0x01, 0x87, 0x04, 0xa2, 0x64,
+   0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x7b, 0x20, 0x22,
+   0x75, 0x65, 0x69, 0x64, 0x22, 0x2c, 0x20, 0x22,
+   0x78, 0x79, 0x7a, 0x22, 0x7d, 0x66, 0x73, 0x75,
+   0x62, 0x73, 0x75, 0x62, 0xa1, 0x1a, 0x00, 0x01,
+   0x86, 0xa2, 0x46, 0x14, 0x18, 0x13, 0x19, 0x10,
+   0x01
 };
 
 /*  Get item in multi-level nesting in spNestedCBOR */
@@ -4960,11 +5044,12 @@
 
 
 /*
- [23,
-  6000,
-  h'67616C6163746963',
-  h'686176656E20746F6B656E'
- ]
+   [
+      23,
+      6000,
+      h'67616C6163746963',
+      h'686176656E20746F6B656E'
+   ]
  */
 static const uint8_t spSimpleArray[] = {
    0x84,
@@ -4973,12 +5058,16 @@
    0x48, 0x67, 0x61, 0x6C, 0x61, 0x63, 0x74, 0x69, 0x63,
    0x4B, 0x68, 0x61, 0x76, 0x65, 0x6E, 0x20, 0x74, 0x6F, 0x6B, 0x65, 0x6E};
 
+/* [h'', {}, [], 0] */
+static const uint8_t spArrayOfEmpty[] = {0x84, 0x40, 0xa0, 0x80, 0x00};
 
+/* {} */
 static const uint8_t spEmptyMap[] = {0xa0};
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
+/* {} */
 static const uint8_t spEmptyInDefinteLengthMap[] = {0xbf, 0xff};
 
-static const uint8_t spArrayOfEmpty[] = {0x84, 0x40, 0xa0, 0x80, 0x00};
 
 /*
    {
@@ -4998,13 +5087,16 @@
          [],
          []
       ]
- }
+   }
  */
-
 static const uint8_t spMapOfEmpty[] = {
-   0xa6, 0x00, 0x80, 0x09, 0x82, 0x80, 0x80, 0x08, 0xa3, 0x01,
-   0x80, 0x02, 0xa0, 0x03, 0x80, 0x04, 0xa0, 0x05, 0x9f, 0xff,
-   0x06, 0x9f, 0x80, 0x9f, 0xff, 0xff};
+   0xa6, 0x00, 0x80, 0x09, 0x82, 0x80, 0x80, 0x08,
+   0xa3, 0x01, 0x80, 0x02, 0xa0, 0x03, 0x80, 0x04,
+   0xa0, 0x05, 0x9f, 0xff, 0x06, 0x9f, 0x80, 0x9f,
+   0xff, 0xff};
+
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+
 
 /*
  Too many tags
@@ -5013,14 +5105,16 @@
  Integer overflow
  Date overflow
 
- {1: 224(225(226(227(4(0))))),
-  2: 1(h''),
-  3: -18446744073709551616,
-  4: 1(1.0e+300),
-  5: 0, 8: 8}
+   {
+      1: 224(225(226(227(4(0))))),
+      2: 1(h''),
+      3: -18446744073709551616,
+      4: 1(1.0e+300),
+      5: 0, 8: 8
+    }
  */
 static const uint8_t spRecoverableMapErrors[] = {
-   0xbf,
+   0xa7,
    0x01, 0xd8, 0xe0, 0xd8, 0xe1, 0xd8, 0xe2, 0xd8, 0xe3, 0xd8, 0x04, 0x00,
    0x02, 0xc1, 0x40,
    0x03, 0x3b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -5028,25 +5122,25 @@
    0x05, 0x00,
    0x05, 0x00,
    0x08, 0x08,
-   0xff
 };
 
-// Bad break
+/* Bad break */
 static const uint8_t spUnRecoverableMapError1[] = {
    0xa2, 0xff, 0x01, 0x00, 0x02, 0x00
 };
 
-// No more items
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
+/* No more items */
 static const uint8_t spUnRecoverableMapError2[] = {
    0xbf, 0x02, 0xbf, 0xff, 0x01, 0x00, 0x02, 0x00
 };
 
-// Hit end because string is too long
+/* Hit end because string is too long */
 static const uint8_t spUnRecoverableMapError3[] = {
    0xbf, 0x02, 0x69, 0x64, 0x64, 0xff
 };
 
-// Hit end because string is too long
+/* Hit end because string is too long */
 static const uint8_t spUnRecoverableMapError4[] = {
    0xbf,
       0x02, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
@@ -5055,6 +5149,7 @@
             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff
 };
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
 int32_t EnterMapTest()
@@ -5065,7 +5160,7 @@
    int32_t            nReturn;
    QCBORError         uErr;
 
-
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spMapOfEmpty), 0);
    QCBORDecode_EnterMap(&DCtx, NULL);
 
@@ -5109,12 +5204,13 @@
       return 3011;
    }
 
-
    (void)pValidMapIndefEncoded;
    nReturn = SpiffyDecodeBasicMap(UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapIndefEncoded));
    if(nReturn) {
       return nReturn + 20000;
    }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+
 
    nReturn = SpiffyDecodeBasicMap(UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapEncoded));
    if(nReturn) {
@@ -5227,6 +5323,7 @@
    }
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spEmptyInDefinteLengthMap), 0);
    QCBORDecode_EnterMap(&DCtx, NULL);
    // This will fail because the map is empty.
@@ -5240,6 +5337,7 @@
    if(uErr != QCBOR_SUCCESS){
       return 2013;
    }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
 
 
    QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spArrayOfEmpty), 0);
@@ -5292,7 +5390,7 @@
    if(uErr != QCBOR_ERR_FLOAT_DATE_DISABLED) {
       return 2027;
    }
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
 
    QCBORDecode_GetInt64InMapN(&DCtx, 0x05, &nInt);
    uErr = QCBORDecode_GetAndResetError(&DCtx);
@@ -5316,6 +5414,7 @@
       return 2030;
    }
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spUnRecoverableMapError2), 0);
    QCBORDecode_EnterMap(&DCtx, NULL);
    QCBORDecode_GetInt64InMapN(&DCtx, 0x01, &nInt);
@@ -5339,6 +5438,8 @@
    if(uErr != QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP) {
       return 2033;
    }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+
 
    nReturn = DecodeNestedIterate();
 
@@ -5624,7 +5725,7 @@
       -4.0,
       QCBOR_SUCCESS // Uses ieee754.h to conver, not HW
 #endif /* QCBOR_DISABLE_FLOAT_HW_USE */
-#else
+#else /* QCBOR_DISABLE_PREFERRED_FLOAT */
       // Half-precision disabled
       -4,
       QCBOR_ERR_HALF_PRECISION_DISABLED,
@@ -5632,7 +5733,7 @@
       QCBOR_ERR_HALF_PRECISION_DISABLED,
       -4.0,
       QCBOR_ERR_HALF_PRECISION_DISABLED
-#endif
+#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
    },
    {
       "Decimal fraction 3/10",
@@ -6028,6 +6129,7 @@
 
    // Get a second item
    uCBORError = QCBORDecode_GetNext(&DCtx, &Item);
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
    if(uCBORError != QCBOR_SUCCESS) {
       return 9;
    }
@@ -6041,6 +6143,11 @@
    if(uCBORError != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
       return 11;
    }
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+   if(uCBORError != QCBOR_ERR_INDEF_LEN_ARRAYS_DISABLED) {
+      return 20;
+   }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 
 
    // --- Sequence with a closed indefinite length array ---
@@ -6061,6 +6168,8 @@
 
    // Get a second item
    uCBORError = QCBORDecode_GetNext(&DCtx, &Item);
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
+
    if(uCBORError != QCBOR_SUCCESS) {
       return 14;
    }
@@ -6074,6 +6183,11 @@
    if(uCBORError != QCBOR_SUCCESS) {
       return 16;
    }
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+   if(uCBORError != QCBOR_ERR_INDEF_LEN_ARRAYS_DISABLED) {
+      return 20;
+   }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 
 
    return 0;
@@ -6329,6 +6443,11 @@
    return Encoded;
 }
 
+/* h'FF' */
+static const uint8_t spBreakInByteString[] = {
+   0x41, 0xff
+};
+
 
 int32_t EnterBstrTest()
 {
@@ -6363,8 +6482,43 @@
    QCBORDecode_ExitArray(&DC);
 
    QCBORError uErr = QCBORDecode_Finish(&DC);
+   if(uErr) {
+      return (int32_t)uErr;
+   }
 
-   return (int32_t)uErr;
+
+   /* Enter and exit byte string wrapped CBOR that is bad. It has just a break.
+    * Successful because no items are fetched from byte string.
+    */
+   QCBORDecode_Init(&DC,
+                    UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBreakInByteString),
+                    0);
+   QCBORDecode_EnterBstrWrapped(&DC, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, NULL);
+   uErr = QCBORDecode_GetError(&DC);
+   if(uErr) {
+      return 100 + (int32_t)uErr;
+   }
+
+   QCBORDecode_ExitBstrWrapped(&DC);
+   uErr = QCBORDecode_GetError(&DC);
+   if(uErr) {
+      return 200 + (int32_t)uErr;
+   }
+
+   /* Try to get item that is a break out of a byte string wrapped CBOR.
+    * It fails because there should be no break.
+    */
+   QCBORDecode_Init(&DC,
+                    UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBreakInByteString),
+                    0);
+   QCBORDecode_EnterBstrWrapped(&DC, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, NULL);
+   QCBORItem Item;
+   uErr = QCBORDecode_GetNext(&DC, &Item);
+   if(uErr != QCBOR_ERR_BAD_BREAK) {
+      return 300 + (int32_t)uErr;
+   }
+
+   return 0;
 }
 
 
@@ -6646,10 +6800,10 @@
 
 
 /*
- [
-    "aaaaaaaaaa",
-    {}
- ]
+   [
+      "aaaaaaaaaa",
+      {}
+   ]
  */
 static const uint8_t spTooLarge1[] = {
    0x9f,
@@ -6659,11 +6813,11 @@
 };
 
 /*
- [
-   {
-      0: "aaaaaaaaaa"
-    }
- ]
+   [
+      {
+         0: "aaaaaaaaaa"
+      }
+    ]
  */
 static const uint8_t spTooLarge2[] = {
    0x9f,
@@ -6674,11 +6828,11 @@
 };
 
 /*
- h'A1006A61616161616161616161'
+   h'A1006A61616161616161616161'
 
- {
-    0: "aaaaaaaaaa"
- }
+   {
+      0: "aaaaaaaaaa"
+   }
  */
 static const uint8_t spTooLarge3[] = {
    0x4d,
@@ -6748,7 +6902,7 @@
 #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
 
 static const uint8_t spMapWithIndefLenStrings[] = {
-   0xbf,
+   0xa3,
       0x7f, 0x61, 'l', 0x64, 'a', 'b', 'e', 'l' , 0x61, '1', 0xff,
       0x5f, 0x42, 0x01, 0x02, 0x43, 0x03, 0x04, 0x05, 0xff,
       0x7f, 0x62, 'd', 'y', 0x61, 'm', 0x61, 'o', 0xff,
@@ -6756,7 +6910,6 @@
       0x7f, 0x62, 'l', 'a', 0x63, 'b', 'e', 'l', 0x61, '2', 0xff,
       0xc3,
           0x5f, 0x42, 0x00, 0x01, 0x42, 0x00, 0x01, 0x41, 0x01, 0xff,
-   0xff
 };
 
 int32_t SpiffyIndefiniteLengthStringsTests()
@@ -6803,11 +6956,11 @@
    if(uDouble != -16777474) {
       return 6;
    }
-#else
+#else /* QCBOR_DISABLE_FLOAT_HW_USE */
    if(QCBORDecode_GetAndResetError(&DCtx) != QCBOR_ERR_HW_FLOAT_DISABLED) {
       return 7;
    }
-#endif
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
 
 
    QCBORDecode_ExitMap(&DCtx);
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index c7fb137..f9d8507 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -1803,7 +1803,7 @@
 
    uError = QCBOREncode_Finish(&EC, &Encoded2);
    if(uError != QCBOR_ERR_CLOSE_MISMATCH) {
-      return 100 + uError;
+      return (int32_t)(100 + uError);
    }
 
    // -------- test closing a bstrwrap when nothing is open ----------------
@@ -1811,7 +1811,7 @@
    QCBOREncode_CloseBstrWrap(&EC, &Wrapped);
    uError = QCBOREncode_Finish(&EC, &Encoded2);
    if(uError != QCBOR_ERR_TOO_MANY_CLOSES) {
-      return 200 + uError;
+      return (int32_t)(200 + uError);
    }
 #endif /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
 
@@ -1828,7 +1828,7 @@
 
    uError = QCBOREncode_Finish(&EC, &Encoded2);
    if(uError != QCBOR_ERR_ARRAY_NESTING_TOO_DEEP) {
-      return 300 + uError;
+      return (int32_t)(300 + uError);
    }
 
    return 0;
diff --git a/test/run_tests.c b/test/run_tests.c
index b2dc46c..0146d93 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -63,8 +63,11 @@
     TEST_ENTRY(EmptyMapsAndArraysTest),
     TEST_ENTRY(NotWellFormedTests),
     TEST_ENTRY(ParseMapAsArrayTest),
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
     TEST_ENTRY(IndefiniteLengthNestTest),
+    TEST_ENTRY(IndefiniteLengthArrayMapTest),
     TEST_ENTRY(NestedMapTestIndefLen),
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
     TEST_ENTRY(ParseSimpleTest),
     TEST_ENTRY(DecodeFailureTests),
     TEST_ENTRY(EncodeRawTest),
@@ -82,7 +85,6 @@
     TEST_ENTRY(ParseTooDeepArrayTest),
     TEST_ENTRY(ComprehensiveInputTest),
     TEST_ENTRY(ParseMapTest),
-    TEST_ENTRY(IndefiniteLengthArrayMapTest),
     TEST_ENTRY(BasicEncodeTest),
     TEST_ENTRY(NestedMapTest),
     TEST_ENTRY(BignumParseTest),