[warnings] fix warnings detected by latest CI build

This commit is contained in:
akallabeth
2025-01-03 09:45:30 +01:00
parent a6f884f0e3
commit 0969502541
5 changed files with 10 additions and 10 deletions

View File

@@ -2614,9 +2614,8 @@ int ncrush_compress(NCRUSH_CONTEXT* ncrush, const BYTE* pSrcData, UINT32 SrcSize
CopyOffset = 0;
MatchOffset = 0;
const intptr_t thsize = HistoryPtr - HistoryBuffer;
WINPR_ASSERT(thsize >= 0);
WINPR_ASSERT(thsize <= UINT32_MAX);
ncrush_hash_table_add(ncrush, pSrcData, SrcSize, (UINT32)thsize);
ncrush_hash_table_add(ncrush, pSrcData, SrcSize, WINPR_ASSERTING_INT_CAST(UINT32, thsize));
CopyMemory(HistoryPtr, pSrcData, SrcSize);
ncrush->HistoryPtr = &HistoryPtr[SrcSize];

View File

@@ -440,7 +440,7 @@ int websocket_context_read(websocket_context* encodingContext, BIO* bio, BYTE* p
effectiveDataLen += status;
if ((size_t)status == size)
if ((size_t)status >= size)
return effectiveDataLen;
pBuffer += status;
size -= WINPR_ASSERTING_INT_CAST(size_t, status);

View File

@@ -1045,9 +1045,6 @@ SSIZE_T transport_parse_pdu(rdpTransport* transport, wStream* s, BOOL* incomplet
if (pduLength <= 0)
return pduLength;
if (pduLength > SSIZE_MAX)
return -1;
const size_t len = Stream_Length(s);
if (len > WINPR_ASSERTING_INT_CAST(size_t, pduLength))
return -1;

View File

@@ -76,6 +76,9 @@ static INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, UINT32 x, UINT32 y)
* brush origin and dest coordinates */
const UINT32 w = WINPR_ASSERTING_INT_CAST(UINT32, hBmpBrush->width);
const UINT32 h = WINPR_ASSERTING_INT_CAST(UINT32, hBmpBrush->height);
WINPR_ASSERT(w > 0);
WINPR_ASSERT(h > 0);
x = (x + w - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nXOrg) % w)) % w;
y = (y + h - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nYOrg) % h)) % h;
p = hBmpBrush->data + (y * hBmpBrush->scanline) +

View File

@@ -242,9 +242,10 @@ general_yCbCrToRGB_16s16s_P3P3(const INT16* WINPR_RESTRICT pSrc[3], INT32 srcSte
* B: 1.770 << 16 = 115998
*/
cy = (INT32)((UINT32)(cy + 4096) << 16);
r = cy + cr * ycbcr_constants[16][0];
g = cy - cb * ycbcr_constants[16][1] - cr * ycbcr_constants[16][2];
b = cy + cb * ycbcr_constants[16][3];
r = 1LL * cy + 1LL * cr * ycbcr_constants[16][0];
g = 1LL * cy - 1LL * cb * ycbcr_constants[16][1] - 1LL * cr * ycbcr_constants[16][2];
b = 1LL * cy + 1LL * cb * ycbcr_constants[16][3];
*rptr++ = CLIP(r >> 21);
*gptr++ = CLIP(g >> 21);
*bptr++ = CLIP(b >> 21);