Turn up compiler warnings to max and fix them; one more indefinite length test
diff --git a/src/UsefulBuf.c b/src/UsefulBuf.c
index c8e5d28..dcd7d34 100644
--- a/src/UsefulBuf.c
+++ b/src/UsefulBuf.c
@@ -105,7 +105,7 @@
return NULLUsefulBufC;
}
- memcpy(Dest.ptr + uOffset, Src.ptr, Src.len);
+ memcpy((uint8_t *)Dest.ptr + uOffset, Src.ptr, Src.len);
return((UsefulBufC){Dest.ptr, Src.len + uOffset});
}
diff --git a/src/ieee754.c b/src/ieee754.c
index 7844c1a..b4497cc 100644
--- a/src/ieee754.c
+++ b/src/ieee754.c
@@ -42,11 +42,12 @@
job and the resulting object code is smaller from combining code for the many different
cases (normal, subnormal, infinity, zero...) for the conversions.
- Dead stripping is also really helpful to get code size down.
+ Dead stripping is also really helpful to get code size down when floating point
+ encoding is not needed.
- This code also works solely using shifts and masks and thus has no dependency on
- any math libraries. It will even work if the CPU doesn't have any floating
- point support.
+ This code works solely using shifts and masks and thus has no dependency on
+ any math libraries. It can even work if the CPU doesn't have any floating
+ point support, though that isn't the most useful thing to do.
The memcpy() dependency is only for CopyFloatToUint32() and friends which only
is needed to avoid type punning when converting the actual float bits to
@@ -169,13 +170,6 @@
return u64;
}
-static inline double CopyUint64ToDouble(uint64_t u64)
-{
- double d;
- memcpy(&d, &u64, sizeof(uint64_t));
- return d;
-}
-
static inline float CopyUint32ToFloat(uint32_t u32)
{
float f;
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 187419b..0f76963 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -437,21 +437,6 @@
/*
Decode text and byte strings
*/
-inline static int DecodeBytesOld(int nMajorType, uint64_t uNumber, UsefulInputBuf *pUInBuf, QCBORItem *pDecodedItem)
-{
- const void *pBytes = UsefulInputBuf_GetBytes(pUInBuf, uNumber);
-
- int nReturn = QCBOR_ERR_HIT_END;
-
- if(pBytes != NULL) {
- pDecodedItem->val.string = (UsefulBufC){pBytes, uNumber};
- pDecodedItem->uDataType = (nMajorType == CBOR_MAJOR_TYPE_BYTE_STRING) ? QCBOR_TYPE_BYTE_STRING : QCBOR_TYPE_TEXT_STRING;
- nReturn = QCBOR_SUCCESS;
- }
-
- return nReturn;
-}
-
inline static int DecodeBytes(QCBORStringAllocator *pAlloc, int nMajorType, uint64_t uNumber, UsefulInputBuf *pUInBuf, QCBORItem *pDecodedItem)
{
UsefulBufC Bytes = UsefulInputBuf_GetUsefulBuf(pUInBuf, uNumber);
@@ -1123,9 +1108,9 @@
pMP->StringAllocator.fFree = MemPool_Free;
pMP->StringAllocator.fDestructor = NULL;
- pMP->pStart = Pool.ptr + sizeof(MemPool);
+ pMP->pStart = (uint8_t *)Pool.ptr + sizeof(MemPool);
pMP->pFree = pMP->pStart;
- pMP->pEnd = Pool.ptr + Pool.len;
+ pMP->pEnd = (uint8_t *)Pool.ptr + Pool.len;
pMP->StringAllocator.pAllocaterContext = pMP;
me->pStringAllocator = pMP;