[warnings] fix integer narrowing

This commit is contained in:
akallabeth 2024-10-04 10:53:09 +02:00
parent 15d408d6fc
commit e6cf35c518
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
2 changed files with 23 additions and 18 deletions

View File

@ -722,14 +722,19 @@ static BOOL x11_shadow_check_resize(x11ShadowSubsystem* subsystem)
/* Screen size changed. Refresh monitor definitions and trigger screen resize */
subsystem->common.numMonitors = x11_shadow_enum_monitors(subsystem->common.monitors, 16);
shadow_screen_resize(subsystem->common.server->screen);
subsystem->width = attr.width;
subsystem->height = attr.height;
if (!shadow_screen_resize(subsystem->common.server->screen))
return FALSE;
WINPR_ASSERT(attr.width > 0);
WINPR_ASSERT(attr.height > 0);
subsystem->width = (UINT32)attr.width;
subsystem->height = (UINT32)attr.height;
virtualScreen->left = 0;
virtualScreen->top = 0;
virtualScreen->right = subsystem->width - 1;
virtualScreen->bottom = subsystem->height - 1;
virtualScreen->right = attr.width - 1;
virtualScreen->bottom = attr.height - 1;
virtualScreen->flags = 1;
return TRUE;
}

View File

@ -119,23 +119,22 @@ void shadow_screen_free(rdpShadowScreen* screen)
BOOL shadow_screen_resize(rdpShadowScreen* screen)
{
int x = 0;
int y = 0;
int width = 0;
int height = 0;
MONITOR_DEF* primary = NULL;
rdpShadowSubsystem* subsystem = NULL;
if (!screen)
return FALSE;
subsystem = screen->server->subsystem;
primary = &(subsystem->monitors[subsystem->selectedMonitor]);
WINPR_ASSERT(screen->server);
x = primary->left;
y = primary->top;
width = primary->right - primary->left + 1;
height = primary->bottom - primary->top + 1;
rdpShadowSubsystem* subsystem = screen->server->subsystem;
WINPR_ASSERT(subsystem);
WINPR_ASSERT(subsystem->monitors);
MONITOR_DEF* primary = &(subsystem->monitors[subsystem->selectedMonitor]);
WINPR_ASSERT(primary);
const INT32 x = primary->left;
const INT32 y = primary->top;
const INT32 width = primary->right - primary->left + 1;
const INT32 height = primary->bottom - primary->top + 1;
WINPR_ASSERT(x >= 0);
WINPR_ASSERT(x <= UINT16_MAX);
@ -145,6 +144,7 @@ BOOL shadow_screen_resize(rdpShadowScreen* screen)
WINPR_ASSERT(width <= UINT16_MAX);
WINPR_ASSERT(height >= 0);
WINPR_ASSERT(height <= UINT16_MAX);
if (shadow_surface_resize(screen->primary, (UINT16)x, (UINT16)y, (UINT16)width,
(UINT16)height) &&
shadow_surface_resize(screen->lobby, (UINT16)x, (UINT16)y, (UINT16)width, (UINT16)height))