[various] fix integer conversions

This commit is contained in:
akallabeth 2023-08-04 14:29:59 +02:00 committed by akallabeth
parent fee2b10ba1
commit 41bd8bd3fb
9 changed files with 20 additions and 35 deletions

View File

@ -514,7 +514,6 @@ static UINT cliprdr_server_receive_general_capability(CliprdrServerContext* cont
static UINT cliprdr_server_receive_capabilities(CliprdrServerContext* context, wStream* s,
const CLIPRDR_HEADER* header)
{
UINT16 index;
UINT16 capabilitySetType;
UINT16 capabilitySetLength;
UINT error = ERROR_INVALID_DATA;
@ -532,7 +531,7 @@ static UINT cliprdr_server_receive_capabilities(CliprdrServerContext* context, w
Stream_Read_UINT16(s, capabilities.cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
Stream_Seek_UINT16(s); /* pad1 (2 bytes) */
for (index = 0; index < capabilities.cCapabilitiesSets; index++)
for (size_t index = 0; index < capabilities.cCapabilitiesSets; index++)
{
void* tmp = NULL;
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))

View File

@ -202,7 +202,6 @@ static UINT device_server_recv_media_type_list_response(CameraDeviceServerContex
{
CAM_MEDIA_TYPE_LIST_RESPONSE pdu = { 0 };
UINT error = CHANNEL_RC_OK;
BYTE i;
WINPR_ASSERT(context);
WINPR_ASSERT(header);
@ -222,7 +221,7 @@ static UINT device_server_recv_media_type_list_response(CameraDeviceServerContex
return ERROR_NOT_ENOUGH_MEMORY;
}
for (i = 0; i < pdu.N_Descriptions; ++i)
for (size_t i = 0; i < pdu.N_Descriptions; ++i)
{
CAM_MEDIA_TYPE_DESCRIPTION* MediaTypeDescriptions = &pdu.MediaTypeDescriptions[i];

View File

@ -55,8 +55,6 @@ static wStream* rdpsnd_server_get_buffer(RdpsndServerContext* context)
static UINT rdpsnd_server_send_formats(RdpsndServerContext* context)
{
wStream* s = rdpsnd_server_get_buffer(context);
size_t pos;
UINT16 i;
BOOL status = FALSE;
ULONG written;
@ -75,7 +73,7 @@ static UINT rdpsnd_server_send_formats(RdpsndServerContext* context)
Stream_Write_UINT16(s, CHANNEL_VERSION_WIN_MAX); /* wVersion */
Stream_Write_UINT8(s, 0); /* bPad */
for (i = 0; i < context->num_server_formats; i++)
for (size_t i = 0; i < context->num_server_formats; i++)
{
const AUDIO_FORMAT* format = &context->server_formats[i];
@ -83,7 +81,7 @@ static UINT rdpsnd_server_send_formats(RdpsndServerContext* context)
goto fail;
}
pos = Stream_GetPosition(s);
const size_t pos = Stream_GetPosition(s);
Stream_SetPosition(s, 2);
Stream_Write_UINT16(s, pos - 4);
Stream_SetPosition(s, pos);

View File

@ -356,8 +356,9 @@ static BOOL rdtk_nine_patch_get_fill_ht(rdtkNinePatch* ninePatch, wImage* image)
for (uint32_t y = 1; y < image->height - 1; y++)
{
const uint32_t* pixel = (uint32_t*)&image->data[((image->width - 1) * sizeof(uint32_t)) +
image->scanline * y]; /* (width - 1, 1) */
const uint32_t* pixel =
(uint32_t*)&image->data[((image->width - 1) * sizeof(uint32_t)) +
image->scanline * y * 1ull]; /* (width - 1, 1) */
if (beg < 0)
{
if (*pixel)

View File

@ -366,7 +366,7 @@ static BOOL test_peer_load_icon(freerdp_peer* client)
if (!(context->bg_data = calloc(context->icon_height, context->icon_width * 3)))
goto out_fail;
memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3);
memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3ull);
context->icon_data = rgb_data;
fclose(fp);
return TRUE;

View File

@ -162,8 +162,8 @@ static BOOL capture_plugin_send_frame(pClientContext* pc, SOCKET socket, const B
settings = pc->context.settings;
WINPR_ASSERT(settings);
frame_size = settings->DesktopWidth * settings->DesktopHeight *
(freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth) / 8);
frame_size = settings->DesktopWidth * settings->DesktopHeight * 1ull *
(freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth) / 8ull);
bmp_header =
winpr_bitmap_construct_header(settings->DesktopWidth, settings->DesktopHeight,
freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth));

View File

@ -1116,8 +1116,8 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
return -1;
}
subsystem->fb_shm_info.shmid =
shmget(IPC_PRIVATE, subsystem->fb_image->bytes_per_line * subsystem->fb_image->height,
subsystem->fb_shm_info.shmid = shmget(
IPC_PRIVATE, subsystem->fb_image->bytes_per_line * subsystem->fb_image->height * 1ull,
IPC_CREAT | 0600);
if (subsystem->fb_shm_info.shmid == -1)
@ -1333,7 +1333,7 @@ static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
subsystem->cursorMaxWidth = 256;
subsystem->cursorMaxHeight = 256;
subsystem->cursorPixels =
winpr_aligned_malloc(subsystem->cursorMaxWidth * subsystem->cursorMaxHeight * 4, 16);
winpr_aligned_malloc(subsystem->cursorMaxWidth * subsystem->cursorMaxHeight * 4ull, 16);
if (!subsystem->cursorPixels)
return -1;

View File

@ -31,31 +31,19 @@
static void rdpsnd_activated(RdpsndServerContext* context)
{
const AUDIO_FORMAT* agreed_format = NULL;
UINT16 i = 0, j = 0;
for (i = 0; i < context->num_client_formats; i++)
for (size_t i = 0; i < context->num_client_formats; i++)
{
for (j = 0; j < context->num_server_formats; j++)
for (size_t j = 0; j < context->num_server_formats; j++)
{
if (audio_format_compatible(&context->server_formats[j], &context->client_formats[i]))
{
agreed_format = &context->server_formats[j];
break;
}
}
if (agreed_format != NULL)
break;
}
if (agreed_format == NULL)
{
WLog_ERR(TAG, "Could not agree on a audio format with the server\n");
context->SelectFormat(context, i);
return;
}
}
}
context->SelectFormat(context, i);
WLog_ERR(TAG, "Could not agree on a audio format with the server\n");
}
int shadow_client_rdpsnd_init(rdpShadowClient* client)

View File

@ -87,7 +87,7 @@ BOOL shadow_surface_resize(rdpShadowSurface* surface, UINT16 x, UINT16 y, UINT32
return TRUE;
}
buffer = (BYTE*)realloc(surface->data, scanline * ALIGN_SCREEN_SIZE(height, 4));
buffer = (BYTE*)realloc(surface->data, scanline * ALIGN_SCREEN_SIZE(height, 4) * 1ull);
if (buffer)
{