[warnings] fix coverity warnings

This commit is contained in:
Armin Novak 2025-03-12 13:23:56 +01:00
parent 3e6707c443
commit 8fb49b0abe
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
5 changed files with 12 additions and 10 deletions

View File

@ -426,6 +426,9 @@ UINT cliprdr_read_format_list(wStream* s, CLIPRDR_FORMAT_LIST* formatList, BOOL
while (Stream_GetRemainingLength(sub1) >= 4) while (Stream_GetRemainingLength(sub1) >= 4)
{ {
if (index >= formatList->numFormats)
goto error_out;
CLIPRDR_FORMAT* format = &formats[index]; CLIPRDR_FORMAT* format = &formats[index];
Stream_Read_UINT32(sub1, format->formatId); /* formatId (4 bytes) */ Stream_Read_UINT32(sub1, format->formatId); /* formatId (4 bytes) */

View File

@ -2114,7 +2114,7 @@ exit:
if (groupDsc) if (groupDsc)
{ {
groupDsc->cItems = clipboard->nFiles; groupDsc->cItems = WINPR_ASSERTING_INT_CAST(UINT, clipboard->nFiles);
for (size_t i = 0; i < clipboard->nFiles; i++) for (size_t i = 0; i < clipboard->nFiles; i++)
{ {

View File

@ -2895,10 +2895,10 @@ static bool sUuidEqual(const UUID* Uuid1, const UUID* Uuid2)
if (!Uuid1 && !Uuid2) if (!Uuid1 && !Uuid2)
return false; return false;
if (!Uuid2 && Uuid1) if (Uuid1 && !Uuid2)
return false; return false;
if (!Uuid1 && !Uuid2) if (!Uuid1 && Uuid2)
return true; return true;
if (Uuid1->Data1 != Uuid2->Data1) if (Uuid1->Data1 != Uuid2->Data1)

View File

@ -139,7 +139,6 @@
int shifts = 0; \ int shifts = 0; \
const _type_* sptr = pSrc; \ const _type_* sptr = pSrc; \
_type_* dptr = pDst; \ _type_* dptr = pDst; \
size_t count; \
__m128i xmm0; \ __m128i xmm0; \
if (sizeof(_type_) == 1) \ if (sizeof(_type_) == 1) \
shifts = 1; \ shifts = 1; \
@ -150,10 +149,10 @@
else if (sizeof(_type_) == 8) \ else if (sizeof(_type_) == 8) \
shifts = 4; \ shifts = 4; \
/* Use 4 128-bit SSE registers. */ \ /* Use 4 128-bit SSE registers. */ \
count = len >> (7 - shifts); \ size_t count = len >> (7 - shifts); \
len -= count << (7 - shifts); \ len -= count << (7 - shifts); \
xmm0 = mm_set1_epu32(val); \ xmm0 = mm_set1_epu32(val); \
while (count--) \ for (size_t x = 0; x < count; x++) \
{ \ { \
__m128i xmm1 = LOAD_SI128(sptr); \ __m128i xmm1 = LOAD_SI128(sptr); \
sptr += (16 / sizeof(_type_)); \ sptr += (16 / sizeof(_type_)); \
@ -179,7 +178,7 @@
/* Use a single 128-bit SSE register. */ \ /* Use a single 128-bit SSE register. */ \
count = len >> (5 - shifts); \ count = len >> (5 - shifts); \
len -= count << (5 - shifts); \ len -= count << (5 - shifts); \
while (count--) \ for (size_t x = 0; x < count; x++) \
{ \ { \
__m128i xmm1 = LOAD_SI128(sptr); \ __m128i xmm1 = LOAD_SI128(sptr); \
sptr += (16 / sizeof(_type_)); \ sptr += (16 / sizeof(_type_)); \
@ -188,7 +187,7 @@
dptr += (16 / sizeof(_type_)); \ dptr += (16 / sizeof(_type_)); \
} \ } \
/* Finish off the remainder. */ \ /* Finish off the remainder. */ \
while (len--) \ for (size_t x = 0; x < len; x++) \
{ \ { \
_slowWay_; \ _slowWay_; \
} \ } \

View File

@ -379,7 +379,7 @@ BOOL BufferPool_Return(wBufferPool* pool, void* buffer)
if ((pool->size + 1) >= pool->capacity) if ((pool->size + 1) >= pool->capacity)
{ {
SSIZE_T newCapacity = MAX(1, pool->size + (pool->size + 2) / 2 + 1); SSIZE_T newCapacity = MAX(2, pool->size + (pool->size + 2) / 2 + 1);
void** newArray = (void**)realloc( void** newArray = (void**)realloc(
(void*)pool->array, sizeof(void*) * WINPR_ASSERTING_INT_CAST(size_t, newCapacity)); (void*)pool->array, sizeof(void*) * WINPR_ASSERTING_INT_CAST(size_t, newCapacity));
if (!newArray) if (!newArray)
@ -416,7 +416,7 @@ BOOL BufferPool_Return(wBufferPool* pool, void* buffer)
{ {
if ((pool->aSize + 1) >= pool->aCapacity) if ((pool->aSize + 1) >= pool->aCapacity)
{ {
SSIZE_T newCapacity = MAX(1, pool->aSize + (pool->aSize + 2) / 2 + 1); SSIZE_T newCapacity = MAX(2, pool->aSize + (pool->aSize + 2) / 2 + 1);
wBufferPoolItem* newArray = (wBufferPoolItem*)realloc( wBufferPoolItem* newArray = (wBufferPoolItem*)realloc(
pool->aArray, pool->aArray,
sizeof(wBufferPoolItem) * WINPR_ASSERTING_INT_CAST(size_t, newCapacity)); sizeof(wBufferPoolItem) * WINPR_ASSERTING_INT_CAST(size_t, newCapacity));