Merge pull request #10609 from akallabeth/warn

Fix unused return values
This commit is contained in:
akallabeth 2024-09-16 12:03:31 +02:00 committed by GitHub
commit 073f1ee642
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
148 changed files with 601 additions and 577 deletions

View File

@ -176,7 +176,7 @@ static UINT ainput_server_send_version(ainput_server* ainput)
Stream_Write_UINT32(s, AINPUT_VERSION_MAJOR); /* Version (4 bytes) */
Stream_Write_UINT32(s, AINPUT_VERSION_MINOR); /* Version (4 bytes) */
WINPR_ASSERT(Stream_GetPosition(s) <= ULONG_MAX);
WINPR_ASSERT(Stream_GetPosition(s) <= UINT32_MAX);
if (!WTSVirtualChannelWrite(ainput->ainput_channel, (PCHAR)Stream_Buffer(s),
(ULONG)Stream_GetPosition(s), &written))
{
@ -327,7 +327,7 @@ static UINT ainput_server_open(ainput_server_context* context)
if (!ainput->thread)
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(ainput->stopEvent);
(void)CloseHandle(ainput->stopEvent);
ainput->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -351,7 +351,7 @@ static UINT ainput_server_close(ainput_server_context* context)
if (!ainput->externalThread && ainput->thread)
{
SetEvent(ainput->stopEvent);
(void)SetEvent(ainput->stopEvent);
if (WaitForSingleObject(ainput->thread, INFINITE) == WAIT_FAILED)
{
@ -360,8 +360,8 @@ static UINT ainput_server_close(ainput_server_context* context)
return error;
}
CloseHandle(ainput->thread);
CloseHandle(ainput->stopEvent);
(void)CloseHandle(ainput->thread);
(void)CloseHandle(ainput->stopEvent);
ainput->thread = NULL;
ainput->stopEvent = NULL;
}

View File

@ -302,7 +302,7 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us
return CHANNEL_RC_OK;
error_out:
CloseHandle(alsa->stopEvent);
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -322,7 +322,7 @@ static UINT audin_alsa_close(IAudinDevice* device)
if (alsa->stopEvent)
{
SetEvent(alsa->stopEvent);
(void)SetEvent(alsa->stopEvent);
if (WaitForSingleObject(alsa->thread, INFINITE) == WAIT_FAILED)
{
@ -332,9 +332,9 @@ static UINT audin_alsa_close(IAudinDevice* device)
return error;
}
CloseHandle(alsa->stopEvent);
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
CloseHandle(alsa->thread);
(void)CloseHandle(alsa->thread);
alsa->thread = NULL;
}

View File

@ -113,7 +113,7 @@ static UINT audin_channel_write_and_free(AUDIN_CHANNEL_CALLBACK* callback, wStre
return ERROR_INTERNAL_ERROR;
Stream_SealLength(out);
WINPR_ASSERT(Stream_Length(out) <= ULONG_MAX);
WINPR_ASSERT(Stream_Length(out) <= UINT32_MAX);
const UINT error = callback->channel->Write(callback->channel, (ULONG)Stream_Length(out),
Stream_Buffer(out), NULL);

View File

@ -309,7 +309,7 @@ static UINT audin_oss_open(IAudinDevice* device, AudinReceive receive, void* use
if (!(oss->thread = CreateThread(NULL, 0, audin_oss_thread_func, oss, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(oss->stopEvent);
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -332,7 +332,7 @@ static UINT audin_oss_close(IAudinDevice* device)
if (oss->stopEvent != NULL)
{
SetEvent(oss->stopEvent);
(void)SetEvent(oss->stopEvent);
if (WaitForSingleObject(oss->thread, INFINITE) == WAIT_FAILED)
{
@ -341,9 +341,9 @@ static UINT audin_oss_close(IAudinDevice* device)
return error;
}
CloseHandle(oss->stopEvent);
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
CloseHandle(oss->thread);
(void)CloseHandle(oss->thread);
oss->thread = NULL;
}

View File

@ -204,7 +204,7 @@ static UINT audin_sndio_open(IAudinDevice* device, AudinReceive receive, void* u
sndio, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed");
CloseHandle(sndio->stopEvent);
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -227,7 +227,7 @@ static UINT audin_sndio_close(IAudinDevice* device)
if (sndio->stopEvent != NULL)
{
SetEvent(sndio->stopEvent);
(void)SetEvent(sndio->stopEvent);
if (WaitForSingleObject(sndio->thread, INFINITE) == WAIT_FAILED)
{
@ -236,9 +236,9 @@ static UINT audin_sndio_close(IAudinDevice* device)
return error;
}
CloseHandle(sndio->stopEvent);
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
CloseHandle(sndio->thread);
(void)CloseHandle(sndio->thread);
sndio->thread = NULL;
}

View File

@ -293,7 +293,7 @@ static UINT audin_winmm_close(IAudinDevice* device)
if (!winmm)
return ERROR_INVALID_PARAMETER;
SetEvent(winmm->stopEvent);
(void)SetEvent(winmm->stopEvent);
status = WaitForSingleObject(winmm->thread, INFINITE);
if (status == WAIT_FAILED)
@ -304,8 +304,8 @@ static UINT audin_winmm_close(IAudinDevice* device)
return error;
}
CloseHandle(winmm->thread);
CloseHandle(winmm->stopEvent);
(void)CloseHandle(winmm->thread);
(void)CloseHandle(winmm->stopEvent);
winmm->thread = NULL;
winmm->stopEvent = NULL;
winmm->receive = NULL;
@ -436,7 +436,7 @@ static UINT audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u
if (!(winmm->thread = CreateThread(NULL, 0, audin_winmm_thread_func, winmm, 0, NULL)))
{
WLog_Print(winmm->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(winmm->stopEvent);
(void)CloseHandle(winmm->stopEvent);
winmm->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}

View File

@ -378,7 +378,7 @@ static DWORD WINAPI audin_server_thread_func(LPVOID arg)
if (!Stream_EnsureRemainingCapacity(s, BytesReturned))
break;
WINPR_ASSERT(Stream_Capacity(s) <= ULONG_MAX);
WINPR_ASSERT(Stream_Capacity(s) <= UINT32_MAX);
if (WTSVirtualChannelRead(audin->audin_channel, 0, (PCHAR)Stream_Buffer(s),
(ULONG)Stream_Capacity(s), &BytesReturned) == FALSE)
{
@ -489,7 +489,7 @@ static BOOL audin_server_open(audin_server_context* context)
CreateThread(NULL, 0, audin_server_thread_func, (void*)audin, 0, NULL)))
{
WLog_Print(audin->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(audin->stopEvent);
(void)CloseHandle(audin->stopEvent);
audin->stopEvent = NULL;
return FALSE;
}
@ -516,7 +516,7 @@ static BOOL audin_server_close(audin_server_context* context)
if (audin->thread)
{
SetEvent(audin->stopEvent);
(void)SetEvent(audin->stopEvent);
if (WaitForSingleObject(audin->thread, INFINITE) == WAIT_FAILED)
{
@ -525,8 +525,8 @@ static BOOL audin_server_close(audin_server_context* context)
return FALSE;
}
CloseHandle(audin->thread);
CloseHandle(audin->stopEvent);
(void)CloseHandle(audin->thread);
(void)CloseHandle(audin->stopEvent);
audin->thread = NULL;
audin->stopEvent = NULL;
}

View File

@ -594,7 +594,7 @@ static void channel_client_handler_free(msg_proc_internals* internals)
return;
if (internals->thread)
CloseHandle(internals->thread);
(void)CloseHandle(internals->thread);
MessageQueue_Free(internals->queue);
Stream_Free(internals->data_in, TRUE);
free(internals->channel_name);

View File

@ -1395,7 +1395,7 @@ static UINT cliprdr_server_start(CliprdrServerContext* context)
if (!(cliprdr->Thread = CreateThread(NULL, 0, cliprdr_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(cliprdr->StopEvent);
(void)CloseHandle(cliprdr->StopEvent);
cliprdr->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -1420,7 +1420,7 @@ static UINT cliprdr_server_stop(CliprdrServerContext* context)
if (cliprdr->StopEvent)
{
SetEvent(cliprdr->StopEvent);
(void)SetEvent(cliprdr->StopEvent);
if (WaitForSingleObject(cliprdr->Thread, INFINITE) == WAIT_FAILED)
{
@ -1429,8 +1429,8 @@ static UINT cliprdr_server_stop(CliprdrServerContext* context)
return error;
}
CloseHandle(cliprdr->Thread);
CloseHandle(cliprdr->StopEvent);
(void)CloseHandle(cliprdr->Thread);
(void)CloseHandle(cliprdr->StopEvent);
}
if (cliprdr->ChannelHandle)

View File

@ -465,7 +465,7 @@ static UINT disp_server_open(DispServerContext* context)
CreateThread(NULL, 0, disp_server_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->stopEvent);
priv->stopEvent = NULL;
rc = ERROR_INTERNAL_ERROR;
goto out_close;
@ -550,7 +550,7 @@ static UINT disp_server_close(DispServerContext* context)
if (priv->thread)
{
SetEvent(priv->stopEvent);
(void)SetEvent(priv->stopEvent);
if (WaitForSingleObject(priv->thread, INFINITE) == WAIT_FAILED)
{
@ -559,8 +559,8 @@ static UINT disp_server_close(DispServerContext* context)
return error;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -1770,7 +1770,7 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
return status;
}
CloseHandle(drdynvc->thread);
(void)CloseHandle(drdynvc->thread);
drdynvc->thread = NULL;
}
else

View File

@ -138,7 +138,7 @@ static UINT drdynvc_server_start(DrdynvcServerContext* context)
CreateThread(NULL, 0, drdynvc_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -154,7 +154,7 @@ static UINT drdynvc_server_start(DrdynvcServerContext* context)
static UINT drdynvc_server_stop(DrdynvcServerContext* context)
{
UINT error = 0;
SetEvent(context->priv->StopEvent);
(void)SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
@ -163,7 +163,7 @@ static UINT drdynvc_server_stop(DrdynvcServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->Thread);
return CHANNEL_RC_OK;
}

View File

@ -45,12 +45,12 @@
#include "drive_file.h"
#ifdef WITH_DEBUG_RDPDR
#define DEBUG_WSTR(msg, wstr) \
do \
{ \
char lpstr[1024] = { 0 }; \
ConvertWCharToUtf8(wstr, lpstr, ARRAYSIZE(lpstr)); \
WLog_DBG(TAG, msg, lpstr); \
#define DEBUG_WSTR(msg, wstr) \
do \
{ \
char lpstr[1024] = { 0 }; \
(void)ConvertWCharToUtf8(wstr, lpstr, ARRAYSIZE(lpstr)); \
WLog_DBG(TAG, msg, lpstr); \
} while (0)
#else
#define DEBUG_WSTR(msg, wstr) \
@ -147,7 +147,7 @@ static WCHAR* drive_file_combine_fullpath(const WCHAR* base_path, const WCHAR* p
if (contains_dotdot(&fullpath[base_path_length], base_path_length, PathWCharLength))
{
char abuffer[MAX_PATH] = { 0 };
ConvertWCharToUtf8(&fullpath[base_path_length], abuffer, ARRAYSIZE(abuffer));
(void)ConvertWCharToUtf8(&fullpath[base_path_length], abuffer, ARRAYSIZE(abuffer));
WLog_WARN(TAG, "[rdpdr] received invalid file path '%s' from server, aborting!",
&abuffer[base_path_length]);
@ -361,7 +361,7 @@ BOOL drive_file_free(DRIVE_FILE* file)
if (file->file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(file->file_handle);
(void)CloseHandle(file->file_handle);
file->file_handle = INVALID_HANDLE_VALUE;
}
@ -585,7 +585,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
if (hFile != INVALID_HANDLE_VALUE)
{
status = GetFileInformationByHandle(hFile, &fileInformation);
CloseHandle(hFile);
(void)CloseHandle(hFile);
if (!status)
goto out_fail;
@ -790,7 +790,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
if (file->file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(file->file_handle);
(void)CloseHandle(file->file_handle);
file->file_handle = INVALID_HANDLE_VALUE;
}

View File

@ -822,7 +822,7 @@ static UINT drive_free_int(DRIVE_DEVICE* drive)
if (!drive)
return ERROR_INVALID_PARAMETER;
CloseHandle(drive->thread);
(void)CloseHandle(drive->thread);
ListDictionary_Free(drive->files);
MessageQueue_Free(drive->IrpQueue);
Stream_Free(drive->device.data, TRUE);

View File

@ -307,7 +307,7 @@ static UINT echo_server_open(echo_server_context* context)
if (!(echo->thread = CreateThread(NULL, 0, echo_server_thread_func, (void*)echo, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(echo->stopEvent);
(void)CloseHandle(echo->stopEvent);
echo->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -328,7 +328,7 @@ static UINT echo_server_close(echo_server_context* context)
if (echo->thread)
{
SetEvent(echo->stopEvent);
(void)SetEvent(echo->stopEvent);
if (WaitForSingleObject(echo->thread, INFINITE) == WAIT_FAILED)
{
@ -337,8 +337,8 @@ static UINT echo_server_close(echo_server_context* context)
return error;
}
CloseHandle(echo->thread);
CloseHandle(echo->stopEvent);
(void)CloseHandle(echo->thread);
(void)CloseHandle(echo->stopEvent);
echo->thread = NULL;
echo->stopEvent = NULL;
}

View File

@ -1137,7 +1137,7 @@ static UINT encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp)
}
MessageQueue_Free(encomsp->queue);
CloseHandle(encomsp->thread);
(void)CloseHandle(encomsp->thread);
encomsp->queue = NULL;
encomsp->thread = NULL;

View File

@ -311,7 +311,7 @@ static UINT encomsp_server_start(EncomspServerContext* context)
CreateThread(NULL, 0, encomsp_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -327,7 +327,7 @@ static UINT encomsp_server_start(EncomspServerContext* context)
static UINT encomsp_server_stop(EncomspServerContext* context)
{
UINT error = CHANNEL_RC_OK;
SetEvent(context->priv->StopEvent);
(void)SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
@ -336,8 +336,8 @@ static UINT encomsp_server_stop(EncomspServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
return error;
}

View File

@ -679,7 +679,7 @@ static UINT gfxredir_server_open(GfxRedirServerContext* context)
CreateThread(NULL, 0, gfxredir_server_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->stopEvent);
priv->stopEvent = NULL;
rc = ERROR_INTERNAL_ERROR;
}
@ -705,7 +705,7 @@ static UINT gfxredir_server_close(GfxRedirServerContext* context)
if (priv->thread)
{
SetEvent(priv->stopEvent);
(void)SetEvent(priv->stopEvent);
if (WaitForSingleObject(priv->thread, INFINITE) == WAIT_FAILED)
{
@ -714,8 +714,8 @@ static UINT gfxredir_server_close(GfxRedirServerContext* context)
return error;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -456,7 +456,7 @@ static UINT location_server_open(LocationServerContext* context)
if (!location->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(location->stopEvent);
(void)CloseHandle(location->stopEvent);
location->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -475,7 +475,7 @@ static UINT location_server_close(LocationServerContext* context)
if (!location->externalThread && location->thread)
{
SetEvent(location->stopEvent);
(void)SetEvent(location->stopEvent);
if (WaitForSingleObject(location->thread, INFINITE) == WAIT_FAILED)
{
@ -484,8 +484,8 @@ static UINT location_server_close(LocationServerContext* context)
return error;
}
CloseHandle(location->thread);
CloseHandle(location->stopEvent);
(void)CloseHandle(location->thread);
(void)CloseHandle(location->stopEvent);
location->thread = NULL;
location->stopEvent = NULL;
}

View File

@ -395,7 +395,7 @@ static UINT parallel_free_int(PARALLEL_DEVICE* parallel)
"WaitForSingleObject failed with error %" PRIu32 "!", error);
}
CloseHandle(parallel->thread);
(void)CloseHandle(parallel->thread);
Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue);
}

View File

@ -139,7 +139,7 @@ static BOOL printer_write_setting(const char* path, prn_conf_t type, const void*
rc = TRUE;
fail:
CloseHandle(file);
(void)CloseHandle(file);
free(base64);
return rc;
}
@ -194,7 +194,7 @@ static BOOL printer_read_setting(const char* path, prn_conf_t type, void** data,
}
fail:
CloseHandle(file);
(void)CloseHandle(file);
if (rc && (lowSize <= INT_MAX))
{
@ -651,7 +651,7 @@ static DWORD WINAPI printer_thread_func(LPVOID arg)
else if (rc != WAIT_OBJECT_0)
continue;
ResetEvent(printer_dev->event);
(void)ResetEvent(printer_dev->event);
irp = (IRP*)InterlockedPopEntrySList(printer_dev->pIrpList);
if (irp == NULL)
@ -690,7 +690,7 @@ static UINT printer_irp_request(DEVICE* device, IRP* irp)
if (printer_dev->async)
{
InterlockedPushEntrySList(printer_dev->pIrpList, &(irp->ItemEntry));
SetEvent(printer_dev->event);
(void)SetEvent(printer_dev->event);
}
else
{
@ -908,7 +908,7 @@ static UINT printer_free(DEVICE* device)
if (printer_dev->async)
{
SetEvent(printer_dev->stopEvent);
(void)SetEvent(printer_dev->stopEvent);
if (WaitForSingleObject(printer_dev->thread, INFINITE) == WAIT_FAILED)
{
@ -929,9 +929,9 @@ static UINT printer_free(DEVICE* device)
irp->Discard(irp);
}
CloseHandle(printer_dev->thread);
CloseHandle(printer_dev->stopEvent);
CloseHandle(printer_dev->event);
(void)CloseHandle(printer_dev->thread);
(void)CloseHandle(printer_dev->stopEvent);
(void)CloseHandle(printer_dev->event);
winpr_aligned_free(printer_dev->pIrpList);
}

View File

@ -1459,7 +1459,7 @@ static UINT rail_server_start(RailServerContext* context)
return CHANNEL_RC_OK;
out_stop_event:
CloseHandle(context->priv->stopEvent);
(void)CloseHandle(context->priv->stopEvent);
context->priv->stopEvent = NULL;
out_close:
(void)WTSVirtualChannelClose(context->priv->rail_channel);
@ -1473,7 +1473,7 @@ static BOOL rail_server_stop(RailServerContext* context)
if (priv->thread)
{
SetEvent(priv->stopEvent);
(void)SetEvent(priv->stopEvent);
if (WaitForSingleObject(priv->thread, INFINITE) == WAIT_FAILED)
{
@ -1481,8 +1481,8 @@ static BOOL rail_server_stop(RailServerContext* context)
return FALSE;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -103,9 +103,9 @@ static int init_external_addin(Plugin* plugin)
}
plugin->hProcess = procInfo.hProcess;
CloseHandle(procInfo.hThread);
CloseHandle(siStartInfo.hStdOutput);
CloseHandle(siStartInfo.hStdInput);
(void)CloseHandle(procInfo.hThread);
(void)CloseHandle(siStartInfo.hStdOutput);
(void)CloseHandle(siStartInfo.hStdInput);
return 0;
}
@ -175,7 +175,7 @@ static DWORD WINAPI copyThread(void* data)
handles[1] = freerdp_abort_event(plugin->channelEntryPoints.context);
status = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
if (status == WAIT_OBJECT_0)
ResetEvent(plugin->writeComplete);
(void)ResetEvent(plugin->writeComplete);
}
fail:
@ -246,7 +246,7 @@ static void VCAPITYPE VirtualChannelOpenEventEx(LPVOID lpUserParam, DWORD openHa
free(pData);
break;
case CHANNEL_EVENT_WRITE_COMPLETE:
SetEvent(plugin->writeComplete);
(void)SetEvent(plugin->writeComplete);
free(pData);
break;
}
@ -261,14 +261,14 @@ static void channel_terminated(Plugin* plugin)
return;
if (plugin->copyThread)
TerminateThread(plugin->copyThread, 0);
(void)TerminateThread(plugin->copyThread, 0);
if (plugin->writeComplete)
CloseHandle(plugin->writeComplete);
(void)CloseHandle(plugin->writeComplete);
CloseHandle(plugin->hStdInputWrite);
CloseHandle(plugin->hStdOutputRead);
(void)CloseHandle(plugin->hStdInputWrite);
(void)CloseHandle(plugin->hStdOutputRead);
TerminateProcess(plugin->hProcess, 0);
CloseHandle(plugin->hProcess);
(void)CloseHandle(plugin->hProcess);
free(plugin->commandline);
free(plugin);
}

View File

@ -706,7 +706,7 @@ static DWORD WINAPI drive_hotplug_thread_func(LPVOID arg)
out:
if (rdpdr->stopEvent)
{
CloseHandle(rdpdr->stopEvent);
(void)CloseHandle(rdpdr->stopEvent);
rdpdr->stopEvent = NULL;
}
ExitThread(CHANNEL_RC_OK);
@ -1083,7 +1083,7 @@ out:
if (rdpdr->stopEvent)
{
CloseHandle(rdpdr->stopEvent);
(void)CloseHandle(rdpdr->stopEvent);
rdpdr->stopEvent = NULL;
}
@ -1109,7 +1109,7 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
{
#if !defined(_WIN32)
if (rdpdr->stopEvent)
SetEvent(rdpdr->stopEvent);
(void)SetEvent(rdpdr->stopEvent);
#endif
#ifdef __MACOSX__
CFRunLoopStop(rdpdr->runLoop);
@ -1123,7 +1123,7 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
return error;
}
CloseHandle(rdpdr->hotplugThread);
(void)CloseHandle(rdpdr->hotplugThread);
rdpdr->hotplugThread = NULL;
}
@ -1176,7 +1176,8 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
if (!drive->Path)
continue;
BOOL hotplugAll = strncmp(drive->Path, "*", 2) == 0;
const char wildcard[] = "*";
BOOL hotplugAll = strncmp(drive->Path, wildcard, sizeof(wildcard)) == 0;
BOOL hotplugLater = strncmp(drive->Path, DynamicDrives, sizeof(DynamicDrives)) == 0;
if (hotplugAll || hotplugLater)
@ -2193,7 +2194,7 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
}
if (rdpdr->thread)
CloseHandle(rdpdr->thread);
(void)CloseHandle(rdpdr->thread);
MessageQueue_Free(rdpdr->queue);
rdpdr->queue = NULL;
rdpdr->thread = NULL;

View File

@ -215,7 +215,7 @@ static UINT rdpdr_seal_send_free_request(RdpdrServerContext* context, wStream* s
Stream_SealLength(s);
length = Stream_Length(s);
WINPR_ASSERT(length <= ULONG_MAX);
WINPR_ASSERT(length <= UINT32_MAX);
Stream_SetPosition(s, 0);
if (length >= RDPDR_HEADER_LENGTH)
@ -2077,7 +2077,7 @@ static DWORD WINAPI rdpdr_server_thread(LPVOID arg)
break;
}
capacity = MIN(Stream_Capacity(s), ULONG_MAX);
capacity = MIN(Stream_Capacity(s), UINT32_MAX);
if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0, (PCHAR)Stream_Buffer(s),
(ULONG)capacity, &BytesReturned))
{
@ -2147,7 +2147,7 @@ static UINT rdpdr_server_start(RdpdrServerContext* context)
CreateThread(NULL, 0, rdpdr_server_thread, (void*)context, 0, NULL)))
{
WLog_Print(context->priv->log, WLOG_ERROR, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -2168,7 +2168,7 @@ static UINT rdpdr_server_stop(RdpdrServerContext* context)
if (context->priv->StopEvent)
{
SetEvent(context->priv->StopEvent);
(void)SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
@ -2178,9 +2178,9 @@ static UINT rdpdr_server_stop(RdpdrServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->Thread);
context->priv->Thread = NULL;
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
}

View File

@ -27,6 +27,7 @@
#include <linux/videodev2.h>
#include "camera.h"
#include <winpr/handle.h>
#define TAG CHANNELS_TAG("rdpecam-v4l.client")
@ -530,8 +531,8 @@ UINT cam_v4l_stream_stop(CamV4lStream* stream)
if (stream->captureThread)
{
WaitForSingleObject(stream->captureThread, INFINITE);
CloseHandle(stream->captureThread);
(void)WaitForSingleObject(stream->captureThread, INFINITE);
(void)CloseHandle(stream->captureThread);
stream->captureThread = NULL;
}

View File

@ -449,7 +449,7 @@ static UINT enumerator_server_open(CamDevEnumServerContext* context)
if (!enumerator->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(enumerator->stopEvent);
(void)CloseHandle(enumerator->stopEvent);
enumerator->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -468,7 +468,7 @@ static UINT enumerator_server_close(CamDevEnumServerContext* context)
if (!enumerator->externalThread && enumerator->thread)
{
SetEvent(enumerator->stopEvent);
(void)SetEvent(enumerator->stopEvent);
if (WaitForSingleObject(enumerator->thread, INFINITE) == WAIT_FAILED)
{
@ -477,8 +477,8 @@ static UINT enumerator_server_close(CamDevEnumServerContext* context)
return error;
}
CloseHandle(enumerator->thread);
CloseHandle(enumerator->stopEvent);
(void)CloseHandle(enumerator->thread);
(void)CloseHandle(enumerator->stopEvent);
enumerator->thread = NULL;
enumerator->stopEvent = NULL;
}

View File

@ -601,7 +601,7 @@ static UINT device_server_open(CameraDeviceServerContext* context)
if (!device->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(device->stopEvent);
(void)CloseHandle(device->stopEvent);
device->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -620,7 +620,7 @@ static UINT device_server_close(CameraDeviceServerContext* context)
if (!device->externalThread && device->thread)
{
SetEvent(device->stopEvent);
(void)SetEvent(device->stopEvent);
if (WaitForSingleObject(device->thread, INFINITE) == WAIT_FAILED)
{
@ -629,8 +629,8 @@ static UINT device_server_close(CameraDeviceServerContext* context)
return error;
}
CloseHandle(device->thread);
CloseHandle(device->stopEvent);
(void)CloseHandle(device->thread);
(void)CloseHandle(device->stopEvent);
device->thread = NULL;
device->stopEvent = NULL;
}

View File

@ -464,7 +464,7 @@ static DWORD WINAPI rdpei_periodic_update(LPVOID arg)
}
if (status == WAIT_OBJECT_0)
ResetEvent(rdpei->event);
(void)ResetEvent(rdpei->event);
LeaveCriticalSection(&rdpei->lock);
}
@ -963,7 +963,7 @@ static UINT rdpei_add_contact(RdpeiClientContext* context, const RDPINPUT_CONTAC
contactPoint = &rdpei->contactPoints[contact->contactId];
contactPoint->data = *contact;
contactPoint->dirty = TRUE;
SetEvent(rdpei->event);
(void)SetEvent(rdpei->event);
LeaveCriticalSection(&rdpei->lock);
return CHANNEL_RC_OK;
@ -1175,7 +1175,7 @@ static UINT rdpei_add_pen(RdpeiClientContext* context, INT32 externalId,
{
contactPoint->data = *contact;
contactPoint->dirty = TRUE;
SetEvent(rdpei->event);
(void)SetEvent(rdpei->event);
}
LeaveCriticalSection(&rdpei->lock);
@ -1442,16 +1442,16 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
rdpei->running = FALSE;
if (rdpei->event)
SetEvent(rdpei->event);
(void)SetEvent(rdpei->event);
if (rdpei->thread)
{
WaitForSingleObject(rdpei->thread, INFINITE);
CloseHandle(rdpei->thread);
(void)WaitForSingleObject(rdpei->thread, INFINITE);
(void)CloseHandle(rdpei->thread);
}
if (rdpei->event)
CloseHandle(rdpei->event);
(void)CloseHandle(rdpei->event);
DeleteCriticalSection(&rdpei->lock);
free(rdpei->context);

View File

@ -406,7 +406,7 @@ static UINT mouse_cursor_server_open(MouseCursorServerContext* context)
if (!mouse_cursor->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(mouse_cursor->stopEvent);
(void)CloseHandle(mouse_cursor->stopEvent);
mouse_cursor->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -425,7 +425,7 @@ static UINT mouse_cursor_server_close(MouseCursorServerContext* context)
if (!mouse_cursor->externalThread && mouse_cursor->thread)
{
SetEvent(mouse_cursor->stopEvent);
(void)SetEvent(mouse_cursor->stopEvent);
if (WaitForSingleObject(mouse_cursor->thread, INFINITE) == WAIT_FAILED)
{
@ -434,8 +434,8 @@ static UINT mouse_cursor_server_close(MouseCursorServerContext* context)
return error;
}
CloseHandle(mouse_cursor->thread);
CloseHandle(mouse_cursor->stopEvent);
(void)CloseHandle(mouse_cursor->thread);
(void)CloseHandle(mouse_cursor->stopEvent);
mouse_cursor->thread = NULL;
mouse_cursor->stopEvent = NULL;
}

View File

@ -1630,7 +1630,7 @@ BOOL rdpgfx_server_close(RdpgfxServerContext* context)
if (priv->ownThread && priv->thread)
{
SetEvent(priv->stopEvent);
(void)SetEvent(priv->stopEvent);
if (WaitForSingleObject(priv->thread, INFINITE) == WAIT_FAILED)
{
@ -1638,8 +1638,8 @@ BOOL rdpgfx_server_close(RdpgfxServerContext* context)
return FALSE;
}
CloseHandle(priv->thread);
CloseHandle(priv->stopEvent);
(void)CloseHandle(priv->thread);
(void)CloseHandle(priv->stopEvent);
priv->thread = NULL;
priv->stopEvent = NULL;
}

View File

@ -1461,8 +1461,8 @@ void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
if (rdpsnd->thread)
{
WaitForSingleObject(rdpsnd->thread, INFINITE);
CloseHandle(rdpsnd->thread);
(void)WaitForSingleObject(rdpsnd->thread, INFINITE);
(void)CloseHandle(rdpsnd->thread);
}
MessageQueue_Free(rdpsnd->queue);

View File

@ -180,8 +180,8 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device)
if (winmm->hThread)
{
WaitForSingleObject(winmm->hThread, INFINITE);
CloseHandle(winmm->hThread);
(void)WaitForSingleObject(winmm->hThread, INFINITE);
(void)CloseHandle(winmm->hThread);
winmm->hThread = NULL;
}
}

View File

@ -957,7 +957,7 @@ static UINT rdpsnd_server_start(RdpsndServerContext* context)
return CHANNEL_RC_OK;
out_stopEvent:
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
out_lock:
DeleteCriticalSection(&context->priv->lock);
@ -989,7 +989,7 @@ static UINT rdpsnd_server_stop(RdpsndServerContext* context)
{
if (context->priv->StopEvent)
{
SetEvent(context->priv->StopEvent);
(void)SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
@ -998,8 +998,8 @@ static UINT rdpsnd_server_stop(RdpsndServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
context->priv->Thread = NULL;
context->priv->StopEvent = NULL;
}

View File

@ -970,7 +970,7 @@ static UINT remdesk_virtual_channel_event_disconnected(remdeskPlugin* remdesk)
remdesk->OpenHandle = 0;
}
MessageQueue_Free(remdesk->queue);
CloseHandle(remdesk->thread);
(void)CloseHandle(remdesk->thread);
Stream_Free(remdesk->data_in, TRUE);
remdesk->data_in = NULL;
remdesk->queue = NULL;

View File

@ -669,7 +669,7 @@ static UINT remdesk_server_start(RemdeskServerContext* context)
CreateThread(NULL, 0, remdesk_server_thread, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->StopEvent);
context->priv->StopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -685,7 +685,7 @@ static UINT remdesk_server_start(RemdeskServerContext* context)
static UINT remdesk_server_stop(RemdeskServerContext* context)
{
UINT error = 0;
SetEvent(context->priv->StopEvent);
(void)SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
@ -694,8 +694,8 @@ static UINT remdesk_server_stop(RemdeskServerContext* context)
return error;
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
(void)CloseHandle(context->priv->Thread);
(void)CloseHandle(context->priv->StopEvent);
return CHANNEL_RC_OK;
}

View File

@ -685,7 +685,7 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp)
return;
error_handle:
if (irpThread)
CloseHandle(irpThread);
(void)CloseHandle(irpThread);
irp->IoStatus = STATUS_NO_MEMORY;
irp->Complete(irp);
free(data);
@ -785,11 +785,11 @@ static UINT serial_free(DEVICE* device)
WLog_Print(serial->log, WLOG_ERROR,
"WaitForSingleObject failed with error %" PRIu32 "!", error);
}
CloseHandle(serial->MainThread);
(void)CloseHandle(serial->MainThread);
}
if (serial->hComm)
CloseHandle(serial->hComm);
(void)CloseHandle(*serial->hComm);
/* Clean up resources */
Stream_Free(serial->device.data, TRUE);
@ -825,9 +825,9 @@ static void irp_thread_close(void* arg)
WLog_WARN(TAG, "closing self, ignoring...");
else
{
TerminateThread(hdl, 0);
WaitForSingleObject(hdl, INFINITE);
CloseHandle(hdl);
(void)TerminateThread(hdl, 0);
(void)WaitForSingleObject(hdl, INFINITE);
(void)CloseHandle(hdl);
}
}
}

View File

@ -232,7 +232,7 @@ void smartcard_context_free(void* pCtx)
if (WaitForSingleObject(pContext->thread, INFINITE) == WAIT_FAILED)
WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!", GetLastError());
CloseHandle(pContext->thread);
(void)CloseHandle(pContext->thread);
}
MessageQueue_Free(pContext->IrpQueue);
}
@ -253,7 +253,7 @@ static UINT smartcard_free_(SMARTCARD_DEVICE* smartcard)
if (smartcard->IrpQueue)
{
MessageQueue_Free(smartcard->IrpQueue);
CloseHandle(smartcard->thread);
(void)CloseHandle(smartcard->thread);
}
Stream_Free(smartcard->device.data, TRUE);

View File

@ -233,7 +233,7 @@ static UINT sshagent_on_close(IWTSVirtualChannelCallback* pChannelCallback)
return error;
}
CloseHandle(callback->thread);
(void)CloseHandle(callback->thread);
LeaveCriticalSection(&callback->lock);
DeleteCriticalSection(&callback->lock);
free(callback);

View File

@ -325,7 +325,7 @@ static UINT telemetry_server_open(TelemetryServerContext* context)
if (!telemetry->thread)
{
WLog_ERR(TAG, "CreateThread failed!");
CloseHandle(telemetry->stopEvent);
(void)CloseHandle(telemetry->stopEvent);
telemetry->stopEvent = NULL;
return ERROR_INTERNAL_ERROR;
}
@ -344,7 +344,7 @@ static UINT telemetry_server_close(TelemetryServerContext* context)
if (!telemetry->externalThread && telemetry->thread)
{
SetEvent(telemetry->stopEvent);
(void)SetEvent(telemetry->stopEvent);
if (WaitForSingleObject(telemetry->thread, INFINITE) == WAIT_FAILED)
{
@ -353,8 +353,8 @@ static UINT telemetry_server_close(TelemetryServerContext* context)
return error;
}
CloseHandle(telemetry->thread);
CloseHandle(telemetry->stopEvent);
(void)CloseHandle(telemetry->thread);
(void)CloseHandle(telemetry->stopEvent);
telemetry->thread = NULL;
telemetry->stopEvent = NULL;
}

View File

@ -1261,13 +1261,13 @@ TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, UINT32 stream_id,
stream->rdpcontext = rdpcontext;
return stream;
error_add:
SetEvent(stream->stopEvent);
(void)SetEvent(stream->stopEvent);
if (WaitForSingleObject(stream->ack_thread, INFINITE) == WAIT_FAILED)
WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!", GetLastError());
error_ack_thread:
SetEvent(stream->stopEvent);
(void)SetEvent(stream->stopEvent);
if (WaitForSingleObject(stream->play_thread, INFINITE) == WAIT_FAILED)
WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!", GetLastError());
@ -1277,9 +1277,9 @@ error_play_thread:
error_sample_ack_list:
Queue_Free(stream->sample_list);
error_sample_list:
CloseHandle(stream->ready);
(void)CloseHandle(stream->ready);
error_ready:
CloseHandle(stream->stopEvent);
(void)CloseHandle(stream->stopEvent);
error_stopEvent:
free(stream);
return NULL;
@ -1316,7 +1316,7 @@ TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, UINT32 stre
static void tsmf_stream_resync(void* arg)
{
TSMF_STREAM* stream = arg;
ResetEvent(stream->ready);
(void)ResetEvent(stream->ready);
}
BOOL tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, wStream* s)
@ -1402,7 +1402,7 @@ void s_tsmf_stream_free(void* obj)
return;
tsmf_stream_stop(stream);
SetEvent(stream->stopEvent);
(void)SetEvent(stream->stopEvent);
if (stream->play_thread)
{
@ -1412,7 +1412,7 @@ void s_tsmf_stream_free(void* obj)
return;
}
CloseHandle(stream->play_thread);
(void)CloseHandle(stream->play_thread);
stream->play_thread = NULL;
}
@ -1424,7 +1424,7 @@ void s_tsmf_stream_free(void* obj)
return;
}
CloseHandle(stream->ack_thread);
(void)CloseHandle(stream->ack_thread);
stream->ack_thread = NULL;
}
@ -1437,8 +1437,8 @@ void s_tsmf_stream_free(void* obj)
stream->decoder = NULL;
}
CloseHandle(stream->stopEvent);
CloseHandle(stream->ready);
(void)CloseHandle(stream->stopEvent);
(void)CloseHandle(stream->ready);
ZeroMemory(stream, sizeof(TSMF_STREAM));
free(stream);
}
@ -1454,7 +1454,7 @@ BOOL tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
UINT32 extensions, UINT32 data_size, BYTE* data)
{
TSMF_SAMPLE* sample = NULL;
SetEvent(stream->ready);
(void)SetEvent(stream->ready);
if (TERMINATING)
return TRUE;

View File

@ -436,13 +436,13 @@ static IUDEVICE* udevman_get_udevice_by_ChannelID(IUDEVMAN* idevman, UINT32 chan
static void udevman_loading_lock(IUDEVMAN* idevman)
{
UDEVMAN* udevman = (UDEVMAN*)idevman;
WaitForSingleObject(udevman->devman_loading, INFINITE);
(void)WaitForSingleObject(udevman->devman_loading, INFINITE);
}
static void udevman_loading_unlock(IUDEVMAN* idevman)
{
UDEVMAN* udevman = (UDEVMAN*)idevman;
ReleaseMutex(udevman->devman_loading);
(void)ReleaseMutex(udevman->devman_loading);
}
BASIC_STATE_FUNC_DEFINED(device_num, UINT32)
@ -469,14 +469,14 @@ static void udevman_free(IUDEVMAN* idevman)
udevman->running = FALSE;
if (udevman->thread)
{
WaitForSingleObject(udevman->thread, INFINITE);
CloseHandle(udevman->thread);
(void)WaitForSingleObject(udevman->thread, INFINITE);
(void)CloseHandle(udevman->thread);
}
udevman_unregister_all_udevices(idevman);
if (udevman->devman_loading)
CloseHandle(udevman->devman_loading);
(void)CloseHandle(udevman->devman_loading);
libusb_exit(udevman->context);

View File

@ -108,7 +108,7 @@ static UINT android_cliprdr_send_client_format_data_request(CliprdrClientContext
formatDataRequest.common.msgFlags = 0;
formatDataRequest.requestedFormatId = formatId;
afc->requestedFormatId = formatId;
ResetEvent(afc->clipboardRequestEvent);
(void)ResetEvent(afc->clipboardRequestEvent);
rc = cliprdr->ClientFormatDataRequest(cliprdr, &formatDataRequest);
fail:
return rc;
@ -397,7 +397,7 @@ android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr,
if (!format)
{
SetEvent(afc->clipboardRequestEvent);
(void)SetEvent(afc->clipboardRequestEvent);
return ERROR_INTERNAL_ERROR;
}
@ -411,7 +411,7 @@ android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr,
if (!ClipboardSetData(afc->clipboard, formatId, formatDataResponse->requestedFormatData, size))
return ERROR_INTERNAL_ERROR;
SetEvent(afc->clipboardRequestEvent);
(void)SetEvent(afc->clipboardRequestEvent);
if ((formatId == CF_TEXT) || (formatId == CF_UNICODETEXT))
{
@ -475,7 +475,7 @@ BOOL android_cliprdr_init(androidContext* afc, CliprdrClientContext* cliprdr)
if (!(clipboard = ClipboardCreate()))
{
CloseHandle(hevent);
(void)CloseHandle(hevent);
return FALSE;
}
@ -504,6 +504,6 @@ BOOL android_cliprdr_uninit(androidContext* afc, CliprdrClientContext* cliprdr)
cliprdr->custom = NULL;
afc->cliprdr = NULL;
ClipboardDestroy(afc->clipboard);
CloseHandle(afc->clipboardRequestEvent);
(void)CloseHandle(afc->clipboardRequestEvent);
return TRUE;
}

View File

@ -325,7 +325,7 @@ BOOL android_event_queue_init(freerdp* inst)
if (!queue->events)
{
WLog_ERR(TAG, "android_event_queue_init: memory allocation failed");
CloseHandle(queue->isSet);
(void)CloseHandle(queue->isSet);
free(queue);
return FALSE;
}
@ -349,7 +349,7 @@ void android_event_queue_uninit(freerdp* inst)
{
if (queue->isSet)
{
CloseHandle(queue->isSet);
(void)CloseHandle(queue->isSet);
queue->isSet = NULL;
}

View File

@ -99,7 +99,7 @@ static int mac_cliprdr_send_client_format_data_request(CliprdrClientContext *cli
formatDataRequest.requestedFormatId = formatId;
mfc->requestedFormatId = formatId;
ResetEvent(mfc->clipboardRequestEvent);
(void)ResetEvent(mfc->clipboardRequestEvent);
cliprdr->ClientFormatDataRequest(cliprdr, &formatDataRequest);
@ -330,7 +330,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
if (formatDataResponse->common.msgFlags & CB_RESPONSE_FAIL)
{
SetEvent(mfc->clipboardRequestEvent);
(void)SetEvent(mfc->clipboardRequestEvent);
return ERROR_INTERNAL_ERROR;
}
@ -342,7 +342,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
if (!format)
{
SetEvent(mfc->clipboardRequestEvent);
(void)SetEvent(mfc->clipboardRequestEvent);
return ERROR_INTERNAL_ERROR;
}
@ -355,7 +355,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
ClipboardSetData(mfc->clipboard, formatId, formatDataResponse->requestedFormatData, size);
SetEvent(mfc->clipboardRequestEvent);
(void)SetEvent(mfc->clipboardRequestEvent);
if ((formatId == CF_TEXT) || (formatId == CF_OEMTEXT) || (formatId == CF_UNICODETEXT))
{
@ -428,5 +428,5 @@ void mac_cliprdr_uninit(mfContext *mfc, CliprdrClientContext *cliprdr)
mfc->cliprdr = NULL;
ClipboardDestroy(mfc->clipboard);
CloseHandle(mfc->clipboardRequestEvent);
(void)CloseHandle(mfc->clipboardRequestEvent);
}

View File

@ -111,7 +111,7 @@ static void mfreerdp_client_free(freerdp *instance, rdpContext *context)
return;
mfc = (mfContext *)instance->context;
CloseHandle(mfc->stopEvent);
(void)CloseHandle(mfc->stopEvent);
}
static void mf_scale_mouse_coordinates(mfContext *mfc, UINT16 *px, UINT16 *py)

View File

@ -260,17 +260,17 @@ WinPREvent::WinPREvent(bool initial)
WinPREvent::~WinPREvent()
{
CloseHandle(_handle);
(void)CloseHandle(_handle);
}
void WinPREvent::set()
{
SetEvent(_handle);
(void)SetEvent(_handle);
}
void WinPREvent::clear()
{
ResetEvent(_handle);
(void)ResetEvent(_handle);
}
bool WinPREvent::isSet() const

View File

@ -101,7 +101,7 @@ sdlClip::~sdlClip()
{
cliprdr_file_context_free(_file);
ClipboardDestroy(_system);
CloseHandle(_event);
(void)CloseHandle(_event);
}
BOOL sdlClip::init(CliprdrClientContext* clip)
@ -638,7 +638,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context,
if (!sres)
return ERROR_INTERNAL_ERROR;
SetEvent(clipboard->_event);
(void)SetEvent(clipboard->_event);
return CHANNEL_RC_OK;
}
@ -681,7 +681,7 @@ const void* sdlClip::ClipDataCb(void* userdata, const char* mime_type, size_t* s
std::lock_guard<CriticalSection> lock(clip->_lock);
auto request = clip->_request_queue.front();
clip->_request_queue.pop();
ResetEvent(clip->_event);
(void)ResetEvent(clip->_event);
auto formatID = ClipboardRegisterFormat(clip->_system, mime_type);
auto data = ClipboardGetData(clip->_system, formatID, &len);

View File

@ -306,17 +306,17 @@ WinPREvent::WinPREvent(bool initial)
WinPREvent::~WinPREvent()
{
CloseHandle(_handle);
(void)CloseHandle(_handle);
}
void WinPREvent::set()
{
SetEvent(_handle);
(void)SetEvent(_handle);
}
void WinPREvent::clear()
{
ResetEvent(_handle);
(void)ResetEvent(_handle);
}
bool WinPREvent::isSet() const

View File

@ -575,7 +575,7 @@ static int wlfreerdp_run(freerdp* instance)
disconnect:
if (timer)
CloseHandle(timer);
(void)CloseHandle(timer);
freerdp_disconnect(instance);
return status;
}
@ -619,7 +619,7 @@ static void wlf_client_free(freerdp* instance, rdpContext* context)
UwacCloseDisplay(&wlf->display);
if (wlf->displayHandle)
CloseHandle(wlf->displayHandle);
(void)CloseHandle(wlf->displayHandle);
ArrayList_Free(wlf->events);
DeleteCriticalSection(&wlf->critical);
}

View File

@ -526,15 +526,15 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo
if (*username)
{
ConvertUtf8ToWChar(*username, UserNameW, ARRAYSIZE(UserNameW));
ConvertUtf8ToWChar(*username, UserW, ARRAYSIZE(UserW));
(void)ConvertUtf8ToWChar(*username, UserNameW, ARRAYSIZE(UserNameW));
(void)ConvertUtf8ToWChar(*username, UserW, ARRAYSIZE(UserW));
}
if (*password)
ConvertUtf8ToWChar(*password, PasswordW, ARRAYSIZE(PasswordW));
(void)ConvertUtf8ToWChar(*password, PasswordW, ARRAYSIZE(PasswordW));
if (*domain)
ConvertUtf8ToWChar(*domain, DomainW, ARRAYSIZE(DomainW));
(void)ConvertUtf8ToWChar(*domain, DomainW, ARRAYSIZE(DomainW));
if (_wcsnlen(PasswordW, ARRAYSIZE(PasswordW)) == 0)
{
@ -566,9 +566,10 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo
CHAR UserName[CREDUI_MAX_USERNAME_LENGTH + 1] = { 0 };
CHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1] = { 0 };
ConvertWCharNToUtf8(UserNameW, ARRAYSIZE(UserNameW), UserName, ARRAYSIZE(UserName));
ConvertWCharNToUtf8(UserW, ARRAYSIZE(UserW), User, ARRAYSIZE(User));
ConvertWCharNToUtf8(DomainW, ARRAYSIZE(DomainW), Domain, ARRAYSIZE(Domain));
(void)ConvertWCharNToUtf8(UserNameW, ARRAYSIZE(UserNameW), UserName,
ARRAYSIZE(UserName));
(void)ConvertWCharNToUtf8(UserW, ARRAYSIZE(UserW), User, ARRAYSIZE(User));
(void)ConvertWCharNToUtf8(DomainW, ARRAYSIZE(DomainW), Domain, ARRAYSIZE(Domain));
WLog_ERR(TAG, "Failed to parse UserName: %s into User: %s Domain: %s", UserName,
User, Domain);
return FALSE;
@ -1465,8 +1466,8 @@ static int wfreerdp_client_stop(rdpContext* context)
if (wfc->keyboardThread)
{
PostThreadMessage(wfc->keyboardThreadId, WM_QUIT, 0, 0);
WaitForSingleObject(wfc->keyboardThread, INFINITE);
CloseHandle(wfc->keyboardThread);
(void)WaitForSingleObject(wfc->keyboardThread, INFINITE);
(void)CloseHandle(wfc->keyboardThread);
wfc->keyboardThread = NULL;
wfc->keyboardThreadId = 0;
}

View File

@ -1672,7 +1672,7 @@ static FILEDESCRIPTORW* wf_cliprdr_get_file_descriptor(WCHAR* file_name, size_t
fd->nFileSizeLow = GetFileSize(hFile, &fd->nFileSizeHigh);
wcscpy_s(fd->cFileName, sizeof(fd->cFileName) / 2, file_name + pathLen);
CloseHandle(hFile);
(void)CloseHandle(hFile);
return fd;
}
@ -2535,15 +2535,15 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr)
if (clipboard->thread)
{
WaitForSingleObject(clipboard->thread, INFINITE);
CloseHandle(clipboard->thread);
(void)WaitForSingleObject(clipboard->thread, INFINITE);
(void)CloseHandle(clipboard->thread);
}
if (clipboard->response_data_event)
CloseHandle(clipboard->response_data_event);
(void)CloseHandle(clipboard->response_data_event);
if (clipboard->req_fevent)
CloseHandle(clipboard->req_fevent);
(void)CloseHandle(clipboard->req_fevent);
clear_file_array(clipboard);
clear_format_map(clipboard);

View File

@ -96,7 +96,7 @@ int main(int argc, char* argv[])
thread = freerdp_client_get_thread(context);
WaitForSingleObject(thread, INFINITE);
(void)WaitForSingleObject(thread, INFINITE);
GetExitCodeThread(thread, &dwExitCode);
rc = xf_exit_code_from_disconnect_reason(dwExitCode);

View File

@ -805,7 +805,7 @@ void xf_lock_x11_(xfContext* xfc, const char* fkt)
{
if (!xfc->UseXThreads)
WaitForSingleObject(xfc->mutex, INFINITE);
(void)WaitForSingleObject(xfc->mutex, INFINITE);
else
XLockDisplay(xfc->display);
@ -827,7 +827,7 @@ void xf_unlock_x11_(xfContext* xfc, const char* fkt)
#endif
if (!xfc->UseXThreads)
ReleaseMutex(xfc->mutex);
(void)ReleaseMutex(xfc->mutex);
else
XUnlockDisplay(xfc->display);
}
@ -1451,8 +1451,8 @@ static void xf_post_disconnect(freerdp* instance)
if (xfc->pipethread)
{
WaitForSingleObject(xfc->pipethread, INFINITE);
CloseHandle(xfc->pipethread);
(void)WaitForSingleObject(xfc->pipethread, INFINITE);
(void)CloseHandle(xfc->pipethread);
xfc->pipethread = NULL;
}
if (xfc->clipboard)
@ -1681,7 +1681,7 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
disconnect:
if (timer)
CloseHandle(timer);
(void)CloseHandle(timer);
freerdp_disconnect(instance);
end:
@ -1832,13 +1832,13 @@ void xf_teardown_x11(xfContext* xfc)
if (xfc->x11event)
{
CloseHandle(xfc->x11event);
(void)CloseHandle(xfc->x11event);
xfc->x11event = NULL;
}
if (xfc->mutex)
{
CloseHandle(xfc->mutex);
(void)CloseHandle(xfc->mutex);
xfc->mutex = NULL;
}

View File

@ -980,7 +980,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
case 'n':
case 'N':
freerdp_interruptible_getc(instance->context, stdin);
(void)freerdp_interruptible_getc(instance->context, stdin);
return FALSE;
default:
@ -1339,8 +1339,8 @@ int freerdp_client_common_stop(rdpContext* context)
if (cctx->thread)
{
WaitForSingleObject(cctx->thread, INFINITE);
CloseHandle(cctx->thread);
(void)WaitForSingleObject(cctx->thread, INFINITE);
(void)CloseHandle(cctx->thread);
cctx->thread = NULL;
}
@ -1411,7 +1411,8 @@ client_encomsp_participant_created(EncomspClientContext* context,
/* if auto-request-control setting is enabled then only request control once upon connect,
* otherwise it will auto request control again every time server turns off control which
* is a bit annoying */
freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceRequestControl, FALSE);
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceRequestControl, FALSE))
return ERROR_INTERNAL_ERROR;
}
return CHANNEL_RC_OK;

