Fixed shadowing and type errors
This commit is contained in:
parent
297f965052
commit
f515bd4560
@ -537,7 +537,7 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp)
|
||||
{
|
||||
/* Cleaning up termitating and pending irp
|
||||
* threads. See also: irp_thread_func() */
|
||||
HANDLE irpThread;
|
||||
HANDLE cirpThread;
|
||||
ULONG_PTR* ids;
|
||||
int i, nbIds;
|
||||
nbIds = ListDictionary_GetKeys(serial->IrpThreads, &ids);
|
||||
@ -547,17 +547,17 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp)
|
||||
/* Checking if ids[i] is terminating or pending */
|
||||
DWORD waitResult;
|
||||
ULONG_PTR id = ids[i];
|
||||
irpThread = ListDictionary_GetItemValue(serial->IrpThreads, (void*)id);
|
||||
cirpThread = ListDictionary_GetItemValue(serial->IrpThreads, (void*)id);
|
||||
/* FIXME: not quite sure a zero timeout is a good thing to check whether a thread is
|
||||
* stil alived or not */
|
||||
waitResult = WaitForSingleObject(irpThread, 0);
|
||||
waitResult = WaitForSingleObject(cirpThread, 0);
|
||||
|
||||
if (waitResult == WAIT_OBJECT_0)
|
||||
{
|
||||
/* terminating thread */
|
||||
/* WLog_Print(serial->log, WLOG_DEBUG, "IRP thread with CompletionId=%"PRIuz"
|
||||
* naturally died", id); */
|
||||
CloseHandle(irpThread);
|
||||
CloseHandle(cirpThread);
|
||||
ListDictionary_Remove(serial->IrpThreads, (void*)id);
|
||||
serial->IrpThreadToBeTerminatedCount--;
|
||||
}
|
||||
|
@ -424,10 +424,10 @@ static BOOL urbdrc_announce_devices(IUDEVMAN* udevman)
|
||||
if (!pdev->isAlreadySend(pdev))
|
||||
{
|
||||
const UINT32 deviceId = pdev->get_UsbDevice(pdev);
|
||||
UINT error =
|
||||
UINT cerror =
|
||||
urdbrc_send_virtual_channel_add(udevman->plugin, get_channel(udevman), deviceId);
|
||||
|
||||
if (error != ERROR_SUCCESS)
|
||||
if (cerror != ERROR_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
if (cnv < 0)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
size = (size_t)cnv;
|
||||
size = (UINT32)cnv;
|
||||
data = cdata;
|
||||
break;
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <freerdp/locale/keyboard.h>
|
||||
@ -42,6 +44,25 @@ typedef struct touch_contact
|
||||
|
||||
static touchContact contacts[MAX_CONTACTS];
|
||||
|
||||
static BOOL scale_signed_coordinates(rdpContext* context, int32_t* x, int32_t* y,
|
||||
BOOL fromLocalToRDP)
|
||||
{
|
||||
BOOL rc;
|
||||
UINT32 ux = (UINT32)x;
|
||||
UINT32 uy = (UINT32)y;
|
||||
WINPR_ASSERT(context);
|
||||
WINPR_ASSERT(x);
|
||||
WINPR_ASSERT(y);
|
||||
WINPR_ASSERT(*x >= 0);
|
||||
WINPR_ASSERT(*y >= 0);
|
||||
rc = wlf_scale_coordinates(context, &ux, &uy, fromLocalToRDP);
|
||||
WINPR_ASSERT(ux < INT32_MAX);
|
||||
WINPR_ASSERT(uy < INT32_MAX);
|
||||
*x = (int32_t)ux;
|
||||
*y = (int32_t)uy;
|
||||
return rc;
|
||||
}
|
||||
|
||||
BOOL wlf_handle_pointer_enter(freerdp* instance, const UwacPointerEnterLeaveEvent* ev)
|
||||
{
|
||||
uint32_t x, y;
|
||||
@ -55,7 +76,9 @@ BOOL wlf_handle_pointer_enter(freerdp* instance, const UwacPointerEnterLeaveEven
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
|
||||
return freerdp_input_send_mouse_event(instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
WINPR_ASSERT(x <= UINT16_MAX);
|
||||
WINPR_ASSERT(y <= UINT16_MAX);
|
||||
return freerdp_input_send_mouse_event(instance->input, PTR_FLAGS_MOVE, (UINT16)x, (UINT16)y);
|
||||
}
|
||||
|
||||
BOOL wlf_handle_pointer_motion(freerdp* instance, const UwacPointerMotionEvent* ev)
|
||||
@ -71,7 +94,9 @@ BOOL wlf_handle_pointer_motion(freerdp* instance, const UwacPointerMotionEvent*
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
|
||||
return freerdp_input_send_mouse_event(instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
WINPR_ASSERT(x <= UINT16_MAX);
|
||||
WINPR_ASSERT(y <= UINT16_MAX);
|
||||
return freerdp_input_send_mouse_event(instance->input, PTR_FLAGS_MOVE, (UINT16)x, (UINT16)y);
|
||||
}
|
||||
|
||||
BOOL wlf_handle_pointer_buttons(freerdp* instance, const UwacPointerButtonEvent* ev)
|
||||
@ -124,11 +149,14 @@ BOOL wlf_handle_pointer_buttons(freerdp* instance, const UwacPointerButtonEvent*
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WINPR_ASSERT(x <= UINT16_MAX);
|
||||
WINPR_ASSERT(y <= UINT16_MAX);
|
||||
|
||||
if ((flags & ~PTR_FLAGS_DOWN) != 0)
|
||||
return freerdp_input_send_mouse_event(input, flags, x, y);
|
||||
return freerdp_input_send_mouse_event(input, flags, (UINT16)x, (UINT16)y);
|
||||
|
||||
if ((xflags & ~PTR_XFLAGS_DOWN) != 0)
|
||||
return freerdp_input_send_extended_mouse_event(input, xflags, x, y);
|
||||
return freerdp_input_send_extended_mouse_event(input, xflags, (UINT16)x, (UINT16)y);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -159,9 +187,12 @@ static BOOL wlf_handle_wheel(freerdp* instance, uint32_t x, uint32_t y, uint32_t
|
||||
rdpInput* input;
|
||||
UINT16 flags = 0;
|
||||
int32_t direction;
|
||||
uint32_t avalue = abs(value);
|
||||
uint32_t avalue = (uint32_t)abs(value);
|
||||
|
||||
WINPR_ASSERT(instance);
|
||||
|
||||
input = instance->input;
|
||||
WINPR_ASSERT(input);
|
||||
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
@ -195,8 +226,8 @@ static BOOL wlf_handle_wheel(freerdp* instance, uint32_t x, uint32_t y, uint32_t
|
||||
|
||||
while (avalue > 0)
|
||||
{
|
||||
const uint32_t cval = avalue > 0xFF ? 0xFF : avalue;
|
||||
uint32_t cflags = flags | cval;
|
||||
const UINT16 cval = (avalue > 0xFF) ? 0xFF : (UINT16)avalue;
|
||||
UINT16 cflags = flags | cval;
|
||||
/* Convert negative values to 9bit twos complement */
|
||||
if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
|
||||
cflags = (flags & 0xFF00) | (0x100 - cval);
|
||||
@ -214,7 +245,7 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
|
||||
BOOL handle = FALSE;
|
||||
size_t x;
|
||||
wlfContext* context;
|
||||
enum wl_pointer_axis_source source;
|
||||
enum wl_pointer_axis_source source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
|
||||
|
||||
if (!instance || !ev || !instance->input || !instance->context)
|
||||
return FALSE;
|
||||
@ -223,13 +254,13 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
|
||||
|
||||
for (x = 0; x < ArrayList_Count(context->events); x++)
|
||||
{
|
||||
UwacEvent* ev = ArrayList_GetItem(context->events, x);
|
||||
if (!ev)
|
||||
UwacEvent* cev = ArrayList_GetItem(context->events, x);
|
||||
if (!cev)
|
||||
continue;
|
||||
if (ev->type == UWAC_EVENT_POINTER_SOURCE)
|
||||
if (cev->type == UWAC_EVENT_POINTER_SOURCE)
|
||||
{
|
||||
handle = TRUE;
|
||||
source = ev->mouse_source.axis_source;
|
||||
source = cev->mouse_source.axis_source;
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,8 +269,8 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
|
||||
{
|
||||
for (x = 0; x < ArrayList_Count(context->events); x++)
|
||||
{
|
||||
UwacEvent* ev = ArrayList_GetItem(context->events, x);
|
||||
if (!ev)
|
||||
UwacEvent* cev = ArrayList_GetItem(context->events, x);
|
||||
if (!cev)
|
||||
continue;
|
||||
|
||||
switch (source)
|
||||
@ -252,22 +283,22 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
|
||||
if (ev->type == UWAC_EVENT_POINTER_AXIS_DISCRETE)
|
||||
{
|
||||
/* Get the number of steps, multiply by default step width of 120 */
|
||||
int32_t val = ev->mouse_axis.value * 0x78;
|
||||
int32_t val = cev->mouse_axis.value * 0x78;
|
||||
/* No wheel event received, success! */
|
||||
if (!wlf_handle_wheel(instance, ev->mouse_axis.x, ev->mouse_axis.y,
|
||||
ev->mouse_axis.axis, val))
|
||||
if (!wlf_handle_wheel(instance, cev->mouse_axis.x, cev->mouse_axis.y,
|
||||
cev->mouse_axis.axis, val))
|
||||
success = FALSE;
|
||||
}
|
||||
break;
|
||||
/* If we have a touch pad we get actual data, scale */
|
||||
case WL_POINTER_AXIS_SOURCE_FINGER:
|
||||
case WL_POINTER_AXIS_SOURCE_CONTINUOUS:
|
||||
if (ev->type == UWAC_EVENT_POINTER_AXIS)
|
||||
if (cev->type == UWAC_EVENT_POINTER_AXIS)
|
||||
{
|
||||
double dval = wl_fixed_to_double(ev->mouse_axis.value);
|
||||
int32_t val = dval * 0x78 / 10.0;
|
||||
if (!wlf_handle_wheel(instance, ev->mouse_axis.x, ev->mouse_axis.y,
|
||||
ev->mouse_axis.axis, val))
|
||||
double dval = wl_fixed_to_double(cev->mouse_axis.value);
|
||||
int32_t val = (int32_t)(dval * 0x78 / 10.0);
|
||||
if (!wlf_handle_wheel(instance, cev->mouse_axis.x, cev->mouse_axis.y,
|
||||
cev->mouse_axis.axis, val))
|
||||
success = FALSE;
|
||||
}
|
||||
break;
|
||||
@ -333,7 +364,7 @@ BOOL wlf_keyboard_enter(freerdp* instance, const UwacKeyboardEnterLeaveEvent* ev
|
||||
BOOL wlf_keyboard_modifiers(freerdp* instance, const UwacKeyboardModifiersEvent* ev)
|
||||
{
|
||||
rdpInput* input;
|
||||
uint32_t syncFlags;
|
||||
UINT16 syncFlags;
|
||||
|
||||
if (!instance || !ev || !instance->input)
|
||||
return FALSE;
|
||||
@ -357,7 +388,7 @@ BOOL wlf_keyboard_modifiers(freerdp* instance, const UwacKeyboardModifiersEvent*
|
||||
|
||||
BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
|
||||
{
|
||||
uint32_t x = 0, y = 0;
|
||||
int32_t x = 0, y = 0;
|
||||
int i;
|
||||
int touchId;
|
||||
int contactId;
|
||||
@ -369,11 +400,12 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
|
||||
|
||||
for (i = 0; i < MAX_CONTACTS; i++)
|
||||
{
|
||||
if (contacts[i].id == touchId)
|
||||
touchContact* contact = &contacts[i];
|
||||
if (contact->id == touchId)
|
||||
{
|
||||
contacts[i].id = 0;
|
||||
x = contacts[i].pos_x;
|
||||
y = contacts[i].pos_y;
|
||||
contact->id = 0;
|
||||
x = (int32_t)contact->pos_x;
|
||||
y = (int32_t)contact->pos_y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -383,7 +415,7 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
|
||||
|
||||
WLog_DBG(TAG, "%s called | event_id: %u | x: %u / y: %u", __FUNCTION__, touchId, x, y);
|
||||
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
|
||||
RdpeiClientContext* rdpei = ((wlfContext*)instance->context)->rdpei;
|
||||
@ -393,8 +425,10 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
|
||||
UINT16 flags = 0;
|
||||
flags |= PTR_FLAGS_BUTTON1;
|
||||
|
||||
WINPR_ASSERT(x <= UINT16_MAX);
|
||||
WINPR_ASSERT(y <= UINT16_MAX);
|
||||
if ((flags & ~PTR_FLAGS_DOWN) != 0)
|
||||
return freerdp_input_send_mouse_event(instance->input, flags, x, y);
|
||||
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -409,7 +443,7 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
|
||||
|
||||
BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
|
||||
{
|
||||
uint32_t x, y;
|
||||
int32_t x, y;
|
||||
int i;
|
||||
int touchId;
|
||||
int contactId;
|
||||
@ -439,7 +473,7 @@ BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
|
||||
|
||||
WLog_DBG(TAG, "%s called | event_id: %u | x: %u / y: %u", __FUNCTION__, touchId, x, y);
|
||||
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
|
||||
context = (wlfContext*)instance->context;
|
||||
@ -454,8 +488,10 @@ BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
|
||||
flags |= PTR_FLAGS_DOWN;
|
||||
flags |= PTR_FLAGS_BUTTON1;
|
||||
|
||||
WINPR_ASSERT(x <= UINT16_MAX);
|
||||
WINPR_ASSERT(y <= UINT16_MAX);
|
||||
if ((flags & ~PTR_FLAGS_DOWN) != 0)
|
||||
return freerdp_input_send_mouse_event(instance->input, flags, x, y);
|
||||
return freerdp_input_send_mouse_event(instance->input, flags, (UINT16)x, (UINT16)y);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -467,7 +503,7 @@ BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
|
||||
|
||||
BOOL wlf_handle_touch_motion(freerdp* instance, const UwacTouchMotion* ev)
|
||||
{
|
||||
uint32_t x, y;
|
||||
int32_t x, y;
|
||||
int i;
|
||||
int touchId;
|
||||
int contactId;
|
||||
@ -483,7 +519,8 @@ BOOL wlf_handle_touch_motion(freerdp* instance, const UwacTouchMotion* ev)
|
||||
{
|
||||
if (contacts[i].id == touchId)
|
||||
{
|
||||
if (contacts[i].pos_x == x && contacts[i].pos_y == y)
|
||||
if ((fabs(contacts[i].pos_x - x) < DBL_EPSILON) &&
|
||||
(fabs(contacts[i].pos_y - y) < DBL_EPSILON))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -498,7 +535,7 @@ BOOL wlf_handle_touch_motion(freerdp* instance, const UwacTouchMotion* ev)
|
||||
|
||||
WLog_DBG(TAG, "%s called | event_id: %u | x: %u / y: %u", __FUNCTION__, touchId, x, y);
|
||||
|
||||
if (!wlf_scale_coordinates(instance->context, &x, &y, TRUE))
|
||||
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
|
||||
return FALSE;
|
||||
|
||||
RdpeiClientContext* rdpei = ((wlfContext*)instance->context)->rdpei;
|
||||
|
@ -649,10 +649,10 @@ BOOL xf_create_window(xfContext* xfc)
|
||||
|
||||
if (!xfc->image)
|
||||
{
|
||||
rdpGdi* gdi = xfc->context.gdi;
|
||||
rdpGdi* cgdi = xfc->context.gdi;
|
||||
xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*)gdi->primary_buffer, settings->DesktopWidth,
|
||||
settings->DesktopHeight, xfc->scanline_pad, gdi->stride);
|
||||
(char*)cgdi->primary_buffer, settings->DesktopWidth,
|
||||
settings->DesktopHeight, xfc->scanline_pad, cgdi->stride);
|
||||
xfc->image->byte_order = LSBFirst;
|
||||
xfc->image->bitmap_bit_order = LSBFirst;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
|
||||
if (XRRQueryExtension(xfc->display, &major, &minor) &&
|
||||
(XRRQueryVersion(xfc->display, &major, &minor) == True) && (major * 100 + minor >= 105))
|
||||
{
|
||||
XRRMonitorInfo* rrmonitors =
|
||||
XRRMonitorInfo* crrmonitors =
|
||||
XRRGetMonitors(xfc->display, DefaultRootWindow(xfc->display), 1, &vscreen->nmonitors);
|
||||
|
||||
if (vscreen->nmonitors > 16)
|
||||
@ -189,11 +189,13 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
|
||||
|
||||
for (i = 0; i < vscreen->nmonitors; i++)
|
||||
{
|
||||
vscreen->monitors[i].area.left = rrmonitors[i].x;
|
||||
vscreen->monitors[i].area.top = rrmonitors[i].y;
|
||||
vscreen->monitors[i].area.right = rrmonitors[i].x + rrmonitors[i].width - 1;
|
||||
vscreen->monitors[i].area.bottom = rrmonitors[i].y + rrmonitors[i].height - 1;
|
||||
vscreen->monitors[i].primary = rrmonitors[i].primary > 0;
|
||||
MONITOR_INFO* cur_vscreen = &vscreen->monitors[i];
|
||||
const XRRMonitorInfo* cur_monitor = &crrmonitors[i];
|
||||
cur_vscreen->area.left = cur_monitor->x;
|
||||
cur_vscreen->area.top = cur_monitor->y;
|
||||
cur_vscreen->area.right = cur_monitor->x + cur_monitor->width - 1;
|
||||
cur_vscreen->area.bottom = cur_monitor->y + cur_monitor->height - 1;
|
||||
cur_vscreen->primary = cur_monitor->primary > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,12 +636,12 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe
|
||||
}
|
||||
CommandLineSwitchCase(arg, "t")
|
||||
{
|
||||
unsigned long p = strtoul(arg->Value, NULL, 0);
|
||||
unsigned long cp = strtoul(arg->Value, NULL, 0);
|
||||
|
||||
if ((errno != 0) || (p == 0) || (p > UINT16_MAX))
|
||||
if ((errno != 0) || (cp == 0) || (cp > UINT16_MAX))
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
|
||||
settings->ServerPort = p;
|
||||
settings->ServerPort = cp;
|
||||
WLog_WARN(TAG, "-t %s -> /port:%s", arg->Value, arg->Value);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "u")
|
||||
|
@ -695,15 +695,15 @@ BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer,
|
||||
|
||||
if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
|
||||
{
|
||||
int length;
|
||||
int clength;
|
||||
LPCWSTR uc = (LPCWSTR)(&buffer[2]);
|
||||
size = size / 2 - 1;
|
||||
|
||||
if (size > INT_MAX)
|
||||
return FALSE;
|
||||
|
||||
length = (int)size;
|
||||
if (ConvertFromUnicode(CP_UTF8, 0, uc, length, ©, 0, NULL, NULL) < 0)
|
||||
clength = (int)size;
|
||||
if (ConvertFromUnicode(CP_UTF8, 0, uc, clength, ©, 0, NULL, NULL) < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to convert RDP file from UCS2 to UTF8");
|
||||
return FALSE;
|
||||
|
@ -279,7 +279,7 @@ static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount
|
||||
{
|
||||
BYTE* pTmpData =
|
||||
&pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + (nYDstRel + y) * nDstStep];
|
||||
UINT32 color = palette[suiteIndex];
|
||||
UINT32 ccolor = palette[suiteIndex];
|
||||
|
||||
if (suiteIndex > 127)
|
||||
{
|
||||
@ -290,7 +290,7 @@ static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount
|
||||
suiteIndex++;
|
||||
|
||||
if ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))
|
||||
WriteColor(pTmpData, DstFormat, color);
|
||||
WriteColor(pTmpData, DstFormat, ccolor);
|
||||
|
||||
if (++x >= width)
|
||||
{
|
||||
@ -609,7 +609,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
|
||||
while (suboffset < bandsByteCount)
|
||||
{
|
||||
BYTE r, g, b;
|
||||
BYTE cr, cg, cb;
|
||||
UINT16 xStart;
|
||||
UINT16 xEnd;
|
||||
UINT16 yStart;
|
||||
@ -632,11 +632,11 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
Stream_Read_UINT16(s, xEnd);
|
||||
Stream_Read_UINT16(s, yStart);
|
||||
Stream_Read_UINT16(s, yEnd);
|
||||
Stream_Read_UINT8(s, b);
|
||||
Stream_Read_UINT8(s, g);
|
||||
Stream_Read_UINT8(s, r);
|
||||
Stream_Read_UINT8(s, cb);
|
||||
Stream_Read_UINT8(s, cg);
|
||||
Stream_Read_UINT8(s, cr);
|
||||
suboffset += 11;
|
||||
colorBkg = FreeRDPGetColor(clear->format, r, g, b, 0xFF);
|
||||
colorBkg = FreeRDPGetColor(clear->format, cr, cg, cb, 0xFF);
|
||||
|
||||
if (xEnd < xStart)
|
||||
{
|
||||
@ -658,7 +658,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
CLEAR_VBAR_ENTRY* vBarEntry = NULL;
|
||||
CLEAR_VBAR_ENTRY* vBarShortEntry;
|
||||
BOOL vBarUpdate = FALSE;
|
||||
const BYTE* pSrcPixel;
|
||||
const BYTE* cpSrcPixel;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
{
|
||||
@ -870,7 +870,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
|
||||
nXDstRel = nXDst + xStart;
|
||||
nYDstRel = nYDst + yStart;
|
||||
pSrcPixel = vBarEntry->pixels;
|
||||
cpSrcPixel = vBarEntry->pixels;
|
||||
|
||||
if (i < nWidth)
|
||||
{
|
||||
@ -883,13 +883,13 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
{
|
||||
BYTE* pDstPixel8 = &pDstData[((nYDstRel + y) * nDstStep) +
|
||||
((nXDstRel + i) * GetBytesPerPixel(DstFormat))];
|
||||
UINT32 color = ReadColor(pSrcPixel, clear->format);
|
||||
UINT32 color = ReadColor(cpSrcPixel, clear->format);
|
||||
color = FreeRDPConvertColor(color, clear->format, DstFormat, NULL);
|
||||
|
||||
if (!WriteColor(pDstPixel8, DstFormat, color))
|
||||
return FALSE;
|
||||
|
||||
pSrcPixel += GetBytesPerPixel(clear->format);
|
||||
cpSrcPixel += GetBytesPerPixel(clear->format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ static BYTE encodeDataSample[] = {
|
||||
0xc5, 0xcc, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00
|
||||
};
|
||||
|
||||
static UINT32 refImage
|
||||
static UINT32 srefImage
|
||||
[] = { /* 4.2.4.4 Inverse Color Conversion */
|
||||
0x00229cdf, 0x00249de0, 0x00259fe2, 0x002ca5e8, 0x00229cdf, 0x00229ce0, 0x00239de0,
|
||||
0x00229ce0, 0x00229cdf, 0x00229cdf, 0x00239ce0, 0x00249ce0, 0x00249ce0, 0x00219ce3,
|
||||
@ -807,12 +807,12 @@ static INLINE size_t fuzzyCompare(BYTE b1, BYTE b2)
|
||||
return b2 - b1;
|
||||
}
|
||||
|
||||
static BOOL fuzzyCompareImage(const UINT32* refImage, const BYTE* img, size_t npixels)
|
||||
static BOOL fuzzyCompareImage(const UINT32* crefImage, const BYTE* img, size_t npixels)
|
||||
{
|
||||
size_t i;
|
||||
size_t totalDelta = 0;
|
||||
|
||||
for (i = 0; i < npixels; i++, refImage++)
|
||||
for (i = 0; i < npixels; i++, crefImage++)
|
||||
{
|
||||
BYTE A = *img++;
|
||||
BYTE R = *img++;
|
||||
@ -823,17 +823,17 @@ static BOOL fuzzyCompareImage(const UINT32* refImage, const BYTE* img, size_t np
|
||||
if (A != 0x00)
|
||||
return FALSE;
|
||||
|
||||
delta = fuzzyCompare(R, (*refImage & 0x00ff0000) >> 16);
|
||||
delta = fuzzyCompare(R, (*crefImage & 0x00ff0000) >> 16);
|
||||
if (delta > 1)
|
||||
return FALSE;
|
||||
totalDelta += delta;
|
||||
|
||||
delta = fuzzyCompare(G, (*refImage & 0x0000ff00) >> 8);
|
||||
delta = fuzzyCompare(G, (*crefImage & 0x0000ff00) >> 8);
|
||||
if (delta > 1)
|
||||
return FALSE;
|
||||
totalDelta += delta;
|
||||
|
||||
delta = fuzzyCompare(B, (*refImage & 0x0000ff));
|
||||
delta = fuzzyCompare(B, (*crefImage & 0x0000ff));
|
||||
if (delta > 1)
|
||||
return FALSE;
|
||||
totalDelta += delta;
|
||||
@ -851,6 +851,9 @@ int TestFreeRDPCodecRemoteFX(int argc, char* argv[])
|
||||
BYTE* dest = NULL;
|
||||
size_t stride = FORMAT_SIZE * IMG_WIDTH;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
/* use default threading options here, pass zero as
|
||||
* ThreadingFlags */
|
||||
context = rfx_context_new(FALSE);
|
||||
@ -878,7 +881,7 @@ int TestFreeRDPCodecRemoteFX(int argc, char* argv[])
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
if (!fuzzyCompareImage(refImage, dest, IMG_WIDTH * IMG_HEIGHT))
|
||||
if (!fuzzyCompareImage(srefImage, dest, IMG_WIDTH * IMG_HEIGHT))
|
||||
goto fail;
|
||||
|
||||
rc = 0;
|
||||
|
@ -2402,10 +2402,10 @@ static int rdg_bio_gets(BIO* bio, char* str, int size)
|
||||
return -2;
|
||||
}
|
||||
|
||||
static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
static long rdg_bio_ctrl(BIO* in_bio, int cmd, long arg1, void* arg2)
|
||||
{
|
||||
long status = -1;
|
||||
rdpRdg* rdg = (rdpRdg*)BIO_get_data(bio);
|
||||
rdpRdg* rdg = (rdpRdg*)BIO_get_data(in_bio);
|
||||
rdpTls* tlsOut = rdg->tlsOut;
|
||||
rdpTls* tlsIn = rdg->tlsIn;
|
||||
|
||||
@ -2422,42 +2422,42 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
}
|
||||
else if (cmd == BIO_C_READ_BLOCKED)
|
||||
{
|
||||
BIO* bio = tlsOut->bio;
|
||||
status = BIO_read_blocked(bio);
|
||||
BIO* cbio = tlsOut->bio;
|
||||
status = BIO_read_blocked(cbio);
|
||||
}
|
||||
else if (cmd == BIO_C_WRITE_BLOCKED)
|
||||
{
|
||||
BIO* bio = tlsIn->bio;
|
||||
BIO* cbio = tlsIn->bio;
|
||||
|
||||
if (rdg->transferEncoding.isWebsocketTransport)
|
||||
bio = tlsOut->bio;
|
||||
cbio = tlsOut->bio;
|
||||
|
||||
status = BIO_write_blocked(bio);
|
||||
status = BIO_write_blocked(cbio);
|
||||
}
|
||||
else if (cmd == BIO_C_WAIT_READ)
|
||||
{
|
||||
int timeout = (int)arg1;
|
||||
BIO* bio = tlsOut->bio;
|
||||
BIO* cbio = tlsOut->bio;
|
||||
|
||||
if (BIO_read_blocked(bio))
|
||||
return BIO_wait_read(bio, timeout);
|
||||
else if (BIO_write_blocked(bio))
|
||||
return BIO_wait_write(bio, timeout);
|
||||
if (BIO_read_blocked(cbio))
|
||||
return BIO_wait_read(cbio, timeout);
|
||||
else if (BIO_write_blocked(cbio))
|
||||
return BIO_wait_write(cbio, timeout);
|
||||
else
|
||||
status = 1;
|
||||
}
|
||||
else if (cmd == BIO_C_WAIT_WRITE)
|
||||
{
|
||||
int timeout = (int)arg1;
|
||||
BIO* bio = tlsIn->bio;
|
||||
BIO* cbio = tlsIn->bio;
|
||||
|
||||
if (rdg->transferEncoding.isWebsocketTransport)
|
||||
bio = tlsOut->bio;
|
||||
cbio = tlsOut->bio;
|
||||
|
||||
if (BIO_write_blocked(bio))
|
||||
status = BIO_wait_write(bio, timeout);
|
||||
else if (BIO_read_blocked(bio))
|
||||
status = BIO_wait_read(bio, timeout);
|
||||
if (BIO_write_blocked(cbio))
|
||||
status = BIO_wait_write(cbio, timeout);
|
||||
else if (BIO_read_blocked(cbio))
|
||||
status = BIO_wait_read(cbio, timeout);
|
||||
else
|
||||
status = 1;
|
||||
}
|
||||
|
@ -279,9 +279,8 @@ BOOL rpc_get_stub_data_info(rdpRpc* rpc, BYTE* buffer, UINT32* offset, UINT32* l
|
||||
|
||||
if (header->common.ptype == PTYPE_REQUEST)
|
||||
{
|
||||
UINT32 sec_trailer_offset;
|
||||
sec_trailer_offset = header->common.frag_length - header->common.auth_length - 8;
|
||||
*length = sec_trailer_offset - *offset;
|
||||
UINT32 csec_trailer_offset = header->common.frag_length - header->common.auth_length - 8;
|
||||
*length = csec_trailer_offset - *offset;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2339,27 +2339,27 @@ static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
|
||||
case BIO_C_READ_BLOCKED:
|
||||
{
|
||||
BIO* bio = outChannel->common.bio;
|
||||
status = BIO_read_blocked(bio);
|
||||
BIO* cbio = outChannel->common.bio;
|
||||
status = BIO_read_blocked(cbio);
|
||||
}
|
||||
break;
|
||||
|
||||
case BIO_C_WRITE_BLOCKED:
|
||||
{
|
||||
BIO* bio = inChannel->common.bio;
|
||||
status = BIO_write_blocked(bio);
|
||||
BIO* cbio = inChannel->common.bio;
|
||||
status = BIO_write_blocked(cbio);
|
||||
}
|
||||
break;
|
||||
|
||||
case BIO_C_WAIT_READ:
|
||||
{
|
||||
int timeout = (int)arg1;
|
||||
BIO* bio = outChannel->common.bio;
|
||||
BIO* cbio = outChannel->common.bio;
|
||||
|
||||
if (BIO_read_blocked(bio))
|
||||
return BIO_wait_read(bio, timeout);
|
||||
else if (BIO_write_blocked(bio))
|
||||
return BIO_wait_write(bio, timeout);
|
||||
if (BIO_read_blocked(cbio))
|
||||
return BIO_wait_read(cbio, timeout);
|
||||
else if (BIO_write_blocked(cbio))
|
||||
return BIO_wait_write(cbio, timeout);
|
||||
else
|
||||
status = 1;
|
||||
}
|
||||
@ -2368,12 +2368,12 @@ static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
case BIO_C_WAIT_WRITE:
|
||||
{
|
||||
int timeout = (int)arg1;
|
||||
BIO* bio = inChannel->common.bio;
|
||||
BIO* cbio = inChannel->common.bio;
|
||||
|
||||
if (BIO_write_blocked(bio))
|
||||
status = BIO_wait_write(bio, timeout);
|
||||
else if (BIO_read_blocked(bio))
|
||||
status = BIO_wait_read(bio, timeout);
|
||||
if (BIO_write_blocked(cbio))
|
||||
status = BIO_wait_write(cbio, timeout);
|
||||
else if (BIO_read_blocked(cbio))
|
||||
status = BIO_wait_read(cbio, timeout);
|
||||
else
|
||||
status = 1;
|
||||
}
|
||||
|
@ -630,35 +630,35 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
* Custom builds use <Vendor>/<Product> as config folder. */
|
||||
if (_stricmp(FREERDP_VENDOR_STRING, FREERDP_PRODUCT_STRING))
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
BOOL res = TRUE;
|
||||
base = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME, FREERDP_VENDOR_STRING);
|
||||
|
||||
if (base)
|
||||
{
|
||||
char* combined = GetCombinedPath(base, FREERDP_PRODUCT_STRING);
|
||||
rc = freerdp_settings_set_string(settings, FreeRDP_ConfigPath, combined);
|
||||
res = freerdp_settings_set_string(settings, FreeRDP_ConfigPath, combined);
|
||||
free(combined);
|
||||
}
|
||||
|
||||
free(base);
|
||||
if (!rc)
|
||||
if (!res)
|
||||
goto out_fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL rc;
|
||||
BOOL res;
|
||||
size_t i;
|
||||
char* path;
|
||||
char* cpath;
|
||||
char product[sizeof(FREERDP_PRODUCT_STRING)];
|
||||
memset(product, 0, sizeof(product));
|
||||
|
||||
for (i = 0; i < sizeof(product); i++)
|
||||
product[i] = tolower(FREERDP_PRODUCT_STRING[i]);
|
||||
|
||||
path = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME, product);
|
||||
rc = freerdp_settings_set_string(settings, FreeRDP_ConfigPath, path);
|
||||
free(path);
|
||||
if (!rc)
|
||||
cpath = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME, product);
|
||||
res = freerdp_settings_set_string(settings, FreeRDP_ConfigPath, cpath);
|
||||
free(cpath);
|
||||
if (!res)
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,8 @@ static void* base64_decode(const char* s, size_t length, size_t* data_len)
|
||||
q[2] = ((n[2] & 3) << 6) + n[3];
|
||||
}
|
||||
|
||||
*data_len = outputLen;
|
||||
if (data_len)
|
||||
*data_len = outputLen;
|
||||
data[outputLen] = '\0';
|
||||
|
||||
return data;
|
||||
|
@ -904,8 +904,8 @@ rdpCertificateData* certificate_split_line(char* line)
|
||||
{
|
||||
BOOL rc;
|
||||
char* dpem = NULL;
|
||||
size_t length;
|
||||
crypto_base64_decode(pem, strlen(pem), (BYTE**)&dpem, &length);
|
||||
size_t clength;
|
||||
crypto_base64_decode(pem, strlen(pem), (BYTE**)&dpem, &clength);
|
||||
rc = certificate_data_set_pem(data, dpem);
|
||||
free(dpem);
|
||||
if (!rc)
|
||||
@ -914,11 +914,11 @@ rdpCertificateData* certificate_split_line(char* line)
|
||||
else
|
||||
{
|
||||
BOOL rc;
|
||||
size_t length;
|
||||
size_t clength;
|
||||
char* dsubject = NULL;
|
||||
char* dissuer = NULL;
|
||||
crypto_base64_decode(subject, strlen(subject), (BYTE**)&dsubject, &length);
|
||||
crypto_base64_decode(issuer, strlen(issuer), (BYTE**)&dissuer, &length);
|
||||
crypto_base64_decode(subject, strlen(subject), (BYTE**)&dsubject, &clength);
|
||||
crypto_base64_decode(issuer, strlen(issuer), (BYTE**)&dissuer, &clength);
|
||||
|
||||
rc = certificate_data_set_subject(data, dsubject) &&
|
||||
certificate_data_set_issuer(data, dissuer) &&
|
||||
|
@ -85,7 +85,7 @@ static const certificate_test_t certificate_tests[] = {
|
||||
};
|
||||
|
||||
static int TestCertificateFile(const char* certificate_path,
|
||||
const certificate_test_t* certificate_tests, int count)
|
||||
const certificate_test_t* ccertificate_tests, int count)
|
||||
{
|
||||
X509* certificate;
|
||||
FILE* certificate_file = winpr_fopen(certificate_path, "r");
|
||||
@ -112,23 +112,24 @@ static int TestCertificateFile(const char* certificate_path,
|
||||
{
|
||||
char* result;
|
||||
|
||||
if (certificate_tests[i].status == DISABLED)
|
||||
if (ccertificate_tests[i].status == DISABLED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result = (certificate_tests[i].get_field ? certificate_tests[i].get_field(certificate) : 0);
|
||||
result =
|
||||
(ccertificate_tests[i].get_field ? ccertificate_tests[i].get_field(certificate) : 0);
|
||||
|
||||
if (result)
|
||||
{
|
||||
printf("%s: crypto got %-40s -> \"%s\"\n", __FUNCTION__,
|
||||
certificate_tests[i].field_description, result);
|
||||
ccertificate_tests[i].field_description, result);
|
||||
|
||||
if (0 != strcmp(result, certificate_tests[i].expected_result))
|
||||
if (0 != strcmp(result, ccertificate_tests[i].expected_result))
|
||||
{
|
||||
printf("%s: failure: for %s, actual: \"%s\", expected \"%s\"\n", __FUNCTION__,
|
||||
certificate_tests[i].field_description, result,
|
||||
certificate_tests[i].expected_result);
|
||||
ccertificate_tests[i].field_description, result,
|
||||
ccertificate_tests[i].expected_result);
|
||||
success = -1;
|
||||
}
|
||||
|
||||
@ -137,7 +138,7 @@ static int TestCertificateFile(const char* certificate_path,
|
||||
else
|
||||
{
|
||||
printf("%s: failure: cannot get %s\n", __FUNCTION__,
|
||||
certificate_tests[i].field_description);
|
||||
ccertificate_tests[i].field_description);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1375,10 +1375,10 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
if (!certificate_status || !hostname_match)
|
||||
{
|
||||
DWORD accept_certificate = 0;
|
||||
size_t length = 0;
|
||||
size_t pem_length = 0;
|
||||
char* issuer = crypto_cert_issuer(cert->px509);
|
||||
char* subject = crypto_cert_subject(cert->px509);
|
||||
char* pem = (char*)crypto_cert_pem(cert->px509, NULL, &length);
|
||||
char* pem = (char*)crypto_cert_pem(cert->px509, NULL, &pem_length);
|
||||
|
||||
if (!pem)
|
||||
goto end;
|
||||
@ -1407,8 +1407,8 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
}
|
||||
else if (instance->VerifyX509Certificate)
|
||||
{
|
||||
int rc = instance->VerifyX509Certificate(instance, pemCert, length, hostname,
|
||||
port, flags);
|
||||
int rc = instance->VerifyX509Certificate(instance, pemCert, pem_length,
|
||||
hostname, port, flags);
|
||||
|
||||
if (rc == 1)
|
||||
accept_certificate = 1;
|
||||
@ -1467,8 +1467,8 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
else if (instance->VerifyX509Certificate)
|
||||
{
|
||||
const int rc =
|
||||
instance->VerifyX509Certificate(instance, pemCert, length, hostname, port,
|
||||
flags | VERIFY_CERT_FLAG_CHANGED);
|
||||
instance->VerifyX509Certificate(instance, pemCert, pem_length, hostname,
|
||||
port, flags | VERIFY_CERT_FLAG_CHANGED);
|
||||
|
||||
if (rc == 1)
|
||||
accept_certificate = 1;
|
||||
|
@ -166,7 +166,7 @@ DWORD freerdp_keyboard_init(DWORD keyboardLayoutId)
|
||||
|
||||
DWORD freerdp_keyboard_init_ex(DWORD keyboardLayoutId, const char* keyboardRemappingList)
|
||||
{
|
||||
DWORD rc = freerdp_keyboard_init(keyboardLayoutId);
|
||||
DWORD res = freerdp_keyboard_init(keyboardLayoutId);
|
||||
|
||||
memset(REMAPPING_TABLE, 0, sizeof(REMAPPING_TABLE));
|
||||
if (keyboardRemappingList)
|
||||
@ -197,7 +197,7 @@ DWORD freerdp_keyboard_init_ex(DWORD keyboardLayoutId, const char* keyboardRemap
|
||||
fail:
|
||||
free(copy);
|
||||
}
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
DWORD freerdp_keyboard_get_rdp_scancode_from_x11_keycode(DWORD keycode)
|
||||
|
@ -167,7 +167,7 @@ static pstatus_t general_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], INT3
|
||||
/* INT32 is used intentionally because we calculate
|
||||
* with shifted factors!
|
||||
*/
|
||||
INT32 y = (INT32)(*yptr++);
|
||||
INT32 cy = (INT32)(*yptr++);
|
||||
INT32 cb = (INT32)(*cbptr++);
|
||||
INT32 cr = (INT32)(*crptr++);
|
||||
INT64 r, g, b;
|
||||
@ -191,10 +191,10 @@ static pstatus_t general_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], INT3
|
||||
* G: 0.344 << 16 = 22544, 0.714 << 16 = 46792
|
||||
* B: 1.770 << 16 = 115998
|
||||
*/
|
||||
y = (INT32)((UINT32)(y + 4096) << 16);
|
||||
r = y + cr * 91947LL;
|
||||
g = y - cb * 22544LL - cr * 46792LL;
|
||||
b = y + cb * 115998LL;
|
||||
cy = (INT32)((UINT32)(cy + 4096) << 16);
|
||||
r = cy + cr * 91947LL;
|
||||
g = cy - cb * 22544LL - cr * 46792LL;
|
||||
b = cy + cb * 115998LL;
|
||||
*rptr++ = CLIP(r >> 21);
|
||||
*gptr++ = CLIP(g >> 21);
|
||||
*bptr++ = CLIP(b >> 21);
|
||||
@ -260,10 +260,10 @@ static pstatus_t general_RGBToYCbCr_16s16s_P3P3(const INT16* const pSrc[3], INT3
|
||||
* Cr: 0.499813 << 15 = 16377, 0.418531 << 15 = 13714,
|
||||
* 0.081282 << 15 = 2663
|
||||
*/
|
||||
INT32 y = (r * 9798 + g * 19235 + b * 3735) >> 10;
|
||||
INT32 cy = (r * 9798 + g * 19235 + b * 3735) >> 10;
|
||||
INT32 cb = (r * -5535 + g * -10868 + b * 16403) >> 10;
|
||||
INT32 cr = (r * 16377 + g * -13714 + b * -2663) >> 10;
|
||||
*yptr++ = (INT16)MINMAX(y - 4096, -4096, 4095);
|
||||
*yptr++ = (INT16)MINMAX(cy - 4096, -4096, 4095);
|
||||
*cbptr++ = (INT16)MINMAX(cb, -4096, 4095);
|
||||
*crptr++ = (INT16)MINMAX(cr, -4096, 4095);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ static INLINE fkt_writePixel getPixelWriteFunction(DWORD format, BOOL useAlpha)
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE BYTE CLIP(INT32 X)
|
||||
static INLINE BYTE CLIP(INT64 X)
|
||||
{
|
||||
if (X > 255L)
|
||||
return 255L;
|
||||
@ -208,7 +208,7 @@ static INLINE BYTE CLIP(INT32 X)
|
||||
if (X < 0L)
|
||||
return 0L;
|
||||
|
||||
return X;
|
||||
return (BYTE)X;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@
|
||||
UINT32 offBeatMask; \
|
||||
const _type_* sptr = pSrc; \
|
||||
_type_* dptr = pDst; \
|
||||
size_t count; \
|
||||
int count; \
|
||||
if (val == 0) \
|
||||
return PRIMITIVES_SUCCESS; \
|
||||
if (val >= 16) \
|
||||
|
@ -191,10 +191,10 @@ static BOOL primitives_YUV_benchmark_run(primitives_YUV_benchmark* bench, primit
|
||||
dueDate = GetTickCount64() + runTime;
|
||||
while (GetTickCount64() < dueDate)
|
||||
{
|
||||
pstatus_t status =
|
||||
pstatus_t cstatus =
|
||||
prims->YUV420ToRGB_8u_P3AC4R(channels, bench->steps, bench->outputBuffer,
|
||||
bench->outputStride, bench->testedFormat, &bench->roi);
|
||||
if (status != PRIMITIVES_SUCCESS)
|
||||
if (cstatus != PRIMITIVES_SUCCESS)
|
||||
return FALSE;
|
||||
*computations = *computations + 1;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ fail:
|
||||
|
||||
static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
BOOL res = FALSE;
|
||||
UINT32 x, y;
|
||||
UINT32 awidth, aheight;
|
||||
BYTE* yuv[3] = { 0 };
|
||||
@ -561,14 +561,14 @@ static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
|
||||
PROFILER_FREE(yuv444ToRGB)
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
res = TRUE;
|
||||
fail:
|
||||
free_padding(rgb, padding);
|
||||
free_padding(rgb_dst, padding);
|
||||
free_padding(yuv[0], padding);
|
||||
free_padding(yuv[1], padding);
|
||||
free_padding(yuv[2], padding);
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOL allocate_yuv420(BYTE** planes, UINT32 width, UINT32 height, UINT32 padding)
|
||||
@ -668,7 +668,7 @@ static BOOL compare_yuv420(BYTE** planesA, BYTE** planesB, UINT32 width, UINT32
|
||||
|
||||
static BOOL TestPrimitiveRgbToLumaChroma(primitives_t* prims, prim_size_t roi, UINT32 version)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
BOOL res = FALSE;
|
||||
UINT32 x, y, cnt;
|
||||
UINT32 awidth, aheight;
|
||||
BYTE* luma[3] = { 0 };
|
||||
@ -845,14 +845,14 @@ static BOOL TestPrimitiveRgbToLumaChroma(primitives_t* prims, prim_size_t roi, U
|
||||
goto fail;
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
res = TRUE;
|
||||
fail:
|
||||
free_padding(rgb, padding);
|
||||
free_yuv420(luma, padding);
|
||||
free_yuv420(chroma, padding);
|
||||
free_yuv420(lumaGeneric, padding);
|
||||
free_yuv420(chromaGeneric, padding);
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
int TestPrimitivesYUV(int argc, char* argv[])
|
||||
@ -869,9 +869,9 @@ int TestPrimitivesYUV(int argc, char* argv[])
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
int rc = sscanf(argv[1], "%" PRIu32 "x%" PRIu32, &roi.width, &roi.height);
|
||||
int crc = sscanf(argv[1], "%" PRIu32 "x%" PRIu32, &roi.width, &roi.height);
|
||||
|
||||
if (rc != 2)
|
||||
if (crc != 2)
|
||||
{
|
||||
roi.width = 1920;
|
||||
roi.height = 1080;
|
||||
|
@ -100,7 +100,7 @@ void prim_test_setup(BOOL performance)
|
||||
g_TestPrimitivesPerformance = performance;
|
||||
}
|
||||
|
||||
BOOL speed_test(const char* name, const char* dsc, UINT32 iterations, pstatus_t (*generic)(),
|
||||
BOOL speed_test(const char* name, const char* dsc, UINT32 iterations, pstatus_t (*fkt_generic)(),
|
||||
pstatus_t (*optimised)(), ...)
|
||||
{
|
||||
UINT32 i;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <uwac/uwac.h>
|
||||
|
||||
/** @brief */
|
||||
struct uwac_touch_point
|
||||
{
|
||||
uint32_t id;
|
||||
@ -37,24 +36,8 @@ typedef struct uwac_touch_point UwacTouchPoint;
|
||||
struct uwac_touch_automata;
|
||||
typedef struct uwac_touch_automata UwacTouchAutomata;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param automata
|
||||
*/
|
||||
UWAC_API void UwacTouchAutomataInit(UwacTouchAutomata* automata);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param automata
|
||||
*/
|
||||
UWAC_API void UwacTouchAutomataReset(UwacTouchAutomata* automata);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param automata
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
UWAC_API bool UwacTouchAutomataInjectEvent(UwacTouchAutomata* automata, UwacEvent* event);
|
||||
|
||||
#endif /* UWAC_TOOLS_H_ */
|
||||
|
@ -294,7 +294,6 @@ struct uwac_output_geometry_event
|
||||
};
|
||||
typedef struct uwac_output_geometry_event UwacOutputGeometryEvent;
|
||||
|
||||
/** @brief */
|
||||
union uwac_event {
|
||||
int type;
|
||||
UwacOutputNewEvent output_new;
|
||||
@ -477,10 +476,10 @@ extern "C"
|
||||
* Sets the region that should be considered opaque to the compositor.
|
||||
*
|
||||
* @param window the UwacWindow
|
||||
* @param x
|
||||
* @param y
|
||||
* @param width
|
||||
* @param height
|
||||
* @param x The horizontal coordinate in pixels
|
||||
* @param y The vertical coordinate in pixels
|
||||
* @param width The width of the region
|
||||
* @param height The height of the region
|
||||
* @return UWAC_SUCCESS on success, an error otherwise
|
||||
*/
|
||||
UWAC_API UwacReturnCode UwacWindowSetOpaqueRegion(UwacWindow* window, uint32_t x, uint32_t y,
|
||||
@ -490,11 +489,11 @@ extern "C"
|
||||
* Sets the region of the window that can trigger input events
|
||||
*
|
||||
* @param window the UwacWindow
|
||||
* @param x
|
||||
* @param y
|
||||
* @param width
|
||||
* @param height
|
||||
* @return
|
||||
* @param x The horizontal coordinate in pixels
|
||||
* @param y The vertical coordinate in pixels
|
||||
* @param width The width of the region
|
||||
* @param height The height of the region
|
||||
* @return UWAC_SUCCESS on success, an error otherwise
|
||||
*/
|
||||
UWAC_API UwacReturnCode UwacWindowSetInputRegion(UwacWindow* window, uint32_t x, uint32_t y,
|
||||
uint32_t width, uint32_t height);
|
||||
@ -571,11 +570,11 @@ extern "C"
|
||||
*/
|
||||
UWAC_API void UwacWindowSetTitle(UwacWindow* window, const char* name);
|
||||
|
||||
/**
|
||||
/** Dispatch the display
|
||||
*
|
||||
* @param display
|
||||
* @param timeout
|
||||
* @return
|
||||
* @param display The display to dispatch
|
||||
* @param timeout The maximum time to wait in milliseconds (-1 == infinite).
|
||||
* @return 1 for success, 0 if display not running, -1 on failure
|
||||
*/
|
||||
UWAC_API int UwacDisplayDispatch(UwacDisplay* display, int timeout);
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <string.h>
|
||||
#include <uwac/uwac-tools.h>
|
||||
|
||||
/** @brief */
|
||||
struct uwac_touch_automata
|
||||
{
|
||||
struct wl_array tp;
|
||||
|
@ -206,9 +206,9 @@ void* _aligned_offset_recalloc(void* memblock, size_t num, size_t size, size_t a
|
||||
|
||||
pNewMem = WINPR_ALIGNED_MEM_STRUCT_FROM_PTR(newMemblock);
|
||||
{
|
||||
const size_t size = cMIN(pMem->size, pNewMem->size);
|
||||
memcpy(newMemblock, pMem->base_addr, size);
|
||||
ZeroMemory(newMemblock + size, pNewMem->size - size);
|
||||
const size_t csize = cMIN(pMem->size, pNewMem->size);
|
||||
memcpy(newMemblock, pMem->base_addr, csize);
|
||||
ZeroMemory(newMemblock + csize, pNewMem->size - csize);
|
||||
}
|
||||
fail:
|
||||
_aligned_free(memblock);
|
||||
|
@ -320,14 +320,14 @@ static TIME_ZONE_ENTRY* winpr_detect_windows_time_zone(void)
|
||||
|
||||
if (winpr_match_unix_timezone_identifier_with_list(tzid, wzid->tzid))
|
||||
{
|
||||
TIME_ZONE_ENTRY* timezone = (TIME_ZONE_ENTRY*)malloc(sizeof(TIME_ZONE_ENTRY));
|
||||
TIME_ZONE_ENTRY* ctimezone = (TIME_ZONE_ENTRY*)malloc(sizeof(TIME_ZONE_ENTRY));
|
||||
free(tzid);
|
||||
|
||||
if (!timezone)
|
||||
if (!ctimezone)
|
||||
return NULL;
|
||||
|
||||
*timezone = TimeZoneTable[i];
|
||||
return timezone;
|
||||
*ctimezone = TimeZoneTable[i];
|
||||
return ctimezone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -494,14 +494,14 @@ char** CommandLineParseCommaSeparatedValuesEx(const char* name, const char* list
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
size_t len = strlen(name);
|
||||
p = (char**)calloc(2UL + len, sizeof(char*));
|
||||
size_t clen = strlen(name);
|
||||
p = (char**)calloc(2UL + clen, sizeof(char*));
|
||||
|
||||
if (p)
|
||||
{
|
||||
char* dst = (char*)&p[1];
|
||||
p[0] = dst;
|
||||
sprintf_s(dst, len + 1, "%s", name);
|
||||
sprintf_s(dst, clen + 1, "%s", name);
|
||||
*count = 1;
|
||||
return p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user