Refine integer signedness use for static analyizers (#24)


diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 1009e16..125560e 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -835,14 +835,14 @@
 {
    int nResult = 0;
 
-   for(int nNum = sizeof(spExpectedEncodedInts)-1; nNum; nNum--) {
+   for(size_t nNum = sizeof(spExpectedEncodedInts)-1; nNum; nNum--) {
       QCBORDecodeContext DCtx;
 
       QCBORDecode_Init(&DCtx,
                        (UsefulBufC){spExpectedEncodedInts, nNum},
                        QCBOR_DECODE_MODE_NORMAL);
 
-      const QCBORError nErr = IntegerValuesParseTestInternal(&DCtx);
+      const int nErr = IntegerValuesParseTestInternal(&DCtx);
 
       if(nErr != QCBOR_ERR_HIT_END && nErr != QCBOR_ERR_NO_MORE_ITEMS) {
          nResult = -1;
@@ -1615,8 +1615,9 @@
       if(nCBORError != pF->nError ||
          Item.uDataType != QCBOR_TYPE_NONE ||
          Item.uLabelType != QCBOR_TYPE_NONE) {
-         // return index of CBOR + 1000
-         return (int)(pF -  pFailInputs) * 100 + nCBORError;
+         // return index of CBOR + 100
+         const size_t nIndex = (size_t)(pF - pFailInputs)/sizeof(struct FailInput);
+         return (int32_t)(nIndex * 100 + nCBORError);
       }
    }
 
@@ -1969,7 +1970,7 @@
 /* Try all 256 values of the byte at nLen including recursing for
  each of the values to try values at nLen+1 ... up to nLenMax
  */
-static void ComprehensiveInputRecurser(uint8_t *pBuf, int nLen, int nLenMax)
+static void ComprehensiveInputRecurser(uint8_t *pBuf, size_t nLen, size_t nLenMax)
 {
    if(nLen >= nLenMax) {
       return;
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index e922503..36187e3 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -1129,18 +1129,18 @@
    // add array with 31 items
    QCBOREncode_OpenArrayInMap(&ECtx, "arr");
    for (size_t ix = 0; ix < 31; ix++) {
-      QCBOREncode_AddInt64(&ECtx, ix);
+      QCBOREncode_AddInt64(&ECtx, (int64_t)ix);
    }
    QCBOREncode_CloseArray(&ECtx);
 
    // add map with 31 items
    QCBOREncode_OpenMapInMap(&ECtx, "map");
-   for (size_t ix = 0; ix < 31; ix++) {
+   for (int ix = 0; ix < 31; ix++) {
       // make sure we have unique keys in the map (a-z then follow by A-Z)
-      char c = 'a';
+      int c = 'a';
       if (ix < 26) c = c + ix;
       else c = 'A' + (ix - 26);
-      char buffer[2] = { c, 0 };
+      char buffer[2] = { (char)c, 0 };
       QCBOREncode_AddInt64ToMap(&ECtx, buffer, ix);
    }
    QCBOREncode_CloseMap(&ECtx);
@@ -1563,8 +1563,8 @@
  */
 
 static UsefulBufC
-FormatRTICResults(uint64_t uRResult,
-                  uint64_t time,
+FormatRTICResults(uint8_t uRResult,
+                  int64_t time,
                   const char *szType,
                   const char *szAlexString,
                   UsefulBuf Storage)
diff --git a/test/run_tests.c b/test/run_tests.c
index 133103f..f8ed83b 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -288,7 +288,7 @@
 
    (*pfOutput)(szWhat, pOutCtx, 0);
    (*pfOutput)(" ", pOutCtx, 0);
-   (*pfOutput)(NumToString(uSize, buffer), pOutCtx, 0);
+   (*pfOutput)(NumToString((int32_t)uSize, buffer), pOutCtx, 0);
    (*pfOutput)("", pOutCtx, 1);
 }