View File

@ -1144,7 +1144,7 @@ static DWORD WINAPI cliprdr_file_fuse_thread(LPVOID arg)
fuse_opt_add_arg(&args, file->path);
file->fuse_sess = fuse_session_new(&args, &cliprdr_file_fuse_oper,
sizeof(cliprdr_file_fuse_oper), (void*)file);
SetEvent(file->fuse_start_sync);
(void)SetEvent(file->fuse_start_sync);
if (file->fuse_sess != NULL)
{
@ -2046,7 +2046,7 @@ void cliprdr_file_session_terminate(CliprdrFileContext* file, BOOL stop_thread)
if (stop_thread)
{
WLog_Print(file->log, WLOG_DEBUG, "Setting FUSE stop event");
SetEvent(file->fuse_stop_sync);
(void)SetEvent(file->fuse_stop_sync);
}
#endif
/* not elegant but works for umounting FUSE
@ -2055,7 +2055,7 @@ void cliprdr_file_session_terminate(CliprdrFileContext* file, BOOL stop_thread)
#if defined(WITH_FUSE)
WLog_Print(file->log, WLOG_DEBUG, "Forcing FUSE to check exit flag");
#endif
winpr_PathFileExists(file->path);
(void)winpr_PathFileExists(file->path);
}
void cliprdr_file_context_free(CliprdrFileContext* file)
@ -2078,13 +2078,13 @@ void cliprdr_file_context_free(CliprdrFileContext* file)
cliprdr_file_session_terminate(file, TRUE);
WLog_Print(file->log, WLOG_DEBUG, "Waiting on FUSE thread");
WaitForSingleObject(file->fuse_thread, INFINITE);
CloseHandle(file->fuse_thread);
(void)WaitForSingleObject(file->fuse_thread, INFINITE);
(void)CloseHandle(file->fuse_thread);
}
if (file->fuse_stop_sync)
CloseHandle(file->fuse_stop_sync);
(void)CloseHandle(file->fuse_stop_sync);
if (file->fuse_start_sync)
CloseHandle(file->fuse_start_sync);
(void)CloseHandle(file->fuse_start_sync);
HashTable_Free(file->request_table);
HashTable_Free(file->clip_data_table);
@ -2198,7 +2198,7 @@ static BOOL is_directory(const char* path)
BY_HANDLE_FILE_INFORMATION fileInformation = { 0 };
const BOOL status = GetFileInformationByHandle(hFile, &fileInformation);
CloseHandle(hFile);
(void)CloseHandle(hFile);
if (!status)
return FALSE;
@ -2237,8 +2237,8 @@ static BOOL add_directory(CliprdrLocalStream* stream, const char* path)
continue;
char cFileName[MAX_PATH] = { 0 };
ConvertWCharNToUtf8(FindFileData.cFileName, ARRAYSIZE(FindFileData.cFileName), cFileName,
ARRAYSIZE(cFileName));
(void)ConvertWCharNToUtf8(FindFileData.cFileName, ARRAYSIZE(FindFileData.cFileName),
cFileName, ARRAYSIZE(cFileName));
free(next);
next = GetCombinedPath(path, cFileName);

View File

@ -1692,8 +1692,8 @@ static void freerdp_client_print_timezone_list(void)
{
char TimeZoneKeyName[ARRAYSIZE(info.TimeZoneKeyName) + 1] = { 0 };
ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName), TimeZoneKeyName,
ARRAYSIZE(TimeZoneKeyName));
(void)ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
printf("%" PRIu32 ": '%s'\n", index, TimeZoneKeyName);
}
}
@ -1779,7 +1779,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
}
else if (status == COMMAND_LINE_STATUS_PRINT)
{
CommandLineParseArgumentsA(argc, argv, largs, 0x112, NULL, NULL, NULL);
(void)CommandLineParseArgumentsA(argc, argv, largs, 0x112, NULL, NULL, NULL);
arg = CommandLineFindArgumentA(largs, "list");
WINPR_ASSERT(arg);
@ -2464,7 +2464,8 @@ static int parse_host_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT
if (!arg->Value)
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
freerdp_settings_set_string(settings, FreeRDP_ServerHostname, NULL);
if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, NULL))
return COMMAND_LINE_ERROR_MEMORY;
char* p = strchr(arg->Value, '[');
/* ipv4 */
@ -4774,8 +4775,8 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
char TimeZoneKeyName[ARRAYSIZE(info.TimeZoneKeyName) + 1] = { 0 };
while (EnumDynamicTimeZoneInformation(index++, &info) != ERROR_NO_MORE_ITEMS)
{
ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
(void)ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
WINPR_ASSERT(arg->Value);
if (strncmp(TimeZoneKeyName, arg->Value, ARRAYSIZE(TimeZoneKeyName)) == 0)

View File

@ -539,13 +539,15 @@ int TestClientRdpFile(int argc, char* argv[])
if (iValue != 456)
return -1;
const char microsoft[] = "microsoft";
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
if (strncmp(sValue, "microsoft", 10) != 0)
if (strncmp(sValue, microsoft, sizeof(microsoft)) != 0)
goto fail;
const char apple[] = "apple";
freerdp_client_rdp_file_set_string_option(file, "vendor string", "apple");
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
if (strncmp(sValue, "apple", 6) != 0)
if (strncmp(sValue, apple, sizeof(apple)) != 0)
goto fail;
freerdp_client_rdp_file_set_string_option(file, "fruits", "banana,oranges");

View File

@ -106,7 +106,7 @@ static UINT ios_cliprdr_send_client_format_data_request(CliprdrClientContext *cl
formatDataRequest.common.msgFlags = 0;
formatDataRequest.requestedFormatId = formatId;
afc->requestedFormatId = formatId;
ResetEvent(afc->clipboardRequestEvent);
(void)ResetEvent(afc->clipboardRequestEvent);
rc = cliprdr->ClientFormatDataRequest(cliprdr, &formatDataRequest);
fail:
return rc;
@ -391,7 +391,7 @@ ios_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
if (!format)
{
SetEvent(afc->clipboardRequestEvent);
(void)SetEvent(afc->clipboardRequestEvent);
return ERROR_INTERNAL_ERROR;
}
@ -406,7 +406,7 @@ ios_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
if (!ClipboardSetData(afc->clipboard, formatId, formatDataResponse->requestedFormatData, size))
return ERROR_INTERNAL_ERROR;
SetEvent(afc->clipboardRequestEvent);
(void)SetEvent(afc->clipboardRequestEvent);
if ((formatId == CF_TEXT) || (formatId == CF_UNICODETEXT))
{
@ -465,7 +465,7 @@ BOOL ios_cliprdr_init(mfContext *afc, CliprdrClientContext *cliprdr)
if (!(clipboard = ClipboardCreate()))
{
CloseHandle(hevent);
(void)CloseHandle(hevent);
return FALSE;
}
@ -494,6 +494,6 @@ BOOL ios_cliprdr_uninit(mfContext *afc, CliprdrClientContext *cliprdr)
cliprdr->custom = NULL;
afc->cliprdr = NULL;
ClipboardDestroy(afc->clipboard);
CloseHandle(afc->clipboardRequestEvent);
(void)CloseHandle(afc->clipboardRequestEvent);
return TRUE;
}

View File

@ -170,5 +170,5 @@ void ios_events_free_pipe(mfInfo *mfi)
mfi->event_pipe_consumer = mfi->event_pipe_producer = -1;
close(producer_fd);
close(consumer_fd);
CloseHandle(mfi->handle);
(void)CloseHandle(mfi->handle);
}

View File

@ -42,6 +42,8 @@ struct rdp_persistent_cache
UINT32 bmpSize;
};
static const char sig_str[] = "RDP8bmp";
int persistent_cache_get_version(rdpPersistentCache* persistent)
{
WINPR_ASSERT(persistent);
@ -258,7 +260,7 @@ static int persistent_cache_open_read(rdpPersistentCache* persistent)
if (fread(sig, 8, 1, persistent->fp) != 1)
return -1;
if (!strncmp((const char*)sig, "RDP8bmp", 8))
if (memcmp(sig, sig_str, sizeof(sig_str)) == 0)
persistent->version = 3;
else
persistent->version = 2;
@ -298,7 +300,7 @@ static int persistent_cache_open_write(rdpPersistentCache* persistent)
if (persistent->version == 3)
{
PERSISTENT_CACHE_HEADER_V3 header = { 0 };
strncpy((char*)header.sig, "RDP8bmp", 8);
memcpy(header.sig, sig_str, MIN(sizeof(header.sig), sizeof(sig_str)));
header.flags = 0x00000006;
if (fwrite(&header, sizeof(header), 1, persistent->fp) != 1)

View File

@ -677,9 +677,9 @@ void freerdp_static_channel_collection_free(rdpSettings* settings)
}
free(settings->StaticChannelArray);
freerdp_settings_set_uint32(settings, FreeRDP_StaticChannelArraySize, 0);
(void)freerdp_settings_set_uint32(settings, FreeRDP_StaticChannelArraySize, 0);
settings->StaticChannelArray = NULL;
freerdp_settings_set_uint32(settings, FreeRDP_StaticChannelCount, 0);
(void)freerdp_settings_set_uint32(settings, FreeRDP_StaticChannelCount, 0);
}
BOOL freerdp_dynamic_channel_collection_del(rdpSettings* settings, const char* name)

View File

@ -348,13 +348,13 @@ static void BIO_NAMED_free(WINPR_BIO_NAMED* ptr)
if (ptr->hFile)
{
CloseHandle(ptr->hFile);
(void)CloseHandle(ptr->hFile);
ptr->hFile = NULL;
}
if (ptr->readEvent)
{
CloseHandle(ptr->readEvent);
(void)CloseHandle(ptr->readEvent);
ptr->readEvent = NULL;
}
@ -502,7 +502,7 @@ static BOOL createChildSessionTransport(HANDLE* pFile)
memcpy(pipePath, startOfPath, 8);
}
ConvertWCharNToUtf8(pipePath, 0x80, pipePathA, sizeof(pipePathA));
(void)ConvertWCharNToUtf8(pipePath, 0x80, pipePathA, sizeof(pipePathA));
WLog_DBG(TAG, "child session is at '%s'", pipePathA);
HANDLE f = CreateFileW(pipePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
@ -530,7 +530,7 @@ BIO* createChildSessionBio(void)
BIO* lowLevelBio = BIO_new(BIO_s_namedpipe());
if (!lowLevelBio)
{
CloseHandle(f);
(void)CloseHandle(f);
return NULL;
}

View File

@ -895,7 +895,7 @@ void freerdp_context_free(freerdp* instance)
ctx->metrics = NULL;
if (ctx->channelErrorEvent)
CloseHandle(ctx->channelErrorEvent);
(void)CloseHandle(ctx->channelErrorEvent);
ctx->channelErrorEvent = NULL;
free(ctx->errorDescription);
@ -1292,7 +1292,7 @@ void clearChannelError(rdpContext* context)
WINPR_ASSERT(context);
context->channelErrorNum = 0;
memset(context->errorDescription, 0, 500);
ResetEvent(context->channelErrorEvent);
(void)ResetEvent(context->channelErrorEvent);
}
WINPR_ATTR_FORMAT_ARG(3, 4)
@ -1306,7 +1306,7 @@ void setChannelError(rdpContext* context, UINT errorNum, WINPR_FORMAT_ARG const
context->channelErrorNum = errorNum;
(void)vsnprintf(context->errorDescription, 499, format, ap);
va_end(ap);
SetEvent(context->channelErrorEvent);
(void)SetEvent(context->channelErrorEvent);
}
const char* freerdp_nego_get_routing_token(rdpContext* context, DWORD* length)

