mirror of https://github.com/FreeRDP/FreeRDP
[warnings] fix clang-tidy issues in channels
This commit is contained in:
parent
36c3184a0f
commit
47e40dd7a5
|
@ -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, 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,17 +393,22 @@ 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)
|
||||
parallel_free_int(device);
|
||||
}
|
||||
|
||||
static void parallel_message_free(void* obj)
|
||||
{
|
||||
wMessage* msg = obj;
|
||||
|
@ -516,7 +514,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2014,8 +2014,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;
|
||||
|
|
|
@ -1329,7 +1329,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 +1433,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 +1696,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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue