Fixed sign-compare warnings

This commit is contained in:
Armin Novak 2019-02-07 14:40:36 +01:00
parent 8bb83f2526
commit e009a62f06
9 changed files with 90 additions and 63 deletions

View File

@ -195,9 +195,9 @@ BOOL xf_picture_transform_required(xfContext* xfc)
{
rdpSettings* settings = xfc->context.settings;
if (xfc->offset_x || xfc->offset_y ||
xfc->scaledWidth != settings->DesktopWidth ||
xfc->scaledHeight != settings->DesktopHeight)
if ((xfc->offset_x != 0) || (xfc->offset_y != 0) ||
(xfc->scaledWidth != (INT64)settings->DesktopWidth) ||
(xfc->scaledHeight != (INT64)settings->DesktopHeight))
{
return TRUE;
}

View File

@ -450,7 +450,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_raw_server_formats(xfClipboard* clipboard,
static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(
xfClipboard* clipboard, UINT32* numFormats)
{
int i;
unsigned long i;
Atom atom;
BYTE* data = NULL;
int format_property;
@ -750,7 +750,10 @@ static void xf_cliprdr_append_target(xfClipboard* clipboard, Atom target)
{
int i;
if (clipboard->numTargets >= ARRAYSIZE(clipboard->targets))
if (clipboard->numTargets < 0)
return;
if ((size_t)clipboard->numTargets >= ARRAYSIZE(clipboard->targets))
return;
for (i = 0; i < clipboard->numTargets; i++)

View File

@ -751,7 +751,7 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
(((Atom) event->xproperty.atom == xfc->WM_STATE)
&& (event->xproperty.state != PropertyDelete)))
{
int i;
unsigned long i;
BOOL status;
BOOL maxVert = FALSE;
BOOL maxHorz = FALSE;

View File

@ -747,7 +747,8 @@ fail:
static BOOL xf_gdi_polygon_sc(rdpContext* context,
const POLYGON_SC_ORDER* polygon_sc)
{
int i, npoints;
UINT32 i;
int npoints;
XPoint* points;
XColor brush_color;
xfContext* xfc = (xfContext*) context;
@ -811,7 +812,8 @@ static BOOL xf_gdi_polygon_sc(rdpContext* context,
static BOOL xf_gdi_polygon_cb(rdpContext* context,
POLYGON_CB_ORDER* polygon_cb)
{
int i, npoints;
UINT32 i;
int npoints;
XPoint* points;
Pixmap pattern;
const rdpBrush* brush;

View File

@ -122,7 +122,7 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
XSetFunction(xfc->display, xfc->gc, GXcopy);
if (depth != xfc->depth)
if ((INT64)depth != xfc->depth)
{
if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16)))
goto unlock;

View File

@ -119,7 +119,7 @@ int xf_list_monitors(xfContext* xfc)
static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
{
int index;
UINT32 index;
rdpSettings* settings = xfc->context.settings;
if (!settings->NumMonitorIds)
@ -136,7 +136,6 @@ static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
{
UINT32 i;
int nmonitors = 0;
int monitor_index = 0;
BOOL primaryMonitorFound = FALSE;
@ -154,7 +153,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
XRRMonitorInfo* rrmonitors = NULL;
BOOL useXRandr = FALSE;
#endif
if (!xfc || !pMaxWidth || !pMaxHeight || !xfc->context.settings)
return FALSE;
@ -183,6 +182,8 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (vscreen->nmonitors)
{
int i;
for (i = 0; i < vscreen->nmonitors; i++)
{
vscreen->monitors[i].area.left = rrmonitors[i].x;
@ -208,6 +209,8 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (vscreen->nmonitors)
{
int i;
for (i = 0; i < vscreen->nmonitors; i++)
{
vscreen->monitors[i].area.left = screenInfo[i].x_org;
@ -227,6 +230,8 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
/* Determine which monitor that the mouse cursor is on */
if (vscreen->monitors)
{
int i;
for (i = 0; i < vscreen->nmonitors; i++)
{
if ((mouse_x >= vscreen->monitors[i].area.left) &&
@ -279,6 +284,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (settings->NumMonitorIds == 1)
{
monitor = vscreen->monitors + current_monitor;
if (!monitor)
return FALSE;
@ -350,62 +356,68 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
}
/* Create array of all active monitors by taking into account monitors requested on the command-line */
for (i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_ATTRIBUTES* attrs;
int i;
if (!xf_is_monitor_id_active(xfc, i))
continue;
for (i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_ATTRIBUTES* attrs;
if (!vscreen->monitors)
return FALSE;
if (!xf_is_monitor_id_active(xfc, (UINT32)i))
continue;
settings->MonitorDefArray[nmonitors].x = vscreen->monitors[i].area.left;
settings->MonitorDefArray[nmonitors].y = vscreen->monitors[i].area.top;
settings->MonitorDefArray[nmonitors].width =
vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1;
settings->MonitorDefArray[nmonitors].height =
vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1;
settings->MonitorDefArray[nmonitors].orig_screen = i;
if (!vscreen->monitors)
return FALSE;
settings->MonitorDefArray[nmonitors].x = vscreen->monitors[i].area.left;
settings->MonitorDefArray[nmonitors].y = vscreen->monitors[i].area.top;
settings->MonitorDefArray[nmonitors].width =
vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1;
settings->MonitorDefArray[nmonitors].height =
vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1;
settings->MonitorDefArray[nmonitors].orig_screen = i;
#ifdef USABLE_XRANDR
if (useXRandr && rrmonitors)
{
Rotation rot, ret;
attrs = &settings->MonitorDefArray[nmonitors].attributes;
attrs->physicalWidth = rrmonitors[i].mwidth;
attrs->physicalHeight = rrmonitors[i].mheight;
ret = XRRRotations(xfc->display, i, &rot);
attrs->orientation = rot;
}
if (useXRandr && rrmonitors)
{
Rotation rot, ret;
attrs = &settings->MonitorDefArray[nmonitors].attributes;
attrs->physicalWidth = rrmonitors[i].mwidth;
attrs->physicalHeight = rrmonitors[i].mheight;
ret = XRRRotations(xfc->display, i, &rot);
attrs->orientation = rot;
}
#endif
if (i == settings->MonitorIds[0])
{
settings->MonitorDefArray[nmonitors].is_primary = TRUE;
settings->MonitorLocalShiftX = settings->MonitorDefArray[nmonitors].x;
settings->MonitorLocalShiftY = settings->MonitorDefArray[nmonitors].y;
primaryMonitorFound = TRUE;
}
if ((UINT32)i == settings->MonitorIds[0])
{
settings->MonitorDefArray[nmonitors].is_primary = TRUE;
settings->MonitorLocalShiftX = settings->MonitorDefArray[nmonitors].x;
settings->MonitorLocalShiftY = settings->MonitorDefArray[nmonitors].y;
primaryMonitorFound = TRUE;
}
nmonitors++;
nmonitors++;
}
}
/* If no monitor is active(bogus command-line monitor specification) - then lets try to fallback to go fullscreen on the current monitor only */
if (nmonitors == 0 && vscreen->nmonitors > 0)
{
{
INT32 width, height;
if (!vscreen->monitors)
return FALSE;
width = vscreen->monitors[current_monitor].area.right -
vscreen->monitors[current_monitor].area.left + 1L;
height = vscreen->monitors[current_monitor].area.bottom -
vscreen->monitors[current_monitor].area.top + 1L;
settings->MonitorDefArray[0].x = vscreen->monitors[current_monitor].area.left;
settings->MonitorDefArray[0].y = vscreen->monitors[current_monitor].area.top;
settings->MonitorDefArray[0].width = MIN(
vscreen->monitors[current_monitor].area.right -
vscreen->monitors[current_monitor].area.left + 1, *pMaxWidth);
settings->MonitorDefArray[0].height = MIN(
vscreen->monitors[current_monitor].area.bottom -
vscreen->monitors[current_monitor].area.top + 1, *pMaxHeight);
settings->MonitorDefArray[0].width = MIN(width, (INT64)(*pMaxWidth));
settings->MonitorDefArray[0].height = MIN(height, (INT64)(*pMaxHeight));
settings->MonitorDefArray[0].orig_screen = current_monitor;
nmonitors = 1;
}
@ -415,6 +427,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
/* If we have specific monitor information */
if (settings->MonitorCount)
{
UINT32 i;
/* Initialize bounding rectangle for all monitors */
int vX = settings->MonitorDefArray[0].x;
int vY = settings->MonitorDefArray[0].y;
@ -526,8 +539,8 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
}
/* Set the desktop width and height according to the bounding rectangle around the active monitors */
*pMaxWidth = MIN(*pMaxWidth, vscreen->area.right - vscreen->area.left + 1);
*pMaxHeight = MIN(*pMaxHeight, vscreen->area.bottom - vscreen->area.top + 1);
*pMaxWidth = MIN(*pMaxWidth, (UINT32)vscreen->area.right - vscreen->area.left + 1);
*pMaxHeight = MIN(*pMaxHeight, (UINT32)vscreen->area.bottom - vscreen->area.top + 1);
}
/* some 2008 server freeze at logon if we announce support for monitor layout PDU with

View File

@ -143,8 +143,8 @@ void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
/* If current window position disagrees with RDP window position, send update to RDP server */
if (appWindow->x != appWindow->windowOffsetX ||
appWindow->y != appWindow->windowOffsetY ||
appWindow->width != appWindow->windowWidth ||
appWindow->height != appWindow->windowHeight)
appWindow->width != (INT64)appWindow->windowWidth ||
appWindow->height != (INT64)appWindow->windowHeight)
{
windowMove.windowId = appWindow->windowId;
/*
@ -504,10 +504,10 @@ static BOOL xf_rail_window_common(rdpContext* context,
if (appWindow->rail_state != WINDOW_SHOW_MINIMIZED)
{
/* Redraw window area if already in the correct position */
if (appWindow->x == appWindow->windowOffsetX &&
appWindow->y == appWindow->windowOffsetY &&
appWindow->width == appWindow->windowWidth &&
appWindow->height == appWindow->windowHeight)
if (appWindow->x == (INT64)appWindow->windowOffsetX &&
appWindow->y == (INT64)appWindow->windowOffsetY &&
appWindow->width == (INT64)appWindow->windowWidth &&
appWindow->height == (INT64)appWindow->windowHeight)
{
xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth,
appWindow->windowHeight);

View File

@ -72,7 +72,7 @@ static BOOL xf_tsmf_is_format_supported(xfXvContext* xv, UINT32 pixfmt)
return FALSE;
}
int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAME_EVENT* event)
static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAME_EVENT* event)
{
int i;
int x, y;
@ -87,7 +87,7 @@ int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAME_EVENT
int numRects = 0;
xfContext* xfc;
xfXvContext* xv;
XRectangle* xrects;
XRectangle* xrects = NULL;
XShmSegmentInfo shminfo;
BOOL converti420yv12 = FALSE;
@ -281,8 +281,17 @@ int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAME_EVENT
break;
default:
CopyMemory(image->data, event->frameData, image->data_size <= event->frameSize ?
image->data_size : event->frameSize);
if (image->data_size < 0)
{
free(xrects);
return -2000;
}
else
{
const size_t size = ((UINT32)image->data_size <= event->frameSize) ?
(UINT32)image->data_size : event->frameSize;
CopyMemory(image->data, event->frameData, size);
}
break;
}
@ -397,7 +406,7 @@ int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
{
xv->xv_pixfmts = (UINT32*) calloc((ret + 1), sizeof(UINT32));
for (i = 0; i < ret; i++)
for (i = 0; i < (unsigned int)ret; i++)
{
xv->xv_pixfmts[i] = fo[i].id;
WLog_DBG(TAG, "%c%c%c%c ", ((char*)(xv->xv_pixfmts + i))[0], ((char*)(xv->xv_pixfmts + i))[1],

View File

@ -401,7 +401,7 @@ BOOL xf_GetWorkArea(xfContext* xfc)
if (!status)
return FALSE;
if ((xfc->current_desktop * 4 + 3) >= nitems)
if ((xfc->current_desktop * 4 + 3) >= (INT64)nitems)
{
free(prop);
return FALSE;