View File

@ -137,7 +137,7 @@ static int rpc_client_receive_pipe_write(RpcClient* client, const BYTE* buffer,
status += (int)length;
if (ringbuffer_used(&(client->ReceivePipe)) > 0)
SetEvent(client->PipeEvent);
(void)SetEvent(client->PipeEvent);
LeaveCriticalSection(&(client->PipeLock));
return status;
@ -165,7 +165,7 @@ int rpc_client_receive_pipe_read(RpcClient* client, BYTE* buffer, size_t length)
ringbuffer_commit_read_bytes(&(client->ReceivePipe), status);
if (ringbuffer_used(&(client->ReceivePipe)) < 1)
ResetEvent(client->PipeEvent);
(void)ResetEvent(client->PipeEvent);
LeaveCriticalSection(&(client->PipeLock));
@ -1214,7 +1214,7 @@ void rpc_client_free(RpcClient* client)
Stream_Free(client->ReceiveFragment, TRUE);
if (client->PipeEvent)
CloseHandle(client->PipeEvent);
(void)CloseHandle(client->PipeEvent);
ringbuffer_destroy(&(client->ReceivePipe));
DeleteCriticalSection(&(client->PipeLock));

View File

@ -2844,7 +2844,7 @@ static int tsg_read(rdpTsg* tsg, BYTE* data, size_t length)
if (!tsg_check_event_handles(tsg))
return -1;
WaitForSingleObject(rpc->client->PipeEvent, 100);
(void)WaitForSingleObject(rpc->client->PipeEvent, 100);
}
}
} while (transport_get_blocking(rpc->transport));

