[warnings] fix missing integer casts

This commit is contained in:
akallabeth
2025-03-11 11:29:18 +01:00
parent 85fdbc3b71
commit 1fe0ca41e1
18 changed files with 98 additions and 57 deletions

View File

@@ -945,7 +945,6 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, const B
size_t pos = 0;
UINT8 cbChId = 0;
UINT8 cbLen = 0;
unsigned long chunkLength = 0;
UINT status = CHANNEL_RC_BAD_INIT_HANDLE;
DVCMAN* dvcman = NULL;
@@ -993,10 +992,16 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, const B
const INT32 pdu = (DATA_FIRST_PDU << 4) | cbChId | (cbLen << 2);
Stream_Write_UINT8(data_out, WINPR_ASSERTING_INT_CAST(UINT8, pdu));
Stream_SetPosition(data_out, pos);
chunkLength = CHANNEL_CHUNK_LENGTH - pos;
Stream_Write(data_out, data, chunkLength);
data += chunkLength;
dataSize -= chunkLength;
{
WINPR_ASSERT(pos <= CHANNEL_CHUNK_LENGTH);
const uint32_t chunkLength =
CHANNEL_CHUNK_LENGTH - WINPR_ASSERTING_INT_CAST(uint32_t, pos);
Stream_Write(data_out, data, chunkLength);
data += chunkLength;
dataSize -= chunkLength;
}
status = drdynvc_send(drdynvc, data_out);
while (status == CHANNEL_RC_OK && dataSize > 0)
@@ -1015,10 +1020,12 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, const B
Stream_SetPosition(data_out, 0);
Stream_Write_UINT8(data_out, (DATA_PDU << 4) | cbChId);
Stream_SetPosition(data_out, pos);
chunkLength = dataSize;
uint32_t chunkLength = dataSize;
WINPR_ASSERT(pos <= CHANNEL_CHUNK_LENGTH);
if (chunkLength > CHANNEL_CHUNK_LENGTH - pos)
chunkLength = CHANNEL_CHUNK_LENGTH - pos;
chunkLength = CHANNEL_CHUNK_LENGTH - WINPR_ASSERTING_INT_CAST(uint32_t, pos);
Stream_Write(data_out, data, chunkLength);
data += chunkLength;