Fix enum conversion warnings for LLVM/XCode 11 (#44)

* Fix enum conversion warnings for LLVM/XCode 11

* Add int conversion warning back in to optional CFLAGS

* type conversion and integer overflow fix when decoding maps as arrays

* add test for map that is too large to handle as an array

Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index fd3e57b..09a220d 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -365,7 +365,7 @@
    UsefulInputBuf_Init(&(me->InBuf), EncodedCBOR);
    // Don't bother with error check on decode mode. If a bad value is
    // passed it will just act as if the default normal mode of 0 was set.
-   me->uDecodeMode = nDecodeMode;
+   me->uDecodeMode = (uint8_t)nDecodeMode;
    DecodeNesting_Init(&(me->nesting));
 }
 
@@ -1012,9 +1012,15 @@
       }
    } else {
       if(pDecodedItem->uDataType == QCBOR_TYPE_MAP) {
+         if(pDecodedItem->val.uCount > QCBOR_MAX_ITEMS_IN_ARRAY/2) {
+            nReturn = QCBOR_ERR_ARRAY_TOO_LONG;
+            goto Done;
+         }
          // Decoding a map as an array
          pDecodedItem->uDataType = QCBOR_TYPE_MAP_AS_ARRAY;
-         pDecodedItem->val.uCount *= 2;
+         // Cast is safe because of check against QCBOR_MAX_ITEMS_IN_ARRAY/2
+         // Cast is needed because of integer promotion
+         pDecodedItem->val.uCount = (uint16_t)(pDecodedItem->val.uCount * 2);
       }
    }