View File

@ -1366,7 +1366,10 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs)
*/
if ((clientColorDepth < freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth)) ||
!settings->ServerMode)
freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, clientColorDepth);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, clientColorDepth))
return FALSE;
}
WLog_DBG(TAG, "Received EarlyCapabilityFlags=%s",
rdp_early_client_caps_string(settings->EarlyCapabilityFlags, buffer, sizeof(buffer)));

View File

@ -342,7 +342,7 @@ static void freerdp_listener_close(freerdp_listener* instance)
for (int i = 0; i < listener->num_sockfds; i++)
{
closesocket((SOCKET)listener->sockfds[i]);
CloseHandle(listener->events[i]);
(void)CloseHandle(listener->events[i]);
}
listener->num_sockfds = 0;
@ -476,7 +476,7 @@ static BOOL freerdp_listener_check_fds(freerdp_listener* instance)
{
struct sockaddr_storage peer_addr = { 0 };
WSAResetEvent(listener->events[i]);
(void)WSAResetEvent(listener->events[i]);
int peer_addr_size = sizeof(peer_addr);
int peer_sockfd =
_accept(listener->sockfds[i], (struct sockaddr*)&peer_addr, &peer_addr_size);

View File

@ -2905,9 +2905,9 @@ void update_message_proxy_free(rdpUpdateProxy* message)
{
rdp_update_internal* up = update_cast(message->update);
if (MessageQueue_PostQuit(up->queue, 0))
WaitForSingleObject(message->thread, INFINITE);
(void)WaitForSingleObject(message->thread, INFINITE);
CloseHandle(message->thread);
(void)CloseHandle(message->thread);
free(message);
}
}

