Merge pull request #10535 from akallabeth/clang-tidy-fixes
Clang tidy fixes
This commit is contained in:
commit
605d390dba
@ -34,6 +34,7 @@ Checks: >
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-google-readability-braces-around-statements,
|
||||
-google-readability-todo,
|
||||
-hicpp-braces-around-statements,
|
||||
-hicpp-no-array-decay,
|
||||
-hicpp-multiway-paths-covered,
|
||||
|
2
.github/workflows/clang-tidy.yml
vendored
2
.github/workflows/clang-tidy.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
id: review
|
||||
with:
|
||||
split_workflow: true
|
||||
config_file: '.clang-tidy'
|
||||
clang_tidy_checks: ''
|
||||
# List of packages to install
|
||||
apt_packages: libkrb5-dev,libxkbcommon-dev,libxkbfile-dev,libx11-dev,libwayland-dev,libxrandr-dev,libxi-dev,libxrender-dev,libxext-dev,libxinerama-dev,libxfixes-dev,libxcursor-dev,libxv-dev,libxdamage-dev,libxtst-dev,libcups2-dev,libcairo2-dev,libpcsclite-dev,libasound2-dev,libswscale-dev,libpulse-dev,libavcodec-dev,libavutil-dev,libfuse3-dev,libswresample-dev,libusb-1.0-0-dev,libudev-dev,libdbus-glib-1-dev,libpam0g-dev,uuid-dev,libxml2-dev,libcjson-dev,libsdl2-2.0-0,libsdl2-dev,libsdl2-ttf-dev,libsdl2-image-dev,libsystemd-dev,liburiparser-dev,libopus-dev,libwebp-dev,libjpeg-dev,libpng-dev,xsltproc,docbook-xsl,libgsm1-dev,libfaac-dev,libfaad-dev,libsoxr-dev,opencl-c-headers,opencl-headers,ocl-icd-opencl-dev,libssl-dev,libv4l-dev
|
||||
|
||||
|
@ -121,7 +121,7 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand
|
||||
|
||||
static DWORD WINAPI audin_alsa_thread_func(LPVOID arg)
|
||||
{
|
||||
int error = 0;
|
||||
DWORD error = CHANNEL_RC_OK;
|
||||
BYTE* buffer = NULL;
|
||||
snd_pcm_t* capture_handle = NULL;
|
||||
AudinALSADevice* alsa = (AudinALSADevice*)arg;
|
||||
@ -159,26 +159,28 @@ static DWORD WINAPI audin_alsa_thread_func(LPVOID arg)
|
||||
if (status == WAIT_FAILED)
|
||||
{
|
||||
error = GetLastError();
|
||||
WLog_Print(alsa->log, WLOG_ERROR, "WaitForSingleObject failed with error %ld!", error);
|
||||
WLog_Print(alsa->log, WLOG_ERROR, "WaitForSingleObject failed with error %" PRIu32 "!",
|
||||
error);
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == WAIT_OBJECT_0)
|
||||
break;
|
||||
|
||||
error = snd_pcm_readi(capture_handle, buffer, frames);
|
||||
snd_pcm_sframes_t err = snd_pcm_readi(capture_handle, buffer, frames);
|
||||
|
||||
if (error == 0)
|
||||
if (err == 0)
|
||||
continue;
|
||||
|
||||
if (error == -EPIPE)
|
||||
if (err == -EPIPE)
|
||||
{
|
||||
snd_pcm_recover(capture_handle, error, 0);
|
||||
snd_pcm_recover(capture_handle, (int)err, 0);
|
||||
continue;
|
||||
}
|
||||
else if (error < 0)
|
||||
else if (err < 0)
|
||||
{
|
||||
WLog_Print(alsa->log, WLOG_ERROR, "snd_pcm_readi (%s)", snd_strerror(error));
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -112,9 +112,6 @@ static void audin_pulse_context_state_callback(pa_context* context, void* userda
|
||||
switch (state)
|
||||
{
|
||||
case PA_CONTEXT_READY:
|
||||
pa_threaded_mainloop_signal(pulse->mainloop, 0);
|
||||
break;
|
||||
|
||||
case PA_CONTEXT_FAILED:
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
pa_threaded_mainloop_signal(pulse->mainloop, 0);
|
||||
@ -309,9 +306,6 @@ static void audin_pulse_stream_state_callback(pa_stream* stream, void* userdata)
|
||||
switch (state)
|
||||
{
|
||||
case PA_STREAM_READY:
|
||||
pa_threaded_mainloop_signal(pulse->mainloop, 0);
|
||||
break;
|
||||
|
||||
case PA_STREAM_FAILED:
|
||||
case PA_STREAM_TERMINATED:
|
||||
pa_threaded_mainloop_signal(pulse->mainloop, 0);
|
||||
|
@ -474,7 +474,7 @@ PVIRTUALCHANNELENTRY freerdp_channels_load_static_addin_entry(LPCSTR pszName, LP
|
||||
{
|
||||
if (strncmp(table->name, pszName, MAX_PATH) == 0)
|
||||
{
|
||||
if (type && strncmp(table->type, type, MAX_PATH))
|
||||
if (type && (strncmp(table->type, type, MAX_PATH) != 0))
|
||||
continue;
|
||||
|
||||
if (pszSubsystem != NULL)
|
||||
|
@ -1031,8 +1031,6 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
||||
if (error && encomsp && encomsp->rdpcontext)
|
||||
setChannelError(encomsp->rdpcontext, error,
|
||||
"encomsp_virtual_channel_open_event reported an error");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static DWORD WINAPI encomsp_virtual_channel_client_thread(LPVOID arg)
|
||||
|
@ -132,12 +132,7 @@ static UINT parallel_process_irp_close(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
WINPR_ASSERT(parallel);
|
||||
WINPR_ASSERT(irp);
|
||||
|
||||
if (close(parallel->file) < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
(void)close(parallel->file);
|
||||
|
||||
Stream_Zero(irp->output, 5); /* Padding(5) */
|
||||
return irp->Complete(irp);
|
||||
@ -388,10 +383,8 @@ static UINT parallel_irp_request(DEVICE* device, IRP* irp)
|
||||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT parallel_free(DEVICE* device)
|
||||
static UINT parallel_free_int(PARALLEL_DEVICE* parallel)
|
||||
{
|
||||
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*)device;
|
||||
|
||||
if (parallel)
|
||||
{
|
||||
if (!MessageQueue_PostQuit(parallel->queue, 0) ||
|
||||
@ -400,14 +393,20 @@ static UINT parallel_free(DEVICE* device)
|
||||
const UINT error = GetLastError();
|
||||
WLog_Print(parallel->log, WLOG_ERROR,
|
||||
"WaitForSingleObject failed with error %" PRIu32 "!", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
CloseHandle(parallel->thread);
|
||||
Stream_Free(parallel->device.data, TRUE);
|
||||
MessageQueue_Free(parallel->queue);
|
||||
free(parallel);
|
||||
}
|
||||
free(parallel);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static UINT parallel_free(DEVICE* device)
|
||||
{
|
||||
if (device)
|
||||
return parallel_free_int((PARALLEL_DEVICE*)device);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
@ -516,7 +515,6 @@ FREERDP_ENTRY_POINT(UINT parallel_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINT
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
error_out:
|
||||
if (parallel)
|
||||
parallel_free(¶llel->device);
|
||||
parallel_free_int(parallel);
|
||||
return error;
|
||||
}
|
||||
|
@ -541,8 +541,6 @@ static VOID VCAPITYPE rail_virtual_channel_open_event_ex(LPVOID lpUserParam, DWO
|
||||
if (error && rail && rail->rdpcontext)
|
||||
setChannelError(rail->rdpcontext, error,
|
||||
"rail_virtual_channel_open_event reported an error");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1117,13 +1117,10 @@ UINT rail_order_recv(LPVOID userdata, wStream* s)
|
||||
*/
|
||||
UINT rail_send_handshake_order(railPlugin* rail, const RAIL_HANDSHAKE_ORDER* handshake)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
UINT error = 0;
|
||||
|
||||
if (!rail || !handshake)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
s = rail_pdu_init(RAIL_HANDSHAKE_ORDER_LENGTH);
|
||||
wStream* s = rail_pdu_init(RAIL_HANDSHAKE_ORDER_LENGTH);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
@ -1142,13 +1139,10 @@ UINT rail_send_handshake_order(railPlugin* rail, const RAIL_HANDSHAKE_ORDER* han
|
||||
*/
|
||||
UINT rail_send_handshake_ex_order(railPlugin* rail, const RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
UINT error = 0;
|
||||
|
||||
if (!rail || !handshakeEx)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
s = rail_pdu_init(RAIL_HANDSHAKE_EX_ORDER_LENGTH);
|
||||
wStream* s = rail_pdu_init(RAIL_HANDSHAKE_EX_ORDER_LENGTH);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
@ -1531,13 +1525,10 @@ UINT rail_send_client_compartment_info_order(railPlugin* rail,
|
||||
|
||||
UINT rail_send_client_cloak_order(railPlugin* rail, const RAIL_CLOAK* cloak)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
UINT error = 0;
|
||||
|
||||
if (!rail || !cloak)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
s = rail_pdu_init(5);
|
||||
wStream* s = rail_pdu_init(5);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
@ -1552,9 +1543,6 @@ UINT rail_send_client_cloak_order(railPlugin* rail, const RAIL_CLOAK* cloak)
|
||||
|
||||
UINT rail_send_client_snap_arrange_order(railPlugin* rail, const RAIL_SNAP_ARRANGE* snap)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
UINT error = 0;
|
||||
|
||||
if (!rail)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
@ -1570,7 +1558,7 @@ UINT rail_send_client_snap_arrange_order(railPlugin* rail, const RAIL_SNAP_ARRAN
|
||||
return rail_send_client_window_move_order(rail, &move);
|
||||
}
|
||||
|
||||
s = rail_pdu_init(12);
|
||||
wStream* s = rail_pdu_init(12);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ UINT rail_write_unicode_string_value(wStream* s, const RAIL_UNICODE_STRING* unic
|
||||
UINT rail_read_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam, BOOL extendedSpiSupported);
|
||||
UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
|
||||
BOOL extendedSpiSupported);
|
||||
BOOL rail_is_extended_spi_supported(UINT32 channelsFlags);
|
||||
BOOL rail_is_extended_spi_supported(UINT32 channelFlags);
|
||||
const char* rail_get_order_type_string(UINT16 orderType);
|
||||
const char* rail_get_order_type_string_full(UINT16 orderType, char* buffer, size_t length);
|
||||
|
||||
|
@ -670,14 +670,14 @@ static UINT rail_read_exec_order(wStream* s, RAIL_EXEC_ORDER* exec, char* args[]
|
||||
|
||||
if (exeLen > 0)
|
||||
{
|
||||
const SSIZE_T len = exeLen / sizeof(WCHAR);
|
||||
const size_t len = exeLen / sizeof(WCHAR);
|
||||
exec->RemoteApplicationProgram = args[0] = Stream_Read_UTF16_String_As_UTF8(s, len, NULL);
|
||||
if (!exec->RemoteApplicationProgram)
|
||||
goto fail;
|
||||
}
|
||||
if (workLen > 0)
|
||||
{
|
||||
const SSIZE_T len = workLen / sizeof(WCHAR);
|
||||
const size_t len = workLen / sizeof(WCHAR);
|
||||
exec->RemoteApplicationWorkingDir = args[1] =
|
||||
Stream_Read_UTF16_String_As_UTF8(s, len, NULL);
|
||||
if (!exec->RemoteApplicationWorkingDir)
|
||||
@ -685,7 +685,7 @@ static UINT rail_read_exec_order(wStream* s, RAIL_EXEC_ORDER* exec, char* args[]
|
||||
}
|
||||
if (argLen > 0)
|
||||
{
|
||||
const SSIZE_T len = argLen / sizeof(WCHAR);
|
||||
const size_t len = argLen / sizeof(WCHAR);
|
||||
exec->RemoteApplicationArguments = args[2] = Stream_Read_UTF16_String_As_UTF8(s, len, NULL);
|
||||
if (!exec->RemoteApplicationArguments)
|
||||
goto fail;
|
||||
|
@ -19,6 +19,12 @@
|
||||
|
||||
define_channel_client("rdpdr")
|
||||
|
||||
include (CheckFunctionExists)
|
||||
check_function_exists(getmntent_r FREERDP_HAVE_GETMNTENT_R)
|
||||
if (FREERDP_HAVE_GETMNTENT_R)
|
||||
add_definitions(-DFREERDP_HAVE_GETMNTENT_R)
|
||||
endif()
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
irp.c
|
||||
irp.h
|
||||
|
@ -223,7 +223,7 @@ static BOOL rdpdr_load_drive(rdpdrPlugin* rdpdr, const char* name, const char* p
|
||||
|
||||
fail:
|
||||
freerdp_device_free(drive.device);
|
||||
return rc;
|
||||
return rc == CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -834,9 +834,25 @@ static UINT handle_platform_mounts_bsd(wLog* log, hotplug_dev* dev_array, size_t
|
||||
|
||||
#if defined(__LINUX__) || defined(__linux__)
|
||||
#include <mntent.h>
|
||||
static struct mntent* getmntent_x(FILE* f, struct mntent* buffer, char* pathbuffer,
|
||||
size_t pathbuffersize)
|
||||
{
|
||||
#if defined(FREERDP_HAVE_GETMNTENT_R)
|
||||
WINPR_ASSERT(pathbuffersize <= INT32_MAX);
|
||||
return getmntent_r(f, buffer, pathbuffer, (int)pathbuffersize);
|
||||
#else
|
||||
(void)buffer;
|
||||
(void)pathbuffer;
|
||||
(void)pathbuffersize;
|
||||
return getmntent(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size_t* size)
|
||||
{
|
||||
FILE* f = NULL;
|
||||
struct mntent mnt = { 0 };
|
||||
char pathbuffer[PATH_MAX] = { 0 };
|
||||
struct mntent* ent = NULL;
|
||||
f = winpr_fopen("/proc/mounts", "r");
|
||||
if (f == NULL)
|
||||
@ -844,7 +860,7 @@ static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size
|
||||
WLog_Print(log, WLOG_ERROR, "fopen failed!");
|
||||
return ERROR_OPEN_FAILED;
|
||||
}
|
||||
while ((ent = getmntent(f)) != NULL)
|
||||
while ((ent = getmntent_x(f, &mnt, pathbuffer, sizeof(pathbuffer))) != NULL)
|
||||
{
|
||||
handle_mountpoint(dev_array, size, ent->mnt_dir);
|
||||
}
|
||||
@ -2014,8 +2030,6 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DW
|
||||
if (error && rdpdr && rdpdr->rdpcontext)
|
||||
setChannelError(rdpdr->rdpcontext, error,
|
||||
"rdpdr_virtual_channel_open_event_ex reported an error");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static DWORD WINAPI rdpdr_virtual_channel_client_thread(LPVOID arg)
|
||||
|
@ -463,13 +463,9 @@ static UINT rdpdr_server_read_general_capability_set(RdpdrServerContext* context
|
||||
switch (VersionMinor)
|
||||
{
|
||||
case RDPDR_MINOR_RDP_VERSION_13:
|
||||
break;
|
||||
case RDPDR_MINOR_RDP_VERSION_6_X:
|
||||
break;
|
||||
case RDPDR_MINOR_RDP_VERSION_5_2:
|
||||
break;
|
||||
case RDPDR_MINOR_RDP_VERSION_5_1:
|
||||
break;
|
||||
case RDPDR_MINOR_RDP_VERSION_5_0:
|
||||
break;
|
||||
default:
|
||||
|
@ -544,6 +544,15 @@ static void rdpei_print_contact_flags(UINT32 contactFlags)
|
||||
WLog_DBG(TAG, " RDPINPUT_CONTACT_FLAG_CANCELED");
|
||||
}
|
||||
|
||||
static INT16 bounded(INT32 val)
|
||||
{
|
||||
if (val < INT16_MIN)
|
||||
return INT16_MIN;
|
||||
if (val > INT16_MAX)
|
||||
return INT16_MAX;
|
||||
return (INT16)val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function description
|
||||
*
|
||||
@ -578,10 +587,10 @@ static UINT rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
|
||||
{
|
||||
contact = &frame->contacts[index];
|
||||
contact->fieldsPresent |= CONTACT_DATA_CONTACTRECT_PRESENT;
|
||||
contact->contactRectLeft = contact->x - rectSize;
|
||||
contact->contactRectTop = contact->y - rectSize;
|
||||
contact->contactRectRight = contact->x + rectSize;
|
||||
contact->contactRectBottom = contact->y + rectSize;
|
||||
contact->contactRectLeft = bounded(contact->x - rectSize);
|
||||
contact->contactRectTop = bounded(contact->y - rectSize);
|
||||
contact->contactRectRight = bounded(contact->x + rectSize);
|
||||
contact->contactRectBottom = bounded(contact->y + rectSize);
|
||||
#ifdef WITH_DEBUG_RDPEI
|
||||
WLog_DBG(TAG, "contact[%" PRIu32 "].contactId: %" PRIu32 "", index, contact->contactId);
|
||||
WLog_DBG(TAG, "contact[%" PRIu32 "].fieldsPresent: %" PRIu32 "", index,
|
||||
@ -965,17 +974,15 @@ static UINT rdpei_touch_process(RdpeiClientContext* context, INT32 externalId, U
|
||||
{
|
||||
INT64 contactIdlocal = -1;
|
||||
RDPINPUT_CONTACT_POINT* contactPoint = NULL;
|
||||
RDPEI_PLUGIN* rdpei = NULL;
|
||||
BOOL begin = 0;
|
||||
UINT error = CHANNEL_RC_OK;
|
||||
|
||||
if (!context || !contactId || !context->handle)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rdpei = (RDPEI_PLUGIN*)context->handle;
|
||||
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*)context->handle;
|
||||
/* Create a new contact point in an empty slot */
|
||||
EnterCriticalSection(&rdpei->lock);
|
||||
begin = contactFlags & RDPINPUT_CONTACT_FLAG_DOWN;
|
||||
const BOOL begin = (contactFlags & RDPINPUT_CONTACT_FLAG_DOWN) != 0;
|
||||
contactPoint = rdpei_contact(rdpei, externalId, !begin);
|
||||
if (contactPoint)
|
||||
contactIdlocal = contactPoint->contactId;
|
||||
@ -1003,7 +1010,7 @@ static UINT rdpei_touch_process(RdpeiClientContext* context, INT32 externalId, U
|
||||
if (p >= 360)
|
||||
{
|
||||
WLog_WARN(TAG,
|
||||
"TouchContact %" PRIu32 ": Invalid orientation value %" PRIu32
|
||||
"TouchContact %" PRId64 ": Invalid orientation value %" PRIu32
|
||||
"degree, clamping to 359 degree",
|
||||
contactIdlocal, p);
|
||||
p = 359;
|
||||
@ -1016,7 +1023,7 @@ static UINT rdpei_touch_process(RdpeiClientContext* context, INT32 externalId, U
|
||||
if (p > 1024)
|
||||
{
|
||||
WLog_WARN(TAG,
|
||||
"TouchContact %" PRIu32 ": Invalid pressure value %" PRIu32
|
||||
"TouchContact %" PRId64 ": Invalid pressure value %" PRIu32
|
||||
", clamping to 1024",
|
||||
contactIdlocal, p);
|
||||
p = 1024;
|
||||
@ -1028,7 +1035,7 @@ static UINT rdpei_touch_process(RdpeiClientContext* context, INT32 externalId, U
|
||||
}
|
||||
|
||||
if (contactId)
|
||||
*contactId = contactIdlocal;
|
||||
*contactId = (INT32)contactIdlocal;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ BOOL rdpei_read_2byte_signed(wStream* s, INT16* value)
|
||||
return FALSE;
|
||||
|
||||
Stream_Read_UINT8(s, byte);
|
||||
*value = (*value << 8) | byte;
|
||||
*value = ((*value & 0xFF) << 8) | byte;
|
||||
}
|
||||
|
||||
if (negative)
|
||||
|
@ -502,7 +502,6 @@ fail:
|
||||
*/
|
||||
static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
{
|
||||
int pad = 0;
|
||||
MONITOR_DEF* monitor = NULL;
|
||||
RDPGFX_RESET_GRAPHICS_PDU pdu = { 0 };
|
||||
WINPR_ASSERT(callback);
|
||||
@ -543,7 +542,13 @@ static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, w
|
||||
Stream_Read_UINT32(s, monitor->flags); /* flags (4 bytes) */
|
||||
}
|
||||
|
||||
pad = 340 - (RDPGFX_HEADER_SIZE + 12 + (pdu.monitorCount * 20));
|
||||
const size_t size = (RDPGFX_HEADER_SIZE + 12ULL + (pdu.monitorCount * 20ULL));
|
||||
if (size > 340)
|
||||
{
|
||||
free(pdu.monitorDefArray);
|
||||
return CHANNEL_RC_NULL_DATA;
|
||||
}
|
||||
const size_t pad = 340ULL - size;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, (size_t)pad))
|
||||
{
|
||||
@ -772,13 +777,11 @@ static UINT rdpgfx_send_cache_import_offer_pdu(RdpgfxClientContext* context,
|
||||
wStream* s = NULL;
|
||||
RDPGFX_HEADER header;
|
||||
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
||||
WINPR_ASSERT(context);
|
||||
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
|
||||
|
||||
if (!context || !pdu)
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
|
||||
gfx = (RDPGFX_PLUGIN*)context->handle;
|
||||
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
|
||||
|
||||
if (!gfx || !gfx->base.listener_callback)
|
||||
return ERROR_BAD_CONFIGURATION;
|
||||
|
@ -111,8 +111,8 @@ static int rdpsnd_alsa_set_hw_params(rdpsndAlsaPlugin* alsa)
|
||||
* It is also possible for the buffer size to not be an integer multiple of the period size.
|
||||
*/
|
||||
int interrupts_per_sec_near = 50;
|
||||
int bytes_per_sec =
|
||||
(alsa->actual_rate * alsa->aformat.wBitsPerSample / 8 * alsa->actual_channels);
|
||||
const size_t bytes_per_sec =
|
||||
(1ull * alsa->actual_rate * alsa->aformat.wBitsPerSample / 8 * alsa->actual_channels);
|
||||
alsa->buffer_size = buffer_size_max;
|
||||
alsa->period_size = (bytes_per_sec / interrupts_per_sec_near);
|
||||
|
||||
@ -423,12 +423,11 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
|
||||
{
|
||||
UINT latency = 0;
|
||||
size_t offset = 0;
|
||||
int frame_size = 0;
|
||||
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
|
||||
WINPR_ASSERT(alsa);
|
||||
WINPR_ASSERT(data || (size == 0));
|
||||
frame_size = alsa->actual_channels * alsa->aformat.wBitsPerSample / 8;
|
||||
if (frame_size <= 0)
|
||||
const size_t frame_size = 1ull * alsa->actual_channels * alsa->aformat.wBitsPerSample / 8;
|
||||
if (frame_size == 0)
|
||||
return 0;
|
||||
|
||||
while (offset < size)
|
||||
@ -437,7 +436,7 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
|
||||
snd_pcm_writei(alsa->pcm_handle, &data[offset], (size - offset) / frame_size);
|
||||
|
||||
if (status < 0)
|
||||
status = snd_pcm_recover(alsa->pcm_handle, status, 0);
|
||||
status = snd_pcm_recover(alsa->pcm_handle, (int)status, 0);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -455,12 +454,8 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
|
||||
snd_pcm_sframes_t delay = 0;
|
||||
int rc = snd_pcm_avail_delay(alsa->pcm_handle, &available, &delay);
|
||||
|
||||
if (rc != 0)
|
||||
latency = 0;
|
||||
else if (available == 0) /* Get [ms] from number of samples */
|
||||
if ((rc == 0) && (available == 0)) /* Get [ms] from number of samples */
|
||||
latency = delay * 1000 / alsa->actual_rate;
|
||||
else
|
||||
latency = 0;
|
||||
}
|
||||
|
||||
return latency + alsa->latency;
|
||||
|
@ -163,7 +163,7 @@ static BOOL rdpsnd_oss_set_format(rdpsndDevicePlugin* device, const AUDIO_FORMAT
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tmp = format->nSamplesPerSec;
|
||||
tmp = (int)format->nSamplesPerSec;
|
||||
|
||||
if (ioctl(oss->pcm_handle, SNDCTL_DSP_SPEED, &tmp) == -1)
|
||||
{
|
||||
@ -321,15 +321,14 @@ static UINT32 rdpsnd_oss_get_volume(rdpsndDevicePlugin* device)
|
||||
|
||||
static BOOL rdpsnd_oss_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
||||
{
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device;
|
||||
WINPR_ASSERT(oss);
|
||||
|
||||
if (device == NULL || oss->mixer_handle == -1)
|
||||
return FALSE;
|
||||
|
||||
left = (((value & 0xFFFF) * 100) / 0xFFFF);
|
||||
right = ((((value >> 16) & 0xFFFF) * 100) / 0xFFFF);
|
||||
unsigned left = (((value & 0xFFFF) * 100) / 0xFFFF);
|
||||
unsigned right = ((((value >> 16) & 0xFFFF) * 100) / 0xFFFF);
|
||||
|
||||
if (left < 0)
|
||||
left = 0;
|
||||
@ -425,7 +424,7 @@ static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, const ADDIN_A
|
||||
return CHANNEL_RC_NULL_DATA;
|
||||
}
|
||||
|
||||
oss->dev_unit = val;
|
||||
oss->dev_unit = (int)val;
|
||||
}
|
||||
|
||||
if (oss->dev_unit < 0 || *eptr != '\0')
|
||||
|
@ -696,7 +696,7 @@ static UINT rdpsnd_pulse_parse_addin_args(rdpsndDevicePlugin* device, const ADDI
|
||||
if ((errno != 0) || (val > INT32_MAX))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
pulse->reconnect_delay_seconds = val;
|
||||
pulse->reconnect_delay_seconds = (time_t)val;
|
||||
}
|
||||
CommandLineSwitchEnd(arg)
|
||||
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
||||
|
@ -302,6 +302,8 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
|
||||
WINPR_ASSERT(rdpsnd->device);
|
||||
ret = IFCALLRESULT(CHANNEL_RC_OK, rdpsnd->device->ServerFormatAnnounce, rdpsnd->device,
|
||||
rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
|
||||
if (ret != CHANNEL_RC_OK)
|
||||
goto out_fail;
|
||||
|
||||
rdpsnd_select_supported_audio_formats(rdpsnd);
|
||||
WLog_Print(rdpsnd->log, WLOG_DEBUG, "%s Server Audio Formats",
|
||||
@ -1329,7 +1331,7 @@ static UINT rdpsnd_virtual_channel_event_disconnected(rdpsndPlugin* rdpsnd)
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static void _queue_free(void* obj)
|
||||
static void queue_free(void* obj)
|
||||
{
|
||||
wMessage* msg = obj;
|
||||
if (!msg)
|
||||
@ -1433,7 +1435,7 @@ static UINT rdpsnd_virtual_channel_event_initialized(rdpsndPlugin* rdpsnd)
|
||||
{
|
||||
wObject obj = { 0 };
|
||||
|
||||
obj.fnObjectFree = _queue_free;
|
||||
obj.fnObjectFree = queue_free;
|
||||
rdpsnd->queue = MessageQueue_New(&obj);
|
||||
if (!rdpsnd->queue)
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
@ -1696,8 +1698,8 @@ static UINT rdpsnd_on_close(IWTSVirtualChannelCallback* pChannelCallback)
|
||||
}
|
||||
|
||||
static UINT rdpsnd_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
|
||||
IWTSVirtualChannel* pChannel, BYTE* Data,
|
||||
BOOL* pbAccept,
|
||||
IWTSVirtualChannel* pChannel, const BYTE* Data,
|
||||
const BOOL* pbAccept,
|
||||
IWTSVirtualChannelCallback** ppCallback)
|
||||
{
|
||||
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <freerdp/config.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
@ -154,8 +154,8 @@ struct S_TSMF_SAMPLE
|
||||
static wArrayList* presentation_list = NULL;
|
||||
static int TERMINATING = 0;
|
||||
|
||||
static void _tsmf_presentation_free(void* obj);
|
||||
static void _tsmf_stream_free(void* obj);
|
||||
static void s_tsmf_presentation_free(void* obj);
|
||||
static void s_tsmf_stream_free(void* obj);
|
||||
|
||||
static UINT64 get_current_time(void)
|
||||
{
|
||||
@ -365,7 +365,7 @@ TSMF_PRESENTATION* tsmf_presentation_new(const BYTE* guid,
|
||||
obj = ArrayList_Object(presentation->stream_list);
|
||||
if (!obj)
|
||||
goto error_add;
|
||||
obj->fnObjectFree = _tsmf_stream_free;
|
||||
obj->fnObjectFree = s_tsmf_stream_free;
|
||||
|
||||
if (!ArrayList_Append(presentation_list, presentation))
|
||||
goto error_add;
|
||||
@ -1163,7 +1163,7 @@ BOOL tsmf_stream_flush(TSMF_STREAM* stream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void _tsmf_presentation_free(void* obj)
|
||||
void s_tsmf_presentation_free(void* obj)
|
||||
{
|
||||
TSMF_PRESENTATION* presentation = (TSMF_PRESENTATION*)obj;
|
||||
|
||||
@ -1394,7 +1394,7 @@ void tsmf_stream_end(TSMF_STREAM* stream, UINT32 message_id,
|
||||
stream->eos_channel_callback = pChannelCallback;
|
||||
}
|
||||
|
||||
void _tsmf_stream_free(void* obj)
|
||||
void s_tsmf_stream_free(void* obj)
|
||||
{
|
||||
TSMF_STREAM* stream = (TSMF_STREAM*)obj;
|
||||
|
||||
@ -1484,14 +1484,19 @@ BOOL tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
|
||||
sample->data = calloc(1, data_size + TSMF_BUFFER_PADDING_SIZE);
|
||||
|
||||
if (!sample->data)
|
||||
{
|
||||
WLog_ERR(TAG, "calloc sample->data failed!");
|
||||
free(sample);
|
||||
return FALSE;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
CopyMemory(sample->data, data, data_size);
|
||||
return Queue_Enqueue(stream->sample_list, sample);
|
||||
if (!Queue_Enqueue(stream->sample_list, sample))
|
||||
goto fail;
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
if (sample)
|
||||
free(sample->data);
|
||||
free(sample);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
@ -1536,7 +1541,7 @@ BOOL tsmf_media_init(void)
|
||||
obj = ArrayList_Object(presentation_list);
|
||||
if (!obj)
|
||||
return FALSE;
|
||||
obj->fnObjectFree = _tsmf_presentation_free;
|
||||
obj->fnObjectFree = s_tsmf_presentation_free;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -44,9 +44,6 @@ static void usb_process_get_port_status(IUDEVICE* pdev, wStream* out)
|
||||
break;
|
||||
|
||||
case USB_v2_0:
|
||||
Stream_Write_UINT32(out, 0x503);
|
||||
break;
|
||||
|
||||
default:
|
||||
Stream_Write_UINT32(out, 0x503);
|
||||
break;
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
#define BASIC_STATE_FUNC_REGISTER(_arg, _dev) \
|
||||
_dev->iface.get_##_arg = udev_get_##_arg; \
|
||||
_dev->iface.set_##_arg = udev_set_##_arg
|
||||
(_dev)->iface.set_##_arg = udev_set_##_arg
|
||||
|
||||
#if LIBUSB_API_VERSION >= 0x01000103
|
||||
#define HAVE_STREAM_ID_API 1
|
||||
|
@ -69,7 +69,7 @@ typedef UDEVICE* PUDEVICE;
|
||||
|
||||
size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendor, UINT16 idProduct,
|
||||
IUDEVICE*** devArray);
|
||||
IUDEVICE* udev_new_by_addr(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, BYTE bus_number,
|
||||
IUDEVICE* udev_new_by_addr(URBDRC_PLUGIN* urbdrc, libusb_context* context, BYTE bus_number,
|
||||
BYTE dev_number);
|
||||
const char* usb_interface_class_to_string(uint8_t class);
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
#define BASIC_STATE_FUNC_REGISTER(_arg, _man) \
|
||||
_man->iface.get_##_arg = udevman_get_##_arg; \
|
||||
_man->iface.set_##_arg = udevman_set_##_arg
|
||||
(_man)->iface.set_##_arg = udevman_set_##_arg
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -217,6 +217,6 @@ FREERDP_API BOOL add_device(IUDEVMAN* idevman, UINT32 flags, BYTE busnum, BYTE d
|
||||
FREERDP_API BOOL del_device(IUDEVMAN* idevman, UINT32 flags, BYTE busnum, BYTE devnum,
|
||||
UINT16 idVendor, UINT16 idProduct);
|
||||
|
||||
UINT stream_write_and_free(IWTSPlugin* plugin, IWTSVirtualChannel* channel, wStream* s);
|
||||
UINT stream_write_and_free(IWTSPlugin* plugin, IWTSVirtualChannel* channel, wStream* out);
|
||||
|
||||
#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_MAIN_H */
|
||||
|
@ -310,7 +310,7 @@ static VideoFrame* VideoFrame_new(VideoClientContextPriv* priv, PresentationCont
|
||||
frame->h = surface->alignedHeight;
|
||||
frame->scanline = surface->scanline;
|
||||
|
||||
frame->surfaceData = BufferPool_Take(priv->surfacePool, 1ull * frame->scanline * frame->h);
|
||||
frame->surfaceData = BufferPool_Take(priv->surfacePool, 1ll * frame->scanline * frame->h);
|
||||
if (!frame->surfaceData)
|
||||
goto fail;
|
||||
|
||||
@ -1014,8 +1014,8 @@ static UINT video_data_on_close(IWTSVirtualChannelCallback* pChannelCallback)
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT video_control_on_new_channel_connection(IWTSListenerCallback* listenerCallback,
|
||||
IWTSVirtualChannel* channel, BYTE* Data,
|
||||
BOOL* pbAccept,
|
||||
IWTSVirtualChannel* channel, const BYTE* Data,
|
||||
const BOOL* pbAccept,
|
||||
IWTSVirtualChannelCallback** ppCallback)
|
||||
{
|
||||
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
||||
@ -1044,8 +1044,8 @@ static UINT video_control_on_new_channel_connection(IWTSListenerCallback* listen
|
||||
}
|
||||
|
||||
static UINT video_data_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
|
||||
IWTSVirtualChannel* pChannel, BYTE* Data,
|
||||
BOOL* pbAccept,
|
||||
IWTSVirtualChannel* pChannel, const BYTE* Data,
|
||||
const BOOL* pbAccept,
|
||||
IWTSVirtualChannelCallback** ppCallback)
|
||||
{
|
||||
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
#include "sdl_button.hpp"
|
||||
|
||||
@ -27,8 +28,8 @@ static const SDL_Color buttonhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 };
|
||||
static const SDL_Color buttonmouseovercolor = { 0x66, 0xff, 0x66, 0x60 };
|
||||
static const SDL_Color buttonfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
||||
SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id, const SDL_Rect& rect)
|
||||
: SdlWidget(renderer, rect, false), _name(label), _id(id)
|
||||
SdlButton::SdlButton(SDL_Renderer* renderer, std::string label, int id, SDL_Rect rect)
|
||||
: SdlWidget(renderer, rect, false), _name(std::move(label)), _id(id)
|
||||
{
|
||||
assert(renderer);
|
||||
|
||||
@ -36,7 +37,7 @@ SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id, c
|
||||
}
|
||||
|
||||
SdlButton::SdlButton(SdlButton&& other) noexcept
|
||||
: SdlWidget(std::move(other)), _name(std::move(other._name)), _id(std::move(other._id))
|
||||
: SdlWidget(std::move(other)), _name(std::move(other._name)), _id(other._id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
class SdlButton : public SdlWidget
|
||||
{
|
||||
public:
|
||||
SdlButton(SDL_Renderer* renderer, const std::string& label, int id, const SDL_Rect& rect);
|
||||
SdlButton(SDL_Renderer* renderer, std::string label, int id, SDL_Rect rect);
|
||||
SdlButton(SdlButton&& other) noexcept;
|
||||
~SdlButton() override = default;
|
||||
|
||||
@ -20,7 +20,6 @@ class SdlButton : public SdlWidget
|
||||
private:
|
||||
SdlButton(const SdlButton& other) = delete;
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
int _id;
|
||||
};
|
||||
|
@ -29,7 +29,6 @@ class SdlButtonList
|
||||
SdlButtonList(const SdlButtonList& other) = delete;
|
||||
SdlButtonList(SdlButtonList&& other) = delete;
|
||||
|
||||
private:
|
||||
std::vector<SdlButton> _list;
|
||||
SdlButton* _highlighted = nullptr;
|
||||
size_t _highlight_index = 0;
|
||||
|
@ -64,7 +64,6 @@ class SDLConnectionDialog
|
||||
MSG_DISCARD
|
||||
};
|
||||
|
||||
private:
|
||||
bool createWindow();
|
||||
void destroyWindow();
|
||||
|
||||
@ -72,21 +71,19 @@ class SDLConnectionDialog
|
||||
|
||||
bool setModal();
|
||||
|
||||
bool clearWindow(SDL_Renderer* renderer);
|
||||
static bool clearWindow(SDL_Renderer* renderer);
|
||||
|
||||
bool update(SDL_Renderer* renderer);
|
||||
|
||||
bool show(MsgType type, const char* fmt, va_list ap);
|
||||
bool show(MsgType type);
|
||||
|
||||
std::string print(const char* fmt, va_list ap);
|
||||
static std::string print(const char* fmt, va_list ap);
|
||||
bool setTimer(Uint32 timeoutMS = 15000);
|
||||
void resetTimer();
|
||||
|
||||
private:
|
||||
static Uint32 timeout(Uint32 intervalMS, void* _this);
|
||||
|
||||
private:
|
||||
struct widget_cfg_t
|
||||
{
|
||||
SDL_Color fgcolor = {};
|
||||
@ -94,7 +91,6 @@ class SDLConnectionDialog
|
||||
SdlWidget widget;
|
||||
};
|
||||
|
||||
private:
|
||||
rdpContext* _context = nullptr;
|
||||
SDL_Window* _window = nullptr;
|
||||
SDL_Renderer* _renderer = nullptr;
|
||||
@ -121,9 +117,8 @@ class SDLConnectionDialogHider
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* get(freerdp* instance);
|
||||
SDLConnectionDialog* get(rdpContext* context);
|
||||
static SDLConnectionDialog* get(rdpContext* context);
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* _dialog = nullptr;
|
||||
bool _visible = false;
|
||||
};
|
||||
|
@ -333,14 +333,14 @@ static char* sdl_pem_cert(const char* pem)
|
||||
{
|
||||
rdpCertificate* cert = freerdp_certificate_new_from_pem(pem);
|
||||
if (!cert)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
char* fp = freerdp_certificate_get_fingerprint(cert);
|
||||
char* start = freerdp_certificate_get_validity(cert, TRUE);
|
||||
char* end = freerdp_certificate_get_validity(cert, FALSE);
|
||||
freerdp_certificate_free(cert);
|
||||
|
||||
char* str = NULL;
|
||||
char* str = nullptr;
|
||||
size_t slen = 0;
|
||||
winpr_asprintf(&str, &slen,
|
||||
"Valid from: %s\n"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
@ -39,10 +40,9 @@ static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
static const Uint32 vpadding = 5;
|
||||
static const Uint32 hpadding = 10;
|
||||
|
||||
SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
const std::string& initial, Uint32 flags, size_t offset,
|
||||
size_t width, size_t height)
|
||||
: _flags(flags), _text(initial), _text_label(label),
|
||||
SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial,
|
||||
Uint32 flags, size_t offset, size_t width, size_t height)
|
||||
: _flags(flags), _text(std::move(initial)), _text_label(std::move(label)),
|
||||
_label(renderer,
|
||||
{ 0, static_cast<int>(offset * (height + vpadding)), static_cast<int>(width),
|
||||
static_cast<int>(height) },
|
||||
@ -56,7 +56,7 @@ SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
}
|
||||
|
||||
SdlInputWidget::SdlInputWidget(SdlInputWidget&& other) noexcept
|
||||
: _flags(std::move(other._flags)), _text(std::move(other._text)),
|
||||
: _flags(other._flags), _text(std::move(other._text)),
|
||||
_text_label(std::move(other._text_label)), _label(std::move(other._label)),
|
||||
_input(std::move(other._input)), _highlight(other._highlight), _mouseover(other._mouseover)
|
||||
{
|
||||
|
@ -34,9 +34,8 @@ class SdlInputWidget
|
||||
SDL_INPUT_READONLY = 2
|
||||
};
|
||||
|
||||
public:
|
||||
SdlInputWidget(SDL_Renderer* renderer, const std::string& label, const std::string& initial,
|
||||
Uint32 flags, size_t offset, size_t width, size_t height);
|
||||
SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial, Uint32 flags,
|
||||
size_t offset, size_t width, size_t height);
|
||||
SdlInputWidget(SdlInputWidget&& other) noexcept;
|
||||
|
||||
bool fill_label(SDL_Renderer* renderer, SDL_Color color);
|
||||
@ -62,7 +61,6 @@ class SdlInputWidget
|
||||
private:
|
||||
SdlInputWidget(const SdlInputWidget& other) = delete;
|
||||
|
||||
private:
|
||||
Uint32 _flags;
|
||||
std::string _text;
|
||||
std::string _text_label;
|
||||
|
@ -24,19 +24,16 @@ class SdlInputWidgetList
|
||||
SdlInputWidgetList(const SdlInputWidgetList& other) = delete;
|
||||
SdlInputWidgetList(SdlInputWidgetList&& other) = delete;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
INPUT_BUTTON_ACCEPT = 1,
|
||||
INPUT_BUTTON_CANCEL = -2
|
||||
};
|
||||
|
||||
private:
|
||||
ssize_t next(ssize_t current);
|
||||
[[nodiscard]] bool valid(ssize_t current) const;
|
||||
SdlInputWidget* get(ssize_t index);
|
||||
|
||||
private:
|
||||
SDL_Window* _window;
|
||||
SDL_Renderer* _renderer;
|
||||
std::vector<SdlInputWidget> _list;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
@ -35,9 +36,8 @@ static const SDL_Color labelbackgroundcolor = { 0x69, 0x66, 0x63, 0xff };
|
||||
static const SDL_Color labelhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 };
|
||||
static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
||||
SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
const SDL_Rect& rect)
|
||||
: SdlWidget(renderer, rect, true), _text(label), _mouseover(false), _highlight(false)
|
||||
SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, std::string label, SDL_Rect rect)
|
||||
: SdlWidget(renderer, rect, true), _text(std::move(label)), _mouseover(false), _highlight(false)
|
||||
{
|
||||
update_text(renderer);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
class SdlSelectWidget : public SdlWidget
|
||||
{
|
||||
public:
|
||||
SdlSelectWidget(SDL_Renderer* renderer, const std::string& label, const SDL_Rect& rect);
|
||||
SdlSelectWidget(SDL_Renderer* renderer, std::string label, SDL_Rect rect);
|
||||
SdlSelectWidget(SdlSelectWidget&& other) noexcept;
|
||||
~SdlSelectWidget() override = default;
|
||||
|
||||
@ -39,7 +39,6 @@ class SdlSelectWidget : public SdlWidget
|
||||
private:
|
||||
SdlSelectWidget(const SdlSelectWidget& other) = delete;
|
||||
|
||||
private:
|
||||
std::string _text;
|
||||
bool _mouseover;
|
||||
bool _highlight;
|
||||
|
@ -21,20 +21,17 @@ class SdlSelectList
|
||||
SdlSelectList(const SdlSelectList& other) = delete;
|
||||
SdlSelectList(SdlSelectList&& other) = delete;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
INPUT_BUTTON_ACCEPT = 0,
|
||||
INPUT_BUTTON_CANCEL = -2
|
||||
};
|
||||
|
||||
private:
|
||||
ssize_t get_index(const SDL_MouseButtonEvent& button);
|
||||
bool update_text();
|
||||
void reset_mouseover();
|
||||
void reset_highlight();
|
||||
|
||||
private:
|
||||
SDL_Window* _window;
|
||||
SDL_Renderer* _renderer;
|
||||
std::vector<SdlSelectWidget> _list;
|
||||
|
@ -41,8 +41,7 @@ static const SDL_Color backgroundcolor = { 0x38, 0x36, 0x35, 0xff };
|
||||
|
||||
static const Uint32 hpadding = 10;
|
||||
|
||||
SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, bool input)
|
||||
: _rect(rect), _input(input)
|
||||
SdlWidget::SdlWidget(SDL_Renderer* renderer, SDL_Rect rect, bool input) : _rect(rect), _input(input)
|
||||
{
|
||||
assert(renderer);
|
||||
|
||||
@ -59,7 +58,7 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, bool input)
|
||||
}
|
||||
|
||||
#if defined(WITH_SDL_IMAGE_DIALOGS)
|
||||
SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, SDL_RWops* ops) : _rect(rect)
|
||||
SdlWidget::SdlWidget(SDL_Renderer* renderer, SDL_Rect rect, SDL_RWops* ops) : _rect(rect)
|
||||
{
|
||||
if (ops)
|
||||
{
|
||||
@ -71,8 +70,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, SDL_RWops* op
|
||||
#endif
|
||||
|
||||
SdlWidget::SdlWidget(SdlWidget&& other) noexcept
|
||||
: _font(std::move(other._font)), _image(other._image), _rect(std::move(other._rect)),
|
||||
_input(other._input), _wrap(other._wrap), _text_width(other._text_width)
|
||||
: _font(other._font), _image(other._image), _rect(other._rect), _input(other._input),
|
||||
_wrap(other._wrap), _text_width(other._text_width)
|
||||
{
|
||||
other._font = nullptr;
|
||||
other._image = nullptr;
|
||||
|
@ -48,9 +48,9 @@ typedef SSIZE_T ssize_t;
|
||||
class SdlWidget
|
||||
{
|
||||
public:
|
||||
SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, bool input);
|
||||
SdlWidget(SDL_Renderer* renderer, SDL_Rect rect, bool input);
|
||||
#if defined(WITH_SDL_IMAGE_DIALOGS)
|
||||
SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, SDL_RWops* ops);
|
||||
SdlWidget(SDL_Renderer* renderer, SDL_Rect rect, SDL_RWops* ops);
|
||||
#endif
|
||||
SdlWidget(SdlWidget&& other) noexcept;
|
||||
virtual ~SdlWidget();
|
||||
@ -61,11 +61,10 @@ class SdlWidget
|
||||
bool update_text(SDL_Renderer* renderer, const std::string& text, SDL_Color fgcolor,
|
||||
SDL_Color bgcolor);
|
||||
|
||||
bool wrap() const;
|
||||
[[nodiscard]] bool wrap() const;
|
||||
bool set_wrap(bool wrap = true, size_t width = 0);
|
||||
const SDL_Rect& rect() const;
|
||||
[[nodiscard]] const SDL_Rect& rect() const;
|
||||
|
||||
public:
|
||||
#define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__)
|
||||
static bool error_ex(Uint32 res, const char* what, const char* file, size_t line,
|
||||
const char* fkt);
|
||||
@ -78,7 +77,6 @@ class SdlWidget
|
||||
SDL_Texture* render_text_wrapped(SDL_Renderer* renderer, const std::string& text,
|
||||
SDL_Color fgcolor, SDL_Rect& src, SDL_Rect& dst);
|
||||
|
||||
private:
|
||||
TTF_Font* _font = nullptr;
|
||||
SDL_Texture* _image = nullptr;
|
||||
SDL_Rect _rect;
|
||||
|
@ -62,7 +62,7 @@ void sdl_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnec
|
||||
WINPR_ASSERT(sdl);
|
||||
WINPR_ASSERT(e);
|
||||
|
||||
// TODO: Set resizeable depending on disp channel and /dynamic-resolution
|
||||
// TODO(nin): Set resizeable depending on disp channel and /dynamic-resolution
|
||||
if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class sdlDispContext
|
||||
BOOL uninit(DispClientContext* disp);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
BOOL handle_display_event(const SDL_DisplayEvent* ev);
|
||||
static BOOL handle_display_event(const SDL_DisplayEvent* ev);
|
||||
#endif
|
||||
|
||||
BOOL handle_window_event(const SDL_WindowEvent* ev);
|
||||
@ -54,14 +54,12 @@ class sdlDispContext
|
||||
|
||||
BOOL addTimer();
|
||||
|
||||
private:
|
||||
static UINT DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors,
|
||||
UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB);
|
||||
static void OnActivated(void* context, const ActivatedEventArgs* e);
|
||||
static void OnGraphicsReset(void* context, const GraphicsResetEventArgs* e);
|
||||
static Uint32 SDLCALL OnTimer(Uint32 interval, void* param);
|
||||
|
||||
private:
|
||||
SdlContext* _sdl = nullptr;
|
||||
DispClientContext* _disp = nullptr;
|
||||
int _eventBase = -1;
|
||||
|
@ -211,9 +211,9 @@ static const struct sdl_exit_code_map_t sdl_exit_code_map[] = {
|
||||
|
||||
static const struct sdl_exit_code_map_t* sdl_map_entry_by_code(int exit_code)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
|
||||
for (const auto& x : sdl_exit_code_map)
|
||||
{
|
||||
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
|
||||
const struct sdl_exit_code_map_t* cur = &x;
|
||||
if (cur->code == exit_code)
|
||||
return cur;
|
||||
}
|
||||
@ -230,9 +230,9 @@ static void sdl_hide_connection_dialog(SdlContext* sdl)
|
||||
|
||||
static const struct sdl_exit_code_map_t* sdl_map_entry_by_error(DWORD error)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
|
||||
for (const auto& x : sdl_exit_code_map)
|
||||
{
|
||||
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
|
||||
const struct sdl_exit_code_map_t* cur = &x;
|
||||
if (cur->error == error)
|
||||
return cur;
|
||||
}
|
||||
@ -335,7 +335,7 @@ class SdlEventUpdateTriggerGuard
|
||||
};
|
||||
|
||||
static bool sdl_draw_to_window_rect(SdlContext* sdl, SdlWindow& window, SDL_Surface* surface,
|
||||
SDL_Point offset, const SDL_Rect& srcRect)
|
||||
SDL_Point offset, SDL_Rect srcRect)
|
||||
{
|
||||
SDL_Rect dstRect = { offset.x + srcRect.x, offset.y + srcRect.y, srcRect.w, srcRect.h };
|
||||
return window.blit(surface, srcRect, dstRect);
|
||||
@ -358,7 +358,7 @@ static bool sdl_draw_to_window_rect(SdlContext* sdl, SdlWindow& window, SDL_Surf
|
||||
}
|
||||
|
||||
static bool sdl_draw_to_window_scaled_rect(SdlContext* sdl, SdlWindow& window, SDL_Surface* surface,
|
||||
const SDL_Rect& srcRect)
|
||||
SDL_Rect srcRect)
|
||||
{
|
||||
SDL_Rect dstRect = srcRect;
|
||||
sdl_scale_coordinates(sdl, window.id(), &dstRect.x, &dstRect.y, FALSE, TRUE);
|
||||
@ -1347,7 +1347,7 @@ terminate:
|
||||
/* Optional global initializer.
|
||||
* Here we just register a signal handler to print out stack traces
|
||||
* if available. */
|
||||
static BOOL sdl_client_global_init(void)
|
||||
static BOOL sdl_client_global_init()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSADATA wsaData = { 0 };
|
||||
@ -1367,7 +1367,7 @@ static BOOL sdl_client_global_init(void)
|
||||
}
|
||||
|
||||
/* Optional global tear down */
|
||||
static void sdl_client_global_uninit(void)
|
||||
static void sdl_client_global_uninit()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSACleanup();
|
||||
|
@ -83,7 +83,6 @@ class SdlContext
|
||||
|
||||
std::atomic<bool> rdp_thread_running;
|
||||
|
||||
public:
|
||||
BOOL update_resizeable(BOOL enable);
|
||||
BOOL update_fullscreen(BOOL enter);
|
||||
|
||||
|
@ -30,13 +30,13 @@
|
||||
#include <freerdp/log.h>
|
||||
#define TAG CLIENT_TAG("SDL.kbd")
|
||||
|
||||
typedef struct
|
||||
using scancode_entry_t = struct
|
||||
{
|
||||
Uint32 sdl;
|
||||
const char* sdl_name;
|
||||
UINT32 rdp;
|
||||
const char* rdp_name;
|
||||
} scancode_entry_t;
|
||||
};
|
||||
|
||||
#define STR(x) #x
|
||||
#define ENTRY(x, y) \
|
||||
@ -292,7 +292,7 @@ static const scancode_entry_t map[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static UINT32 sdl_get_kbd_flags(void)
|
||||
static UINT32 sdl_get_kbd_flags()
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
|
||||
@ -623,9 +623,10 @@ BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable)
|
||||
return it->second.grabMouse(enable);
|
||||
}
|
||||
|
||||
sdlInput::sdlInput(SdlContext* sdl) : _sdl(sdl), _lastWindowID(UINT32_MAX)
|
||||
sdlInput::sdlInput(SdlContext* sdl)
|
||||
: _sdl(sdl), _lastWindowID(UINT32_MAX), _hotkeyModmask(prefToMask())
|
||||
{
|
||||
_hotkeyModmask = prefToMask();
|
||||
|
||||
_hotkeyFullscreen = prefKeyValue("SDL_Fullscreen", SDL_SCANCODE_RETURN);
|
||||
_hotkeyResizable = prefKeyValue("SDL_Resizeable", SDL_SCANCODE_R);
|
||||
_hotkeyGrab = prefKeyValue("SDL_Grab", SDL_SCANCODE_G);
|
||||
|
@ -45,7 +45,6 @@ class sdlInput
|
||||
BOOL mouse_focus(Uint32 windowID);
|
||||
BOOL mouse_grab(Uint32 windowID, SDL_bool enable);
|
||||
|
||||
public:
|
||||
static BOOL keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
|
||||
static BOOL keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState,
|
||||
UINT32 imeConvMode);
|
||||
@ -61,7 +60,6 @@ class sdlInput
|
||||
uint32_t remapScancode(uint32_t scancode);
|
||||
void remapInitialize();
|
||||
|
||||
private:
|
||||
SdlContext* _sdl;
|
||||
Uint32 _lastWindowID;
|
||||
std::map<uint32_t, uint32_t> _remapList;
|
||||
|
@ -38,20 +38,20 @@
|
||||
#include "sdl_monitor.hpp"
|
||||
#include "sdl_freerdp.hpp"
|
||||
|
||||
typedef struct
|
||||
using MONITOR_INFO = struct
|
||||
{
|
||||
RECTANGLE_16 area;
|
||||
RECTANGLE_16 workarea;
|
||||
BOOL primary;
|
||||
} MONITOR_INFO;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
using VIRTUAL_SCREEN = struct
|
||||
{
|
||||
int nmonitors;
|
||||
RECTANGLE_16 area;
|
||||
RECTANGLE_16 workarea;
|
||||
MONITOR_INFO* monitors;
|
||||
} VIRTUAL_SCREEN;
|
||||
};
|
||||
|
||||
/* See MSDN Section on Multiple Display Monitors: http://msdn.microsoft.com/en-us/library/dd145071
|
||||
*/
|
||||
@ -292,7 +292,7 @@ static BOOL sdl_detect_single_window(SdlContext* sdl, UINT32* pMaxWidth, UINT32*
|
||||
if (freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds) == 0)
|
||||
{
|
||||
const size_t id =
|
||||
(sdl->windows.size() > 0) ? sdl->windows.begin()->second.displayIndex() : 0;
|
||||
(!sdl->windows.empty()) ? sdl->windows.begin()->second.displayIndex() : 0;
|
||||
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, &id, 1))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -30,14 +30,14 @@
|
||||
|
||||
#define TAG CLIENT_TAG("SDL.pointer")
|
||||
|
||||
typedef struct
|
||||
using sdlPointer = struct
|
||||
{
|
||||
rdpPointer pointer;
|
||||
SDL_Cursor* cursor;
|
||||
SDL_Surface* image;
|
||||
size_t size;
|
||||
void* data;
|
||||
} sdlPointer;
|
||||
};
|
||||
|
||||
static BOOL sdl_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
{
|
||||
@ -191,7 +191,7 @@ BOOL sdl_register_pointer(rdpGraphics* graphics)
|
||||
const rdpPointer pointer = { sizeof(sdlPointer), sdl_Pointer_New,
|
||||
sdl_Pointer_Free, sdl_Pointer_Set,
|
||||
sdl_Pointer_SetNull, sdl_Pointer_SetDefault,
|
||||
sdl_Pointer_SetPosition, 0 };
|
||||
sdl_Pointer_SetPosition, { 0 } };
|
||||
graphics_register_pointer(graphics, &pointer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class CriticalSection
|
||||
void unlock();
|
||||
|
||||
private:
|
||||
CRITICAL_SECTION _section;
|
||||
CRITICAL_SECTION _section{};
|
||||
};
|
||||
|
||||
class WinPREvent
|
||||
|
@ -27,7 +27,7 @@ SdlWindow::SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY,
|
||||
{
|
||||
}
|
||||
|
||||
SdlWindow::SdlWindow(SdlWindow&& other)
|
||||
SdlWindow::SdlWindow(SdlWindow&& other) noexcept
|
||||
: _window(other._window), _offset_x(other._offset_x), _offset_y(other._offset_y)
|
||||
{
|
||||
other._window = nullptr;
|
||||
@ -180,7 +180,7 @@ bool SdlWindow::fill(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SdlWindow::blit(SDL_Surface* surface, const SDL_Rect& srcRect, SDL_Rect& dstRect)
|
||||
bool SdlWindow::blit(SDL_Surface* surface, SDL_Rect srcRect, SDL_Rect& dstRect)
|
||||
{
|
||||
auto screen = SDL_GetWindowSurface(_window);
|
||||
if (!screen || !surface)
|
||||
|
@ -27,7 +27,7 @@ class SdlWindow
|
||||
public:
|
||||
SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY, Sint32 width,
|
||||
Sint32 height, Uint32 flags);
|
||||
SdlWindow(SdlWindow&& other);
|
||||
SdlWindow(SdlWindow&& other) noexcept;
|
||||
~SdlWindow();
|
||||
|
||||
[[nodiscard]] Uint32 id() const;
|
||||
@ -49,7 +49,7 @@ class SdlWindow
|
||||
void fullscreen(bool use);
|
||||
|
||||
bool fill(Uint8 r = 0x00, Uint8 g = 0x00, Uint8 b = 0x00, Uint8 a = 0xff);
|
||||
bool blit(SDL_Surface* surface, const SDL_Rect& src, SDL_Rect& dst);
|
||||
bool blit(SDL_Surface* surface, SDL_Rect src, SDL_Rect& dst);
|
||||
void updateSurface();
|
||||
|
||||
private:
|
||||
@ -57,6 +57,5 @@ class SdlWindow
|
||||
Sint32 _offset_x = 0;
|
||||
Sint32 _offset_y = 0;
|
||||
|
||||
private:
|
||||
SdlWindow(const SdlWindow& other) = delete;
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
#include "sdl_button.hpp"
|
||||
|
||||
@ -27,9 +28,8 @@ static const SDL_Color buttonhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 };
|
||||
static const SDL_Color buttonmouseovercolor = { 0x66, 0xff, 0x66, 0x60 };
|
||||
static const SDL_Color buttonfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
||||
SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id,
|
||||
const SDL_FRect& rect)
|
||||
: SdlWidget(renderer, rect, false), _name(label), _id(id)
|
||||
SdlButton::SdlButton(SDL_Renderer* renderer, std::string label, int id, const SDL_FRect& rect)
|
||||
: SdlWidget(renderer, rect, false), _name(std::move(label)), _id(id)
|
||||
{
|
||||
assert(renderer);
|
||||
|
||||
@ -37,7 +37,7 @@ SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id,
|
||||
}
|
||||
|
||||
SdlButton::SdlButton(SdlButton&& other) noexcept
|
||||
: SdlWidget(std::move(other)), _name(std::move(other._name)), _id(std::move(other._id))
|
||||
: SdlWidget(std::move(other)), _name(std::move(other._name)), _id(other._id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
class SdlButton : public SdlWidget
|
||||
{
|
||||
public:
|
||||
SdlButton(SDL_Renderer* renderer, const std::string& label, int id, const SDL_FRect& rect);
|
||||
SdlButton(SDL_Renderer* renderer, std::string label, int id, const SDL_FRect& rect);
|
||||
SdlButton(SdlButton&& other) noexcept;
|
||||
~SdlButton() override = default;
|
||||
|
||||
@ -20,7 +20,6 @@ class SdlButton : public SdlWidget
|
||||
private:
|
||||
SdlButton(const SdlButton& other) = delete;
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
int _id;
|
||||
};
|
||||
|
@ -29,7 +29,6 @@ class SdlButtonList
|
||||
SdlButtonList(const SdlButtonList& other) = delete;
|
||||
SdlButtonList(SdlButtonList&& other) = delete;
|
||||
|
||||
private:
|
||||
std::vector<SdlButton> _list;
|
||||
SdlButton* _highlighted = nullptr;
|
||||
size_t _highlight_index = 0;
|
||||
|
@ -64,7 +64,6 @@ class SDLConnectionDialog
|
||||
MSG_DISCARD
|
||||
};
|
||||
|
||||
private:
|
||||
bool createWindow();
|
||||
void destroyWindow();
|
||||
|
||||
@ -72,21 +71,19 @@ class SDLConnectionDialog
|
||||
|
||||
bool setModal();
|
||||
|
||||
bool clearWindow(SDL_Renderer* renderer);
|
||||
static bool clearWindow(SDL_Renderer* renderer);
|
||||
|
||||
bool update(SDL_Renderer* renderer);
|
||||
|
||||
bool show(MsgType type, const char* fmt, va_list ap);
|
||||
bool show(MsgType type);
|
||||
|
||||
std::string print(const char* fmt, va_list ap);
|
||||
static std::string print(const char* fmt, va_list ap);
|
||||
bool setTimer(Uint32 timeoutMS = 15000);
|
||||
void resetTimer();
|
||||
|
||||
private:
|
||||
static Uint32 timeout(void* pvthis, SDL_TimerID timerID, Uint32 intervalMS);
|
||||
|
||||
private:
|
||||
struct widget_cfg_t
|
||||
{
|
||||
SDL_Color fgcolor = {};
|
||||
@ -94,7 +91,6 @@ class SDLConnectionDialog
|
||||
SdlWidget widget;
|
||||
};
|
||||
|
||||
private:
|
||||
rdpContext* _context = nullptr;
|
||||
SDL_Window* _window = nullptr;
|
||||
SDL_Renderer* _renderer = nullptr;
|
||||
@ -121,9 +117,8 @@ class SDLConnectionDialogHider
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* get(freerdp* instance);
|
||||
SDLConnectionDialog* get(rdpContext* context);
|
||||
static SDLConnectionDialog* get(rdpContext* context);
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* _dialog = nullptr;
|
||||
bool _visible = false;
|
||||
};
|
||||
|
@ -331,14 +331,14 @@ static char* sdl_pem_cert(const char* pem)
|
||||
{
|
||||
rdpCertificate* cert = freerdp_certificate_new_from_pem(pem);
|
||||
if (!cert)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
char* fp = freerdp_certificate_get_fingerprint(cert);
|
||||
char* start = freerdp_certificate_get_validity(cert, TRUE);
|
||||
char* end = freerdp_certificate_get_validity(cert, FALSE);
|
||||
freerdp_certificate_free(cert);
|
||||
|
||||
char* str = NULL;
|
||||
char* str = nullptr;
|
||||
size_t slen = 0;
|
||||
winpr_asprintf(&str, &slen,
|
||||
"Valid from: %s\n"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
@ -39,10 +40,9 @@ static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
static const Uint32 vpadding = 5;
|
||||
static const Uint32 hpadding = 10;
|
||||
|
||||
SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
const std::string& initial, Uint32 flags, size_t offset,
|
||||
size_t width, size_t height)
|
||||
: _flags(flags), _text(initial), _text_label(label),
|
||||
SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial,
|
||||
Uint32 flags, size_t offset, size_t width, size_t height)
|
||||
: _flags(flags), _text(std::move(initial)), _text_label(std::move(label)),
|
||||
_label(renderer,
|
||||
{ 0, static_cast<float>(offset * (height + vpadding)), static_cast<float>(width),
|
||||
static_cast<float>(height) },
|
||||
@ -57,7 +57,7 @@ SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
}
|
||||
|
||||
SdlInputWidget::SdlInputWidget(SdlInputWidget&& other) noexcept
|
||||
: _flags(std::move(other._flags)), _text(std::move(other._text)),
|
||||
: _flags(other._flags), _text(std::move(other._text)),
|
||||
_text_label(std::move(other._text_label)), _label(std::move(other._label)),
|
||||
_input(std::move(other._input)), _highlight(other._highlight), _mouseover(other._mouseover)
|
||||
{
|
||||
|
@ -34,9 +34,8 @@ class SdlInputWidget
|
||||
SDL_INPUT_READONLY = 2
|
||||
};
|
||||
|
||||
public:
|
||||
SdlInputWidget(SDL_Renderer* renderer, const std::string& label, const std::string& initial,
|
||||
Uint32 flags, size_t offset, size_t width, size_t height);
|
||||
SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial, Uint32 flags,
|
||||
size_t offset, size_t width, size_t height);
|
||||
SdlInputWidget(SdlInputWidget&& other) noexcept;
|
||||
|
||||
bool fill_label(SDL_Renderer* renderer, SDL_Color color);
|
||||
@ -62,7 +61,6 @@ class SdlInputWidget
|
||||
private:
|
||||
SdlInputWidget(const SdlInputWidget& other) = delete;
|
||||
|
||||
private:
|
||||
Uint32 _flags;
|
||||
std::string _text;
|
||||
std::string _text_label;
|
||||
|
@ -24,19 +24,16 @@ class SdlInputWidgetList
|
||||
SdlInputWidgetList(const SdlInputWidgetList& other) = delete;
|
||||
SdlInputWidgetList(SdlInputWidgetList&& other) = delete;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
INPUT_BUTTON_ACCEPT = 1,
|
||||
INPUT_BUTTON_CANCEL = -2
|
||||
};
|
||||
|
||||
private:
|
||||
ssize_t next(ssize_t current);
|
||||
[[nodiscard]] bool valid(ssize_t current) const;
|
||||
SdlInputWidget* get(ssize_t index);
|
||||
|
||||
private:
|
||||
SDL_Window* _window;
|
||||
SDL_Renderer* _renderer;
|
||||
std::vector<SdlInputWidget> _list;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
@ -35,9 +36,8 @@ static const SDL_Color labelbackgroundcolor = { 0x69, 0x66, 0x63, 0xff };
|
||||
static const SDL_Color labelhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 };
|
||||
static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
||||
SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, const std::string& label,
|
||||
const SDL_FRect& rect)
|
||||
: SdlWidget(renderer, rect, true), _text(label), _mouseover(false), _highlight(false)
|
||||
SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, std::string label, const SDL_FRect& rect)
|
||||
: SdlWidget(renderer, rect, true), _text(std::move(label)), _mouseover(false), _highlight(false)
|
||||
{
|
||||
update_text(renderer);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
class SdlSelectWidget : public SdlWidget
|
||||
{
|
||||
public:
|
||||
SdlSelectWidget(SDL_Renderer* renderer, const std::string& label, const SDL_FRect& rect);
|
||||
SdlSelectWidget(SDL_Renderer* renderer, std::string label, const SDL_FRect& rect);
|
||||
SdlSelectWidget(SdlSelectWidget&& other) noexcept;
|
||||
~SdlSelectWidget() override = default;
|
||||
|
||||
@ -39,7 +39,6 @@ class SdlSelectWidget : public SdlWidget
|
||||
private:
|
||||
SdlSelectWidget(const SdlSelectWidget& other) = delete;
|
||||
|
||||
private:
|
||||
std::string _text;
|
||||
bool _mouseover;
|
||||
bool _highlight;
|
||||
|
@ -21,20 +21,17 @@ class SdlSelectList
|
||||
SdlSelectList(const SdlSelectList& other) = delete;
|
||||
SdlSelectList(SdlSelectList&& other) = delete;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
INPUT_BUTTON_ACCEPT = 0,
|
||||
INPUT_BUTTON_CANCEL = -2
|
||||
};
|
||||
|
||||
private:
|
||||
ssize_t get_index(const SDL_MouseButtonEvent& button);
|
||||
bool update_text();
|
||||
void reset_mouseover();
|
||||
void reset_highlight();
|
||||
|
||||
private:
|
||||
SDL_Window* _window;
|
||||
SDL_Renderer* _renderer;
|
||||
std::vector<SdlSelectWidget> _list;
|
||||
|
@ -71,8 +71,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_FRect& rect, SDL_IOStream
|
||||
#endif
|
||||
|
||||
SdlWidget::SdlWidget(SdlWidget&& other) noexcept
|
||||
: _font(std::move(other._font)), _image(other._image), _rect(std::move(other._rect)),
|
||||
_input(other._input), _wrap(other._wrap), _text_width(other._text_width)
|
||||
: _font(other._font), _image(other._image), _rect(other._rect), _input(other._input),
|
||||
_wrap(other._wrap), _text_width(other._text_width)
|
||||
{
|
||||
other._font = nullptr;
|
||||
other._image = nullptr;
|
||||
|
@ -59,11 +59,10 @@ class SdlWidget
|
||||
bool update_text(SDL_Renderer* renderer, const std::string& text, SDL_Color fgcolor,
|
||||
SDL_Color bgcolor);
|
||||
|
||||
bool wrap() const;
|
||||
[[nodiscard]] bool wrap() const;
|
||||
bool set_wrap(bool wrap = true, size_t width = 0);
|
||||
const SDL_FRect& rect() const;
|
||||
[[nodiscard]] const SDL_FRect& rect() const;
|
||||
|
||||
public:
|
||||
#define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__)
|
||||
static bool error_ex(Uint32 res, const char* what, const char* file, size_t line,
|
||||
const char* fkt);
|
||||
@ -76,7 +75,6 @@ class SdlWidget
|
||||
SDL_Texture* render_text_wrapped(SDL_Renderer* renderer, const std::string& text,
|
||||
SDL_Color fgcolor, SDL_FRect& src, SDL_FRect& dst);
|
||||
|
||||
private:
|
||||
TTF_Font* _font = nullptr;
|
||||
SDL_Texture* _image = nullptr;
|
||||
SDL_FRect _rect;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <mutex>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
@ -57,7 +58,7 @@ static const char* type_FileGroupDescriptorW = "FileGroupDescriptorW";
|
||||
class ClipboardLockGuard
|
||||
{
|
||||
public:
|
||||
ClipboardLockGuard(wClipboard* clipboard) : _clipboard(clipboard)
|
||||
explicit ClipboardLockGuard(wClipboard* clipboard) : _clipboard(clipboard)
|
||||
{
|
||||
ClipboardLock(_clipboard);
|
||||
}
|
||||
@ -155,7 +156,7 @@ bool sdlClip::handle_update()
|
||||
clientFormats.push_back({ CF_UNICODETEXT, nullptr });
|
||||
}
|
||||
if (SDL_HasClipboardData(mime_html.c_str()))
|
||||
clientFormatNames.push_back(type_HtmlFormat);
|
||||
clientFormatNames.emplace_back(type_HtmlFormat);
|
||||
|
||||
for (auto& mime : mime_bitmap)
|
||||
{
|
||||
@ -311,7 +312,7 @@ uint32_t sdlClip::serverIdForMime(const std::string& mime)
|
||||
{
|
||||
if (!format.formatName())
|
||||
continue;
|
||||
if (cmp.compare(format.formatName()) == 0)
|
||||
if (cmp == format.formatName())
|
||||
return format.formatId();
|
||||
}
|
||||
|
||||
@ -378,7 +379,7 @@ UINT sdlClip::ReceiveServerFormatList(CliprdrClientContext* context,
|
||||
{
|
||||
const CLIPRDR_FORMAT* format = &formatList->formats[i];
|
||||
|
||||
clipboard->_serverFormats.push_back({ format->formatId, format->formatName });
|
||||
clipboard->_serverFormats.emplace_back(format->formatId, format->formatName);
|
||||
|
||||
if (format->formatName)
|
||||
{
|
||||
@ -466,7 +467,7 @@ std::shared_ptr<BYTE> sdlClip::ReceiveFormatDataRequestHandle(
|
||||
len = 0;
|
||||
auto localFormatId = formatId = formatDataRequest->requestedFormatId;
|
||||
|
||||
ClipboardLockGuard(clipboard->_system);
|
||||
ClipboardLockGuard give_me_a_name(clipboard->_system);
|
||||
std::lock_guard<CriticalSection> lock(clipboard->_lock);
|
||||
|
||||
const UINT32 fileFormatId = ClipboardGetFormatId(clipboard->_system, type_FileGroupDescriptorW);
|
||||
@ -581,7 +582,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context,
|
||||
cliprdr_file_context_get_context(static_cast<CliprdrFileContext*>(context->custom)));
|
||||
WINPR_ASSERT(clipboard);
|
||||
|
||||
ClipboardLockGuard(clipboard->_system);
|
||||
ClipboardLockGuard give_me_a_name(clipboard->_system);
|
||||
std::lock_guard<CriticalSection> lock(clipboard->_lock);
|
||||
if (clipboard->_request_queue.empty())
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
@ -615,7 +616,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context,
|
||||
auto name = clipboard->getServerFormat(request.format());
|
||||
if (!name.empty())
|
||||
{
|
||||
if (name.compare(type_FileGroupDescriptorW) == 0)
|
||||
if (name == type_FileGroupDescriptorW)
|
||||
{
|
||||
srcFormatId =
|
||||
ClipboardGetFormatId(clipboard->_system, type_FileGroupDescriptorW);
|
||||
@ -624,7 +625,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context,
|
||||
clipboard->_system, data, size))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
else if (name.compare(type_HtmlFormat) == 0)
|
||||
else if (name == type_HtmlFormat)
|
||||
{
|
||||
srcFormatId = ClipboardGetFormatId(clipboard->_system, type_HtmlFormat);
|
||||
}
|
||||
@ -655,7 +656,7 @@ const void* sdlClip::ClipDataCb(void* userdata, const char* mime_type, size_t* s
|
||||
mime_type = "text/plain";
|
||||
|
||||
{
|
||||
ClipboardLockGuard(clip->_system);
|
||||
ClipboardLockGuard give_me_a_name(clip->_system);
|
||||
std::lock_guard<CriticalSection> lock(clip->_lock);
|
||||
auto cache = clip->_cache_data.find(mime_type);
|
||||
if (cache != clip->_cache_data.end())
|
||||
@ -676,7 +677,7 @@ const void* sdlClip::ClipDataCb(void* userdata, const char* mime_type, size_t* s
|
||||
return nullptr;
|
||||
}
|
||||
{
|
||||
ClipboardLockGuard(clip->_system);
|
||||
ClipboardLockGuard give_me_a_name(clip->_system);
|
||||
std::lock_guard<CriticalSection> lock(clip->_lock);
|
||||
auto request = clip->_request_queue.front();
|
||||
clip->_request_queue.pop();
|
||||
@ -698,7 +699,7 @@ void sdlClip::ClipCleanCb(void* userdata)
|
||||
{
|
||||
auto clip = static_cast<sdlClip*>(userdata);
|
||||
WINPR_ASSERT(clip);
|
||||
ClipboardLockGuard(clip->_system);
|
||||
ClipboardLockGuard give_me_a_name(clip->_system);
|
||||
std::lock_guard<CriticalSection> lock(clip->_lock);
|
||||
ClipboardEmpty(clip->_system);
|
||||
clip->_cache_data.clear();
|
||||
@ -719,7 +720,7 @@ bool sdlClip::mime_is_text(const std::string& mime)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(mime_text); x++)
|
||||
{
|
||||
if (mime.compare(mime_text[x]) == 0)
|
||||
if (mime == mime_text[x])
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -730,7 +731,7 @@ bool sdlClip::mime_is_image(const std::string& mime)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(mime_image); x++)
|
||||
{
|
||||
if (mime.compare(mime_image[x]) == 0)
|
||||
if (mime == mime_image[x])
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -739,13 +740,10 @@ bool sdlClip::mime_is_image(const std::string& mime)
|
||||
|
||||
bool sdlClip::mime_is_html(const std::string& mime)
|
||||
{
|
||||
if (mime.compare(mime_html) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return mime.compare(mime_html) == 0;
|
||||
}
|
||||
|
||||
ClipRequest::ClipRequest(UINT32 format, const std::string& mime) : _format(format), _mime(mime)
|
||||
ClipRequest::ClipRequest(UINT32 format, std::string mime) : _format(format), _mime(std::move(mime))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <queue>
|
||||
@ -36,7 +37,7 @@
|
||||
class ClipRequest
|
||||
{
|
||||
public:
|
||||
ClipRequest(UINT32 format, const std::string& mime);
|
||||
ClipRequest(UINT32 format, std::string mime);
|
||||
ClipRequest(const ClipRequest& other) = default;
|
||||
ClipRequest(ClipRequest&& other) = default;
|
||||
~ClipRequest() = default;
|
||||
@ -106,7 +107,6 @@ class sdlClip
|
||||
std::string getServerFormat(uint32_t id);
|
||||
uint32_t serverIdForMime(const std::string& mime);
|
||||
|
||||
private:
|
||||
static UINT MonitorReady(CliprdrClientContext* context,
|
||||
const CLIPRDR_MONITOR_READY* monitorReady);
|
||||
|
||||
@ -131,7 +131,6 @@ class sdlClip
|
||||
static bool mime_is_image(const std::string& mime);
|
||||
static bool mime_is_html(const std::string& mime);
|
||||
|
||||
private:
|
||||
SdlContext* _sdl = nullptr;
|
||||
CliprdrFileContext* _file = nullptr;
|
||||
CliprdrClientContext* _ctx = nullptr;
|
||||
@ -147,7 +146,7 @@ class sdlClip
|
||||
|
||||
struct cache_entry
|
||||
{
|
||||
cache_entry(size_t len, std::shared_ptr<void> p) : size(len), ptr(p)
|
||||
cache_entry(size_t len, std::shared_ptr<void> p) : size(len), ptr(std::move(p))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class sdlDispContext
|
||||
BOOL init(DispClientContext* disp);
|
||||
BOOL uninit(DispClientContext* disp);
|
||||
|
||||
BOOL handle_display_event(const SDL_DisplayEvent* ev);
|
||||
static BOOL handle_display_event(const SDL_DisplayEvent* ev);
|
||||
|
||||
BOOL handle_window_event(const SDL_WindowEvent* ev);
|
||||
|
||||
@ -52,14 +52,12 @@ class sdlDispContext
|
||||
|
||||
BOOL addTimer();
|
||||
|
||||
private:
|
||||
static UINT DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors,
|
||||
UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB);
|
||||
static void OnActivated(void* context, const ActivatedEventArgs* e);
|
||||
static void OnGraphicsReset(void* context, const GraphicsResetEventArgs* e);
|
||||
static Uint32 SDLCALL OnTimer(void* param, SDL_TimerID timerID, Uint32 interval);
|
||||
|
||||
private:
|
||||
SdlContext* _sdl = nullptr;
|
||||
DispClientContext* _disp = nullptr;
|
||||
int _eventBase = -1;
|
||||
|
@ -212,9 +212,9 @@ static const struct sdl_exit_code_map_t sdl_exit_code_map[] = {
|
||||
|
||||
static const struct sdl_exit_code_map_t* sdl_map_entry_by_code(int exit_code)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
|
||||
for (const auto& x : sdl_exit_code_map)
|
||||
{
|
||||
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
|
||||
const struct sdl_exit_code_map_t* cur = &x;
|
||||
if (cur->code == exit_code)
|
||||
return cur;
|
||||
}
|
||||
@ -231,9 +231,9 @@ static void sdl_hide_connection_dialog(SdlContext* sdl)
|
||||
|
||||
static const struct sdl_exit_code_map_t* sdl_map_entry_by_error(DWORD error)
|
||||
{
|
||||
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
|
||||
for (const auto& x : sdl_exit_code_map)
|
||||
{
|
||||
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
|
||||
const struct sdl_exit_code_map_t* cur = &x;
|
||||
if (cur->error == error)
|
||||
return cur;
|
||||
}
|
||||
@ -1334,7 +1334,7 @@ terminate:
|
||||
/* Optional global initializer.
|
||||
* Here we just register a signal handler to print out stack traces
|
||||
* if available. */
|
||||
static BOOL sdl_client_global_init(void)
|
||||
static BOOL sdl_client_global_init()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSADATA wsaData = { 0 };
|
||||
@ -1354,7 +1354,7 @@ static BOOL sdl_client_global_init(void)
|
||||
}
|
||||
|
||||
/* Optional global tear down */
|
||||
static void sdl_client_global_uninit(void)
|
||||
static void sdl_client_global_uninit()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSACleanup();
|
||||
|
@ -83,7 +83,6 @@ class SdlContext
|
||||
|
||||
std::atomic<bool> rdp_thread_running;
|
||||
|
||||
public:
|
||||
BOOL update_resizeable(BOOL enable);
|
||||
BOOL update_fullscreen(BOOL enter);
|
||||
|
||||
|
@ -282,7 +282,7 @@ static const scancode_entry_t map[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static UINT32 sdl_get_kbd_flags(void)
|
||||
static UINT32 sdl_get_kbd_flags()
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
|
||||
@ -598,9 +598,10 @@ BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable)
|
||||
return it->second.grabMouse(enable);
|
||||
}
|
||||
|
||||
sdlInput::sdlInput(SdlContext* sdl) : _sdl(sdl), _lastWindowID(UINT32_MAX)
|
||||
sdlInput::sdlInput(SdlContext* sdl)
|
||||
: _sdl(sdl), _lastWindowID(UINT32_MAX), _hotkeyModmask(prefToMask())
|
||||
{
|
||||
_hotkeyModmask = prefToMask();
|
||||
|
||||
_hotkeyFullscreen = prefKeyValue("SDL_Fullscreen", SDL_SCANCODE_RETURN);
|
||||
_hotkeyResizable = prefKeyValue("SDL_Resizeable", SDL_SCANCODE_R);
|
||||
_hotkeyGrab = prefKeyValue("SDL_Grab", SDL_SCANCODE_G);
|
||||
|
@ -45,7 +45,6 @@ class sdlInput
|
||||
BOOL mouse_focus(Uint32 windowID);
|
||||
BOOL mouse_grab(Uint32 windowID, SDL_bool enable);
|
||||
|
||||
public:
|
||||
static BOOL keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
|
||||
static BOOL keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState,
|
||||
UINT32 imeConvMode);
|
||||
@ -61,7 +60,6 @@ class sdlInput
|
||||
uint32_t remapScancode(uint32_t scancode);
|
||||
void remapInitialize();
|
||||
|
||||
private:
|
||||
SdlContext* _sdl;
|
||||
Uint32 _lastWindowID;
|
||||
std::map<uint32_t, uint32_t> _remapList;
|
||||
|
@ -287,7 +287,7 @@ static BOOL sdl_detect_single_window(SdlContext* sdl, UINT32* pMaxWidth, UINT32*
|
||||
if (freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds) == 0)
|
||||
{
|
||||
const size_t id =
|
||||
(sdl->windows.size() > 0) ? sdl->windows.begin()->second.displayIndex() : 0;
|
||||
(!sdl->windows.empty()) ? sdl->windows.begin()->second.displayIndex() : 0;
|
||||
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, &id, 1))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ BOOL sdl_register_pointer(rdpGraphics* graphics)
|
||||
const rdpPointer pointer = { sizeof(sdlPointer), sdl_Pointer_New,
|
||||
sdl_Pointer_Free, sdl_Pointer_Set,
|
||||
sdl_Pointer_SetNull, sdl_Pointer_SetDefault,
|
||||
sdl_Pointer_SetPosition, 0 };
|
||||
sdl_Pointer_SetPosition, { 0 } };
|
||||
graphics_register_pointer(graphics, &pointer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class CriticalSection
|
||||
void unlock();
|
||||
|
||||
private:
|
||||
CRITICAL_SECTION _section;
|
||||
CRITICAL_SECTION _section{};
|
||||
};
|
||||
|
||||
class WinPREvent
|
||||
|
@ -35,7 +35,7 @@ SdlWindow::SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY,
|
||||
SDL_DestroyProperties(props);
|
||||
}
|
||||
|
||||
SdlWindow::SdlWindow(SdlWindow&& other)
|
||||
SdlWindow::SdlWindow(SdlWindow&& other) noexcept
|
||||
: _window(other._window), _offset_x(other._offset_x), _offset_y(other._offset_y)
|
||||
{
|
||||
other._window = nullptr;
|
||||
|
@ -27,7 +27,7 @@ class SdlWindow
|
||||
public:
|
||||
SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY, Sint32 width,
|
||||
Sint32 height, Uint32 flags);
|
||||
SdlWindow(SdlWindow&& other);
|
||||
SdlWindow(SdlWindow&& other) noexcept;
|
||||
~SdlWindow();
|
||||
|
||||
[[nodiscard]] Uint32 id() const;
|
||||
@ -57,6 +57,5 @@ class SdlWindow
|
||||
Sint32 _offset_x = 0;
|
||||
Sint32 _offset_y = 0;
|
||||
|
||||
private:
|
||||
SdlWindow(const SdlWindow& other) = delete;
|
||||
};
|
||||
|
@ -75,8 +75,8 @@ class SchemeHandler : public QWebEngineUrlSchemeHandler
|
||||
bool webview_impl_run(const std::string& title, const std::string& url, std::string& code)
|
||||
{
|
||||
int argc = 1;
|
||||
const auto vendor = QString::fromUtf8(FREERDP_VENDOR_STRING);
|
||||
const auto product = QString::fromUtf8(FREERDP_PRODUCT_STRING);
|
||||
const auto vendor = QLatin1String(FREERDP_VENDOR_STRING);
|
||||
const auto product = QLatin1String(FREERDP_PRODUCT_STRING);
|
||||
QWebEngineUrlScheme::registerScheme(QWebEngineUrlScheme("ms-appx-web"));
|
||||
|
||||
std::string wtitle = title;
|
||||
|
@ -27,12 +27,12 @@ namespace fs = std::experimental::filesystem;
|
||||
#error Could not find system header "<filesystem>" or "<experimental/filesystem>"
|
||||
#endif
|
||||
|
||||
const std::string SDLResourceManager::typeFonts()
|
||||
std::string SDLResourceManager::typeFonts()
|
||||
{
|
||||
return "fonts";
|
||||
}
|
||||
|
||||
const std::string SDLResourceManager::typeImages()
|
||||
std::string SDLResourceManager::typeImages()
|
||||
{
|
||||
return "images";
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ class SDLResourceManager
|
||||
SDLResourceManager operator=(const SDLResourceManager& other) = delete;
|
||||
SDLResourceManager& operator=(SDLResourceManager&& other) = delete;
|
||||
|
||||
static const std::string typeFonts();
|
||||
static const std::string typeImages();
|
||||
static std::string typeFonts();
|
||||
static std::string typeImages();
|
||||
|
||||
protected:
|
||||
static void insert(const std::string& type, const std::string& id,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <fstream>
|
||||
#if __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
namespace fs = std::filesystem;
|
||||
#elif __has_include(<experimental/filesystem>)
|
||||
#include <experimental/filesystem>
|
||||
@ -102,7 +103,7 @@ std::vector<std::string> SdlPref::get_array(const std::string& key,
|
||||
return values;
|
||||
}
|
||||
|
||||
SdlPref::SdlPref(const std::string& file) : _name(file), _config(get())
|
||||
SdlPref::SdlPref(std::string file) : _name(std::move(file)), _config(get())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class SdlPref
|
||||
std::string _name;
|
||||
WINPR_JSONPtr _config;
|
||||
|
||||
SdlPref(const std::string& file);
|
||||
explicit SdlPref(std::string file);
|
||||
|
||||
WINPR_JSON* get_item(const std::string& key);
|
||||
WINPR_JSONPtr get();
|
||||
|
@ -69,6 +69,8 @@
|
||||
#include <freerdp/log.h>
|
||||
#define TAG CLIENT_TAG("common.cmdline")
|
||||
|
||||
static const char str_force[] = "force";
|
||||
|
||||
static const char* option_starts_with(const char* what, const char* val);
|
||||
static BOOL option_ends_with(const char* str, const char* ext);
|
||||
static BOOL option_equals(const char* what, const char* val);
|
||||
@ -4330,7 +4332,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
||||
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
||||
{
|
||||
if (option_equals(arg->Value, "force"))
|
||||
if (option_equals(arg->Value, str_force))
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ForceMultimon, TRUE))
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
@ -4637,7 +4639,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
||||
}
|
||||
CommandLineSwitchCase(arg, "ipv4")
|
||||
{
|
||||
if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0)
|
||||
if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0)
|
||||
{
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 4))
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
@ -4650,7 +4652,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
||||
}
|
||||
CommandLineSwitchCase(arg, "ipv6")
|
||||
{
|
||||
if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0)
|
||||
if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0)
|
||||
{
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 6))
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
@ -4986,7 +4988,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
||||
{
|
||||
if (!arg->Value)
|
||||
return fail_at(arg, COMMAND_LINE_ERROR_UNEXPECTED_VALUE);
|
||||
promptForPassword = (option_equals(arg->Value, "force"));
|
||||
promptForPassword = (option_equals(arg->Value, str_force));
|
||||
|
||||
if (!promptForPassword)
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
@ -5715,9 +5717,9 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpS
|
||||
const char* name, void* data)
|
||||
{
|
||||
PVIRTUALCHANNELENTRY entry = NULL;
|
||||
PVIRTUALCHANNELENTRYEX entryEx = NULL;
|
||||
entryEx = (PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(
|
||||
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
||||
PVIRTUALCHANNELENTRYEX entryEx =
|
||||
(PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(
|
||||
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
||||
|
||||
if (!entryEx)
|
||||
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||
|
2
libfreerdp/cache/glyph.c
vendored
2
libfreerdp/cache/glyph.c
vendored
@ -72,7 +72,7 @@ static UINT32 update_glyph_offset(const BYTE* data, size_t length, UINT32 index,
|
||||
}
|
||||
|
||||
static BOOL update_process_glyph(rdpContext* context, const BYTE* data, UINT32 cacheIndex, INT32* x,
|
||||
INT32* y, UINT32 cacheId, UINT32 flAccel, BOOL fOpRedundant,
|
||||
const INT32* y, UINT32 cacheId, UINT32 flAccel, BOOL fOpRedundant,
|
||||
const RDP_RECT* bound)
|
||||
{
|
||||
INT32 sx = 0;
|
||||
|
@ -277,7 +277,7 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context)
|
||||
#endif
|
||||
context->context->sample_rate = (int)format->nSamplesPerSec;
|
||||
context->context->block_align = format->nBlockAlign;
|
||||
context->context->bit_rate = format->nAvgBytesPerSec * 8;
|
||||
context->context->bit_rate = format->nAvgBytesPerSec * 8LL;
|
||||
context->context->sample_fmt = ffmpeg_sample_format(format);
|
||||
context->context->time_base = av_make_q(1, context->context->sample_rate);
|
||||
|
||||
|
@ -44,10 +44,10 @@
|
||||
#define UNROLL_MULTIPLE(_condition, _exp, _count) \
|
||||
do \
|
||||
{ \
|
||||
while ((_condition) >= _count) \
|
||||
while ((_condition) >= (_count)) \
|
||||
{ \
|
||||
UNROLL_BODY(_exp, _count); \
|
||||
(_condition) -= _count; \
|
||||
(_condition) -= (_count); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
@ -428,14 +428,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
||||
do \
|
||||
{ \
|
||||
write_pixel_8(_buf, _pix); \
|
||||
_buf += 1; \
|
||||
(_buf) += 1; \
|
||||
} while (0)
|
||||
#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0]
|
||||
#define SRCREADPIXEL(_pix, _buf) \
|
||||
do \
|
||||
{ \
|
||||
_pix = (_buf)[0]; \
|
||||
_buf += 1; \
|
||||
(_pix) = (_buf)[0]; \
|
||||
(_buf) += 1; \
|
||||
} while (0)
|
||||
|
||||
#define WRITEFGBGIMAGE WriteFgBgImage8to8
|
||||
@ -463,14 +463,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
||||
do \
|
||||
{ \
|
||||
write_pixel_16(_buf, _pix); \
|
||||
_buf += 2; \
|
||||
(_buf) += 2; \
|
||||
} while (0)
|
||||
#define DESTREADPIXEL(_pix, _buf) _pix = ((UINT16*)(_buf))[0]
|
||||
#define SRCREADPIXEL(_pix, _buf) \
|
||||
do \
|
||||
{ \
|
||||
_pix = (_buf)[0] | ((_buf)[1] << 8); \
|
||||
_buf += 2; \
|
||||
#define SRCREADPIXEL(_pix, _buf) \
|
||||
do \
|
||||
{ \
|
||||
(_pix) = (_buf)[0] | ((_buf)[1] << 8); \
|
||||
(_buf) += 2; \
|
||||
} while (0)
|
||||
#define WRITEFGBGIMAGE WriteFgBgImage16to16
|
||||
#define WRITEFIRSTLINEFGBGIMAGE WriteFirstLineFgBgImage16to16
|
||||
@ -497,14 +497,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
||||
do \
|
||||
{ \
|
||||
write_pixel_24(_buf, _pix); \
|
||||
_buf += 3; \
|
||||
(_buf) += 3; \
|
||||
} while (0)
|
||||
#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16)
|
||||
#define SRCREADPIXEL(_pix, _buf) \
|
||||
do \
|
||||
{ \
|
||||
_pix = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16); \
|
||||
_buf += 3; \
|
||||
#define SRCREADPIXEL(_pix, _buf) \
|
||||
do \
|
||||
{ \
|
||||
(_pix) = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16); \
|
||||
(_buf) += 3; \
|
||||
} while (0)
|
||||
|
||||
#define WRITEFGBGIMAGE WriteFgBgImage24to24
|
||||
|
@ -2341,7 +2341,7 @@ static int ncrush_hash_table_add(NCRUSH_CONTEXT* ncrush, const BYTE* pSrcData, U
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ncrush_find_match_length(const BYTE* Ptr1, const BYTE* Ptr2, BYTE* HistoryPtr)
|
||||
static int ncrush_find_match_length(const BYTE* Ptr1, const BYTE* Ptr2, const BYTE* HistoryPtr)
|
||||
{
|
||||
BYTE val1 = 0;
|
||||
BYTE val2 = 0;
|
||||
|
@ -589,7 +589,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* WINPR_RESTRICT pSrcData, UINT32
|
||||
#define OutputBit(count, bit) \
|
||||
do \
|
||||
{ \
|
||||
UINT16 _b = (bit ? 0xFFFF : 0); \
|
||||
UINT16 _b = ((bit) ? 0xFFFF : 0); \
|
||||
int _c = (count); \
|
||||
for (; _c > 0; _c -= 16) \
|
||||
rfx_bitstream_put_bits(bs, _b, (_c > 16 ? 16 : _c)); \
|
||||
|
@ -54,19 +54,18 @@
|
||||
#define ATTRIBUTES __gnu_inline__, __always_inline__
|
||||
#endif
|
||||
|
||||
#define _mm_between_epi16(_val, _min, _max) \
|
||||
do \
|
||||
{ \
|
||||
_val = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
|
||||
#define mm_between_epi16(_val, _min, _max) \
|
||||
do \
|
||||
{ \
|
||||
(_val) = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
|
||||
} while (0)
|
||||
|
||||
static __inline void __attribute__((ATTRIBUTES))
|
||||
_mm_prefetch_buffer(char* WINPR_RESTRICT buffer, int num_bytes)
|
||||
mm_prefetch_buffer(char* WINPR_RESTRICT buffer, size_t num_bytes)
|
||||
{
|
||||
__m128i* buf = (__m128i*)buffer;
|
||||
|
||||
for (unsigned int i = 0; i < (num_bytes / sizeof(__m128i));
|
||||
i += (CACHE_LINE_BYTES / sizeof(__m128i)))
|
||||
for (size_t i = 0; i < (num_bytes / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i)))
|
||||
{
|
||||
_mm_prefetch((char*)(&buf[i]), _MM_HINT_NTA);
|
||||
}
|
||||
@ -101,7 +100,7 @@ static void rfx_quantization_decode_sse2(INT16* WINPR_RESTRICT buffer,
|
||||
WINPR_ASSERT(buffer);
|
||||
WINPR_ASSERT(quantVals);
|
||||
|
||||
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
rfx_quantization_decode_block_sse2(&buffer[0], 1024, quantVals[8] - 1); /* HL1 */
|
||||
rfx_quantization_decode_block_sse2(&buffer[1024], 1024, quantVals[7] - 1); /* LH1 */
|
||||
rfx_quantization_decode_block_sse2(&buffer[2048], 1024, quantVals[9] - 1); /* HH1 */
|
||||
@ -144,7 +143,7 @@ static void rfx_quantization_encode_sse2(INT16* WINPR_RESTRICT buffer,
|
||||
WINPR_ASSERT(buffer);
|
||||
WINPR_ASSERT(quantization_values);
|
||||
|
||||
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
rfx_quantization_encode_block_sse2(buffer, 1024, quantization_values[8] - 6); /* HL1 */
|
||||
rfx_quantization_encode_block_sse2(buffer + 1024, 1024, quantization_values[7] - 6); /* LH1 */
|
||||
rfx_quantization_encode_block_sse2(buffer + 2048, 1024, quantization_values[9] - 6); /* HH1 */
|
||||
@ -321,7 +320,7 @@ rfx_dwt_2d_decode_block_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT
|
||||
INT16* ll = NULL;
|
||||
INT16* l_dst = NULL;
|
||||
INT16* h_dst = NULL;
|
||||
_mm_prefetch_buffer((char*)idwt, 4ULL * subband_width * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)idwt, 4ULL * subband_width * sizeof(INT16));
|
||||
/* Inverse DWT in horizontal direction, results in 2 sub-bands in L, H order in tmp buffer idwt.
|
||||
*/
|
||||
/* The 4 sub-bands are stored in HL(0), LH(1), HH(2), LL(3) order. */
|
||||
@ -344,7 +343,7 @@ static void rfx_dwt_2d_decode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RE
|
||||
WINPR_ASSERT(buffer);
|
||||
WINPR_ASSERT(dwt_buffer);
|
||||
|
||||
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
rfx_dwt_2d_decode_block_sse2(&buffer[3840], dwt_buffer, 8);
|
||||
rfx_dwt_2d_decode_block_sse2(&buffer[3072], dwt_buffer, 16);
|
||||
rfx_dwt_2d_decode_block_sse2(&buffer[0], dwt_buffer, 32);
|
||||
@ -461,7 +460,7 @@ rfx_dwt_2d_encode_block_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT
|
||||
INT16* ll = NULL;
|
||||
INT16* l_src = NULL;
|
||||
INT16* h_src = NULL;
|
||||
_mm_prefetch_buffer((char*)dwt, 4ULL * subband_width * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)dwt, 4ULL * subband_width * sizeof(INT16));
|
||||
/* DWT in vertical direction, results in 2 sub-bands in L, H order in tmp buffer dwt. */
|
||||
l_src = dwt;
|
||||
h_src = dwt + 2ULL * subband_width * subband_width;
|
||||
@ -483,7 +482,7 @@ static void rfx_dwt_2d_encode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RE
|
||||
WINPR_ASSERT(buffer);
|
||||
WINPR_ASSERT(dwt_buffer);
|
||||
|
||||
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
|
||||
rfx_dwt_2d_encode_block_sse2(buffer, dwt_buffer, 32);
|
||||
rfx_dwt_2d_encode_block_sse2(buffer + 3072, dwt_buffer, 16);
|
||||
rfx_dwt_2d_encode_block_sse2(buffer + 3840, dwt_buffer, 8);
|
||||
|
@ -5757,7 +5757,7 @@ static BOOL FuzzPlanar(void)
|
||||
", nDstHeight=%" PRIu32 ", nDstStep=%" PRIu32 ", total size=%" PRIuz "\n",
|
||||
FreeRDPGetColorFormatName(DstFormat), nXDst, nYDst, nDstWidth, nDstHeight, nDstStep,
|
||||
sizeof(dstData));
|
||||
freerdp_planar_switch_bgr(planar, rand() % 2);
|
||||
freerdp_planar_switch_bgr(planar, prand(2) % 2);
|
||||
planar_decompress(planar, data, dataSize, prand(4096), prand(4096), dstData, DstFormat,
|
||||
nDstStep, nXDst, nYDst, nDstWidth, nDstHeight, prand(2));
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ static BOOL compareRectangles(const RECTANGLE_16* src1, const RECTANGLE_16* src2
|
||||
{
|
||||
for (int i = 0; i < nb; i++, src1++, src2++)
|
||||
{
|
||||
if (memcmp(src1, src2, sizeof(RECTANGLE_16)))
|
||||
if (memcmp(src1, src2, sizeof(RECTANGLE_16)) != 0)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16
|
||||
@ -58,7 +58,7 @@ static int test_basic(void)
|
||||
|
||||
rects = region16_rects(®ion, &nbRects);
|
||||
|
||||
if (!rects || nbRects != 1 || memcmp(rects, &r1, sizeof(RECTANGLE_16)))
|
||||
if (!rects || nbRects != 1 || memcmp(rects, &r1, sizeof(RECTANGLE_16)) != 0)
|
||||
goto out;
|
||||
|
||||
/* r1 + r2 */
|
||||
|
@ -214,7 +214,7 @@ static BOOL update_connectionstring2_wchar(rdpAssistanceFile* file, const WCHAR*
|
||||
* Use the first n bytes of the result of step 5 as the derived key.
|
||||
*/
|
||||
|
||||
static BOOL freerdp_assistance_crypt_derive_key_sha1(BYTE* hash, size_t hashLength, BYTE* key,
|
||||
static BOOL freerdp_assistance_crypt_derive_key_sha1(const BYTE* hash, size_t hashLength, BYTE* key,
|
||||
size_t keyLength)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
|
@ -3288,8 +3288,8 @@ char* freerdp_settings_get_string_writable(rdpSettings* settings, FreeRDP_Settin
|
||||
}
|
||||
}
|
||||
|
||||
BOOL freerdp_settings_set_string_(rdpSettings* settings, FreeRDP_Settings_Keys_String id, char* val,
|
||||
size_t len)
|
||||
BOOL freerdp_settings_set_string_(rdpSettings* settings, FreeRDP_Settings_Keys_String id,
|
||||
const char* val, size_t len)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ static BOOL rdp_write_client_persistent_key_list_pdu(wStream* s,
|
||||
|
||||
for (UINT32 index = 0; index < info->keyCount; index++)
|
||||
{
|
||||
const UINT32 key1 = (UINT32)info->keyList[index];
|
||||
const UINT32 key1 = (UINT32)(info->keyList[index] & UINT32_MAX);
|
||||
const UINT32 key2 = (UINT32)(info->keyList[index] >> 32);
|
||||
Stream_Write_UINT32(s, key1);
|
||||
Stream_Write_UINT32(s, key2);
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#define TAG FREERDP_TAG("core.gateway.http")
|
||||
|
||||
#define RESPONSE_SIZE_LIMIT 64ULL * 1024ULL * 1024ULL
|
||||
#define RESPONSE_SIZE_LIMIT (64ULL * 1024ULL * 1024ULL)
|
||||
|
||||
#define WEBSOCKET_MAGIC_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
||||
|
||||
|
@ -107,7 +107,7 @@ typedef struct
|
||||
{
|
||||
TRANSFER_ENCODING httpTransferEncoding;
|
||||
BOOL isWebsocketTransport;
|
||||
union _context
|
||||
union context
|
||||
{
|
||||
http_encoding_chunked_context chunked;
|
||||
websocket_context websocket;
|
||||
@ -2070,7 +2070,7 @@ static int rdg_bio_puts(BIO* bio, const char* str)
|
||||
return -2;
|
||||
}
|
||||
|
||||
static int rdg_bio_gets(BIO* bio, char* str, int size)
|
||||
static int rdg_bio_gets(BIO* bio, const char* str, int size)
|
||||
{
|
||||
WINPR_UNUSED(bio);
|
||||
WINPR_UNUSED(str);
|
||||
|
@ -1262,7 +1262,7 @@ static BIO_METHOD* BIO_s_tsg(void);
|
||||
*/
|
||||
|
||||
static int TsProxySendToServer(handle_t IDL_handle, const byte pRpcMessage[], UINT32 count,
|
||||
UINT32* lengths)
|
||||
const UINT32* lengths)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
rdpTsg* tsg = NULL;
|
||||
@ -2970,7 +2970,7 @@ static int transport_bio_tsg_puts(BIO* bio, const char* str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int transport_bio_tsg_gets(BIO* bio, char* str, int size)
|
||||
static int transport_bio_tsg_gets(BIO* bio, const char* str, int size)
|
||||
{
|
||||
WINPR_UNUSED(bio);
|
||||
WINPR_UNUSED(str);
|
||||
|
@ -767,9 +767,9 @@ static BOOL wst_parse_url(rdpWst* wst, const char* url)
|
||||
return FALSE;
|
||||
strncpy(port, portStart, (pos - portStart));
|
||||
port[pos - portStart] = '\0';
|
||||
int _p = strtol(port, &portNumberEnd, 10);
|
||||
if (portNumberEnd && *portNumberEnd == '\0' && _p > 0 && _p <= UINT16_MAX)
|
||||
wst->gwport = _p;
|
||||
long _p = strtol(port, &portNumberEnd, 10);
|
||||
if (portNumberEnd && (*portNumberEnd == '\0') && (_p > 0) && (_p <= UINT16_MAX))
|
||||
wst->gwport = (uint16_t)_p;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ static INLINE BOOL update_write_brush(wStream* s, rdpBrush* brush, BYTE fieldFla
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, UINT32* nr)
|
||||
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, const UINT32* nr)
|
||||
{
|
||||
UINT32 number = *nr;
|
||||
BYTE flags = 0;
|
||||
@ -2246,7 +2246,7 @@ fail:
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_bitmap_order(const CACHE_BITMAP_ORDER* cache_bitmap,
|
||||
BOOL compressed, UINT16* flags)
|
||||
BOOL compressed, const UINT16* flags)
|
||||
{
|
||||
WINPR_ASSERT(cache_bitmap);
|
||||
WINPR_UNUSED(compressed);
|
||||
@ -2392,7 +2392,7 @@ fail:
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_bitmap_v2_order(CACHE_BITMAP_V2_ORDER* cache_bitmap_v2,
|
||||
BOOL compressed, UINT16* flags)
|
||||
BOOL compressed, const UINT16* flags)
|
||||
{
|
||||
WINPR_ASSERT(cache_bitmap_v2);
|
||||
WINPR_UNUSED(flags);
|
||||
@ -2620,7 +2620,7 @@ fail:
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_color_table_order(const CACHE_COLOR_TABLE_ORDER* cache_color_table,
|
||||
UINT16* flags)
|
||||
const UINT16* flags)
|
||||
{
|
||||
WINPR_UNUSED(cache_color_table);
|
||||
WINPR_UNUSED(flags);
|
||||
@ -2717,7 +2717,8 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph, UINT16* flags)
|
||||
size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph,
|
||||
const UINT16* flags)
|
||||
{
|
||||
WINPR_ASSERT(cache_glyph);
|
||||
WINPR_UNUSED(flags);
|
||||
@ -2822,7 +2823,7 @@ fail:
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_glyph_v2_order(const CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
|
||||
UINT16* flags)
|
||||
const UINT16* flags)
|
||||
{
|
||||
WINPR_ASSERT(cache_glyph_v2);
|
||||
WINPR_UNUSED(flags);
|
||||
@ -2987,7 +2988,8 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush, UINT16* flags)
|
||||
size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush,
|
||||
const UINT16* flags)
|
||||
{
|
||||
WINPR_UNUSED(cache_brush);
|
||||
WINPR_UNUSED(flags);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user