View File

@ -177,7 +177,7 @@ static BOOL nla_sec_buffer_alloc(SecBuffer* buffer, size_t size)
{
WINPR_ASSERT(buffer);
sspi_SecBufferFree(buffer);
if (size > ULONG_MAX)
if (size > UINT32_MAX)
return FALSE;
if (!sspi_SecBufferAlloc(buffer, (ULONG)size))
return FALSE;

View File

@ -1340,7 +1340,7 @@ void freerdp_peer_context_free(freerdp_peer* client)
{
rdpContext* ctx = client->context;
CloseHandle(ctx->channelErrorEvent);
(void)CloseHandle(ctx->channelErrorEvent);
ctx->channelErrorEvent = NULL;
free(ctx->errorDescription);
ctx->errorDescription = NULL;

View File

@ -2047,7 +2047,7 @@ static state_run_t rdp_recv_callback_int(rdpTransport* transport, wStream* s, vo
case CONNECTION_STATE_MULTITRANSPORT_BOOTSTRAPPING_REQUEST:
if (!rdp_client_connect_auto_detect(rdp, s))
{
rdp_client_transition_to_state(
(void)rdp_client_transition_to_state(
rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE_DEMAND_ACTIVE);
status = STATE_RUN_TRY_AGAIN;
}
@ -2512,7 +2512,7 @@ void rdp_free(rdpRdp* rdp)
free(rdp->io);
PubSub_Free(rdp->pubSub);
if (rdp->abortEvent)
CloseHandle(rdp->abortEvent);
(void)CloseHandle(rdp->abortEvent);
aad_free(rdp->aad);
free(rdp);
}

View File

@ -547,9 +547,9 @@ out:
{
char cspa[128] = { 0 };
ConvertWCharToUtf8(csp, cspa, sizeof(cspa));
(void)ConvertWCharToUtf8(csp, cspa, sizeof(cspa));
char scopea[128] = { 0 };
ConvertWCharToUtf8(scope, scopea, sizeof(scopea));
(void)ConvertWCharToUtf8(scope, scopea, sizeof(scopea));
WLog_WARN(TAG, "%s [%s] no certificates found", cspa, scopea);
}
*pcount = count;

View File

@ -149,7 +149,7 @@ static int transport_bio_simple_read(BIO* bio, char* buf, int size)
return 0;
BIO_clear_flags(bio, BIO_FLAGS_READ);
WSAResetEvent(ptr->hEvent);
(void)WSAResetEvent(ptr->hEvent);
status = _recv(ptr->socket, buf, size, 0);
if (status > 0)
@ -389,7 +389,7 @@ static int transport_bio_simple_uninit(BIO* bio)
if (ptr && ptr->hEvent)
{
CloseHandle(ptr->hEvent);
(void)CloseHandle(ptr->hEvent);
ptr->hEvent = NULL;
}
@ -874,7 +874,7 @@ static BOOL freerdp_tcp_connect_timeout(rdpContext* context, int sockfd, struct
rc = TRUE;
fail:
CloseHandle(handles[0]);
(void)CloseHandle(handles[0]);
return rc;
}
@ -1356,7 +1356,7 @@ static int freerdp_tcp_layer_read(void* userContext, void* data, int bytes)
int error = 0;
int status = 0;
WSAResetEvent(tcpLayer->hEvent);
(void)WSAResetEvent(tcpLayer->hEvent);
status = _recv(tcpLayer->sockfd, data, bytes, 0);
if (status > 0)
@ -1422,7 +1422,7 @@ static BOOL freerdp_tcp_layer_close(void* userContext)
if (tcpLayer->sockfd >= 0)
closesocket(tcpLayer->sockfd);
if (tcpLayer->hEvent)
CloseHandle(tcpLayer->hEvent);
(void)CloseHandle(tcpLayer->hEvent);
return TRUE;
}

View File

@ -143,12 +143,12 @@ static int testAbort(int port)
if (!thread)
{
CloseHandle(s_sync);
(void)CloseHandle(s_sync);
s_sync = NULL;
return -1;
}
WaitForSingleObject(s_sync, INFINITE);
(void)WaitForSingleObject(s_sync, INFINITE);
Sleep(100); /* Wait until freerdp_connect has been called */
if (instance)
{
@ -156,8 +156,8 @@ static int testAbort(int port)
if (!freerdp_shall_disconnect_context(instance->context))
{
CloseHandle(s_sync);
CloseHandle(thread);
(void)CloseHandle(s_sync);
(void)CloseHandle(thread);
s_sync = NULL;
return -1;
}
@ -165,8 +165,8 @@ static int testAbort(int port)
status = WaitForSingleObject(thread, 20000);
end = GetTickCount();
CloseHandle(s_sync);
CloseHandle(thread);
(void)CloseHandle(s_sync);
(void)CloseHandle(thread);
s_sync = NULL;
diff = end - start;
@ -227,8 +227,8 @@ static BOOL prepare_certificates(const char* path)
goto fail;
rc = TRUE;
fail:
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
(void)CloseHandle(process.hProcess);
(void)CloseHandle(process.hThread);
return rc;
}
@ -293,9 +293,9 @@ static int testSuccess(int port)
if (!TerminateProcess(process.hProcess, 0))
goto fail;
WaitForSingleObject(process.hProcess, INFINITE);
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
(void)WaitForSingleObject(process.hProcess, INFINITE);
(void)CloseHandle(process.hProcess);
(void)CloseHandle(process.hThread);
printf("%s: returned %d!\n", __func__, r);
rc = r;

View File

@ -94,15 +94,15 @@ static void log_timezone_(const TIME_ZONE_INFORMATION* tzif, DWORD result, const
wLog* log = WLog_Get(TIMEZONE_TAG);
log_print(log, level, file, fkt, line, "TIME_ZONE_INFORMATION {");
log_print(log, level, file, fkt, line, " Bias=%" PRIu32, tzif->Bias);
ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
ARRAYSIZE(buffer));
(void)ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
ARRAYSIZE(buffer));
log_print(log, level, file, fkt, line, " StandardName=%s", buffer);
log_print(log, level, file, fkt, line, " StandardDate=%s",
systemtime2str(&tzif->StandardDate, buffer, sizeof(buffer)));
log_print(log, level, file, fkt, line, " StandardBias=%" PRIu32, tzif->StandardBias);
ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
ARRAYSIZE(buffer));
(void)ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
ARRAYSIZE(buffer));
log_print(log, level, file, fkt, line, " DaylightName=%s", buffer);
log_print(log, level, file, fkt, line, " DaylightDate=%s",
systemtime2str(&tzif->DaylightDate, buffer, sizeof(buffer)));

View File

@ -1427,7 +1427,7 @@ int transport_check_fds(rdpTransport* transport)
if (transport->haveMoreBytesToRead)
{
transport->haveMoreBytesToRead = FALSE;
ResetEvent(transport->rereadEvent);
(void)ResetEvent(transport->rereadEvent);
}
return status;
}
@ -1462,7 +1462,7 @@ int transport_check_fds(rdpTransport* transport)
if (!transport->haveMoreBytesToRead)
{
transport->haveMoreBytesToRead = TRUE;
SetEvent(transport->rereadEvent);
(void)SetEvent(transport->rereadEvent);
}
return recv_status;
}
@ -1702,9 +1702,9 @@ void transport_free(rdpTransport* transport)
nla_free(transport->nla);
StreamPool_Free(transport->ReceivePool);
CloseHandle(transport->connectedEvent);
CloseHandle(transport->rereadEvent);
CloseHandle(transport->ioEvent);
(void)CloseHandle(transport->connectedEvent);
(void)CloseHandle(transport->rereadEvent);
(void)CloseHandle(transport->ioEvent);
DeleteCriticalSection(&(transport->ReadLock));
DeleteCriticalSection(&(transport->WriteLock));
free(transport);

View File

@ -1257,8 +1257,8 @@ static BOOL vgids_ins_perform_security_operation(vgidsContext* context, wStream*
if (!context->commandData)
return FALSE;
}
else
Stream_EnsureRemainingCapacity(context->commandData, lc);
else if (!Stream_EnsureRemainingCapacity(context->commandData, lc))
return FALSE;
Stream_Write(context->commandData, Stream_Pointer(s), lc);
Stream_SealLength(context->commandData);

View File

@ -325,8 +325,8 @@ static void rdpdr_dump_packet(wLog* log, DWORD lvl, wStream* s, const char* cust
if (unicodeFlag == 0)
Stream_Read(s, name, MIN(sizeof(name), computerNameLen));
else
ConvertWCharNToUtf8(Stream_ConstPointer(s), computerNameLen / sizeof(WCHAR),
name, sizeof(name));
(void)ConvertWCharNToUtf8(Stream_ConstPointer(s),
computerNameLen / sizeof(WCHAR), name, sizeof(name));
}
WLog_Print(log, lvl,
"%s [%s | %s] [ucs:%" PRIu32 "|cp:%" PRIu32 "][len:0x%08" PRIx32

View File

@ -1959,7 +1959,7 @@ void smartcard_call_context_free(scard_call_context* ctx)
ctx->pWinSCardApi = NULL;
HashTable_Free(ctx->rgSCardContextList);
CloseHandle(ctx->stopEvent);
(void)CloseHandle(ctx->stopEvent);
free(ctx);
}

View File

@ -479,7 +479,7 @@ static void smartcard_trace_context_and_string_call_w(const char* name,
return;
if (sz)
ConvertWCharToUtf8(sz, tmp, ARRAYSIZE(tmp));
(void)ConvertWCharToUtf8(sz, tmp, ARRAYSIZE(tmp));
WLog_LVL(TAG, g_LogLevel, "%s {", name);
smartcard_log_context(TAG, phContext);
@ -532,7 +532,7 @@ static void smartcard_trace_get_status_change_w_call(const GetStatusChangeW_Call
const LPSCARD_READERSTATEW readerState = &call->rgReaderStates[index];
char szReaderA[1024] = { 0 };
ConvertWCharToUtf8(readerState->szReader, szReaderA, ARRAYSIZE(szReaderA));
(void)ConvertWCharToUtf8(readerState->szReader, szReaderA, ARRAYSIZE(szReaderA));
WLog_LVL(TAG, g_LogLevel, "\t[%" PRIu32 "]: szReader: %s cbAtr: %" PRIu32 "", index,
szReaderA, readerState->cbAtr);
@ -806,9 +806,9 @@ static void smartcard_trace_context_and_two_strings_w_call(const ContextAndTwoSt
if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel))
return;
if (call->sz1)
ConvertWCharToUtf8(call->sz1, sz1, ARRAYSIZE(sz1));
(void)ConvertWCharToUtf8(call->sz1, sz1, ARRAYSIZE(sz1));
if (call->sz2)
ConvertWCharToUtf8(call->sz2, sz2, ARRAYSIZE(sz2));
(void)ConvertWCharToUtf8(call->sz2, sz2, ARRAYSIZE(sz2));
WLog_LVL(TAG, g_LogLevel, "ContextAndTwoStringW_Call {");
smartcard_log_context(TAG, &call->handles.hContext);
@ -863,7 +863,7 @@ static void smartcard_trace_write_cache_w_call(const WriteCacheW_Call* call)
WLog_LVL(TAG, g_LogLevel, "WriteCacheW_Call {");
if (call->szLookupName)
ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
(void)ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
WLog_LVL(TAG, g_LogLevel, " szLookupName=%s", tmp);
smartcard_log_context(TAG, &call->Common.handles.hContext);
@ -909,7 +909,7 @@ static void smartcard_trace_read_cache_w_call(const ReadCacheW_Call* call)
WLog_LVL(TAG, g_LogLevel, "ReadCacheW_Call {");
if (call->szLookupName)
ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
(void)ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
WLog_LVL(TAG, g_LogLevel, " szLookupName=%s", tmp);
smartcard_log_context(TAG, &call->Common.handles.hContext);
@ -1011,7 +1011,7 @@ static void smartcard_trace_locate_cards_by_atr_w_call(const LocateCardsByATRW_C
(const LPSCARD_READERSTATEW)&call->rgReaderStates[index];
if (readerState->szReader)
ConvertWCharToUtf8(readerState->szReader, tmp, ARRAYSIZE(tmp));
(void)ConvertWCharToUtf8(readerState->szReader, tmp, ARRAYSIZE(tmp));
WLog_LVL(TAG, g_LogLevel, "\t[%" PRIu32 "]: szReader: %s cbAtr: %" PRIu32 "", index, tmp,
readerState->cbAtr);
szCurrentState = SCardGetReaderStateString(readerState->dwCurrentState);
@ -1307,7 +1307,7 @@ static void smartcard_trace_connect_w_call(const ConnectW_Call* call)
return;
if (call->szReader)
ConvertWCharToUtf8(call->szReader, szReaderA, ARRAYSIZE(szReaderA));
(void)ConvertWCharToUtf8(call->szReader, szReaderA, ARRAYSIZE(szReaderA));
WLog_LVL(TAG, g_LogLevel, "ConnectW_Call {");
smartcard_log_context(TAG, &call->Common.handles.hContext);

View File

@ -82,9 +82,9 @@ static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx)
if (context->debug_channel_thread)
{
WINPR_ASSERT(context->stopEvent);
SetEvent(context->stopEvent);
WaitForSingleObject(context->debug_channel_thread, INFINITE);
CloseHandle(context->debug_channel_thread);
(void)SetEvent(context->stopEvent);
(void)WaitForSingleObject(context->debug_channel_thread, INFINITE);
(void)CloseHandle(context->debug_channel_thread);
}
Stream_Free(context->s, TRUE);
@ -659,7 +659,8 @@ static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
if (BytesReturned == 0)
break;
Stream_EnsureRemainingCapacity(s, BytesReturned);
if (!Stream_EnsureRemainingCapacity(s, BytesReturned))
break;
if (WTSVirtualChannelRead(context->debug_channel, 0, (PCHAR)Stream_Buffer(s),
(ULONG)Stream_Capacity(s), &BytesReturned) == FALSE)
@ -760,7 +761,7 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
CreateThread(NULL, 0, tf_debug_channel_thread_func, (void*)context, 0, NULL)))
{
WLog_ERR(TAG, "Failed to create debug channel thread");
CloseHandle(context->stopEvent);
(void)CloseHandle(context->stopEvent);
context->stopEvent = NULL;
return FALSE;
}
@ -1274,7 +1275,7 @@ static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
if (!(hThread = CreateThread(NULL, 0, test_peer_mainloop, (void*)client, 0, NULL)))
return FALSE;
CloseHandle(hThread);
(void)CloseHandle(hThread);
return TRUE;
}

View File

@ -163,7 +163,7 @@ int main(int argc, char* argv[])
WLog_INFO(TAG, "Starting server");
wfreerdp_server_start(server);
WaitForSingleObject(server->thread, INFINITE);
(void)WaitForSingleObject(server->thread, INFINITE);
WLog_INFO(TAG, "Stopping server");
wfreerdp_server_stop(server);
wfreerdp_server_free(server);

View File

@ -82,7 +82,7 @@ int wf_directsound_activate(RdpsndServerContext* context)
WLog_ERR(TAG, "Failed to create direct sound thread");
return 1;
}
CloseHandle(hThread);
(void)CloseHandle(hThread);
return 0;
}

View File

@ -120,7 +120,7 @@ wfInfo* wf_info_init()
if (!wfi->updateSemaphore)
{
WLog_ERR(TAG, "CreateSemaphore error: %lu", GetLastError());
CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->mutex);
free(wfi);
return NULL;
}
@ -130,8 +130,8 @@ wfInfo* wf_info_init()
if (!wfi->updateThread)
{
WLog_ERR(TAG, "Failed to create update thread");
CloseHandle(wfi->mutex);
CloseHandle(wfi->updateSemaphore);
(void)CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->updateSemaphore);
free(wfi);
return NULL;
}
@ -142,9 +142,9 @@ wfInfo* wf_info_init()
if (!wfi->peers)
{
WLog_ERR(TAG, "Failed to allocate memory for peer");
CloseHandle(wfi->mutex);
CloseHandle(wfi->updateSemaphore);
CloseHandle(wfi->updateThread);
(void)CloseHandle(wfi->mutex);
(void)CloseHandle(wfi->updateSemaphore);
(void)CloseHandle(wfi->updateThread);
free(wfi);
return NULL;
}
@ -244,7 +244,7 @@ BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
wfreerdp_server_peer_callback_event(peerId, FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT);
return TRUE;
fail_driver_init:
CloseHandle(context->updateEvent);
(void)CloseHandle(context->updateEvent);
context->updateEvent = NULL;
fail_update_event:
fail_peer_count:
@ -261,7 +261,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
peerId = ((rdpContext*)context)->peer->pId;
wfi->peers[peerId] = NULL;
wfi->peerCount--;
CloseHandle(context->updateEvent);
(void)CloseHandle(context->updateEvent);
WLog_INFO(TAG, "Unregistering Peer: id=%d, #=%d", peerId, wfi->peerCount);
#ifdef WITH_DXGI_1_2

View File

@ -182,7 +182,7 @@ BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
if (!(hThread = CreateThread(NULL, 0, wf_peer_main_loop, client, 0, NULL)))
return FALSE;
CloseHandle(hThread);
(void)CloseHandle(hThread);
return TRUE;
}
@ -217,8 +217,8 @@ static DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
break;
}
SetEvent(context->socketEvent);
WaitForSingleObject(context->socketSemaphore, INFINITE);
(void)SetEvent(context->socketEvent);
(void)WaitForSingleObject(context->socketSemaphore, INFINITE);
if (context->socketClose)
break;
@ -357,7 +357,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if (client->activated)
wf_update_peer_send(wfi, context);
ResetEvent(context->updateEvent);
(void)ResetEvent(context->updateEvent);
ReleaseSemaphore(wfi->updateSemaphore, 1, NULL);
}
@ -369,7 +369,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
context->socketClose = TRUE;
}
ResetEvent(context->socketEvent);
(void)ResetEvent(context->socketEvent);
ReleaseSemaphore(context->socketSemaphore, 1, NULL);
if (context->socketClose)
@ -392,17 +392,17 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if (WaitForSingleObject(context->updateEvent, 0) == 0)
{
ResetEvent(context->updateEvent);
(void)ResetEvent(context->updateEvent);
ReleaseSemaphore(wfi->updateSemaphore, 1, NULL);
}
wf_update_peer_deactivate(wfi, context);
client->Disconnect(client);
fail_socket_thread:
CloseHandle(context->socketSemaphore);
(void)CloseHandle(context->socketSemaphore);
context->socketSemaphore = NULL;
fail_socket_semaphore:
CloseHandle(context->socketEvent);
(void)CloseHandle(context->socketEvent);
context->socketEvent = NULL;
fail_socket_event:
fail_socked_closed:

View File

@ -70,7 +70,8 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
// WLog_DBG(TAG, "Setting event for %d of %d", index + 1,
// wfi->activePeerCount);
SetEvent(((wfPeerContext*)wfi->peers[index]->context)->updateEvent);
(void)SetEvent(
((wfPeerContext*)wfi->peers[index]->context)->updateEvent);
}
}
}
@ -79,7 +80,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
// WLog_DBG(TAG, "Waiting for %d of %d", index + 1, wfi->activePeerCount);
// WaitForSingleObject(wfi->updateSemaphore, INFINITE);
WaitForSingleObject(wfi->updateSemaphore, 1000);
(void)WaitForSingleObject(wfi->updateSemaphore, 1000);
}
// WLog_DBG(TAG, "End of parallel sending");

View File

@ -58,7 +58,7 @@ int wf_wasapi_activate(RdpsndServerContext* context)
WLog_ERR(TAG, "CreateThread failed");
return 1;
}
CloseHandle(hThread);
(void)CloseHandle(hThread);
return 0;
}

View File

@ -259,7 +259,7 @@ static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wSt
Stream_SealLength(s);
len = Stream_Length(s);
WINPR_ASSERT(len <= ULONG_MAX);
WINPR_ASSERT(len <= UINT32_MAX);
rdpdr_dump_send_packet(context->log, WLOG_TRACE, s, proxy_client_tx);
status = WTSVirtualChannelWrite(context->handle, (char*)Stream_Buffer(s), (ULONG)len, NULL);

View File

@ -198,7 +198,7 @@ void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx)
if (context->dynvcReady)
{
CloseHandle(context->dynvcReady);
(void)CloseHandle(context->dynvcReady);
context->dynvcReady = NULL;
}
@ -388,13 +388,13 @@ void proxy_data_free(proxyData* pdata)
return;
if (pdata->abort_event)
CloseHandle(pdata->abort_event);
(void)CloseHandle(pdata->abort_event);
if (pdata->client_thread)
CloseHandle(pdata->client_thread);
(void)CloseHandle(pdata->client_thread);
if (pdata->gfx_server_ready)
CloseHandle(pdata->gfx_server_ready);
(void)CloseHandle(pdata->gfx_server_ready);
if (pdata->modules_info)
HashTable_Free(pdata->modules_info);
@ -409,7 +409,7 @@ void proxy_data_abort_connect(proxyData* pdata)
{
WINPR_ASSERT(pdata);
WINPR_ASSERT(pdata->abort_event);
SetEvent(pdata->abort_event);
(void)SetEvent(pdata->abort_event);
if (pdata->pc)
freerdp_abort_connect_context(&pdata->pc->context);
}

View File

@ -137,9 +137,15 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
WINPR_ASSERT(config);
if (config->TargetPort > 0)
freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, config->TargetPort);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, config->TargetPort))
return FALSE;
}
else
freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, 3389);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, 3389))
return FALSE;
}
if (!freerdp_settings_set_uint32(settings, FreeRDP_TlsSecLevel,
config->TargetTlsSecLevel))
@ -679,7 +685,7 @@ static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
case DRDYNVC_STATE_READY:
if (WaitForSingleObject(ps->dynvcReady, 0) == WAIT_TIMEOUT)
{
SetEvent(ps->dynvcReady);
(void)SetEvent(ps->dynvcReady);
}
break;
@ -713,7 +719,7 @@ out_free_peer:
if (pdata && pdata->client_thread)
{
proxy_data_abort_connect(pdata);
WaitForSingleObject(pdata->client_thread, INFINITE);
(void)WaitForSingleObject(pdata->client_thread, INFINITE);
}
{
@ -756,7 +762,7 @@ static BOOL pf_server_start_peer(freerdp_peer* client)
args->thread = hThread;
if (!ArrayList_Append(server->peer_list, hThread))
{
CloseHandle(hThread);
(void)CloseHandle(hThread);
return FALSE;
}
@ -905,7 +911,7 @@ static BOOL are_all_required_modules_loaded(proxyModule* module, const proxyConf
static void peer_free(void* obj)
{
HANDLE hdl = (HANDLE)obj;
CloseHandle(hdl);
(void)CloseHandle(hdl);
}
proxyServer* pf_server_new(const proxyConfig* config)
@ -1029,7 +1035,7 @@ void pf_server_stop(proxyServer* server)
return;
/* signal main thread to stop and wait for the thread to exit */
SetEvent(server->stopEvent);
(void)SetEvent(server->stopEvent);
}
void pf_server_free(proxyServer* server)
@ -1057,7 +1063,7 @@ void pf_server_free(proxyServer* server)
freerdp_listener_free(server->listener);
if (server->stopEvent)
CloseHandle(server->stopEvent);
(void)CloseHandle(server->stopEvent);
pf_server_config_free(server->config);
pf_modules_free(server->module);

View File

@ -79,9 +79,9 @@ static BOOL shw_end_paint(rdpContext* context)
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);
}
SetEvent(subsystem->RdpUpdateEnterEvent);
WaitForSingleObject(subsystem->RdpUpdateLeaveEvent, INFINITE);
ResetEvent(subsystem->RdpUpdateLeaveEvent);
(void)SetEvent(subsystem->RdpUpdateEnterEvent);
(void)WaitForSingleObject(subsystem->RdpUpdateLeaveEvent, INFINITE);
(void)ResetEvent(subsystem->RdpUpdateLeaveEvent);
return TRUE;
}
@ -261,7 +261,7 @@ static int shw_freerdp_client_start(rdpContext* context)
static int shw_freerdp_client_stop(rdpContext* context)
{
shwContext* shw = (shwContext*)context;
SetEvent(shw->StopEvent);
(void)SetEvent(shw->StopEvent);
return 0;
}
@ -408,9 +408,9 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem)
subsystem->shw->subsystem = subsystem;
return 1;
fail_context:
CloseHandle(subsystem->RdpUpdateLeaveEvent);
(void)CloseHandle(subsystem->RdpUpdateLeaveEvent);
fail_leave_event:
CloseHandle(subsystem->RdpUpdateEnterEvent);
(void)CloseHandle(subsystem->RdpUpdateEnterEvent);
fail_enter_event:
return -1;
}

View File

@ -353,8 +353,8 @@ static DWORD WINAPI win_shadow_subsystem_thread(LPVOID arg)
if (WaitForSingleObject(subsystem->RdpUpdateEnterEvent, 0) == WAIT_OBJECT_0)
{
win_shadow_surface_copy(subsystem);
ResetEvent(subsystem->RdpUpdateEnterEvent);
SetEvent(subsystem->RdpUpdateLeaveEvent);
(void)ResetEvent(subsystem->RdpUpdateEnterEvent);
(void)SetEvent(subsystem->RdpUpdateLeaveEvent);
}
}

View File

@ -1420,7 +1420,7 @@ static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub)
if (subsystem->common.event)
{
CloseHandle(subsystem->common.event);
(void)CloseHandle(subsystem->common.event);
subsystem->common.event = NULL;
}
@ -1460,9 +1460,9 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
if (subsystem->thread)
{
if (MessageQueue_PostQuit(subsystem->common.MsgPipe->In, 0))
WaitForSingleObject(subsystem->thread, INFINITE);
(void)WaitForSingleObject(subsystem->thread, INFINITE);
CloseHandle(subsystem->thread);
(void)CloseHandle(subsystem->thread);
subsystem->thread = NULL;
}

View File

@ -172,7 +172,7 @@ int main(int argc, char** argv)
}
#endif
WaitForSingleObject(server->thread, INFINITE);
(void)WaitForSingleObject(server->thread, INFINITE);
if (!GetExitCodeThread(server->thread, &dwExitCode))
status = -1;

View File

@ -2586,7 +2586,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
else
{
/* Close the thread handle to make it detached. */
CloseHandle(client->thread);
(void)CloseHandle(client->thread);
client->thread = NULL;
}

View File

@ -73,17 +73,17 @@ rdpShadowMultiClientEvent* shadow_multiclient_new(void)
event->consuming = 0;
event->waiting = 0;
event->eventid = 0;
SetEvent(event->doneEvent);
(void)SetEvent(event->doneEvent);
return event;
out_free_subscribers:
ArrayList_Free(event->subscribers);
out_free_doneEvent:
CloseHandle(event->doneEvent);
(void)CloseHandle(event->doneEvent);
out_free_barrierEvent:
CloseHandle(event->barrierEvent);
(void)CloseHandle(event->barrierEvent);
out_free_event:
CloseHandle(event->event);
(void)CloseHandle(event->event);
out_free:
free(event);
out_error:
@ -98,9 +98,9 @@ void shadow_multiclient_free(rdpShadowMultiClientEvent* event)
DeleteCriticalSection(&(event->lock));
ArrayList_Free(event->subscribers);
CloseHandle(event->doneEvent);
CloseHandle(event->barrierEvent);
CloseHandle(event->event);
(void)CloseHandle(event->doneEvent);
(void)CloseHandle(event->barrierEvent);
(void)CloseHandle(event->event);
free(event);
}
@ -128,8 +128,8 @@ static void Publish(rdpShadowMultiClientEvent* event)
{
event->eventid = (event->eventid & 0xff) + 1;
WLog_VRB(TAG, "Server published event %d. %d clients.\n", event->eventid, event->consuming);
ResetEvent(event->doneEvent);
SetEvent(event->event);
(void)ResetEvent(event->doneEvent);
(void)SetEvent(event->event);
}
}
@ -140,7 +140,7 @@ static void WaitForSubscribers(rdpShadowMultiClientEvent* event)
/* Wait for clients done */
WLog_VRB(TAG, "Server wait event %d. %d clients.\n", event->eventid, event->consuming);
LeaveCriticalSection(&(event->lock));
WaitForSingleObject(event->doneEvent, INFINITE);
(void)WaitForSingleObject(event->doneEvent, INFINITE);
EnterCriticalSection(&(event->lock));
WLog_VRB(TAG, "Server quit event %d. %d clients.\n", event->eventid, event->consuming);
}
@ -195,17 +195,17 @@ static BOOL Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL w
if (event->consuming == 0)
{
/* Last client reset event before notify clients to continue */
ResetEvent(event->event);
(void)ResetEvent(event->event);
if (event->waiting > 0)
{
/* Notify other clients to continue */
SetEvent(event->barrierEvent);
(void)SetEvent(event->barrierEvent);
}
else
{
/* Only one client. Notify server directly */
SetEvent(event->doneEvent);
(void)SetEvent(event->doneEvent);
}
}
else /* (event->consuming > 0) */
@ -219,7 +219,7 @@ static BOOL Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL w
*/
event->waiting++;
LeaveCriticalSection(&(event->lock));
WaitForSingleObject(event->barrierEvent, INFINITE);
(void)WaitForSingleObject(event->barrierEvent, INFINITE);
EnterCriticalSection(&(event->lock));
event->waiting--;
if (event->waiting == 0)
@ -229,8 +229,8 @@ static BOOL Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL w
* We can now discard barrierEvent and notify
* server to continue.
*/
ResetEvent(event->barrierEvent);
SetEvent(event->doneEvent);
(void)ResetEvent(event->barrierEvent);
(void)SetEvent(event->doneEvent);
}
}
}

View File

@ -742,9 +742,9 @@ int shadow_server_stop(rdpShadowServer* server)
if (server->thread)
{
SetEvent(server->StopEvent);
WaitForSingleObject(server->thread, INFINITE);
CloseHandle(server->thread);
(void)SetEvent(server->StopEvent);
(void)WaitForSingleObject(server->thread, INFINITE);
(void)CloseHandle(server->thread);
server->thread = NULL;
if (server->listener && server->listener->Close)
server->listener->Close(server->listener);
@ -978,7 +978,7 @@ int shadow_server_uninit(rdpShadowServer* server)
free(server->ConfigPath);
server->ConfigPath = NULL;
DeleteCriticalSection(&(server->lock));
CloseHandle(server->StopEvent);
(void)CloseHandle(server->StopEvent);
server->StopEvent = NULL;
ArrayList_Free(server->clients);
server->clients = NULL;

View File

@ -1106,7 +1106,7 @@ static UINT file_get_range(struct synthetic_file* file, UINT64 offset, UINT32 si
if (!GetFileInformationByHandle(file->fd, &FileInfo))
{
CloseHandle(file->fd);
(void)CloseHandle(file->fd);
file->fd = INVALID_HANDLE_VALUE;
error = GetLastError();
WLog_ERR(TAG, "Get file [%s] information fail: 0x%08" PRIx32, file->local_name, error);

View File

@ -1356,8 +1356,7 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, DWORD dwShare
return (HANDLE)pComm;
error_handle:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
CloseHandle(pComm);
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC(void) CloseHandle(pComm);
WINPR_PRAGMA_DIAG_POP
return INVALID_HANDLE_VALUE;
}

Some files were not shown because too many files have changed in this diff Show More