[warnings] fix cert-err33-c

Fix unused return values, cast to void if on purpose
This commit is contained in:
akallabeth 2024-08-26 15:39:33 +02:00
parent 7503efed27
commit 1d33095500
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
172 changed files with 1146 additions and 1080 deletions

View File

@ -160,8 +160,8 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
if (oss->dev_unit != -1) if (oss->dev_unit != -1)
{ {
sprintf_s(dev_name, (PATH_MAX - 1), "/dev/dsp%i", oss->dev_unit); (void)sprintf_s(dev_name, (PATH_MAX - 1), "/dev/dsp%i", oss->dev_unit);
sprintf_s(mixer_name, PATH_MAX - 1, "/dev/mixer%i", oss->dev_unit); (void)sprintf_s(mixer_name, PATH_MAX - 1, "/dev/mixer%i", oss->dev_unit);
} }
WLog_INFO(TAG, "open: %s", dev_name); WLog_INFO(TAG, "open: %s", dev_name);

View File

@ -111,7 +111,7 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
goto error_out; goto error_out;
} }
sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", table->name); (void)sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", table->name);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT; pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_STATIC; pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME; pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -128,8 +128,9 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
goto error_out; goto error_out;
} }
sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", table->name); (void)sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", table->name);
sprintf_s(pAddin->cSubsystem, ARRAYSIZE(pAddin->cSubsystem), "%s", subsystems[j].name); (void)sprintf_s(pAddin->cSubsystem, ARRAYSIZE(pAddin->cSubsystem), "%s",
subsystems[j].name);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT; pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_STATIC; pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME; pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -190,23 +191,23 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
if (pszName && pszSubsystem && pszType) if (pszName && pszSubsystem && pszType)
{ {
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-%s-%s.%s", (void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-%s-%s.%s",
pszName, pszSubsystem, pszType, pszExtension); pszName, pszSubsystem, pszType, pszExtension);
} }
else if (pszName && pszType) else if (pszName && pszType)
{ {
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-?-%s.%s", (void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-?-%s.%s",
pszName, pszType, pszExtension); pszName, pszType, pszExtension);
} }
else if (pszName) else if (pszName)
{ {
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client*.%s", pszName, (void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client*.%s",
pszExtension); pszName, pszExtension);
} }
else else
{ {
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "?-client*.%s", (void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "?-client*.%s",
pszExtension); pszExtension);
} }
cchPattern = strnlen(pszPattern, cchPattern); cchPattern = strnlen(pszPattern, cchPattern);
@ -567,10 +568,10 @@ static DWORD WINAPI channel_client_thread_proc(LPVOID userdata)
if (error && internals->ctx) if (error && internals->ctx)
{ {
char msg[128]; char msg[128];
_snprintf(msg, 127, (void)_snprintf(msg, 127,
"%s_virtual_channel_client_thread reported an" "%s_virtual_channel_client_thread reported an"
" error", " error",
internals->channel_name); internals->channel_name);
setChannelError(internals->ctx, error, msg); setChannelError(internals->ctx, error, msg);
} }
ExitThread(error); ExitThread(error);
@ -696,7 +697,8 @@ UINT channel_client_post_message(void* MsgsHandle, LPVOID pData, UINT32 dataLeng
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in)) if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{ {
char msg[128]; char msg[128];
_snprintf(msg, 127, "%s_plugin_process_received: read error", internals->channel_name); (void)_snprintf(msg, 127, "%s_plugin_process_received: read error",
internals->channel_name);
WLog_ERR(TAG, msg); WLog_ERR(TAG, msg);
return ERROR_INTERNAL_ERROR; return ERROR_INTERNAL_ERROR;
} }

View File

@ -1120,8 +1120,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
cliprdr->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | cliprdr->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name), (void)sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name),
CLIPRDR_SVC_CHANNEL_NAME); CLIPRDR_SVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
WINPR_ASSERT(pEntryPointsEx); WINPR_ASSERT(pEntryPointsEx);

View File

@ -61,7 +61,7 @@ static const char* CB_MSG_TYPE_STR(UINT32 type)
const char* CB_MSG_TYPE_STRING(UINT16 type, char* buffer, size_t size) const char* CB_MSG_TYPE_STRING(UINT16 type, char* buffer, size_t size)
{ {
_snprintf(buffer, size, "%s [0x%04" PRIx16 "]", CB_MSG_TYPE_STR(type), type); (void)_snprintf(buffer, size, "%s [0x%04" PRIx16 "]", CB_MSG_TYPE_STR(type), type);
return buffer; return buffer;
} }
@ -79,7 +79,7 @@ const char* CB_MSG_FLAGS_STRING(UINT16 msgFlags, char* buffer, size_t size)
winpr_str_append("NONE", buffer, size, ""); winpr_str_append("NONE", buffer, size, "");
char val[32] = { 0 }; char val[32] = { 0 };
_snprintf(val, sizeof(val), "[0x%04" PRIx16 "]", msgFlags); (void)_snprintf(val, sizeof(val), "[0x%04" PRIx16 "]", msgFlags);
winpr_str_append(val, buffer, size, "|"); winpr_str_append(val, buffer, size, "|");
return buffer; return buffer;
} }

View File

@ -1997,8 +1997,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_E
drdynvc->channelDef.options = drdynvc->channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP; CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name), (void)sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name),
DRDYNVC_SVC_CHANNEL_NAME); DRDYNVC_SVC_CHANNEL_NAME);
drdynvc->state = DRDYNVC_STATE_INITIAL; drdynvc->state = DRDYNVC_STATE_INITIAL;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -1244,8 +1244,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_E
encomsp->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | encomsp->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name), (void)sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name),
ENCOMSP_SVC_CHANNEL_NAME); ENCOMSP_SVC_CHANNEL_NAME);
CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx = CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx =
(CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
WINPR_ASSERT(pEntryPointsEx); WINPR_ASSERT(pEntryPointsEx);

View File

@ -138,7 +138,7 @@ static const char* location_version_str(UINT32 version, char* buffer, size_t siz
break; break;
} }
_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, version); (void)_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, version);
return buffer; return buffer;
} }

View File

@ -110,8 +110,9 @@ static void printer_cups_get_printjob_name(char* buf, size_t size, size_t id)
WINPR_ASSERT(buf); WINPR_ASSERT(buf);
WINPR_ASSERT(size > 0); WINPR_ASSERT(size > 0);
sprintf_s(buf, size - 1, "FreeRDP Print %04d-%02d-%02d %02d-%02d-%02d - Job %" PRIdz, (void)sprintf_s(buf, size - 1, "FreeRDP Print %04d-%02d-%02d %02d-%02d-%02d - Job %" PRIdz,
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, id); t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
id);
} }
static bool http_status_ok(http_status_t status) static bool http_status_ok(http_status_t status)

View File

@ -972,7 +972,7 @@ static UINT printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrint
if (!printer_dev->device.data) if (!printer_dev->device.data)
goto error_out; goto error_out;
sprintf_s(printer_dev->port, sizeof(printer_dev->port), "PRN%" PRIdz, printer->id); (void)sprintf_s(printer_dev->port, sizeof(printer_dev->port), "PRN%" PRIdz, printer->id);
printer_dev->device.type = RDPDR_DTYP_PRINT; printer_dev->device.type = RDPDR_DTYP_PRINT;
printer_dev->device.name = printer_dev->port; printer_dev->device.name = printer_dev->port;
printer_dev->device.IRPRequest = printer_irp_request; printer_dev->device.IRPRequest = printer_irp_request;

View File

@ -82,8 +82,8 @@ UINT client_rail_server_start_cmd(RailClientContext* context)
freerdp_settings_get_string(settings, FreeRDP_RemoteApplicationCmdLine); freerdp_settings_get_string(settings, FreeRDP_RemoteApplicationCmdLine);
if (RemoteApplicationFile && RemoteApplicationCmdLine) if (RemoteApplicationFile && RemoteApplicationCmdLine)
{ {
_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", RemoteApplicationCmdLine, (void)_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", RemoteApplicationCmdLine,
RemoteApplicationFile); RemoteApplicationFile);
exec.RemoteApplicationArguments = argsAndFile; exec.RemoteApplicationArguments = argsAndFile;
} }
else if (RemoteApplicationFile) else if (RemoteApplicationFile)

View File

@ -677,7 +677,7 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
rail->sendHandshake = TRUE; rail->sendHandshake = TRUE;
rail->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | rail->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(rail->channelDef.name, ARRAYSIZE(rail->channelDef.name), RAIL_SVC_CHANNEL_NAME); (void)sprintf_s(rail->channelDef.name, ARRAYSIZE(rail->channelDef.name), RAIL_SVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) && if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&

View File

@ -90,8 +90,8 @@ const char* rail_get_order_type_string(UINT16 orderType)
const char* rail_get_order_type_string_full(UINT16 orderType, char* buffer, size_t length) const char* rail_get_order_type_string_full(UINT16 orderType, char* buffer, size_t length)
{ {
_snprintf(buffer, length, "%s[0x%04" PRIx16 "]", rail_get_order_type_string(orderType), (void)_snprintf(buffer, length, "%s[0x%04" PRIx16 "]", rail_get_order_type_string(orderType),
orderType); orderType);
return buffer; return buffer;
} }
@ -594,7 +594,7 @@ const char* rail_handshake_ex_flags_to_string(UINT32 flags, char* buffer, size_t
if (len < 1) if (len < 1)
return NULL; return NULL;
_snprintf(buffer, len, "{"); (void)_snprintf(buffer, len, "{");
char* fbuffer = &buffer[1]; char* fbuffer = &buffer[1];
len--; len--;
@ -612,7 +612,7 @@ const char* rail_handshake_ex_flags_to_string(UINT32 flags, char* buffer, size_t
winpr_str_append("EXTENDED_SPI_2_SUPPORTED", fbuffer, len, "|"); winpr_str_append("EXTENDED_SPI_2_SUPPORTED", fbuffer, len, "|");
char number[16] = { 0 }; char number[16] = { 0 };
_snprintf(number, sizeof(number), "[0x%08" PRIx32 "]", flags); (void)_snprintf(number, sizeof(number), "[0x%08" PRIx32 "]", flags);
winpr_str_append(number, buffer, len, "}"); winpr_str_append(number, buffer, len, "}");
return buffer; return buffer;
} }

View File

@ -145,7 +145,7 @@ static DWORD WINAPI copyThread(void* data)
if (!buffer) if (!buffer)
{ {
fprintf(stderr, "rdp2tcp copyThread: malloc failed\n"); (void)fprintf(stderr, "rdp2tcp copyThread: malloc failed\n");
goto fail; goto fail;
} }
@ -167,7 +167,7 @@ static DWORD WINAPI copyThread(void* data)
plugin->initHandle, plugin->openHandle, buffer, dwRead, buffer) != CHANNEL_RC_OK) plugin->initHandle, plugin->openHandle, buffer, dwRead, buffer) != CHANNEL_RC_OK)
{ {
free(buffer); free(buffer);
fprintf(stderr, "rdp2tcp copyThread failed %i\n", (int)dwRead); (void)fprintf(stderr, "rdp2tcp copyThread failed %i\n", (int)dwRead);
goto fail; goto fail;
} }

View File

@ -738,11 +738,11 @@ static BOOL isAutomountLocation(const char* path)
size_t length = 0; size_t length = 0;
if (strstr(location, "%lu")) if (strstr(location, "%lu"))
snprintf(buffer, sizeof(buffer), location, (unsigned long)uid); (void)snprintf(buffer, sizeof(buffer), location, (unsigned long)uid);
else if (strstr(location, "%s")) else if (strstr(location, "%s"))
snprintf(buffer, sizeof(buffer), location, uname); (void)snprintf(buffer, sizeof(buffer), location, uname);
else else
snprintf(buffer, sizeof(buffer), "%s", location); (void)snprintf(buffer, sizeof(buffer), "%s", location);
length = strnlen(buffer, sizeof(buffer)); length = strnlen(buffer, sizeof(buffer));
@ -848,7 +848,7 @@ static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size
{ {
handle_mountpoint(dev_array, size, ent->mnt_dir); handle_mountpoint(dev_array, size, ent->mnt_dir);
} }
fclose(f); (void)fclose(f);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
#endif #endif
@ -2311,7 +2311,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
rdpdr->channelDef.options = rdpdr->channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP; CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
sprintf_s(rdpdr->channelDef.name, ARRAYSIZE(rdpdr->channelDef.name), RDPDR_SVC_CHANNEL_NAME); (void)sprintf_s(rdpdr->channelDef.name, ARRAYSIZE(rdpdr->channelDef.name),
RDPDR_SVC_CHANNEL_NAME);
rdpdr->sequenceId = 0; rdpdr->sequenceId = 0;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -191,7 +191,7 @@ static void rdpsnd_oss_open_mixer(rdpsndOssPlugin* oss)
return; return;
if (oss->dev_unit != -1) if (oss->dev_unit != -1)
sprintf_s(mixer_name, PATH_MAX - 1, "/dev/mixer%i", oss->dev_unit); (void)sprintf_s(mixer_name, PATH_MAX - 1, "/dev/mixer%i", oss->dev_unit);
if ((oss->mixer_handle = open(mixer_name, O_RDWR)) < 0) if ((oss->mixer_handle = open(mixer_name, O_RDWR)) < 0)
{ {
@ -218,7 +218,7 @@ static BOOL rdpsnd_oss_open(rdpsndDevicePlugin* device, const AUDIO_FORMAT* form
return TRUE; return TRUE;
if (oss->dev_unit != -1) if (oss->dev_unit != -1)
sprintf_s(dev_name, PATH_MAX - 1, "/dev/dsp%i", oss->dev_unit); (void)sprintf_s(dev_name, PATH_MAX - 1, "/dev/dsp%i", oss->dev_unit);
WLog_INFO(TAG, "open: %s", dev_name); WLog_INFO(TAG, "open: %s", dev_name);

View File

@ -1227,9 +1227,9 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, D
if (error && rdpsnd && rdpsnd->rdpcontext) if (error && rdpsnd && rdpsnd->rdpcontext)
{ {
char buffer[8192]; char buffer[8192];
_snprintf(buffer, sizeof(buffer), (void)_snprintf(buffer, sizeof(buffer),
"%s rdpsnd_virtual_channel_open_event_ex reported an error", "%s rdpsnd_virtual_channel_open_event_ex reported an error",
rdpsnd_is_dyn_str(rdpsnd->dynamic)); rdpsnd_is_dyn_str(rdpsnd->dynamic));
setChannelError(rdpsnd->rdpcontext, error, buffer); setChannelError(rdpsnd->rdpcontext, error, buffer);
} }
} }
@ -1523,8 +1523,8 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_init_event_ex(LPVOID lpUserParam, L
if (error && plugin && plugin->rdpcontext) if (error && plugin && plugin->rdpcontext)
{ {
char buffer[8192]; char buffer[8192];
_snprintf(buffer, sizeof(buffer), "%s reported an error", (void)_snprintf(buffer, sizeof(buffer), "%s reported an error",
rdpsnd_is_dyn_str(plugin->dynamic)); rdpsnd_is_dyn_str(plugin->dynamic));
setChannelError(plugin->rdpcontext, error, buffer); setChannelError(plugin->rdpcontext, error, buffer);
} }
} }
@ -1576,7 +1576,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE rdpsnd_VirtualChannelEntryEx(PCHANNEL_ENTRY_P
return FALSE; return FALSE;
rdpsnd->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP; rdpsnd->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP;
sprintf_s(rdpsnd->channelDef.name, ARRAYSIZE(rdpsnd->channelDef.name), RDPSND_CHANNEL_NAME); (void)sprintf_s(rdpsnd->channelDef.name, ARRAYSIZE(rdpsnd->channelDef.name),
RDPSND_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) && if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&

View File

@ -218,8 +218,8 @@ static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msg
WINPR_ASSERT(ctlHeader); WINPR_ASSERT(ctlHeader);
ctlHeader->msgType = msgType; ctlHeader->msgType = msgType;
sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName), (void)sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME); REMDESK_CHANNEL_CTL_NAME);
ctlHeader->ch.DataLength = 4 + msgSize; ctlHeader->ch.DataLength = 4 + msgSize;
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
@ -1059,8 +1059,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
remdesk->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | remdesk->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name), (void)sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name),
REMDESK_SVC_CHANNEL_NAME); REMDESK_SVC_CHANNEL_NAME);
remdesk->Version = 2; remdesk->Version = 2;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints; pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -128,8 +128,8 @@ static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msg
UINT32 msgSize) UINT32 msgSize)
{ {
ctlHeader->msgType = msgType; ctlHeader->msgType = msgType;
sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName), (void)sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME); REMDESK_CHANNEL_CTL_NAME);
ctlHeader->ch.DataLength = 4 + msgSize; ctlHeader->ch.DataLength = 4 + msgSize;
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }

View File

@ -384,7 +384,7 @@ static char* guid_to_string(const BYTE* guid, char* str, size_t len)
return NULL; return NULL;
for (size_t i = 0; i < GUID_SIZE && (len > 2 * i); i++) for (size_t i = 0; i < GUID_SIZE && (len > 2 * i); i++)
sprintf_s(str + (2 * i), len - 2 * i, "%02" PRIX8 "", guid[i]); (void)sprintf_s(str + (2 * i), len - 2 * i, "%02" PRIX8 "", guid[i]);
return str; return str;
} }
@ -1504,12 +1504,12 @@ static void tsmf_signal_handler(int s)
if (s == SIGINT) if (s == SIGINT)
{ {
signal(s, SIG_DFL); (void)signal(s, SIG_DFL);
kill(getpid(), s); kill(getpid(), s);
} }
else if (s == SIGUSR1) else if (s == SIGUSR1)
{ {
signal(s, SIG_DFL); (void)signal(s, SIG_DFL);
} }
} }

View File

@ -141,7 +141,7 @@ static BOOL log_libusb_result_(wLog* log, DWORD lvl, WINPR_FORMAT_ARG const char
char buffer[8192] = { 0 }; char buffer[8192] = { 0 };
va_list ap; va_list ap;
va_start(ap, error); va_start(ap, error);
vsnprintf(buffer, sizeof(buffer), fmt, ap); (void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap); va_end(ap);
WLog_Print(log, lvl, "[%s:%" PRIuz "]: %s: error %s[%d]", fkt, line, buffer, WLog_Print(log, lvl, "[%s:%" PRIuz "]: %s: error %s[%d]", fkt, line, buffer,
@ -894,8 +894,8 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
case DeviceTextLocationInformation: case DeviceTextLocationInformation:
bus_number = libusb_get_bus_number(pdev->libusb_dev); bus_number = libusb_get_bus_number(pdev->libusb_dev);
device_address = libusb_get_device_address(pdev->libusb_dev); device_address = libusb_get_device_address(pdev->libusb_dev);
sprintf_s(deviceLocation, sizeof(deviceLocation), (void)sprintf_s(deviceLocation, sizeof(deviceLocation),
"Port_#%04" PRIu8 ".Hub_#%04" PRIu8 "", device_address, bus_number); "Port_#%04" PRIu8 ".Hub_#%04" PRIu8 "", device_address, bus_number);
len = strnlen(deviceLocation, len = strnlen(deviceLocation,
MIN(sizeof(deviceLocation), (inSize > 0) ? inSize - 1U : 0)); MIN(sizeof(deviceLocation), (inSize > 0) ? inSize - 1U : 0));
@ -1608,7 +1608,7 @@ static int udev_get_device_handle(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UD
error = 0; error = 0;
WLog_Print(urbdrc->log, WLOG_DEBUG, " Port: %d", pdev->port_number); WLog_Print(urbdrc->log, WLOG_DEBUG, " Port: %d", pdev->port_number);
/* gen device path */ /* gen device path */
sprintf(pdev->path, "%" PRIu16 "-%d", bus_number, pdev->port_number); (void)sprintf(pdev->path, "%" PRIu16 "-%d", bus_number, pdev->port_number);
WLog_Print(urbdrc->log, WLOG_DEBUG, " DevPath: %s", pdev->path); WLog_Print(urbdrc->log, WLOG_DEBUG, " DevPath: %s", pdev->path);
} }

View File

@ -80,33 +80,33 @@ static int func_container_id_generate(IUDEVICE* pdev, char* strContainerId)
else else
p = path; p = path;
sprintf_s((char*)containerId, sizeof(containerId), "%04" PRIX16 "%04" PRIX16 "%s", idVendor, (void)sprintf_s((char*)containerId, sizeof(containerId), "%04" PRIX16 "%04" PRIX16 "%s",
idProduct, p); idVendor, idProduct, p);
/* format */ /* format */
sprintf_s(strContainerId, DEVICE_CONTAINER_STR_SIZE, (void)sprintf_s(strContainerId, DEVICE_CONTAINER_STR_SIZE,
"{%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "{%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8
"%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8
"%02" PRIx8 "%02" PRIx8 "}", "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "}",
containerId[0], containerId[1], containerId[2], containerId[3], containerId[4], containerId[0], containerId[1], containerId[2], containerId[3], containerId[4],
containerId[5], containerId[6], containerId[7], containerId[8], containerId[9], containerId[5], containerId[6], containerId[7], containerId[8], containerId[9],
containerId[10], containerId[11], containerId[12], containerId[13], containerId[14], containerId[10], containerId[11], containerId[12], containerId[13],
containerId[15]); containerId[14], containerId[15]);
return 0; return 0;
} }
static int func_instance_id_generate(IUDEVICE* pdev, char* strInstanceId, size_t len) static int func_instance_id_generate(IUDEVICE* pdev, char* strInstanceId, size_t len)
{ {
char instanceId[17] = { 0 }; char instanceId[17] = { 0 };
sprintf_s(instanceId, sizeof(instanceId), "\\%s", pdev->getPath(pdev)); (void)sprintf_s(instanceId, sizeof(instanceId), "\\%s", pdev->getPath(pdev));
/* format */ /* format */
sprintf_s(strInstanceId, len, (void)sprintf_s(strInstanceId, len,
"%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8
"%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" PRIx8
"%02" PRIx8 "%02" PRIx8 "", "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "",
instanceId[0], instanceId[1], instanceId[2], instanceId[3], instanceId[4], instanceId[0], instanceId[1], instanceId[2], instanceId[3], instanceId[4],
instanceId[5], instanceId[6], instanceId[7], instanceId[8], instanceId[9], instanceId[5], instanceId[6], instanceId[7], instanceId[8], instanceId[9],
instanceId[10], instanceId[11], instanceId[12], instanceId[13], instanceId[14], instanceId[10], instanceId[11], instanceId[12], instanceId[13], instanceId[14],
instanceId[15]); instanceId[15]);
return 0; return 0;
} }
@ -246,11 +246,11 @@ static UINT urdbrc_send_usb_device_add(GENERIC_CHANNEL_CALLBACK* callback, IUDEV
const UINT16 idVendor = (UINT16)pdev->query_device_descriptor(pdev, ID_VENDOR); const UINT16 idVendor = (UINT16)pdev->query_device_descriptor(pdev, ID_VENDOR);
const UINT16 idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT); const UINT16 idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT);
const UINT16 bcdDevice = (UINT16)pdev->query_device_descriptor(pdev, BCD_DEVICE); const UINT16 bcdDevice = (UINT16)pdev->query_device_descriptor(pdev, BCD_DEVICE);
sprintf_s(HardwareIds[1], DEVICE_HARDWARE_ID_SIZE, (void)sprintf_s(HardwareIds[1], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "", idVendor, idProduct); "USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "", idVendor, idProduct);
sprintf_s(HardwareIds[0], DEVICE_HARDWARE_ID_SIZE, (void)sprintf_s(HardwareIds[0], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "&REV_%04" PRIX16 "", idVendor, idProduct, "USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "&REV_%04" PRIX16 "", idVendor,
bcdDevice); idProduct, bcdDevice);
} }
{ {
const UINT8 bDeviceClass = (UINT8)pdev->query_device_descriptor(pdev, B_DEVICE_CLASS); const UINT8 bDeviceClass = (UINT8)pdev->query_device_descriptor(pdev, B_DEVICE_CLASS);
@ -259,22 +259,22 @@ static UINT urdbrc_send_usb_device_add(GENERIC_CHANNEL_CALLBACK* callback, IUDEV
if (!(pdev->isCompositeDevice(pdev))) if (!(pdev->isCompositeDevice(pdev)))
{ {
sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\Class_%02" PRIX8 "", (void)sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE,
bDeviceClass); "USB\\Class_%02" PRIX8 "", bDeviceClass);
sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE, (void)sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "", bDeviceClass, "USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "", bDeviceClass,
bDeviceSubClass); bDeviceSubClass);
sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE, (void)sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "&Prot_%02" PRIX8 "", "USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "&Prot_%02" PRIX8 "",
bDeviceClass, bDeviceSubClass, bDeviceProtocol); bDeviceClass, bDeviceSubClass, bDeviceProtocol);
} }
else else
{ {
sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\DevClass_00"); (void)sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\DevClass_00");
sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE, (void)sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00"); "USB\\DevClass_00&SubClass_00");
sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE, (void)sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00&Prot_00"); "USB\\DevClass_00&SubClass_00&Prot_00");
} }
} }
func_instance_id_generate(pdev, strInstanceId, DEVICE_INSTANCE_STR_SIZE); func_instance_id_generate(pdev, strInstanceId, DEVICE_INSTANCE_STR_SIZE);

View File

@ -663,9 +663,9 @@ static const char* sdl_window_get_title(rdpSettings* settings)
char buffer[MAX_PATH + 64] = { 0 }; char buffer[MAX_PATH + 64] = { 0 };
if (!addPort) if (!addPort)
sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name); (void)sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name);
else else
sprintf_s(buffer, sizeof(buffer), "%s %s:%" PRIu32, prefix, name, port); (void)sprintf_s(buffer, sizeof(buffer), "%s %s:%" PRIu32, prefix, name, port);
if (!freerdp_settings_set_string(settings, FreeRDP_WindowTitle, buffer)) if (!freerdp_settings_set_string(settings, FreeRDP_WindowTitle, buffer))
return nullptr; return nullptr;

View File

@ -108,7 +108,7 @@ static void wlf_request_free(void* rq)
{ {
free(request->responseMime); free(request->responseMime);
if (request->responseFile) if (request->responseFile)
fclose(request->responseFile); (void)fclose(request->responseFile);
} }
free(request); free(request);
} }

View File

@ -582,7 +582,7 @@ disconnect:
static BOOL wlf_client_global_init(void) static BOOL wlf_client_global_init(void)
{ {
setlocale(LC_ALL, ""); (void)setlocale(LC_ALL, "");
if (freerdp_handle_signals() != 0) if (freerdp_handle_signals() != 0)
return FALSE; return FALSE;

View File

@ -539,10 +539,10 @@ static char* xf_window_get_title(rdpSettings* settings)
return NULL; return NULL;
if (!port) if (!port)
sprintf_s(windowTitle, size, "%s %s", prefix, name); (void)sprintf_s(windowTitle, size, "%s %s", prefix, name);
else else
sprintf_s(windowTitle, size, "%s %s:%i", prefix, name, (void)sprintf_s(windowTitle, size, "%s %s:%i", prefix, name,
freerdp_settings_get_uint32(settings, FreeRDP_ServerPort)); freerdp_settings_get_uint32(settings, FreeRDP_ServerPort));
return windowTitle; return windowTitle;
} }
@ -1749,7 +1749,7 @@ static void xf_PanningChangeEventHandler(void* context, const PanningChangeEvent
static BOOL xfreerdp_client_global_init(void) static BOOL xfreerdp_client_global_init(void)
{ {
setlocale(LC_ALL, ""); (void)setlocale(LC_ALL, "");
if (freerdp_handle_signals() != 0) if (freerdp_handle_signals() != 0)
return FALSE; return FALSE;

View File

@ -305,8 +305,8 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
char command[2048] = { 0 }; char command[2048] = { 0 };
char arg[2048] = { 0 }; char arg[2048] = { 0 };
_snprintf(command, sizeof(command), "xevent %s", xeventName); (void)_snprintf(command, sizeof(command), "xevent %s", xeventName);
_snprintf(arg, sizeof(arg), "%lu", (unsigned long)xfc->window->handle); (void)_snprintf(arg, sizeof(arg), "%lu", (unsigned long)xfc->window->handle);
if (!run_action_script(xfc, command, arg, action_script_run, NULL)) if (!run_action_script(xfc, command, arg, action_script_run, NULL))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -533,7 +533,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
if (!match) if (!match)
return 1; return 1;
sprintf_s(command, sizeof(command), "key %s", combination); (void)sprintf_s(command, sizeof(command), "key %s", combination);
if (!run_action_script(xfc, command, NULL, action_script_run, &status)) if (!run_action_script(xfc, command, NULL, action_script_run, &status))
return -1; return -1;

View File

@ -194,7 +194,7 @@ BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_act
goto fail; goto fail;
char command[2048] = { 0 }; char command[2048] = { 0 };
sprintf_s(command, sizeof(command), "%s %s", ActionScript, what); (void)sprintf_s(command, sizeof(command), "%s %s", ActionScript, what);
keyScript = popen(command, "r"); keyScript = popen(command, "r");
if (!keyScript) if (!keyScript)
@ -208,7 +208,7 @@ BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_act
while (fgets(buffer, sizeof(buffer), keyScript) != NULL) while (fgets(buffer, sizeof(buffer), keyScript) != NULL)
{ {
char* context = NULL; char* context = NULL;
strtok_s(buffer, "\n", &context); (void)strtok_s(buffer, "\n", &context);
if (fkt) if (fkt)
{ {

View File

@ -472,7 +472,8 @@ static void xf_SetWindowPID(xfContext* xfc, Window window, pid_t pid)
static const char* get_shm_id(void) static const char* get_shm_id(void)
{ {
static char shm_id[64]; static char shm_id[64];
sprintf_s(shm_id, sizeof(shm_id), "/com.freerdp.xfreerdp.tsmf_%016X", GetCurrentProcessId()); (void)sprintf_s(shm_id, sizeof(shm_id), "/com.freerdp.xfreerdp.tsmf_%016X",
GetCurrentProcessId());
return shm_id; return shm_id;
} }

View File

@ -458,7 +458,7 @@ static BOOL client_cli_authenticate_raw(freerdp* instance, rdp_auth_reason reaso
{ {
size_t username_size = 0; size_t username_size = 0;
printf("%s", prompt[0]); printf("%s", prompt[0]);
fflush(stdout); (void)fflush(stdout);
if (freerdp_interruptible_get_line(instance->context, username, &username_size, stdin) < 0) if (freerdp_interruptible_get_line(instance->context, username, &username_size, stdin) < 0)
{ {
@ -479,7 +479,7 @@ static BOOL client_cli_authenticate_raw(freerdp* instance, rdp_auth_reason reaso
{ {
size_t domain_size = 0; size_t domain_size = 0;
printf("%s", prompt[1]); printf("%s", prompt[1]);
fflush(stdout); (void)fflush(stdout);
if (freerdp_interruptible_get_line(instance->context, domain, &domain_size, stdin) < 0) if (freerdp_interruptible_get_line(instance->context, domain, &domain_size, stdin) < 0)
{ {
@ -579,7 +579,7 @@ BOOL client_cli_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_lis
printf("\nChoose a smartcard to use for %s (0 - %" PRIu32 "): ", printf("\nChoose a smartcard to use for %s (0 - %" PRIu32 "): ",
gateway ? "gateway authentication" : "logon", count - 1); gateway ? "gateway authentication" : "logon", count - 1);
fflush(stdout); (void)fflush(stdout);
if (!fgets(input, 10, stdin)) if (!fgets(input, 10, stdin))
{ {
WLog_ERR(TAG, "could not read from stdin"); WLog_ERR(TAG, "could not read from stdin");
@ -631,7 +631,7 @@ static DWORD client_cli_accept_certificate(freerdp* instance)
while (1) while (1)
{ {
printf("Do you trust the above certificate? (Y/T/N) "); printf("Do you trust the above certificate? (Y/T/N) ");
fflush(stdout); (void)fflush(stdout);
answer = freerdp_interruptible_getc(instance->context, stdin); answer = freerdp_interruptible_getc(instance->context, stdin);
if ((answer == EOF) || feof(stdin)) if ((answer == EOF) || feof(stdin))
@ -943,7 +943,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
while (isConsentMandatory) while (isConsentMandatory)
{ {
printf("I understand and agree to the terms of this policy (Y/N) \n"); printf("I understand and agree to the terms of this policy (Y/N) \n");
fflush(stdout); (void)fflush(stdout);
answer = freerdp_interruptible_getc(instance->context, stdin); answer = freerdp_interruptible_getc(instance->context, stdin);
if ((answer == EOF) || feof(stdin)) if ((answer == EOF) || feof(stdin))

View File

@ -1401,7 +1401,7 @@ static void cliprdr_local_file_try_close(CliprdrLocalFile* file, UINT res, UINT6
// TODO: for the time being just close again. // TODO: for the time being just close again.
} }
if (file->fp) if (file->fp)
fclose(file->fp); (void)fclose(file->fp);
file->fp = NULL; file->fp = NULL;
} }
@ -1705,9 +1705,11 @@ static CliprdrFuseFile* clip_data_dir_new(CliprdrFileContext* file_context, BOOL
} }
if (has_clip_data_id) if (has_clip_data_id)
_snprintf(clip_data_dir->filename_with_root, path_length, "/%u", (unsigned)clip_data_id); (void)_snprintf(clip_data_dir->filename_with_root, path_length, "/%u",
(unsigned)clip_data_id);
else else
_snprintf(clip_data_dir->filename_with_root, path_length, "/%" PRIu64, NO_CLIP_DATA_ID); (void)_snprintf(clip_data_dir->filename_with_root, path_length, "/%" PRIu64,
NO_CLIP_DATA_ID);
clip_data_dir->filename = strrchr(clip_data_dir->filename_with_root, '/') + 1; clip_data_dir->filename = strrchr(clip_data_dir->filename_with_root, '/') + 1;
@ -1863,8 +1865,8 @@ static BOOL set_selection_for_clip_data_entry(CliprdrFileContext* file_context,
return FALSE; return FALSE;
} }
_snprintf(fuse_file->filename_with_root, path_length, "%s/%s", (void)_snprintf(fuse_file->filename_with_root, path_length, "%s/%s",
clip_data_dir->filename_with_root, filename); clip_data_dir->filename_with_root, filename);
free(filename); free(filename);
fuse_file->filename = strrchr(fuse_file->filename_with_root, '/') + 1; fuse_file->filename = strrchr(fuse_file->filename_with_root, '/') + 1;
@ -2098,7 +2100,8 @@ static BOOL create_base_path(CliprdrFileContext* file)
WINPR_ASSERT(file); WINPR_ASSERT(file);
char base[64] = { 0 }; char base[64] = { 0 };
_snprintf(base, sizeof(base), "com.freerdp.client.cliprdr.%" PRIu32, GetCurrentProcessId()); (void)_snprintf(base, sizeof(base), "com.freerdp.client.cliprdr.%" PRIu32,
GetCurrentProcessId());
file->path = GetKnownSubPath(KNOWN_PATH_TEMP, base); file->path = GetKnownSubPath(KNOWN_PATH_TEMP, base);
if (!file->path) if (!file->path)
@ -2120,7 +2123,7 @@ static void cliprdr_local_file_free(CliprdrLocalFile* file)
if (file->fp) if (file->fp)
{ {
WLog_Print(file->context->log, WLOG_DEBUG, "closing file %s, discarding entry", file->name); WLog_Print(file->context->log, WLOG_DEBUG, "closing file %s, discarding entry", file->name);
fclose(file->fp); (void)fclose(file->fp);
} }
free(file->name); free(file->name);
*file = empty; *file = empty;
@ -2366,7 +2369,7 @@ static CliprdrFuseFile* fuse_file_new_root(CliprdrFileContext* file_context)
return NULL; return NULL;
} }
_snprintf(root_dir->filename_with_root, 2, "/"); (void)_snprintf(root_dir->filename_with_root, 2, "/");
root_dir->filename = root_dir->filename_with_root; root_dir->filename = root_dir->filename_with_root;
root_dir->ino = FUSE_ROOT_ID; root_dir->ino = FUSE_ROOT_ID;

View File

@ -100,10 +100,10 @@ static BOOL freerdp_client_print_codepages(const char* arg)
char buffer[2048] = { 0 }; char buffer[2048] = { 0 };
if (strnlen(page->subLanguageSymbol, ARRAYSIZE(page->subLanguageSymbol)) > 0) if (strnlen(page->subLanguageSymbol, ARRAYSIZE(page->subLanguageSymbol)) > 0)
_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol, (void)_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol,
page->subLanguageSymbol); page->subLanguageSymbol);
else else
_snprintf(buffer, sizeof(buffer), "[%s]", page->primaryLanguageSymbol); (void)_snprintf(buffer, sizeof(buffer), "[%s]", page->primaryLanguageSymbol);
printf("id=0x%04" PRIx16 ": [%-6s] %-60s %-36s %-48s\n", page->id, page->locale, buffer, printf("id=0x%04" PRIx16 ": [%-6s] %-60s %-36s %-48s\n", page->id, page->locale, buffer,
page->primaryLanguage, page->subLanguage); page->primaryLanguage, page->subLanguage);
} }
@ -2857,7 +2857,7 @@ static int parse_kbd_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
if (!tmp) if (!tmp)
rc = COMMAND_LINE_ERROR_MEMORY; rc = COMMAND_LINE_ERROR_MEMORY;
else else
_snprintf(tmp, tlen, "%s,%s", old, now); (void)_snprintf(tmp, tlen, "%s,%s", old, now);
free(now); free(now);
now = tmp; now = tmp;
} }

View File

@ -1028,7 +1028,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
if (file_size < 1) if (file_size < 1)
{ {
WLog_ERR(TAG, "RDP file %s is empty", name); WLog_ERR(TAG, "RDP file %s is empty", name);
fclose(fp); (void)fclose(fp);
return FALSE; return FALSE;
} }
@ -1036,7 +1036,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
if (!buffer) if (!buffer)
{ {
fclose(fp); (void)fclose(fp);
return FALSE; return FALSE;
} }
@ -1048,7 +1048,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
read_size = (size_t)file_size; read_size = (size_t)file_size;
} }
fclose(fp); (void)fclose(fp);
if (read_size < 1) if (read_size < 1)
{ {
@ -1390,7 +1390,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
if (!unicodestr) if (!unicodestr)
{ {
free(buffer); free(buffer);
fclose(fp); (void)fclose(fp);
return FALSE; return FALSE;
} }
@ -1400,7 +1400,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
{ {
free(buffer); free(buffer);
free(unicodestr); free(unicodestr);
fclose(fp); (void)fclose(fp);
return FALSE; return FALSE;
} }
@ -1411,12 +1411,12 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
if (fwrite(buffer, 1, (size_t)size, fp) != (size_t)size) if (fwrite(buffer, 1, (size_t)size, fp) != (size_t)size)
{ {
free(buffer); free(buffer);
fclose(fp); (void)fclose(fp);
return FALSE; return FALSE;
} }
} }
fflush(fp); (void)fflush(fp);
status = fclose(fp); status = fclose(fp);
} }
@ -1652,7 +1652,7 @@ static ADDIN_ARGV* rdp_file_to_args(const char* channel, const char* values)
if (!str) if (!str)
goto fail; goto fail;
_snprintf(str, len, "device:%s", val); (void)_snprintf(str, len, "device:%s", val);
rc = freerdp_addin_argv_add_argument(args, str); rc = freerdp_addin_argv_add_argument(args, str);
free(str); free(str);
if (!rc) if (!rc)

View File

@ -12,8 +12,9 @@ static char* resize(char** buffer, size_t* size, size_t increment)
char* tmp = realloc(*buffer, nsize); char* tmp = realloc(*buffer, nsize);
if (!tmp) if (!tmp)
{ {
fprintf(stderr, "Could not reallocate string buffer from %" PRIuz " to %" PRIuz " bytes.\n", (void)fprintf(stderr,
*size, nsize); "Could not reallocate string buffer from %" PRIuz " to %" PRIuz " bytes.\n",
*size, nsize);
free(*buffer); free(*buffer);
return NULL; return NULL;
} }
@ -113,24 +114,24 @@ int main(int argc, char* argv[])
size_t elements = sizeof(global_cmd_args) / sizeof(global_cmd_args[0]); size_t elements = sizeof(global_cmd_args) / sizeof(global_cmd_args[0]);
const char* fname = "freerdp-argument.1.xml"; const char* fname = "freerdp-argument.1.xml";
fprintf(stdout, "Generating docbook file '%s'\n", fname); (void)fprintf(stdout, "Generating docbook file '%s'\n", fname);
FILE* fp = fopen(fname, "w"); FILE* fp = fopen(fname, "w");
if (NULL == fp) if (NULL == fp)
{ {
fprintf(stderr, "Could not open '%s' for writing.\n", fname); (void)fprintf(stderr, "Could not open '%s' for writing.\n", fname);
return -1; return -1;
} }
/* The tag used as header in the manpage */ /* The tag used as header in the manpage */
fprintf(fp, "<refsect1>\n"); (void)fprintf(fp, "<refsect1>\n");
fprintf(fp, "\t<title>Options</title>\n"); (void)fprintf(fp, "\t<title>Options</title>\n");
fprintf(fp, "\t\t<variablelist>\n"); (void)fprintf(fp, "\t\t<variablelist>\n");
/* Iterate over argument struct and write data to docbook 4.5 /* Iterate over argument struct and write data to docbook 4.5
* compatible XML */ * compatible XML */
if (elements < 2) if (elements < 2)
{ {
fprintf(stderr, "The argument array 'args' is empty, writing an empty file.\n"); (void)fprintf(stderr, "The argument array 'args' is empty, writing an empty file.\n");
elements = 1; elements = 1;
} }
@ -141,31 +142,31 @@ int main(int argc, char* argv[])
char* alias = tr_esc_str(arg->Alias, FALSE); char* alias = tr_esc_str(arg->Alias, FALSE);
char* format = tr_esc_str(arg->Format, TRUE); char* format = tr_esc_str(arg->Format, TRUE);
char* text = tr_esc_str(arg->Text, FALSE); char* text = tr_esc_str(arg->Text, FALSE);
fprintf(fp, "\t\t\t<varlistentry>\n"); (void)fprintf(fp, "\t\t\t<varlistentry>\n");
do do
{ {
fprintf(fp, "\t\t\t\t<term><option>"); (void)fprintf(fp, "\t\t\t\t<term><option>");
if (arg->Flags == COMMAND_LINE_VALUE_BOOL) if (arg->Flags == COMMAND_LINE_VALUE_BOOL)
fprintf(fp, "%s", arg->Default ? "-" : "+"); (void)fprintf(fp, "%s", arg->Default ? "-" : "+");
else else
fprintf(fp, "/"); (void)fprintf(fp, "/");
fprintf(fp, "%s</option>", name); (void)fprintf(fp, "%s</option>", name);
if (format) if (format)
{ {
if (arg->Flags == COMMAND_LINE_VALUE_OPTIONAL) if (arg->Flags == COMMAND_LINE_VALUE_OPTIONAL)
fprintf(fp, "["); (void)fprintf(fp, "[");
fprintf(fp, ":%s", format); (void)fprintf(fp, ":%s", format);
if (arg->Flags == COMMAND_LINE_VALUE_OPTIONAL) if (arg->Flags == COMMAND_LINE_VALUE_OPTIONAL)
fprintf(fp, "]"); (void)fprintf(fp, "]");
} }
fprintf(fp, "</term>\n"); (void)fprintf(fp, "</term>\n");
if (alias == name) if (alias == name)
break; break;
@ -176,36 +177,36 @@ int main(int argc, char* argv[])
if (text) if (text)
{ {
fprintf(fp, "\t\t\t\t<listitem>\n"); (void)fprintf(fp, "\t\t\t\t<listitem>\n");
fprintf(fp, "\t\t\t\t\t<para>"); (void)fprintf(fp, "\t\t\t\t\t<para>");
if (text) if (text)
fprintf(fp, "%s", text); (void)fprintf(fp, "%s", text);
if (arg->Flags & COMMAND_LINE_VALUE_BOOL && if (arg->Flags & COMMAND_LINE_VALUE_BOOL &&
(!arg->Default || arg->Default == BoolValueTrue)) (!arg->Default || arg->Default == BoolValueTrue))
fprintf(fp, " (default:%s)", arg->Default ? "on" : "off"); (void)fprintf(fp, " (default:%s)", arg->Default ? "on" : "off");
else if (arg->Default) else if (arg->Default)
{ {
char* value = tr_esc_str(arg->Default, FALSE); char* value = tr_esc_str(arg->Default, FALSE);
fprintf(fp, " (default:%s)", value); (void)fprintf(fp, " (default:%s)", value);
free(value); free(value);
} }
fprintf(fp, "</para>\n"); (void)fprintf(fp, "</para>\n");
fprintf(fp, "\t\t\t\t</listitem>\n"); (void)fprintf(fp, "\t\t\t\t</listitem>\n");
} }
fprintf(fp, "\t\t\t</varlistentry>\n"); (void)fprintf(fp, "\t\t\t</varlistentry>\n");
free(name); free(name);
free(format); free(format);
free(text); free(text);
} }
fprintf(fp, "\t\t</variablelist>\n"); (void)fprintf(fp, "\t\t</variablelist>\n");
fprintf(fp, "\t</refsect1>\n"); (void)fprintf(fp, "\t</refsect1>\n");
fclose(fp); (void)fclose(fp);
fprintf(stdout, "successfully generated '%s'\n", fname); (void)fprintf(stdout, "successfully generated '%s'\n", fname);
return 0; return 0;
} }

View File

@ -10,22 +10,22 @@ typedef BOOL (*validate_settings_pr)(rdpSettings* settings);
#define printref() printf("%s:%d: in function %-40s:", __FILE__, __LINE__, __func__) #define printref() printf("%s:%d: in function %-40s:", __FILE__, __LINE__, __func__)
#define TEST_ERROR(format, ...) \ #define TEST_ERROR(format, ...) \
do \ do \
{ \ { \
fprintf(stderr, format, ##__VA_ARGS__); \ (void)fprintf(stderr, format, ##__VA_ARGS__); \
printref(); \ printref(); \
printf(format, ##__VA_ARGS__); \ (void)printf(format, ##__VA_ARGS__); \
fflush(stdout); \ (void)fflush(stdout); \
} while (0) } while (0)
#define TEST_FAILURE(format, ...) \ #define TEST_FAILURE(format, ...) \
do \ do \
{ \ { \
printref(); \ printref(); \
printf(" FAILURE "); \ (void)printf(" FAILURE "); \
printf(format, ##__VA_ARGS__); \ (void)printf(format, ##__VA_ARGS__); \
fflush(stdout); \ (void)fflush(stdout); \
} while (0) } while (0)
static void print_test_title(int argc, char** argv) static void print_test_title(int argc, char** argv)
@ -223,7 +223,7 @@ static void check_modified_arguments(const test* test, char** command_line, int*
printref(); printref();
printf("Failure: overridden argument %d is %s but it should be %s\n", index, printf("Failure: overridden argument %d is %s but it should be %s\n", index,
actual_argument, expected_argument); actual_argument, expected_argument);
fflush(stdout); (void)fflush(stdout);
*rc = -1; *rc = -1;
} }
} }

View File

@ -263,7 +263,7 @@ static int persistent_cache_open_read(rdpPersistentCache* persistent)
else else
persistent->version = 2; persistent->version = 2;
fseek(persistent->fp, 0, SEEK_SET); (void)fseek(persistent->fp, 0, SEEK_SET);
if (persistent->version == 3) if (persistent->version == 3)
{ {
@ -281,7 +281,7 @@ static int persistent_cache_open_read(rdpPersistentCache* persistent)
offset = 0; offset = 0;
} }
fseek(persistent->fp, offset, SEEK_SET); (void)fseek(persistent->fp, offset, SEEK_SET);
return status; return status;
} }
@ -336,7 +336,7 @@ int persistent_cache_close(rdpPersistentCache* persistent)
WINPR_ASSERT(persistent); WINPR_ASSERT(persistent);
if (persistent->fp) if (persistent->fp)
{ {
fclose(persistent->fp); (void)fclose(persistent->fp);
persistent->fp = NULL; persistent->fp = NULL;
} }

View File

@ -149,7 +149,7 @@ static const char* rle_code_str(UINT32 code)
static const char* rle_code_str_buffer(UINT32 code, char* buffer, size_t size) static const char* rle_code_str_buffer(UINT32 code, char* buffer, size_t size)
{ {
const char* str = rle_code_str(code); const char* str = rle_code_str(code);
_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, code); (void)_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, code);
return buffer; return buffer;
} }

View File

@ -59,8 +59,8 @@ static BOOL test_ClearDecompressExample(UINT32 nr, UINT32 width, UINT32 height,
status = clear_decompress(clear, pSrcData, SrcSize, width, height, pDstData, status = clear_decompress(clear, pSrcData, SrcSize, width, height, pDstData,
PIXEL_FORMAT_XRGB32, 0, 0, 0, width, height, NULL); PIXEL_FORMAT_XRGB32, 0, 0, 0, width, height, NULL);
printf("clear_decompress example %" PRIu32 " status: %d\n", nr, status); (void)printf("clear_decompress example %" PRIu32 " status: %d\n", nr, status);
fflush(stdout); (void)fflush(stdout);
rc = (status == 0); rc = (status == 0);
fail: fail:
clear_context_free(clear); clear_context_free(clear);

View File

@ -35,9 +35,10 @@ static BOOL TestFreeRDPImageCopy(UINT32 w, UINT32 h, UINT32 srcFormat, UINT32 ds
double ms = end - start; double ms = end - start;
ms /= 1000000.0; ms /= 1000000.0;
fprintf(stdout, "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n", (void)fprintf(stdout,
__func__, w, h, FreeRDPGetColorFormatName(srcFormat), "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure"); __func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
if (!rc) if (!rc)
break; break;
} }
@ -72,9 +73,10 @@ static BOOL TestFreeRDPImageCopy_no_overlap(UINT32 w, UINT32 h, UINT32 srcFormat
double ms = end - start; double ms = end - start;
ms /= 1000000.0; ms /= 1000000.0;
fprintf(stdout, "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n", (void)fprintf(stdout,
__func__, w, h, FreeRDPGetColorFormatName(srcFormat), "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure"); __func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
if (!rc) if (!rc)
break; break;
} }
@ -106,8 +108,8 @@ int TestFreeRDPCodecCopy(int argc, char* argv[])
if ((errno != 0) || (width == 0) || (height == 0)) if ((errno != 0) || (width == 0) || (height == 0))
{ {
char buffer[128] = { 0 }; char buffer[128] = { 0 };
fprintf(stderr, "%s failed: width=%" PRIu32 ", height=%" PRIu32 ", errno=%s\n", (void)fprintf(stderr, "%s failed: width=%" PRIu32 ", height=%" PRIu32 ", errno=%s\n",
__func__, width, height, winpr_strerror(errno, buffer, sizeof(buffer))); __func__, width, height, winpr_strerror(errno, buffer, sizeof(buffer)));
return -1; return -1;
} }
} }

View File

@ -5509,9 +5509,9 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap,
BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar, srcBitmap, srcFormat, width, BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar, srcBitmap, srcFormat, width,
height, 0, NULL, &dstSize); height, 0, NULL, &dstSize);
BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat)); BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat));
printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat), (void)printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat)); FreeRDPGetColorFormatName(dstFormat));
fflush(stdout); (void)fflush(stdout);
printf("TODO: Skipping unfinished test!"); printf("TODO: Skipping unfinished test!");
rc = TRUE; rc = TRUE;
goto fail; goto fail;
@ -5539,8 +5539,8 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap,
fail: fail:
free(compressedBitmap); free(compressedBitmap);
free(decompressedBitmap); free(decompressedBitmap);
printf("\n"); (void)printf("\n");
fflush(stdout); (void)fflush(stdout);
return rc; return rc;
} }
@ -5548,9 +5548,9 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
const UINT32 dstFormat) const UINT32 dstFormat)
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat), (void)printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat)); FreeRDPGetColorFormatName(dstFormat));
fflush(stdout); (void)fflush(stdout);
for (UINT32 j = 0; j < 32; j += 8) for (UINT32 j = 0; j < 32; j += 8)
{ {
@ -5610,11 +5610,11 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
} }
} }
printf("SUCCESS"); (void)printf("SUCCESS");
rc = TRUE; rc = TRUE;
fail: fail:
printf("\n"); (void)printf("\n");
fflush(stdout); (void)fflush(stdout);
return rc; return rc;
} }

View File

@ -296,18 +296,18 @@ static BYTE* test_progressive_load_file(const char* path, const char* file, size
if (!buffer) if (!buffer)
{ {
fclose(fp); (void)fclose(fp);
return NULL; return NULL;
} }
if (fread(buffer, *size, 1, fp) != 1) if (fread(buffer, *size, 1, fp) != 1)
{ {
free(buffer); free(buffer);
fclose(fp); (void)fclose(fp);
return NULL; return NULL;
} }
fclose(fp); (void)fclose(fp);
return buffer; return buffer;
} }
@ -1171,14 +1171,14 @@ static void free_cmd(RDPGFX_SURFACE_COMMAND* cmd)
static WINPR_NORETURN(void usage(const char* name)) static WINPR_NORETURN(void usage(const char* name))
{ {
FILE* fp = stdout; FILE* fp = stdout;
fprintf(fp, "%s <directory> <width> <height>\n", name); (void)fprintf(fp, "%s <directory> <width> <height>\n", name);
exit(-1); exit(-1);
} }
static void print_codec_stats(const char* name, UINT64 timeNS) static void print_codec_stats(const char* name, UINT64 timeNS)
{ {
const double dectimems = timeNS / 1000000.0; const double dectimems = timeNS / 1000000.0;
fprintf(stderr, "[%s] took %lf ms to decode\n", name, dectimems); (void)fprintf(stderr, "[%s] took %lf ms to decode\n", name, dectimems);
} }
static int test_dump(int argc, char* argv[]) static int test_dump(int argc, char* argv[])
@ -1259,7 +1259,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
CAPROGRESSIVE_dectime += diff; CAPROGRESSIVE_dectime += diff;
} }
break; break;
@ -1280,7 +1281,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
UNCOMPRESSED_dectime += diff; UNCOMPRESSED_dectime += diff;
} }
break; break;
@ -1294,7 +1296,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
CAVIDEO_dectime += diff; CAVIDEO_dectime += diff;
} }
break; break;
@ -1314,7 +1317,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
CLEARCODEC_dectime += diff; CLEARCODEC_dectime += diff;
} }
break; break;
@ -1337,7 +1341,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
PLANAR_dectime += diff; PLANAR_dectime += diff;
} }
break; break;
@ -1348,7 +1353,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
AVC420_dectime += diff; AVC420_dectime += diff;
success = -1; success = -1;
} }
@ -1360,7 +1366,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
ALPHA_dectime += diff; ALPHA_dectime += diff;
success = -1; success = -1;
} }
@ -1372,7 +1379,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
AVC444_dectime += diff; AVC444_dectime += diff;
success = -1; success = -1;
} }
@ -1384,14 +1392,15 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId, ddiff); (void)fprintf(stderr, "frame [%s] %" PRIu32 " took %lf ms\n", cname, frameId,
ddiff);
AVC444v2_dectime += diff; AVC444v2_dectime += diff;
success = -1; success = -1;
} }
break; break;
default: default:
fprintf(stderr, "unexpected codec %s [0x%08" PRIx32 "]", (void)fprintf(stderr, "unexpected codec %s [0x%08" PRIx32 "]",
rdpgfx_get_codec_id_string(cmd.codecId), cmd.codecId); rdpgfx_get_codec_id_string(cmd.codecId), cmd.codecId);
success = -1; success = -1;
break; break;
} }
@ -1415,13 +1424,13 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS(); const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start; const UINT64 diff = end - start;
const double ddiff = diff / 1000000.0; const double ddiff = diff / 1000000.0;
fprintf(stderr, "frame %" PRIu32 " copy took %lf ms\n", frameId, ddiff); (void)fprintf(stderr, "frame %" PRIu32 " copy took %lf ms\n", frameId, ddiff);
copytime += diff; copytime += diff;
} }
region16_clear(&invalid); region16_clear(&invalid);
} }
free_cmd(&cmd); free_cmd(&cmd);
fclose(fp); (void)fclose(fp);
} }
fail: fail:
@ -1464,11 +1473,11 @@ int TestFreeRDPCodecProgressive(int argc, char* argv[])
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
GetSystemTime(&systemTime); GetSystemTime(&systemTime);
sprintf_s(name, sizeof(name), (void)sprintf_s(name, sizeof(name),
"EGFX_PROGRESSIVE_MS_SAMPLE-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16 "EGFX_PROGRESSIVE_MS_SAMPLE-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16
"%02" PRIu16 "%02" PRIu16 "%04" PRIu16, "%02" PRIu16 "%02" PRIu16 "%04" PRIu16,
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds); systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
ms_sample_path = _strdup(CMAKE_CURRENT_SOURCE_DIR); ms_sample_path = _strdup(CMAKE_CURRENT_SOURCE_DIR);
if (!ms_sample_path) if (!ms_sample_path)

View File

@ -28,11 +28,11 @@ static BOOL compareRectangles(const RECTANGLE_16* src1, const RECTANGLE_16* src2
{ {
if (memcmp(src1, src2, sizeof(RECTANGLE_16))) if (memcmp(src1, src2, sizeof(RECTANGLE_16)))
{ {
fprintf(stderr, (void)fprintf(stderr,
"expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16 "expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16
") and have (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16 ")\n", ") and have (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16 ")\n",
i, src2->left, src2->top, src2->right, src2->bottom, src1->left, src1->top, i, src2->left, src2->top, src2->right, src2->bottom, src1->left,
src1->right, src1->bottom); src1->top, src1->right, src1->bottom);
return FALSE; return FALSE;
} }
} }
@ -709,57 +709,57 @@ static int test_norbert2_case(void)
if (!region16_union_rect(&region, &region, &rect1)) if (!region16_union_rect(&region, &region, &rect1))
{ {
fprintf(stderr, "%s: Error 1 - region16_union_rect failed\n", __func__); (void)fprintf(stderr, "%s: Error 1 - region16_union_rect failed\n", __func__);
goto out; goto out;
} }
if (!(rects = region16_rects(&region, &nbRects))) if (!(rects = region16_rects(&region, &nbRects)))
{ {
fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __func__); (void)fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __func__);
goto out; goto out;
} }
if (nbRects != 1) if (nbRects != 1)
{ {
fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __func__, (void)fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __func__,
nbRects); nbRects);
goto out; goto out;
} }
if (!compareRectangles(&rects[0], &rect1, 1)) if (!compareRectangles(&rects[0], &rect1, 1))
{ {
fprintf(stderr, "%s: Error 4 - compare failed\n", __func__); (void)fprintf(stderr, "%s: Error 4 - compare failed\n", __func__);
goto out; goto out;
} }
if (!region16_union_rect(&region, &region, &rect2)) if (!region16_union_rect(&region, &region, &rect2))
{ {
fprintf(stderr, "%s: Error 5 - region16_union_rect failed\n", __func__); (void)fprintf(stderr, "%s: Error 5 - region16_union_rect failed\n", __func__);
goto out; goto out;
} }
if (!(rects = region16_rects(&region, &nbRects))) if (!(rects = region16_rects(&region, &nbRects)))
{ {
fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __func__); (void)fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __func__);
goto out; goto out;
} }
if (nbRects != 2) if (nbRects != 2)
{ {
fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __func__, (void)fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __func__,
nbRects); nbRects);
goto out; goto out;
} }
if (!compareRectangles(&rects[0], &rect2, 1)) if (!compareRectangles(&rects[0], &rect2, 1))
{ {
fprintf(stderr, "%s: Error 8 - compare failed\n", __func__); (void)fprintf(stderr, "%s: Error 8 - compare failed\n", __func__);
goto out; goto out;
} }
if (!compareRectangles(&rects[1], &rect1, 1)) if (!compareRectangles(&rects[1], &rect1, 1))
{ {
fprintf(stderr, "%s: Error 9 - compare failed\n", __func__); (void)fprintf(stderr, "%s: Error 9 - compare failed\n", __func__);
goto out; goto out;
} }
@ -849,7 +849,7 @@ int TestFreeRDPRegion(int argc, char* argv[])
for (int i = 0; tests[i].func; i++) for (int i = 0; tests[i].func; i++)
{ {
testNb++; testNb++;
fprintf(stderr, "%d: %s\n", testNb, tests[i].name); (void)fprintf(stderr, "%d: %s\n", testNb, tests[i].name);
retCode = tests[i].func(); retCode = tests[i].func();
if (retCode < 0) if (retCode < 0)
@ -857,7 +857,7 @@ int TestFreeRDPRegion(int argc, char* argv[])
} }
if (retCode < 0) if (retCode < 0)
fprintf(stderr, "failed for test %d\n", testNb); (void)fprintf(stderr, "failed for test %d\n", testNb);
return retCode; return retCode;
} }

View File

@ -187,8 +187,8 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPa
if (!pszAddinFile) if (!pszAddinFile)
goto fail; goto fail;
sprintf_s(pszAddinFile, cchAddinFile, FREERDP_SHARED_LIBRARY_PREFIX "%s%s", pszFileName, (void)sprintf_s(pszAddinFile, cchAddinFile, FREERDP_SHARED_LIBRARY_PREFIX "%s%s",
pszExt); pszFileName, pszExt);
} }
cchAddinFile = strlen(pszAddinFile); cchAddinFile = strlen(pszAddinFile);
@ -202,7 +202,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPa
if (!pszRelativeFilePath) if (!pszRelativeFilePath)
goto fail; goto fail;
sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszPath); (void)sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszPath);
const HRESULT hr = NativePathCchAppendA(pszRelativeFilePath, relPathLen, pszAddinFile); const HRESULT hr = NativePathCchAppendA(pszRelativeFilePath, relPathLen, pszAddinFile);
if (FAILED(hr)) if (FAILED(hr))
goto fail; goto fail;
@ -277,7 +277,8 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
if (!pszFileName) if (!pszFileName)
return NULL; return NULL;
sprintf_s(pszFileName, cchFileName, "%s-client-%s-%s", pszName, pszSubsystem, pszType); (void)sprintf_s(pszFileName, cchFileName, "%s-client-%s-%s", pszName, pszSubsystem,
pszType);
} }
else if (pszName && pszSubsystem) else if (pszName && pszSubsystem)
{ {
@ -287,7 +288,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
if (!pszFileName) if (!pszFileName)
return NULL; return NULL;
sprintf_s(pszFileName, cchFileName, "%s-client-%s", pszName, pszSubsystem); (void)sprintf_s(pszFileName, cchFileName, "%s-client-%s", pszName, pszSubsystem);
} }
else if (pszName) else if (pszName)
{ {
@ -297,7 +298,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
if (!pszFileName) if (!pszFileName)
return NULL; return NULL;
sprintf_s(pszFileName, cchFileName, "%s-client", pszName); (void)sprintf_s(pszFileName, cchFileName, "%s-client", pszName);
} }
else else
{ {
@ -339,7 +340,8 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
return NULL; return NULL;
} }
sprintf_s(pszEntryName, cchEntryName + 1, "freerdp_%s_client_subsystem_entry", pszName); (void)sprintf_s(pszEntryName, cchEntryName + 1, "freerdp_%s_client_subsystem_entry",
pszName);
entry = freerdp_load_dynamic_addin(pszFileName, NULL, pszEntryName); entry = freerdp_load_dynamic_addin(pszFileName, NULL, pszEntryName);
free(pszEntryName); free(pszEntryName);
free(pszFileName); free(pszFileName);

View File

@ -791,8 +791,8 @@ char* freerdp_assistance_construct_expert_blob(const char* name, const char* pas
if (!ExpertBlob) if (!ExpertBlob)
return NULL; return NULL;
sprintf_s(ExpertBlob, size, "%" PRIdz ";NAME=%s%" PRIdz ";PASS=%s", nameLength, name, (void)sprintf_s(ExpertBlob, size, "%" PRIdz ";NAME=%s%" PRIdz ";PASS=%s", nameLength, name,
passLength, pass); passLength, pass);
return ExpertBlob; return ExpertBlob;
} }
@ -1243,7 +1243,7 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
if (fileSize.i64 < 1) if (fileSize.i64 < 1)
{ {
WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name); WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name);
fclose(fp); (void)fclose(fp);
return -1; return -1;
} }
@ -1251,7 +1251,7 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
if (!buffer) if (!buffer)
{ {
fclose(fp); (void)fclose(fp);
return -1; return -1;
} }
@ -1263,7 +1263,7 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
readSize = fileSize.s; readSize = fileSize.s;
} }
fclose(fp); (void)fclose(fp);
if (readSize < 1) if (readSize < 1)
{ {

View File

@ -146,7 +146,7 @@ int freerdp_addin_set_argument_value(ADDIN_ARGV* args, const char* option, const
if (!str) if (!str)
return -1; return -1;
sprintf_s(str, length + 1, "%s:%s", option, value); (void)sprintf_s(str, length + 1, "%s:%s", option, value);
for (int i = 0; i < args->argc; i++) for (int i = 0; i < args->argc; i++)
{ {
@ -184,7 +184,7 @@ int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, const char* previous,
if (!str) if (!str)
return -1; return -1;
sprintf_s(str, length + 1, "%s:%s", option, value); (void)sprintf_s(str, length + 1, "%s:%s", option, value);
for (int i = 0; i < args->argc; i++) for (int i = 0; i < args->argc; i++)
{ {
@ -1977,7 +1977,7 @@ char* freerdp_rail_support_flags_to_string(UINT32 flags, char* buffer, size_t le
if ((flags & ~mask) != 0) if ((flags & ~mask) != 0)
{ {
char tbuffer[64] = { 0 }; char tbuffer[64] = { 0 };
_snprintf(tbuffer, sizeof(tbuffer), "RAIL_FLAG_UNKNOWN 0x%08" PRIx32, flags & mask); (void)_snprintf(tbuffer, sizeof(tbuffer), "RAIL_FLAG_UNKNOWN 0x%08" PRIx32, flags & mask);
winpr_str_append(tbuffer, buffer, length, "|"); winpr_str_append(tbuffer, buffer, length, "|");
} }
return buffer; return buffer;
@ -2181,11 +2181,11 @@ const char* freerdp_supported_color_depths_string(UINT16 mask, char* buffer, siz
if (invalid != 0) if (invalid != 0)
{ {
char str[32] = { 0 }; char str[32] = { 0 };
_snprintf(str, sizeof(str), "RNS_UD_INVALID[0x%04" PRIx32 "]", invalid); (void)_snprintf(str, sizeof(str), "RNS_UD_INVALID[0x%04" PRIx32 "]", invalid);
winpr_str_append(str, buffer, size, "|"); winpr_str_append(str, buffer, size, "|");
} }
char hex[32] = { 0 }; char hex[32] = { 0 };
_snprintf(hex, sizeof(hex), "[0x%04" PRIx16 "]", mask); (void)_snprintf(hex, sizeof(hex), "[0x%04" PRIx16 "]", mask);
return buffer; return buffer;
} }

View File

@ -805,6 +805,6 @@ const char* rdp_ctrlaction_string(UINT16 action, char* buffer, size_t size)
break; break;
} }
_snprintf(buffer, size, "%s [0x%04" PRIx16 "]", actstr, action); (void)_snprintf(buffer, size, "%s [0x%04" PRIx16 "]", actstr, action);
return buffer; return buffer;
} }

View File

@ -78,7 +78,7 @@ static const char* autodetect_header_type_string(UINT8 headerType, char* buffer,
break; break;
} }
_snprintf(buffer, size, "%s [0x%08" PRIx8 "]", str, headerType); (void)_snprintf(buffer, size, "%s [0x%08" PRIx8 "]", str, headerType);
return buffer; return buffer;
} }
@ -125,7 +125,7 @@ static const char* autodetect_request_type_to_string_buffer(UINT32 requestType,
size_t size) size_t size)
{ {
const char* str = autodetect_request_type_to_string(requestType); const char* str = autodetect_request_type_to_string(requestType);
_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, requestType); (void)_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, requestType);
return buffer; return buffer;
} }

View File

@ -4884,7 +4884,7 @@ const char* rdp_input_flag_string(UINT16 flags, char* buffer, size_t len)
{ {
char prefix[16] = { 0 }; char prefix[16] = { 0 };
_snprintf(prefix, sizeof(prefix), "[0x%04" PRIx16 "][", flags); (void)_snprintf(prefix, sizeof(prefix), "[0x%04" PRIx16 "][", flags);
winpr_str_append(prefix, buffer, len, ""); winpr_str_append(prefix, buffer, len, "");
if ((flags & INPUT_FLAG_SCANCODES) != 0) if ((flags & INPUT_FLAG_SCANCODES) != 0)
winpr_str_append("INPUT_FLAG_SCANCODES", buffer, len, "|"); winpr_str_append("INPUT_FLAG_SCANCODES", buffer, len, "|");

View File

@ -947,7 +947,7 @@ BOOL credssp_auth_set_spn(rdpCredsspAuth* auth, const char* service, const char*
if (!spn) if (!spn)
return FALSE; return FALSE;
sprintf_s(spn, length, "%s/%s", service, hostname); (void)sprintf_s(spn, length, "%s/%s", service, hostname);
} }
if (!spn) if (!spn)
return FALSE; return FALSE;

View File

@ -1081,7 +1081,7 @@ void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, const char
const char* freerdp_get_logon_error_info_type_ex(UINT32 type, char* buffer, size_t size) const char* freerdp_get_logon_error_info_type_ex(UINT32 type, char* buffer, size_t size)
{ {
const char* str = freerdp_get_logon_error_info_type(type); const char* str = freerdp_get_logon_error_info_type(type);
_snprintf(buffer, size, "%s(0x%04" PRIx32 ")", str, type); (void)_snprintf(buffer, size, "%s(0x%04" PRIx32 ")", str, type);
return buffer; return buffer;
} }
@ -1136,7 +1136,7 @@ const char* freerdp_get_logon_error_info_data(UINT32 data)
const char* freerdp_get_logon_error_info_data_ex(UINT32 data, char* buffer, size_t size) const char* freerdp_get_logon_error_info_data_ex(UINT32 data, char* buffer, size_t size)
{ {
const char* str = freerdp_get_logon_error_info_data(data); const char* str = freerdp_get_logon_error_info_data(data);
_snprintf(buffer, size, "%s(0x%04" PRIx32 ")", str, data); (void)_snprintf(buffer, size, "%s(0x%04" PRIx32 ")", str, data);
return buffer; return buffer;
} }
@ -1275,7 +1275,7 @@ void setChannelError(rdpContext* context, UINT errorNum, WINPR_FORMAT_ARG const
WINPR_ASSERT(context); WINPR_ASSERT(context);
context->channelErrorNum = errorNum; context->channelErrorNum = errorNum;
vsnprintf(context->errorDescription, 499, format, ap); (void)vsnprintf(context->errorDescription, 499, format, ap);
va_end(ap); va_end(ap);
SetEvent(context->channelErrorEvent); SetEvent(context->channelErrorEvent);
} }

View File

@ -373,7 +373,7 @@ static char* guid2str(const GUID* guid)
if (rpcStatus != RPC_S_OK) if (rpcStatus != RPC_S_OK)
return NULL; return NULL;
sprintf_s(bracedGuid, sizeof(bracedGuid), "{%s}", strguid); (void)sprintf_s(bracedGuid, sizeof(bracedGuid), "{%s}", strguid);
RpcStringFreeA(&strguid); RpcStringFreeA(&strguid);
return _strdup(bracedGuid); return _strdup(bracedGuid);
} }

View File

@ -216,7 +216,7 @@ static const char* flags_to_string(UINT32 flags, const t_flag_mapping* map, size
winpr_str_append(cur->name, buffer, sizeof(buffer), "|"); winpr_str_append(cur->name, buffer, sizeof(buffer), "|");
} }
sprintf_s(fields, ARRAYSIZE(fields), " [%04" PRIx32 "]", flags); (void)sprintf_s(fields, ARRAYSIZE(fields), " [%04" PRIx32 "]", flags);
winpr_str_append(fields, buffer, sizeof(buffer), NULL); winpr_str_append(fields, buffer, sizeof(buffer), NULL);
return buffer; return buffer;
} }
@ -294,7 +294,7 @@ static BOOL rdg_write_chunked(BIO* bio, wStream* sPacket)
int status = 0; int status = 0;
wStream* sChunk = NULL; wStream* sChunk = NULL;
char chunkSize[11]; char chunkSize[11];
sprintf_s(chunkSize, sizeof(chunkSize), "%" PRIXz "\r\n", Stream_Length(sPacket)); (void)sprintf_s(chunkSize, sizeof(chunkSize), "%" PRIXz "\r\n", Stream_Length(sPacket));
sChunk = Stream_New(NULL, strnlen(chunkSize, sizeof(chunkSize)) + Stream_Length(sPacket) + 2); sChunk = Stream_New(NULL, strnlen(chunkSize, sizeof(chunkSize)) + Stream_Length(sPacket) + 2);
if (!sChunk) if (!sChunk)
@ -1716,7 +1716,7 @@ static int rdg_write_chunked_data_packet(rdpRdg* rdg, const BYTE* buf, int isize
if (size < 1) if (size < 1)
return 0; return 0;
sprintf_s(chunkSize, sizeof(chunkSize), "%" PRIxz "\r\n", packetSize); (void)sprintf_s(chunkSize, sizeof(chunkSize), "%" PRIxz "\r\n", packetSize);
sChunk = Stream_New(NULL, strnlen(chunkSize, sizeof(chunkSize)) + packetSize + 2); sChunk = Stream_New(NULL, strnlen(chunkSize, sizeof(chunkSize)) + packetSize + 2);
if (!sChunk) if (!sChunk)

View File

@ -361,7 +361,7 @@ const char* rpc_error_to_string(UINT32 code)
const RPC_FAULT_CODE* const current = &RPC_FAULT_CODES[index]; const RPC_FAULT_CODE* const current = &RPC_FAULT_CODES[index];
if (current->code == code) if (current->code == code)
{ {
sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name); (void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
goto out; goto out;
} }
} }
@ -371,7 +371,7 @@ const char* rpc_error_to_string(UINT32 code)
const RPC_FAULT_CODE* const current = &RPC_TSG_FAULT_CODES[index]; const RPC_FAULT_CODE* const current = &RPC_TSG_FAULT_CODES[index];
if (current->code == code) if (current->code == code)
{ {
sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name); (void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
goto out; goto out;
} }
} }
@ -381,12 +381,12 @@ const char* rpc_error_to_string(UINT32 code)
const RPC_FAULT_CODE* const current = &RPC_TSG_FAULT_CODES[index]; const RPC_FAULT_CODE* const current = &RPC_TSG_FAULT_CODES[index];
if (current->code == HRESULT_CODE(code)) if (current->code == HRESULT_CODE(code))
{ {
sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name); (void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
goto out; goto out;
} }
} }
sprintf_s(buffer, ARRAYSIZE(buffer), "%s [0x%08" PRIX32 "]", "UNKNOWN", code); (void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s [0x%08" PRIX32 "]", "UNKNOWN", code);
out: out:
return buffer; return buffer;
} }

View File

@ -103,7 +103,7 @@ static const char* rts_command_to_string(UINT32 cmd, char* buffer, size_t len)
#undef ENTRY #undef ENTRY
_snprintf(buffer, len, "%s [0x%08" PRIx32 "]", str, cmd); (void)_snprintf(buffer, len, "%s [0x%08" PRIx32 "]", str, cmd);
return buffer; return buffer;
} }

View File

@ -285,7 +285,7 @@ static const char* tsg_component_id_to_string(UINT16 ComponentId, char* buffer,
} }
#undef ENTRY #undef ENTRY
_snprintf(buffer, bytelen, "%s [0x%04" PRIx16 "]", str, ComponentId); (void)_snprintf(buffer, bytelen, "%s [0x%04" PRIx16 "]", str, ComponentId);
return buffer; return buffer;
} }
@ -925,18 +925,18 @@ static const char* tsg_redirection_flags_to_string(char* buffer, size_t size,
WINPR_ASSERT(buffer || (size == 0)); WINPR_ASSERT(buffer || (size == 0));
WINPR_ASSERT(flags); WINPR_ASSERT(flags);
_snprintf(buffer, size, (void)_snprintf(
"enableAllRedirections=%s, disableAllRedirections=%s, driveRedirectionDisabled=%s, " buffer, size,
"printerRedirectionDisabled=%s, portRedirectionDisabled=%s, reserved=%s, " "enableAllRedirections=%s, disableAllRedirections=%s, driveRedirectionDisabled=%s, "
"clipboardRedirectionDisabled=%s, pnpRedirectionDisabled=%s", "printerRedirectionDisabled=%s, portRedirectionDisabled=%s, reserved=%s, "
tsg_bool_to_string(flags->enableAllRedirections), "clipboardRedirectionDisabled=%s, pnpRedirectionDisabled=%s",
tsg_bool_to_string(flags->disableAllRedirections), tsg_bool_to_string(flags->enableAllRedirections),
tsg_bool_to_string(flags->driveRedirectionDisabled), tsg_bool_to_string(flags->disableAllRedirections),
tsg_bool_to_string(flags->printerRedirectionDisabled), tsg_bool_to_string(flags->driveRedirectionDisabled),
tsg_bool_to_string(flags->portRedirectionDisabled), tsg_bool_to_string(flags->printerRedirectionDisabled),
tsg_bool_to_string(flags->reserved), tsg_bool_to_string(flags->portRedirectionDisabled), tsg_bool_to_string(flags->reserved),
tsg_bool_to_string(flags->clipboardRedirectionDisabled), tsg_bool_to_string(flags->clipboardRedirectionDisabled),
tsg_bool_to_string(flags->pnpRedirectionDisabled)); tsg_bool_to_string(flags->pnpRedirectionDisabled));
return buffer; return buffer;
} }

View File

@ -157,10 +157,10 @@ static char* rdp_early_server_caps_string(UINT32 flags, char* buffer, size_t siz
if (unknown != 0) if (unknown != 0)
{ {
_snprintf(msg, sizeof(msg), "RNS_UD_SC_UNKNOWN[0x%08" PRIx32 "]", unknown); (void)_snprintf(msg, sizeof(msg), "RNS_UD_SC_UNKNOWN[0x%08" PRIx32 "]", unknown);
winpr_str_append(msg, buffer, size, "|"); winpr_str_append(msg, buffer, size, "|");
} }
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags); (void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
winpr_str_append(msg, buffer, size, "|"); winpr_str_append(msg, buffer, size, "|");
return buffer; return buffer;
} }
@ -204,10 +204,10 @@ static const char* rdp_early_client_caps_string(UINT32 flags, char* buffer, size
if (unknown != 0) if (unknown != 0)
{ {
_snprintf(msg, sizeof(msg), "RNS_UD_CS_UNKNOWN[0x%08" PRIx32 "]", unknown); (void)_snprintf(msg, sizeof(msg), "RNS_UD_CS_UNKNOWN[0x%08" PRIx32 "]", unknown);
winpr_str_append(msg, buffer, size, "|"); winpr_str_append(msg, buffer, size, "|");
} }
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags); (void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
winpr_str_append(msg, buffer, size, "|"); winpr_str_append(msg, buffer, size, "|");
return buffer; return buffer;
} }
@ -744,49 +744,49 @@ char* gcc_block_type_string(UINT16 type, char* buffer, size_t size)
switch (type) switch (type)
{ {
case CS_CORE: case CS_CORE:
_snprintf(buffer, size, "CS_CORE [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_CORE [0x%04" PRIx16 "]", type);
break; break;
case CS_SECURITY: case CS_SECURITY:
_snprintf(buffer, size, "CS_SECURITY [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_SECURITY [0x%04" PRIx16 "]", type);
break; break;
case CS_NET: case CS_NET:
_snprintf(buffer, size, "CS_NET [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_NET [0x%04" PRIx16 "]", type);
break; break;
case CS_CLUSTER: case CS_CLUSTER:
_snprintf(buffer, size, "CS_CLUSTER [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_CLUSTER [0x%04" PRIx16 "]", type);
break; break;
case CS_MONITOR: case CS_MONITOR:
_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
break; break;
case CS_MCS_MSGCHANNEL: case CS_MCS_MSGCHANNEL:
_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
break; break;
case CS_MONITOR_EX: case CS_MONITOR_EX:
_snprintf(buffer, size, "CS_MONITOR_EX [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_MONITOR_EX [0x%04" PRIx16 "]", type);
break; break;
case CS_UNUSED1: case CS_UNUSED1:
_snprintf(buffer, size, "CS_UNUSED1 [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_UNUSED1 [0x%04" PRIx16 "]", type);
break; break;
case CS_MULTITRANSPORT: case CS_MULTITRANSPORT:
_snprintf(buffer, size, "CS_MONITOR_EX [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "CS_MONITOR_EX [0x%04" PRIx16 "]", type);
break; break;
case SC_CORE: case SC_CORE:
_snprintf(buffer, size, "SC_CORE [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "SC_CORE [0x%04" PRIx16 "]", type);
break; break;
case SC_SECURITY: case SC_SECURITY:
_snprintf(buffer, size, "SC_SECURITY [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "SC_SECURITY [0x%04" PRIx16 "]", type);
break; break;
case SC_NET: case SC_NET:
_snprintf(buffer, size, "SC_NET [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "SC_NET [0x%04" PRIx16 "]", type);
break; break;
case SC_MCS_MSGCHANNEL: case SC_MCS_MSGCHANNEL:
_snprintf(buffer, size, "SC_MCS_MSGCHANNEL [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "SC_MCS_MSGCHANNEL [0x%04" PRIx16 "]", type);
break; break;
case SC_MULTITRANSPORT: case SC_MULTITRANSPORT:
_snprintf(buffer, size, "SC_MULTITRANSPORT [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "SC_MULTITRANSPORT [0x%04" PRIx16 "]", type);
break; break;
default: default:
_snprintf(buffer, size, "UNKNOWN [0x%04" PRIx16 "]", type); (void)_snprintf(buffer, size, "UNKNOWN [0x%04" PRIx16 "]", type);
break; break;
} }
return buffer; return buffer;

View File

@ -236,7 +236,7 @@ static const char* license_preferred_key_exchange_alg_string(UINT32 alg, char* b
break; break;
} }
_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", name, alg); (void)_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", name, alg);
return buffer; return buffer;
} }
@ -491,7 +491,7 @@ static BOOL computeCalHash(const char* hostname, char* hashStr, size_t len)
goto out; goto out;
for (size_t i = 0; i < sizeof(hash); i++, hashStr += 2) for (size_t i = 0; i < sizeof(hash); i++, hashStr += 2)
sprintf_s(hashStr, 3, "%.2x", hash[i]); (void)sprintf_s(hashStr, 3, "%.2x", hash[i]);
ret = TRUE; ret = TRUE;
out: out:
@ -548,8 +548,8 @@ static BOOL saveCal(const rdpSettings* settings, const BYTE* data, size_t length
if (!computeCalHash(hostname, hash, sizeof(hash))) if (!computeCalHash(hostname, hash, sizeof(hash)))
goto out; goto out;
sprintf_s(filename, sizeof(filename) - 1, "%s.cal", hash); (void)sprintf_s(filename, sizeof(filename) - 1, "%s.cal", hash);
sprintf_s(filenameNew, sizeof(filenameNew) - 1, "%s.cal.new", hash); (void)sprintf_s(filenameNew, sizeof(filenameNew) - 1, "%s.cal.new", hash);
if (!(filepath = GetCombinedPath(licenseStorePath, filename))) if (!(filepath = GetCombinedPath(licenseStorePath, filename)))
{ {
@ -571,7 +571,7 @@ static BOOL saveCal(const rdpSettings* settings, const BYTE* data, size_t length
} }
written = fwrite(data, length, 1, fp); written = fwrite(data, length, 1, fp);
fclose(fp); (void)fclose(fp);
if (written != 1) if (written != 1)
{ {
@ -612,7 +612,7 @@ static BYTE* loadCalFile(const rdpSettings* settings, const char* hostname, size
return NULL; return NULL;
} }
sprintf_s(calFilename, sizeof(calFilename) - 1, "%s.cal", hash); (void)sprintf_s(calFilename, sizeof(calFilename) - 1, "%s.cal", hash);
if (!(licenseStorePath = GetCombinedPath( if (!(licenseStorePath = GetCombinedPath(
freerdp_settings_get_string(settings, FreeRDP_ConfigPath), licenseStore))) freerdp_settings_get_string(settings, FreeRDP_ConfigPath), licenseStore)))
@ -641,7 +641,7 @@ static BYTE* loadCalFile(const rdpSettings* settings, const char* hostname, size
*dataLen = (size_t)length; *dataLen = (size_t)length;
fclose(fp); (void)fclose(fp);
free(calPath); free(calPath);
free(licenseStorePath); free(licenseStorePath);
return ret; return ret;

View File

@ -1282,7 +1282,7 @@ static const char* nego_rdp_neg_rsp_flags_str(UINT32 flags)
{ {
static char buffer[1024] = { 0 }; static char buffer[1024] = { 0 };
_snprintf(buffer, ARRAYSIZE(buffer), "[0x%02" PRIx32 "] ", flags); (void)_snprintf(buffer, ARRAYSIZE(buffer), "[0x%02" PRIx32 "] ", flags);
if (flags & EXTENDED_CLIENT_DATA_SUPPORTED) if (flags & EXTENDED_CLIENT_DATA_SUPPORTED)
winpr_str_append("EXTENDED_CLIENT_DATA_SUPPORTED", buffer, sizeof(buffer), "|"); winpr_str_append("EXTENDED_CLIENT_DATA_SUPPORTED", buffer, sizeof(buffer), "|");
if (flags & DYNVC_GFX_PROTOCOL_SUPPORTED) if (flags & DYNVC_GFX_PROTOCOL_SUPPORTED)

View File

@ -466,7 +466,7 @@ static const char* primary_order_string(UINT32 orderType)
if (orderType < ARRAYSIZE(orders)) if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType]; fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType); (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
return buffer; return buffer;
} }
static const char* secondary_order_string(UINT32 orderType) static const char* secondary_order_string(UINT32 orderType)
@ -486,7 +486,7 @@ static const char* secondary_order_string(UINT32 orderType)
if (orderType < ARRAYSIZE(orders)) if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType]; fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType); (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
return buffer; return buffer;
} }
static const char* altsec_order_string(BYTE orderType) static const char* altsec_order_string(BYTE orderType)
@ -506,7 +506,7 @@ static const char* altsec_order_string(BYTE orderType)
if (orderType < ARRAYSIZE(orders)) if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType]; fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType); (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
return buffer; return buffer;
} }

View File

@ -568,7 +568,7 @@ static BOOL http_proxy_connect(BIO* bufferedBio, const char* proxyUsername,
const char basic[] = CRLF "Proxy-Authorization: Basic "; const char basic[] = CRLF "Proxy-Authorization: Basic ";
char* base64 = NULL; char* base64 = NULL;
sprintf_s(creds, size, "%s:%s", proxyUsername, proxyPassword); (void)sprintf_s(creds, size, "%s:%s", proxyUsername, proxyPassword);
base64 = crypto_base64_encode((const BYTE*)creds, size - 1); base64 = crypto_base64_encode((const BYTE*)creds, size - 1);
if (!base64 || !Stream_EnsureRemainingCapacity(s, strlen(basic) + strlen(base64))) if (!base64 || !Stream_EnsureRemainingCapacity(s, strlen(basic) + strlen(base64)))

View File

@ -1566,7 +1566,7 @@ const char* pdu_type_to_str(UINT16 pduType, char* buffer, size_t length)
winpr_str_append(str, buffer, length, ""); winpr_str_append(str, buffer, length, "");
{ {
char msg[32] = { 0 }; char msg[32] = { 0 };
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", pduType); (void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", pduType);
winpr_str_append(msg, buffer, length, ""); winpr_str_append(msg, buffer, length, "");
} }
return buffer; return buffer;
@ -2244,7 +2244,7 @@ rdpRdp* rdp_new(rdpContext* context)
rdp->log = WLog_Get(RDP_TAG); rdp->log = WLog_Get(RDP_TAG);
WINPR_ASSERT(rdp->log); WINPR_ASSERT(rdp->log);
_snprintf(rdp->log_context, sizeof(rdp->log_context), "%p", (void*)context); (void)_snprintf(rdp->log_context, sizeof(rdp->log_context), "%p", (void*)context);
WLog_SetContext(rdp->log, NULL, rdp->log_context); WLog_SetContext(rdp->log, NULL, rdp->log_context);
InitializeCriticalSection(&rdp->critical); InitializeCriticalSection(&rdp->critical);
@ -2581,7 +2581,7 @@ const char* rdp_finalize_flags_to_str(UINT32 flags, char* buffer, size_t size)
winpr_str_append("UNKNOWN_FLAG", buffer, size, "|"); winpr_str_append("UNKNOWN_FLAG", buffer, size, "|");
if (flags == 0) if (flags == 0)
winpr_str_append("NO_FLAG_SET", buffer, size, "|"); winpr_str_append("NO_FLAG_SET", buffer, size, "|");
_snprintf(number, sizeof(number), " [0x%08" PRIx32 "]", flags); (void)_snprintf(number, sizeof(number), " [0x%08" PRIx32 "]", flags);
winpr_str_append(number, buffer, size, ""); winpr_str_append(number, buffer, size, "");
return buffer; return buffer;
} }
@ -2687,7 +2687,7 @@ const char* rdp_security_flag_string(UINT32 securityFlags, char* buffer, size_t
{ {
char msg[32] = { 0 }; char msg[32] = { 0 };
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", securityFlags); (void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", securityFlags);
winpr_str_append(msg, buffer, size, ""); winpr_str_append(msg, buffer, size, "");
} }
return buffer; return buffer;

View File

@ -161,8 +161,8 @@ static void settings_client_load_hkey_local_machine(rdpSettings* settings)
TCHAR numentries[64] = { 0 }; TCHAR numentries[64] = { 0 };
TCHAR persist[64] = { 0 }; TCHAR persist[64] = { 0 };
BITMAP_CACHE_V2_CELL_INFO cache = { 0 }; BITMAP_CACHE_V2_CELL_INFO cache = { 0 };
_sntprintf(numentries, ARRAYSIZE(numentries), _T("Cell%uNumEntries"), x); (void)_sntprintf(numentries, ARRAYSIZE(numentries), _T("Cell%uNumEntries"), x);
_sntprintf(persist, ARRAYSIZE(persist), _T("Cell%uPersistent"), x); (void)_sntprintf(persist, ARRAYSIZE(persist), _T("Cell%uPersistent"), x);
if (!settings_reg_query_dword_val(hKey, numentries, &val) || if (!settings_reg_query_dword_val(hKey, numentries, &val) ||
!settings_reg_query_bool_val(hKey, persist, &cache.persistent) || !settings_reg_query_bool_val(hKey, persist, &cache.persistent) ||
!freerdp_settings_set_pointer_array(settings, FreeRDP_BitmapCacheV2CellInfo, x, !freerdp_settings_set_pointer_array(settings, FreeRDP_BitmapCacheV2CellInfo, x,
@ -189,8 +189,8 @@ static void settings_client_load_hkey_local_machine(rdpSettings* settings)
GLYPH_CACHE_DEFINITION cache = { 0 }; GLYPH_CACHE_DEFINITION cache = { 0 };
TCHAR numentries[64] = { 0 }; TCHAR numentries[64] = { 0 };
TCHAR maxsize[64] = { 0 }; TCHAR maxsize[64] = { 0 };
_sntprintf(numentries, ARRAYSIZE(numentries), _T("Cache%uNumEntries"), x); (void)_sntprintf(numentries, ARRAYSIZE(numentries), _T("Cache%uNumEntries"), x);
_sntprintf(maxsize, ARRAYSIZE(maxsize), _T("Cache%uMaxCellSize"), x); (void)_sntprintf(maxsize, ARRAYSIZE(maxsize), _T("Cache%uMaxCellSize"), x);
settings_reg_query_word_val(hKey, numentries, &cache.cacheEntries); settings_reg_query_word_val(hKey, numentries, &cache.cacheEntries);
settings_reg_query_word_val(hKey, maxsize, &cache.cacheMaximumCellSize); settings_reg_query_word_val(hKey, maxsize, &cache.cacheMaximumCellSize);
@ -1274,7 +1274,7 @@ const char* freerdp_settings_glyph_level_string(UINT32 level, char* buffer, size
break; break;
} }
_snprintf(buffer, size, "%s[0x%08" PRIx32 "]", str, level); (void)_snprintf(buffer, size, "%s[0x%08" PRIx32 "]", str, level);
return buffer; return buffer;
} }

View File

@ -68,7 +68,7 @@ static void delete_file(char* path)
break; break;
} }
fclose(fp); (void)fclose(fp);
} }
} }
@ -577,7 +577,7 @@ static BOOL smartcard_hw_enumerateCerts(const rdpSettings* settings, LPCWSTR csp
if (!scopeStr) if (!scopeStr)
goto out; goto out;
_snprintf(scopeStr, readerSz + 5, "\\\\.\\%s\\", reader); (void)_snprintf(scopeStr, readerSz + 5, "\\\\.\\%s\\", reader);
scope = ConvertUtf8NToWCharAlloc(scopeStr, readerSz + 5, NULL); scope = ConvertUtf8NToWCharAlloc(scopeStr, readerSz + 5, NULL);
free(scopeStr); free(scopeStr);
@ -664,7 +664,7 @@ static BOOL smartcard_hw_enumerateCerts(const rdpSettings* settings, LPCWSTR csp
if (ConvertWCharToUtf8(name->pszName, providerNameStr, ARRAYSIZE(providerNameStr)) < 0) if (ConvertWCharToUtf8(name->pszName, providerNameStr, ARRAYSIZE(providerNameStr)) < 0)
{ {
_snprintf(providerNameStr, sizeof(providerNameStr), "<unknown>"); (void)_snprintf(providerNameStr, sizeof(providerNameStr), "<unknown>");
WLog_ERR(TAG, "unable to convert provider name to char*, will show it as '%s'", WLog_ERR(TAG, "unable to convert provider name to char*, will show it as '%s'",
providerNameStr); providerNameStr);
} }

View File

@ -74,7 +74,7 @@ const char* state_run_result_string(state_run_t status, char* buffer, size_t buf
break; break;
} }
_snprintf(buffer, buffersize, "%s [%d]", name, status); (void)_snprintf(buffer, buffersize, "%s [%d]", name, status);
return buffer; return buffer;
} }

View File

@ -223,7 +223,7 @@ SSIZE_T stream_dump_append(const rdpContext* context, UINT32 flags, wStream* s,
*offset = (size_t)rc; *offset = (size_t)rc;
fail: fail:
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
return rc; return rc;
} }
@ -249,7 +249,7 @@ SSIZE_T stream_dump_get(const rdpContext* context, UINT32* flags, wStream* s, si
rc = _ftelli64(fp); rc = _ftelli64(fp);
fail: fail:
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
return rc; return rc;
} }

View File

@ -694,7 +694,7 @@ char* freerdp_tcp_address_to_string(const struct sockaddr_storage* addr, BOOL* p
break; break;
case AF_UNIX: case AF_UNIX:
sprintf_s(ipAddress, ARRAYSIZE(ipAddress), "127.0.0.1"); (void)sprintf_s(ipAddress, ARRAYSIZE(ipAddress), "127.0.0.1");
break; break;
default: default:
@ -779,7 +779,7 @@ struct addrinfo* freerdp_tcp_resolve_host(const char* hostname, int port, int ai
if (port >= 0) if (port >= 0)
{ {
sprintf_s(port_str, sizeof(port_str) - 1, "%d", port); (void)sprintf_s(port_str, sizeof(port_str) - 1, "%d", port);
service = port_str; service = port_str;
} }

View File

@ -78,7 +78,7 @@ static int testTimeout(int port)
char arg1[] = "/v:192.0.2.1:XXXXX"; char arg1[] = "/v:192.0.2.1:XXXXX";
char* argv[] = { "test", "/v:192.0.2.1:XXXXX" }; char* argv[] = { "test", "/v:192.0.2.1:XXXXX" };
int rc = 0; int rc = 0;
_snprintf(arg1, 18, "/v:192.0.2.1:%d", port); (void)_snprintf(arg1, 18, "/v:192.0.2.1:%d", port);
argv[1] = arg1; argv[1] = arg1;
start = GetTickCount(); start = GetTickCount();
rc = runInstance(ARRAYSIZE(argv), argv, NULL, timeout); rc = runInstance(ARRAYSIZE(argv), argv, NULL, timeout);
@ -111,7 +111,7 @@ static DWORD WINAPI testThread(LPVOID arg)
char* argv[] = { "test", "/v:192.0.2.1:XXXXX" }; char* argv[] = { "test", "/v:192.0.2.1:XXXXX" };
int rc = 0; int rc = 0;
struct testThreadArgs* args = arg; struct testThreadArgs* args = arg;
_snprintf(arg1, 18, "/v:192.0.2.1:%d", args->port); (void)_snprintf(arg1, 18, "/v:192.0.2.1:%d", args->port);
argv[1] = arg1; argv[1] = arg1;
rc = runInstance(ARRAYSIZE(argv), argv, args->arg, 5000); rc = runInstance(ARRAYSIZE(argv), argv, args->arg, 5000);
@ -216,7 +216,7 @@ static BOOL prepare_certificates(const char* path)
"winpr-makecert" CMAKE_EXECUTABLE_SUFFIX); "winpr-makecert" CMAKE_EXECUTABLE_SUFFIX);
if (!exe) if (!exe)
return FALSE; return FALSE;
_snprintf(commandLine, sizeof(commandLine), "%s -format crt -path . -n server", exe); (void)_snprintf(commandLine, sizeof(commandLine), "%s -format crt -path . -n server", exe);
rc = CreateProcessA(exe, commandLine, NULL, NULL, TRUE, 0, NULL, path, &si, &process); rc = CreateProcessA(exe, commandLine, NULL, NULL, TRUE, 0, NULL, path, &si, &process);
free(exe); free(exe);
@ -246,7 +246,7 @@ static int testSuccess(int port)
char* path = NULL; char* path = NULL;
char* wpath = NULL; char* wpath = NULL;
char* exe = GetCombinedPath(TESTING_OUTPUT_DIRECTORY, "server"); char* exe = GetCombinedPath(TESTING_OUTPUT_DIRECTORY, "server");
_snprintf(arg1, 18, "/v:127.0.0.1:%d", port); (void)_snprintf(arg1, 18, "/v:127.0.0.1:%d", port);
clientArgs[1] = arg1; clientArgs[1] = arg1;
if (!exe) if (!exe)
@ -281,7 +281,7 @@ static int testSuccess(int port)
if (!commandLine) if (!commandLine)
goto fail; goto fail;
_snprintf(commandLine, commandLineLen, "%s --port=%d", exe, port); (void)_snprintf(commandLine, commandLineLen, "%s --port=%d", exe, port);
si.cb = sizeof(si); si.cb = sizeof(si);
if (!CreateProcessA(NULL, commandLine, NULL, NULL, FALSE, 0, NULL, wpath, &si, &process)) if (!CreateProcessA(NULL, commandLine, NULL, NULL, FALSE, 0, NULL, wpath, &si, &process))

View File

@ -9,7 +9,7 @@
static BOOL log_result(BOOL value, const char* fkt) static BOOL log_result(BOOL value, const char* fkt)
{ {
fprintf(stderr, "TestSettings [%s] returned %s\n", fkt, value ? "TRUE" : "FALSE"); (void)fprintf(stderr, "TestSettings [%s] returned %s\n", fkt, value ? "TRUE" : "FALSE");
return value; return value;
} }
@ -305,19 +305,19 @@ static BOOL format_uint(char* buffer, size_t size, UINT64 value, UINT16 intType,
switch (intType) switch (intType)
{ {
case 0: case 0:
_snprintf(buffer, size, "%" PRIu64, lvalue); (void)_snprintf(buffer, size, "%" PRIu64, lvalue);
return TRUE; return TRUE;
case 1: case 1:
_snprintf(buffer, size, "0x%" PRIx64, lvalue); (void)_snprintf(buffer, size, "0x%" PRIx64, lvalue);
return TRUE; return TRUE;
case 2: case 2:
if (max < UINT64_MAX) if (max < UINT64_MAX)
_snprintf(buffer, size, "%" PRIu64, max + 1); (void)_snprintf(buffer, size, "%" PRIu64, max + 1);
else else
_snprintf(buffer, size, "too large a number"); (void)_snprintf(buffer, size, "too large a number");
return FALSE; return FALSE;
default: default:
_snprintf(buffer, size, "not a number value"); (void)_snprintf(buffer, size, "not a number value");
return FALSE; return FALSE;
} }
} }
@ -327,16 +327,16 @@ static BOOL print_negative(char* buffer, size_t size, INT64 value, INT64 min)
switch (min) switch (min)
{ {
case INT16_MIN: case INT16_MIN:
_snprintf(buffer, size, "%" PRId16, (INT16)value); (void)_snprintf(buffer, size, "%" PRId16, (INT16)value);
return FALSE; return FALSE;
case INT32_MIN: case INT32_MIN:
_snprintf(buffer, size, "%" PRId32, (INT32)value); (void)_snprintf(buffer, size, "%" PRId32, (INT32)value);
return FALSE; return FALSE;
case INT64_MIN: case INT64_MIN:
_snprintf(buffer, size, "%" PRId64, (INT64)value); (void)_snprintf(buffer, size, "%" PRId64, (INT64)value);
return FALSE; return FALSE;
default: default:
_snprintf(buffer, size, "too small a number"); (void)_snprintf(buffer, size, "too small a number");
return FALSE; return FALSE;
} }
} }
@ -345,23 +345,23 @@ static BOOL print_xpositive(char* buffer, size_t size, INT64 value, INT64 max)
{ {
if (value < 0) if (value < 0)
{ {
_snprintf(buffer, size, "%" PRId64, value); (void)_snprintf(buffer, size, "%" PRId64, value);
return TRUE; return TRUE;
} }
switch (max) switch (max)
{ {
case INT16_MAX: case INT16_MAX:
_snprintf(buffer, size, "%" PRIx16, (INT16)value); (void)_snprintf(buffer, size, "%" PRIx16, (INT16)value);
return FALSE; return FALSE;
case INT32_MAX: case INT32_MAX:
_snprintf(buffer, size, "%" PRIx32, (INT32)value); (void)_snprintf(buffer, size, "%" PRIx32, (INT32)value);
return FALSE; return FALSE;
case INT64_MAX: case INT64_MAX:
_snprintf(buffer, size, "%" PRIx64, (INT64)value); (void)_snprintf(buffer, size, "%" PRIx64, (INT64)value);
return FALSE; return FALSE;
default: default:
_snprintf(buffer, size, "too small a number"); (void)_snprintf(buffer, size, "too small a number");
return FALSE; return FALSE;
} }
} }
@ -374,25 +374,25 @@ static BOOL format_int(char* buffer, size_t size, INT64 value, UINT16 intType, I
switch (intType) switch (intType)
{ {
case 0: case 0:
_snprintf(buffer, size, "%" PRId64, lvalue); (void)_snprintf(buffer, size, "%" PRId64, lvalue);
return TRUE; return TRUE;
case 1: case 1:
print_xpositive(buffer, size, lvalue, max); print_xpositive(buffer, size, lvalue, max);
return TRUE; return TRUE;
case 2: case 2:
if (max < INT64_MAX) if (max < INT64_MAX)
_snprintf(buffer, size, "%" PRId64, max + 1); (void)_snprintf(buffer, size, "%" PRId64, max + 1);
else else
_snprintf(buffer, size, "too large a number"); (void)_snprintf(buffer, size, "too large a number");
return FALSE; return FALSE;
case 3: case 3:
if (min < INT64_MIN) if (min < INT64_MIN)
print_negative(buffer, size, min - 1, INT64_MIN); print_negative(buffer, size, min - 1, INT64_MIN);
else else
_snprintf(buffer, size, "too small a number"); (void)_snprintf(buffer, size, "too small a number");
return FALSE; return FALSE;
default: default:
_snprintf(buffer, size, "not a number value"); (void)_snprintf(buffer, size, "not a number value");
return FALSE; return FALSE;
} }
} }
@ -403,37 +403,37 @@ static BOOL format_bool(char* buffer, size_t size, UINT16 intType)
switch (intType) switch (intType)
{ {
case 0: case 0:
_snprintf(buffer, size, "FALSE"); (void)_snprintf(buffer, size, "FALSE");
return TRUE; return TRUE;
case 1: case 1:
_snprintf(buffer, size, "FaLsE"); (void)_snprintf(buffer, size, "FaLsE");
return TRUE; return TRUE;
case 2: case 2:
_snprintf(buffer, size, "False"); (void)_snprintf(buffer, size, "False");
return TRUE; return TRUE;
case 3: case 3:
_snprintf(buffer, size, "false"); (void)_snprintf(buffer, size, "false");
return TRUE; return TRUE;
case 4: case 4:
_snprintf(buffer, size, "falseentry"); (void)_snprintf(buffer, size, "falseentry");
return FALSE; return FALSE;
case 5: case 5:
_snprintf(buffer, size, "TRUE"); (void)_snprintf(buffer, size, "TRUE");
return TRUE; return TRUE;
case 6: case 6:
_snprintf(buffer, size, "TrUe"); (void)_snprintf(buffer, size, "TrUe");
return TRUE; return TRUE;
case 7: case 7:
_snprintf(buffer, size, "True"); (void)_snprintf(buffer, size, "True");
return TRUE; return TRUE;
case 8: case 8:
_snprintf(buffer, size, "true"); (void)_snprintf(buffer, size, "true");
return TRUE; return TRUE;
case 9: case 9:
_snprintf(buffer, size, "someentry"); (void)_snprintf(buffer, size, "someentry");
return FALSE; return FALSE;
default: default:
_snprintf(buffer, size, "ok"); (void)_snprintf(buffer, size, "ok");
return FALSE; return FALSE;
} }
} }
@ -574,7 +574,7 @@ static BOOL check_key_helpers(size_t key, const char* stype)
break; break;
case RDP_SETTINGS_TYPE_STRING: case RDP_SETTINGS_TYPE_STRING:
expect = TRUE; expect = TRUE;
_snprintf(value, sizeof(value), "somerandomstring"); (void)_snprintf(value, sizeof(value), "somerandomstring");
break; break;
case RDP_SETTINGS_TYPE_POINTER: case RDP_SETTINGS_TYPE_POINTER:
expect = FALSE; expect = FALSE;

View File

@ -27,11 +27,11 @@ static BOOL test_entry_read_write(void)
winpr_RAND(tmp, sizeof(tmp)); winpr_RAND(tmp, sizeof(tmp));
for (size_t x = 0; x < sizeof(tmp); x++) for (size_t x = 0; x < sizeof(tmp); x++)
_snprintf(&tmp2[x * 2], sizeof(tmp2) - 2 * x, "%02" PRIx8, tmp[x]); (void)_snprintf(&tmp2[x * 2], sizeof(tmp2) - 2 * x, "%02" PRIx8, tmp[x]);
name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2); name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2);
if (!name) if (!name)
{ {
fprintf(stderr, "[%s] Could not create temporary path\n", __func__); (void)fprintf(stderr, "[%s] Could not create temporary path\n", __func__);
goto fail; goto fail;
} }
@ -39,8 +39,8 @@ static BOOL test_entry_read_write(void)
sr = Stream_New(NULL, 1024); sr = Stream_New(NULL, 1024);
if (!sr || !sw) if (!sr || !sw)
{ {
fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw, (void)fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw,
(void*)sr); (void*)sr);
goto fail; goto fail;
} }
@ -53,7 +53,7 @@ static BOOL test_entry_read_write(void)
goto fail; goto fail;
if (!stream_dump_write_line(fp, 0, sw)) if (!stream_dump_write_line(fp, 0, sw))
goto fail; goto fail;
fclose(fp); (void)fclose(fp);
fp = fopen(name, "rb"); fp = fopen(name, "rb");
if (!fp) if (!fp)
@ -63,21 +63,21 @@ static BOOL test_entry_read_write(void)
if (entrysize != offset) if (entrysize != offset)
{ {
fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n", __func__, (void)fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n",
offset, entrysize); __func__, offset, entrysize);
goto fail; goto fail;
} }
if (Stream_Length(sr) != Stream_Capacity(sw)) if (Stream_Length(sr) != Stream_Capacity(sw))
{ {
fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__, (void)fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__,
Stream_Length(sr), Stream_Capacity(sw)); Stream_Length(sr), Stream_Capacity(sw));
goto fail; goto fail;
} }
if (memcmp(Stream_Buffer(sw), Stream_Buffer(sr), Stream_Capacity(sw)) != 0) if (memcmp(Stream_Buffer(sw), Stream_Buffer(sr), Stream_Capacity(sw)) != 0)
{ {
fprintf(stderr, "[%s] Written data does not match data read back\n", __func__); (void)fprintf(stderr, "[%s] Written data does not match data read back\n", __func__);
goto fail; goto fail;
} }
rc = TRUE; rc = TRUE;
@ -85,11 +85,11 @@ fail:
Stream_Free(sr, TRUE); Stream_Free(sr, TRUE);
Stream_Free(sw, TRUE); Stream_Free(sw, TRUE);
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
if (name) if (name)
DeleteFileA(name); DeleteFileA(name);
free(name); free(name);
fprintf(stderr, "xxxxxxxxxxxxx %d\n", rc); (void)fprintf(stderr, "xxxxxxxxxxxxx %d\n", rc);
return rc; return rc;
} }

View File

@ -457,7 +457,7 @@ char* utils_redir_flags_to_string(UINT32 flags, char* buffer, size_t size)
winpr_str_append("DISABLE_PNP", buffer, size, "|"); winpr_str_append("DISABLE_PNP", buffer, size, "|");
char fbuffer[16] = { 0 }; char fbuffer[16] = { 0 };
_snprintf(fbuffer, sizeof(fbuffer), "[0x%08" PRIx32 "]", flags); (void)_snprintf(fbuffer, sizeof(fbuffer), "[0x%08" PRIx32 "]", flags);
winpr_str_append(fbuffer, buffer, size, " "); winpr_str_append(fbuffer, buffer, size, " ");
winpr_str_append("{", buffer, size, "}"); winpr_str_append("{", buffer, size, "}");

View File

@ -532,13 +532,13 @@ static BOOL window_order_supported(const rdpSettings* settings, UINT32 fieldFlag
} }
} }
#define DUMP_APPEND(buffer, size, ...) \ #define DUMP_APPEND(buffer, size, ...) \
do \ do \
{ \ { \
char* b = (buffer); \ char* b = (buffer); \
size_t s = (size); \ size_t s = (size); \
size_t pos = strnlen(b, s); \ size_t pos = strnlen(b, s); \
_snprintf(&b[pos], s - pos, __VA_ARGS__); \ (void)_snprintf(&b[pos], s - pos, __VA_ARGS__); \
} while (0) } while (0)
static void dump_window_state_order(wLog* log, const char* msg, const WINDOW_ORDER_INFO* order, static void dump_window_state_order(wLog* log, const char* msg, const WINDOW_ORDER_INFO* order,
@ -547,7 +547,7 @@ static void dump_window_state_order(wLog* log, const char* msg, const WINDOW_ORD
char buffer[3000] = { 0 }; char buffer[3000] = { 0 };
const size_t bufferSize = sizeof(buffer) - 1; const size_t bufferSize = sizeof(buffer) - 1;
_snprintf(buffer, bufferSize, "%s windowId=0x%" PRIu32 "", msg, order->windowId); (void)_snprintf(buffer, bufferSize, "%s windowId=0x%" PRIu32 "", msg, order->windowId);
if (order->fieldFlags & WINDOW_ORDER_FIELD_OWNER) if (order->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
DUMP_APPEND(buffer, bufferSize, " owner=0x%" PRIx32 "", state->ownerWindowId); DUMP_APPEND(buffer, bufferSize, " owner=0x%" PRIx32 "", state->ownerWindowId);

View File

@ -1373,7 +1373,7 @@ char* freerdp_certificate_get_fingerprint_by_hash_ex(const rdpCertificate* cert,
pos += (size_t)rc; pos += (size_t)rc;
} }
sprintf_s(&fp_buffer[pos], size - pos, "%02" PRIx8 "", fp[i]); (void)sprintf_s(&fp_buffer[pos], size - pos, "%02" PRIx8 "", fp[i]);
free(fp); free(fp);

View File

@ -64,7 +64,7 @@ static char* ensure_lowercase(char* str, size_t length)
static const char* freerdp_certificate_data_hash_(const char* hostname, UINT16 port, char* name, static const char* freerdp_certificate_data_hash_(const char* hostname, UINT16 port, char* name,
size_t length) size_t length)
{ {
_snprintf(name, length, "%s_%" PRIu16 ".pem", hostname, port); (void)_snprintf(name, length, "%s_%" PRIu16 ".pem", hostname, port);
return ensure_lowercase(name, length); return ensure_lowercase(name, length);
} }

View File

@ -116,12 +116,12 @@ BOOL freerdp_certificate_store_save_data(rdpCertificateStore* store, const rdpCe
if (!fp) if (!fp)
goto fail; goto fail;
fprintf(fp, "%s", freerdp_certificate_data_get_pem_ex(data, FALSE)); (void)fprintf(fp, "%s", freerdp_certificate_data_get_pem_ex(data, FALSE));
rc = TRUE; rc = TRUE;
fail: fail:
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
free(path); free(path);
return rc; return rc;
} }

View File

@ -219,7 +219,7 @@ char* crypto_read_pem(const char* WINPR_RESTRICT filename, size_t* WINPR_RESTRIC
if (plength) if (plength)
*plength = (size_t)strnlen(pem, size); *plength = (size_t)strnlen(pem, size);
fclose(fp); (void)fclose(fp);
return pem; return pem;
fail: fail:
@ -229,7 +229,7 @@ fail:
winpr_strerror(errno, buffer, sizeof(buffer))); winpr_strerror(errno, buffer, sizeof(buffer)));
} }
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
free(pem); free(pem);
return NULL; return NULL;
} }
@ -249,7 +249,7 @@ BOOL crypto_write_pem(const char* WINPR_RESTRICT filename, const char* WINPR_RES
if (!fp) if (!fp)
goto fail; goto fail;
rc = fwrite(pem, 1, size, fp); rc = fwrite(pem, 1, size, fp);
fclose(fp); (void)fclose(fp);
fail: fail:
if (rc == 0) if (rc == 0)
{ {

View File

@ -58,7 +58,7 @@ int TestBase64(int argc, char* argv[])
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
testNb++; testNb++;
fprintf(stderr, "%d:encode base64...", testNb); (void)fprintf(stderr, "%d:encode base64...", testNb);
for (int i = 0; encodeTests_base64[i].input; i++) for (int i = 0; encodeTests_base64[i].input; i++)
{ {
@ -67,16 +67,16 @@ int TestBase64(int argc, char* argv[])
if (strcmp(encodeTests_base64[i].output, encoded)) if (strcmp(encodeTests_base64[i].output, encoded))
{ {
fprintf(stderr, "ko, error for string %d\n", i); (void)fprintf(stderr, "ko, error for string %d\n", i);
return -1; return -1;
} }
free(encoded); free(encoded);
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
testNb++; testNb++;
fprintf(stderr, "%d:encode base64url...", testNb); (void)fprintf(stderr, "%d:encode base64url...", testNb);
for (int i = 0; encodeTests_base64url[i].input; i++) for (int i = 0; encodeTests_base64url[i].input; i++)
{ {
@ -85,16 +85,16 @@ int TestBase64(int argc, char* argv[])
if (strcmp(encodeTests_base64url[i].output, encoded)) if (strcmp(encodeTests_base64url[i].output, encoded))
{ {
fprintf(stderr, "ko, error for string %d\n", i); (void)fprintf(stderr, "ko, error for string %d\n", i);
return -1; return -1;
} }
free(encoded); free(encoded);
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
testNb++; testNb++;
fprintf(stderr, "%d:decode base64...", testNb); (void)fprintf(stderr, "%d:decode base64...", testNb);
for (int i = 0; encodeTests_base64[i].input; i++) for (int i = 0; encodeTests_base64[i].input; i++)
{ {
@ -104,16 +104,16 @@ int TestBase64(int argc, char* argv[])
if (!decoded || (outLen != encodeTests_base64[i].len) || if (!decoded || (outLen != encodeTests_base64[i].len) ||
memcmp(encodeTests_base64[i].input, decoded, outLen)) memcmp(encodeTests_base64[i].input, decoded, outLen))
{ {
fprintf(stderr, "ko, error for string %d\n", i); (void)fprintf(stderr, "ko, error for string %d\n", i);
return -1; return -1;
} }
free(decoded); free(decoded);
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
testNb++; testNb++;
fprintf(stderr, "%d:decode base64url...", testNb); (void)fprintf(stderr, "%d:decode base64url...", testNb);
for (int i = 0; encodeTests_base64url[i].input; i++) for (int i = 0; encodeTests_base64url[i].input; i++)
{ {
@ -123,21 +123,21 @@ int TestBase64(int argc, char* argv[])
if (!decoded || (outLen != encodeTests_base64url[i].len) || if (!decoded || (outLen != encodeTests_base64url[i].len) ||
memcmp(encodeTests_base64url[i].input, decoded, outLen)) memcmp(encodeTests_base64url[i].input, decoded, outLen))
{ {
fprintf(stderr, "ko, error for string %d\n", i); (void)fprintf(stderr, "ko, error for string %d\n", i);
return -1; return -1;
} }
free(decoded); free(decoded);
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
testNb++; testNb++;
fprintf(stderr, "%d:decode base64 errors...", testNb); (void)fprintf(stderr, "%d:decode base64 errors...", testNb);
crypto_base64_decode("000", 3, &decoded, &outLen); crypto_base64_decode("000", 3, &decoded, &outLen);
if (decoded) if (decoded)
{ {
fprintf(stderr, "ko, badly padded string\n"); (void)fprintf(stderr, "ko, badly padded string\n");
return -1; return -1;
} }
@ -145,7 +145,7 @@ int TestBase64(int argc, char* argv[])
if (decoded) if (decoded)
{ {
fprintf(stderr, "ko, = in a wrong place\n"); (void)fprintf(stderr, "ko, = in a wrong place\n");
return -1; return -1;
} }
@ -153,14 +153,14 @@ int TestBase64(int argc, char* argv[])
if (decoded) if (decoded)
{ {
fprintf(stderr, "ko, = in a wrong place\n"); (void)fprintf(stderr, "ko, = in a wrong place\n");
return -1; return -1;
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
testNb++; testNb++;
/* test the encode_ex version that will add \r\n */ /* test the encode_ex version that will add \r\n */
fprintf(stderr, "%d:encode base64 with crLf...", testNb); (void)fprintf(stderr, "%d:encode base64 with crLf...", testNb);
const char* longStr = "01234567890123456789012345678901234567890123456789"; const char* longStr = "01234567890123456789012345678901234567890123456789";
const char* longStrExpected = const char* longStrExpected =
"MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3\r\nODk=\r\n"; "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3\r\nODk=\r\n";
@ -168,11 +168,11 @@ int TestBase64(int argc, char* argv[])
char* encoded = crypto_base64_encode_ex((const BYTE*)longStr, strlen(longStr), TRUE); char* encoded = crypto_base64_encode_ex((const BYTE*)longStr, strlen(longStr), TRUE);
if (!encoded || strcmp(encoded, longStrExpected) != 0) if (!encoded || strcmp(encoded, longStrExpected) != 0)
{ {
fprintf(stderr, "problem with encode with CRLF\n"); (void)fprintf(stderr, "problem with encode with CRLF\n");
return -1; return -1;
} }
free(encoded); free(encoded);
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
return 0; return 0;
} }

View File

@ -139,7 +139,7 @@ static int prepare(const char* currentFileV2)
finish: finish:
if (fc) if (fc)
fclose(fc); (void)fclose(fc);
return rc; return rc;
} }
@ -158,11 +158,11 @@ static BOOL setup_config(rdpSettings** settings)
goto fail; goto fail;
GetSystemTime(&systemTime); GetSystemTime(&systemTime);
sprintf_s(sname, sizeof(sname), (void)sprintf_s(sname, sizeof(sname),
"TestKnownHostsCurrent-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16 "TestKnownHostsCurrent-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16
"%02" PRIu16 "%04" PRIu16, "%02" PRIu16 "%02" PRIu16 "%04" PRIu16,
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds); systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
path = GetKnownSubPath(KNOWN_PATH_TEMP, sname); path = GetKnownSubPath(KNOWN_PATH_TEMP, sname);
if (!path) if (!path)
@ -171,7 +171,7 @@ static BOOL setup_config(rdpSettings** settings)
{ {
if (!CreateDirectoryA(path, NULL)) if (!CreateDirectoryA(path, NULL))
{ {
fprintf(stderr, "Could not create %s!\n", path); (void)fprintf(stderr, "Could not create %s!\n", path);
goto fail; goto fail;
} }
} }

View File

@ -36,7 +36,7 @@ static char* certificate_path(const char* filename)
char* result = calloc(1, flen); char* result = calloc(1, flen);
if (!result) if (!result)
return NULL; return NULL;
_snprintf(result, flen, "%s%c%s", file, dirsep, filename); (void)_snprintf(result, flen, "%s%c%s", file, dirsep, filename);
return result; return result;
#else #else
const char* file = __FILE__; const char* file = __FILE__;

View File

@ -710,9 +710,9 @@ static void SSLCTX_keylog_cb(const SSL* ssl, const char* line)
FILE* f = winpr_fopen(dfile, "a+"); FILE* f = winpr_fopen(dfile, "a+");
if (f) if (f)
{ {
fwrite(line, strlen(line), 1, f); (void)fwrite(line, strlen(line), 1, f);
fwrite("\n", 1, 1, f); (void)fwrite("\n", 1, 1, f);
fclose(f); (void)fclose(f);
} }
} }
} }

View File

@ -130,7 +130,7 @@ static const char* general_name_type_label(int general_name_type)
else else
{ {
static char buffer[80]; static char buffer[80];
sprintf(buffer, "Unknown general name type (%d)", general_name_type); (void)sprintf(buffer, "Unknown general name type (%d)", general_name_type);
return buffer; return buffer;
} }
} }

View File

@ -54,11 +54,11 @@ static char* card_id_and_name_a(const UUID* CardIdentifier, LPCSTR LookupName)
if (!id) if (!id)
return NULL; return NULL;
snprintf(id, len, "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X\\%s", CardIdentifier->Data1, (void)snprintf(id, len, "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X\\%s",
CardIdentifier->Data2, CardIdentifier->Data3, CardIdentifier->Data4[0], CardIdentifier->Data1, CardIdentifier->Data2, CardIdentifier->Data3,
CardIdentifier->Data4[1], CardIdentifier->Data4[2], CardIdentifier->Data4[3], CardIdentifier->Data4[0], CardIdentifier->Data4[1], CardIdentifier->Data4[2],
CardIdentifier->Data4[4], CardIdentifier->Data4[5], CardIdentifier->Data4[6], CardIdentifier->Data4[3], CardIdentifier->Data4[4], CardIdentifier->Data4[5],
CardIdentifier->Data4[7], LookupName); CardIdentifier->Data4[6], CardIdentifier->Data4[7], LookupName);
return id; return id;
} }

View File

@ -40,9 +40,9 @@ static char* gdi_rect_str(char* buffer, size_t size, const HGDI_RECT rect)
if (!buffer || (size < 1) || !rect) if (!buffer || (size < 1) || !rect)
return NULL; return NULL;
_snprintf(buffer, size - 1, (void)_snprintf(buffer, size - 1,
"[top/left=%" PRId32 "x%" PRId32 "-bottom/right%" PRId32 "x%" PRId32 "]", rect->top, "[top/left=%" PRId32 "x%" PRId32 "-bottom/right%" PRId32 "x%" PRId32 "]",
rect->left, rect->bottom, rect->right); rect->top, rect->left, rect->bottom, rect->right);
buffer[size - 1] = '\0'; buffer[size - 1] = '\0';
return buffer; return buffer;
@ -53,8 +53,8 @@ static char* gdi_regn_str(char* buffer, size_t size, const HGDI_RGN rgn)
if (!buffer || (size < 1) || !rgn) if (!buffer || (size < 1) || !rgn)
return NULL; return NULL;
_snprintf(buffer, size - 1, "[%" PRId32 "x%" PRId32 "-%" PRId32 "x%" PRId32 "]", rgn->x, rgn->y, (void)_snprintf(buffer, size - 1, "[%" PRId32 "x%" PRId32 "-%" PRId32 "x%" PRId32 "]", rgn->x,
rgn->w, rgn->h); rgn->y, rgn->w, rgn->h);
buffer[size - 1] = '\0'; buffer[size - 1] = '\0';
return buffer; return buffer;

View File

@ -565,9 +565,9 @@ int TestGdiBitBlt(int argc, char* argv[])
{ {
if (!test_gdi_BitBlt(formatList[x], formatList[y])) if (!test_gdi_BitBlt(formatList[x], formatList[y]))
{ {
fprintf(stderr, "test_gdi_BitBlt(SrcFormat=%s, DstFormat=%s) failed!\n", (void)fprintf(stderr, "test_gdi_BitBlt(SrcFormat=%s, DstFormat=%s) failed!\n",
FreeRDPGetColorFormatName(formatList[x]), FreeRDPGetColorFormatName(formatList[x]),
FreeRDPGetColorFormatName(formatList[y])); FreeRDPGetColorFormatName(formatList[y]));
rc = -1; rc = -1;
} }
} }

View File

@ -331,12 +331,12 @@ int TestGdiClip(int argc, char* argv[])
{ {
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
fprintf(stderr, "test_gdi_ClipCoords()\n"); (void)fprintf(stderr, "test_gdi_ClipCoords()\n");
if (test_gdi_ClipCoords() < 0) if (test_gdi_ClipCoords() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_InvalidateRegion()\n"); (void)fprintf(stderr, "test_gdi_InvalidateRegion()\n");
if (test_gdi_InvalidateRegion() < 0) if (test_gdi_InvalidateRegion() < 0)
return -1; return -1;

View File

@ -518,67 +518,67 @@ int TestGdiCreate(int argc, char* argv[])
{ {
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
fprintf(stderr, "test_gdi_GetDC()\n"); (void)fprintf(stderr, "test_gdi_GetDC()\n");
if (test_gdi_GetDC() < 0) if (test_gdi_GetDC() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateCompatibleDC()\n"); (void)fprintf(stderr, "test_gdi_CreateCompatibleDC()\n");
if (test_gdi_CreateCompatibleDC() < 0) if (test_gdi_CreateCompatibleDC() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateBitmap()\n"); (void)fprintf(stderr, "test_gdi_CreateBitmap()\n");
if (test_gdi_CreateBitmap() < 0) if (test_gdi_CreateBitmap() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateCompatibleBitmap()\n"); (void)fprintf(stderr, "test_gdi_CreateCompatibleBitmap()\n");
if (test_gdi_CreateCompatibleBitmap() < 0) if (test_gdi_CreateCompatibleBitmap() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreatePen()\n"); (void)fprintf(stderr, "test_gdi_CreatePen()\n");
if (test_gdi_CreatePen() < 0) if (test_gdi_CreatePen() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateSolidBrush()\n"); (void)fprintf(stderr, "test_gdi_CreateSolidBrush()\n");
if (test_gdi_CreateSolidBrush() < 0) if (test_gdi_CreateSolidBrush() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreatePatternBrush()\n"); (void)fprintf(stderr, "test_gdi_CreatePatternBrush()\n");
if (test_gdi_CreatePatternBrush() < 0) if (test_gdi_CreatePatternBrush() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateRectRgn()\n"); (void)fprintf(stderr, "test_gdi_CreateRectRgn()\n");
if (test_gdi_CreateRectRgn() < 0) if (test_gdi_CreateRectRgn() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_CreateRect()\n"); (void)fprintf(stderr, "test_gdi_CreateRect()\n");
if (test_gdi_CreateRect() < 0) if (test_gdi_CreateRect() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_GetPixel()\n"); (void)fprintf(stderr, "test_gdi_GetPixel()\n");
if (!test_gdi_GetPixel()) if (!test_gdi_GetPixel())
return -1; return -1;
fprintf(stderr, "test_gdi_SetPixel()\n"); (void)fprintf(stderr, "test_gdi_SetPixel()\n");
if (!test_gdi_SetPixel()) if (!test_gdi_SetPixel())
return -1; return -1;
fprintf(stderr, "test_gdi_SetROP2()\n"); (void)fprintf(stderr, "test_gdi_SetROP2()\n");
if (test_gdi_SetROP2() < 0) if (test_gdi_SetROP2() < 0)
return -1; return -1;
fprintf(stderr, "test_gdi_MoveToEx()\n"); (void)fprintf(stderr, "test_gdi_MoveToEx()\n");
if (test_gdi_MoveToEx() < 0) if (test_gdi_MoveToEx() < 0)
return -1; return -1;

View File

@ -168,7 +168,7 @@ static char* gdi_convert_postfix_to_infix(const char* postfix)
cl = 1; cl = 1;
dl = al + bl + cl + 3; dl = al + bl + cl + 3;
d = malloc(dl + 1); d = malloc(dl + 1);
sprintf_s(d, dl, "(%s%s%s)", b ? b : "", c, a); (void)sprintf_s(d, dl, "(%s%s%s)", b ? b : "", c, a);
Stack_Push(stack, d); Stack_Push(stack, d);
free(a); free(a);
free(b); free(b);

View File

@ -81,7 +81,7 @@ static void test_dump_data(unsigned char* p, int len, int width, const char* nam
} }
printf("\n"); printf("\n");
fflush(stdout); (void)fflush(stdout);
} }
void test_dump_bitmap(HGDI_BITMAP hBmp, const char* name) void test_dump_bitmap(HGDI_BITMAP hBmp, const char* name)
@ -128,8 +128,8 @@ BOOL test_assert_bitmaps_equal(HGDI_BITMAP hBmpActual, HGDI_BITMAP hBmpExpected,
FreeRDPGetColorFormatName(hBmpExpected->format)); FreeRDPGetColorFormatName(hBmpExpected->format));
test_dump_bitmap(hBmpActual, "Actual"); test_dump_bitmap(hBmpActual, "Actual");
test_dump_bitmap(hBmpExpected, "Expected"); test_dump_bitmap(hBmpExpected, "Expected");
fflush(stdout); (void)fflush(stdout);
fflush(stderr); (void)fflush(stderr);
return TRUE; // TODO: Fix test cases return TRUE; // TODO: Fix test cases
} }

View File

@ -774,7 +774,7 @@ static const SYSTEM_LOCALE* get_locale_from_str(const char* name)
char buffer[LOCALE_LANGUAGE_LEN + LOCALE_COUNTRY_LEN + 2] = { 0 }; char buffer[LOCALE_LANGUAGE_LEN + LOCALE_COUNTRY_LEN + 2] = { 0 };
const SYSTEM_LOCALE* current = &SYSTEM_LOCALE_TABLE[i]; const SYSTEM_LOCALE* current = &SYSTEM_LOCALE_TABLE[i];
_snprintf(buffer, sizeof(buffer), "%s_%s", current->language, current->country); (void)_snprintf(buffer, sizeof(buffer), "%s_%s", current->language, current->country);
/* full match, e.g. en_US */ /* full match, e.g. en_US */
if ((strcmp(name, buffer) == 0)) if ((strcmp(name, buffer) == 0))
return current; return current;

View File

@ -24,8 +24,8 @@ static BOOL similar(const BYTE* src, const BYTE* dst, size_t size)
if (abs(diff) > 4) if (abs(diff) > 4)
{ {
fprintf(stderr, "%" PRIuz " %02" PRIX8 " : %02" PRIX8 " diff=%d\n", x, src[x], dst[x], (void)fprintf(stderr, "%" PRIuz " %02" PRIX8 " : %02" PRIX8 " diff=%d\n", x, src[x],
abs(diff)); dst[x], abs(diff));
return FALSE; return FALSE;
} }
} }
@ -62,7 +62,7 @@ static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 for
if ((labs(sR - dR) > maxDiff) || (labs(sG - dG) > maxDiff) || (labs(sB - dB) > maxDiff)) if ((labs(sR - dR) > maxDiff) || (labs(sG - dG) > maxDiff) || (labs(sB - dB) > maxDiff))
{ {
fprintf( (void)fprintf(
stderr, stderr,
"Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %" PRIuz "Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %" PRIuz
"\n", "\n",
@ -72,7 +72,7 @@ static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 for
if (dA != fill) if (dA != fill)
{ {
fprintf( (void)fprintf(
stderr, stderr,
"[%s] Invalid destination alpha value 0x%02X [expected 0x%02X] at position %" PRIuz "[%s] Invalid destination alpha value 0x%02X [expected 0x%02X] at position %" PRIuz
"\n", "\n",
@ -119,9 +119,10 @@ static BOOL check_padding(const BYTE* psrc, size_t size, size_t padding, const c
while ((x < halfPad) && (*esrc++ != 'A')) while ((x < halfPad) && (*esrc++ != 'A'))
x++; x++;
fprintf(stderr, (void)fprintf(stderr,
"Buffer underflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz "]\n", "Buffer underflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz
d, 'A', buffer, start, x); "]\n",
d, 'A', buffer, start, x);
return FALSE; return FALSE;
} }
@ -132,9 +133,10 @@ static BOOL check_padding(const BYTE* psrc, size_t size, size_t padding, const c
while ((x < halfPad) && (*esrc++ != 'A')) while ((x < halfPad) && (*esrc++ != 'A'))
x++; x++;
fprintf(stderr, (void)fprintf(stderr,
"Buffer overflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz "]\n", d, "Buffer overflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz
'A', buffer, start, x); "]\n",
d, 'A', buffer, start, x);
return FALSE; return FALSE;
} }
} }
@ -202,9 +204,10 @@ static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi)
PROFILER_DEFINE(yuvSplit) PROFILER_DEFINE(yuvSplit)
awidth = roi.width + 16 - roi.width % 16; awidth = roi.width + 16 - roi.width % 16;
aheight = roi.height + 16 - roi.height % 16; aheight = roi.height + 16 - roi.height % 16;
fprintf(stderr, (void)fprintf(stderr,
"Running YUVCombine on frame size %" PRIu32 "x%" PRIu32 " [%" PRIu32 "x%" PRIu32 "]\n", "Running YUVCombine on frame size %" PRIu32 "x%" PRIu32 " [%" PRIu32 "x%" PRIu32
roi.width, roi.height, awidth, aheight); "]\n",
roi.width, roi.height, awidth, aheight);
PROFILER_CREATE(yuvCombine, "YUV420CombineToYUV444") PROFILER_CREATE(yuvCombine, "YUV420CombineToYUV444")
PROFILER_CREATE(yuvSplit, "YUV444SplitToYUV420") PROFILER_CREATE(yuvSplit, "YUV444SplitToYUV420")
rect.left = 0; rect.left = 0;
@ -432,8 +435,8 @@ static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
return FALSE; return FALSE;
} }
fprintf(stderr, "Running AVC%s on frame size %" PRIu32 "x%" PRIu32 "\n", use444 ? "444" : "420", (void)fprintf(stderr, "Running AVC%s on frame size %" PRIu32 "x%" PRIu32 "\n",
roi.width, roi.height); use444 ? "444" : "420", roi.width, roi.height);
/* Test RGB to YUV444 conversion and vice versa */ /* Test RGB to YUV444 conversion and vice versa */
if (!(rgb = set_padding(size * sizeof(UINT32), padding))) if (!(rgb = set_padding(size * sizeof(UINT32), padding)))
@ -648,7 +651,7 @@ static BOOL check_for_mismatches(const BYTE* planeA, const BYTE* planeB, UINT32
if (fabsf((float)a - (float)b) > 2.0f) if (fabsf((float)a - (float)b) > 2.0f)
{ {
rc = TRUE; rc = TRUE;
fprintf(stderr, "[%08x] %02x != %02x\n", x, a, b); (void)fprintf(stderr, "[%08x] %02x != %02x\n", x, a, b);
} }
} }
@ -665,19 +668,19 @@ static BOOL compare_yuv420(BYTE** planesA, BYTE** planesB, UINT32 width, UINT32
if (check_for_mismatches(planesA[0], planesB[0], size)) if (check_for_mismatches(planesA[0], planesB[0], size))
{ {
fprintf(stderr, "Mismatch in Y planes!"); (void)fprintf(stderr, "Mismatch in Y planes!");
rc = FALSE; rc = FALSE;
} }
if (check_for_mismatches(planesA[1], planesB[1], uvsize)) if (check_for_mismatches(planesA[1], planesB[1], uvsize))
{ {
fprintf(stderr, "Mismatch in U planes!"); (void)fprintf(stderr, "Mismatch in U planes!");
rc = FALSE; rc = FALSE;
} }
if (check_for_mismatches(planesA[2], planesB[2], uvsize)) if (check_for_mismatches(planesA[2], planesB[2], uvsize))
{ {
fprintf(stderr, "Mismatch in V planes!"); (void)fprintf(stderr, "Mismatch in V planes!");
rc = FALSE; rc = FALSE;
} }
@ -743,8 +746,8 @@ static BOOL TestPrimitiveRgbToLumaChroma(primitives_t* prims, prim_size_t roi, U
if (!fkt || !gen) if (!fkt || !gen)
return FALSE; return FALSE;
fprintf(stderr, "Running AVC444 on frame size %" PRIu32 "x%" PRIu32 "\n", roi.width, (void)fprintf(stderr, "Running AVC444 on frame size %" PRIu32 "x%" PRIu32 "\n", roi.width,
roi.height); roi.height);
/* Test RGB to YUV444 conversion and vice versa */ /* Test RGB to YUV444 conversion and vice versa */
if (!(rgb = set_padding(size * sizeof(UINT32), padding))) if (!(rgb = set_padding(size * sizeof(UINT32), padding)))

View File

@ -57,19 +57,19 @@ void measure_floatprint(float t, char* output)
i = ((int)(t / f + 0.5f)) * (int)f; i = ((int)(t / f + 0.5f)) * (int)f;
if (t < 0.0f) if (t < 0.0f)
sprintf(output, "%f", t); (void)sprintf(output, "%f", t);
else if (i == 0) else if (i == 0)
sprintf(output, "%d", (int)(t + 0.5f)); (void)sprintf(output, "%d", (int)(t + 0.5f));
else if (t < 1e+3f) else if (t < 1e+3f)
sprintf(output, "%3d", i); (void)sprintf(output, "%3d", i);
else if (t < 1e+6f) else if (t < 1e+6f)
sprintf(output, "%3d,%03d", i / 1000, i % 1000); (void)sprintf(output, "%3d,%03d", i / 1000, i % 1000);
else if (t < 1e+9f) else if (t < 1e+9f)
sprintf(output, "%3d,%03d,000", i / 1000000, (i % 1000000) / 1000); (void)sprintf(output, "%3d,%03d,000", i / 1000000, (i % 1000000) / 1000);
else if (t < 1e+12f) else if (t < 1e+12f)
sprintf(output, "%3d,%03d,000,000", i / 1000000000, (i % 1000000000) / 1000000); (void)sprintf(output, "%3d,%03d,000,000", i / 1000000000, (i % 1000000000) / 1000000);
else else
sprintf(output, "%f", t); (void)sprintf(output, "%f", t);
} }
void prim_test_setup(BOOL performance) void prim_test_setup(BOOL performance)

View File

@ -387,6 +387,6 @@ const char* freerdp_http_status_string(long status)
char* freerdp_http_status_string_format(long status, char* buffer, size_t size) char* freerdp_http_status_string_format(long status, char* buffer, size_t size)
{ {
const char* code = freerdp_http_status_string(status); const char* code = freerdp_http_status_string(status);
_snprintf(buffer, size, "%s [%ld]", code, status); (void)_snprintf(buffer, size, "%s [%ld]", code, status);
return buffer; return buffer;
} }

View File

@ -171,8 +171,8 @@ char* freerdp_passphrase_read_tty(rdpContext* context, const char* prompt, char*
if (!fp) if (!fp)
goto error; goto error;
fprintf(fout, "%s", prompt); (void)fprintf(fout, "%s", prompt);
fflush(fout); (void)fflush(fout);
char* ptr = NULL; char* ptr = NULL;
size_t ptr_len = 0; size_t ptr_len = 0;
@ -206,7 +206,7 @@ error:
if (terminal_fildes != STDIN_FILENO) if (terminal_fildes != STDIN_FILENO)
{ {
if (fp) if (fp)
fclose(fp); (void)fclose(fp);
} }
errno = saved_errno; errno = saved_errno;
return NULL; return NULL;

View File

@ -250,7 +250,7 @@ void pcap_flush(rdpPcap* pcap)
} }
if (pcap->fp != NULL) if (pcap->fp != NULL)
fflush(pcap->fp); (void)fflush(pcap->fp);
} }
void pcap_close(rdpPcap* pcap) void pcap_close(rdpPcap* pcap)
@ -261,7 +261,7 @@ void pcap_close(rdpPcap* pcap)
pcap_flush(pcap); pcap_flush(pcap);
if (pcap->fp != NULL) if (pcap->fp != NULL)
fclose(pcap->fp); (void)fclose(pcap->fp);
free(pcap->name); free(pcap->name);
free(pcap); free(pcap);

View File

@ -135,7 +135,7 @@ static void fatal_handler(int signum)
sigemptyset(&this_mask); sigemptyset(&this_mask);
sigaddset(&this_mask, signum); sigaddset(&this_mask, signum);
pthread_sigmask(SIG_UNBLOCK, &this_mask, NULL); pthread_sigmask(SIG_UNBLOCK, &this_mask, NULL);
raise(signum); (void)raise(signum);
} }
static const int term_signals[] = { SIGINT, SIGKILL, SIGQUIT, SIGSTOP, SIGTERM }; static const int term_signals[] = { SIGINT, SIGKILL, SIGQUIT, SIGSTOP, SIGTERM };
@ -204,7 +204,7 @@ int freerdp_handle_signals(void)
goto fail; goto fail;
/* Ignore SIGPIPE signal. */ /* Ignore SIGPIPE signal. */
signal(SIGPIPE, SIG_IGN); (void)signal(SIGPIPE, SIG_IGN);
handlers_registered = TRUE; handlers_registered = TRUE;
rc = 0; rc = 0;
fail: fail:

View File

@ -98,7 +98,7 @@ char* rdp_cluster_info_flags_to_string(UINT32 flags, char* buffer, size_t size)
winpr_str_append(str, buffer, size, "|"); winpr_str_append(str, buffer, size, "|");
{ {
char msg[32] = { 0 }; char msg[32] = { 0 };
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags); (void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
winpr_str_append(msg, buffer, size, ""); winpr_str_append(msg, buffer, size, "");
} }
return buffer; return buffer;

View File

@ -38,23 +38,24 @@ static BOOL test_signed_integer_read_write_equal(INT32 value)
if (!freerdp_write_four_byte_signed_integer(s, value)) if (!freerdp_write_four_byte_signed_integer(s, value))
{ {
fprintf(stderr, "[%s(%" PRId32 ")] failed to write to stream\n", __func__, value); (void)fprintf(stderr, "[%s(%" PRId32 ")] failed to write to stream\n", __func__, value);
return FALSE; return FALSE;
} }
if (!Stream_SetPosition(s, 0)) if (!Stream_SetPosition(s, 0))
{ {
fprintf(stderr, "[%s(%" PRId32 ")] failed to reset stream position\n", __func__, value); (void)fprintf(stderr, "[%s(%" PRId32 ")] failed to reset stream position\n", __func__,
value);
return FALSE; return FALSE;
} }
if (!freerdp_read_four_byte_signed_integer(s, &rvalue)) if (!freerdp_read_four_byte_signed_integer(s, &rvalue))
{ {
fprintf(stderr, "[%s(%" PRId32 ")] failed to read from stream\n", __func__, value); (void)fprintf(stderr, "[%s(%" PRId32 ")] failed to read from stream\n", __func__, value);
return FALSE; return FALSE;
} }
if (value != rvalue) if (value != rvalue)
{ {
fprintf(stderr, "[%s(%" PRId32 ")] read invalid value %" PRId32 " from stream\n", __func__, (void)fprintf(stderr, "[%s(%" PRId32 ")] read invalid value %" PRId32 " from stream\n",
value, rvalue); __func__, value, rvalue);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -69,8 +70,9 @@ static BOOL test_signed_integer_write_oor(INT32 value)
if (freerdp_write_four_byte_signed_integer(s, value)) if (freerdp_write_four_byte_signed_integer(s, value))
{ {
fprintf(stderr, "[%s(%" PRId32 ")] out of range value not detected and written to stream\n", (void)fprintf(stderr,
__func__, value); "[%s(%" PRId32 ")] out of range value not detected and written to stream\n",
__func__, value);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -120,24 +122,25 @@ static BOOL test_float_read_write_equal(double value)
if (!freerdp_write_four_byte_float(s, value)) if (!freerdp_write_four_byte_float(s, value))
{ {
fprintf(stderr, "[%s(%lf)] failed to write to stream\n", __func__, value); (void)fprintf(stderr, "[%s(%lf)] failed to write to stream\n", __func__, value);
return FALSE; return FALSE;
} }
if (!Stream_SetPosition(s, 0)) if (!Stream_SetPosition(s, 0))
{ {
fprintf(stderr, "[%s(%lf)] failed to reset stream position\n", __func__, value); (void)fprintf(stderr, "[%s(%lf)] failed to reset stream position\n", __func__, value);
return FALSE; return FALSE;
} }
if (!freerdp_read_four_byte_float_exp(s, &rvalue, &exp)) if (!freerdp_read_four_byte_float_exp(s, &rvalue, &exp))
{ {
fprintf(stderr, "[%s(%lf)] failed to read from stream\n", __func__, value); (void)fprintf(stderr, "[%s(%lf)] failed to read from stream\n", __func__, value);
return FALSE; return FALSE;
} }
const double diff = fabs(value - rvalue); const double diff = fabs(value - rvalue);
const UINT64 expdiff = diff * pow(10, exp); const UINT64 expdiff = diff * pow(10, exp);
if (expdiff > 0) if (expdiff > 0)
{ {
fprintf(stderr, "[%s(%lf)] read invalid value %lf from stream\n", __func__, value, rvalue); (void)fprintf(stderr, "[%s(%lf)] read invalid value %lf from stream\n", __func__, value,
rvalue);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -152,8 +155,8 @@ static BOOL test_floag_write_oor(double value)
if (freerdp_write_four_byte_float(s, value)) if (freerdp_write_four_byte_float(s, value))
{ {
fprintf(stderr, "[%s(%lf)] out of range value not detected and written to stream\n", (void)fprintf(stderr, "[%s(%lf)] out of range value not detected and written to stream\n",
__func__, value); __func__, value);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;

View File

@ -91,7 +91,7 @@ int TestRingBuffer(int argc, char* argv[])
if (!ringbuffer_init(&ringBuffer, 10)) if (!ringbuffer_init(&ringBuffer, 10))
{ {
fprintf(stderr, "unable to initialize ringbuffer\n"); (void)fprintf(stderr, "unable to initialize ringbuffer\n");
return -1; return -1;
} }
@ -102,24 +102,24 @@ int TestRingBuffer(int argc, char* argv[])
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
tmpBuf[i] = (char)i; tmpBuf[i] = (char)i;
fprintf(stderr, "%d: basic tests...", ++testNo); (void)fprintf(stderr, "%d: basic tests...", ++testNo);
if (!ringbuffer_write(&ringBuffer, tmpBuf, 5) || !ringbuffer_write(&ringBuffer, tmpBuf, 5) || if (!ringbuffer_write(&ringBuffer, tmpBuf, 5) || !ringbuffer_write(&ringBuffer, tmpBuf, 5) ||
!ringbuffer_write(&ringBuffer, tmpBuf, 5)) !ringbuffer_write(&ringBuffer, tmpBuf, 5))
{ {
fprintf(stderr, "error when writing bytes\n"); (void)fprintf(stderr, "error when writing bytes\n");
return -1; return -1;
} }
if (ringbuffer_used(&ringBuffer) != 15) if (ringbuffer_used(&ringBuffer) != 15)
{ {
fprintf(stderr, "invalid used size got %" PRIuz " when I would expect 15\n", (void)fprintf(stderr, "invalid used size got %" PRIuz " when I would expect 15\n",
ringbuffer_used(&ringBuffer)); ringbuffer_used(&ringBuffer));
return -1; return -1;
} }
if (ringbuffer_peek(&ringBuffer, chunks, 10) != 1 || chunks[0].size != 10) if (ringbuffer_peek(&ringBuffer, chunks, 10) != 1 || chunks[0].size != 10)
{ {
fprintf(stderr, "error when reading bytes\n"); (void)fprintf(stderr, "error when reading bytes\n");
return -1; return -1;
} }
ringbuffer_commit_read_bytes(&ringBuffer, chunks[0].size); ringbuffer_commit_read_bytes(&ringBuffer, chunks[0].size);
@ -129,16 +129,16 @@ int TestRingBuffer(int argc, char* argv[])
{ {
if (chunks[0].data[i] != i % 5) if (chunks[0].data[i] != i % 5)
{ {
fprintf(stderr, "invalid byte at %d, got %" PRIu8 " instead of %d\n", i, (void)fprintf(stderr, "invalid byte at %d, got %" PRIu8 " instead of %d\n", i,
chunks[0].data[i], i % 5); chunks[0].data[i], i % 5);
return -1; return -1;
} }
} }
if (ringbuffer_used(&ringBuffer) != 5) if (ringbuffer_used(&ringBuffer) != 5)
{ {
fprintf(stderr, "invalid used size after read got %" PRIuz " when I would expect 5\n", (void)fprintf(stderr, "invalid used size after read got %" PRIuz " when I would expect 5\n",
ringbuffer_used(&ringBuffer)); ringbuffer_used(&ringBuffer));
return -1; return -1;
} }
@ -147,28 +147,28 @@ int TestRingBuffer(int argc, char* argv[])
ringbuffer_peek(&ringBuffer, chunks, 11) != 2 || chunks[0].size != 10 || ringbuffer_peek(&ringBuffer, chunks, 11) != 2 || chunks[0].size != 10 ||
chunks[1].size != 1) chunks[1].size != 1)
{ {
fprintf(stderr, "invalid read of splitted data\n"); (void)fprintf(stderr, "invalid read of splitted data\n");
return -1; return -1;
} }
ringbuffer_commit_read_bytes(&ringBuffer, 11); ringbuffer_commit_read_bytes(&ringBuffer, 11);
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
fprintf(stderr, "%d: peek with nothing to read...", ++testNo); (void)fprintf(stderr, "%d: peek with nothing to read...", ++testNo);
if (ringbuffer_peek(&ringBuffer, chunks, 10)) if (ringbuffer_peek(&ringBuffer, chunks, 10))
{ {
fprintf(stderr, "peek returns some chunks\n"); (void)fprintf(stderr, "peek returns some chunks\n");
return -1; return -1;
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
fprintf(stderr, "%d: ensure_linear_write / read() shouldn't grow...", ++testNo); (void)fprintf(stderr, "%d: ensure_linear_write / read() shouldn't grow...", ++testNo);
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
rb_ptr = ringbuffer_ensure_linear_write(&ringBuffer, 50); rb_ptr = ringbuffer_ensure_linear_write(&ringBuffer, 50);
if (!rb_ptr) if (!rb_ptr)
{ {
fprintf(stderr, "ringbuffer_ensure_linear_write() error\n"); (void)fprintf(stderr, "ringbuffer_ensure_linear_write() error\n");
return -1; return -1;
} }
@ -176,7 +176,7 @@ int TestRingBuffer(int argc, char* argv[])
if (!ringbuffer_commit_written_bytes(&ringBuffer, 50)) if (!ringbuffer_commit_written_bytes(&ringBuffer, 50))
{ {
fprintf(stderr, "ringbuffer_commit_written_bytes() error, i=%d\n", i); (void)fprintf(stderr, "ringbuffer_commit_written_bytes() error, i=%d\n", i);
return -1; return -1;
} }
@ -191,34 +191,34 @@ int TestRingBuffer(int argc, char* argv[])
if (ringbuffer_capacity(&ringBuffer) != 10) if (ringbuffer_capacity(&ringBuffer) != 10)
{ {
fprintf(stderr, "not the expected capacity, have %" PRIuz " and expects 10\n", (void)fprintf(stderr, "not the expected capacity, have %" PRIuz " and expects 10\n",
ringbuffer_capacity(&ringBuffer)); ringbuffer_capacity(&ringBuffer));
return -1; return -1;
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
fprintf(stderr, "%d: free size is correctly computed...", ++testNo); (void)fprintf(stderr, "%d: free size is correctly computed...", ++testNo);
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
ringbuffer_ensure_linear_write(&ringBuffer, 50); ringbuffer_ensure_linear_write(&ringBuffer, 50);
if (!ringbuffer_commit_written_bytes(&ringBuffer, 50)) if (!ringbuffer_commit_written_bytes(&ringBuffer, 50))
{ {
fprintf(stderr, "ringbuffer_commit_written_bytes() error, i=%d\n", i); (void)fprintf(stderr, "ringbuffer_commit_written_bytes() error, i=%d\n", i);
return -1; return -1;
} }
} }
ringbuffer_commit_read_bytes(&ringBuffer, 50 * 1000); ringbuffer_commit_read_bytes(&ringBuffer, 50 * 1000);
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
ringbuffer_destroy(&ringBuffer); ringbuffer_destroy(&ringBuffer);
fprintf(stderr, "%d: specific overlaps test...", ++testNo); (void)fprintf(stderr, "%d: specific overlaps test...", ++testNo);
if (!test_overlaps()) if (!test_overlaps())
{ {
fprintf(stderr, "ko\n"); (void)fprintf(stderr, "ko\n");
return -1; return -1;
} }
fprintf(stderr, "ok\n"); (void)fprintf(stderr, "ok\n");
ringbuffer_destroy(&ringBuffer); ringbuffer_destroy(&ringBuffer);
free(tmpBuf); free(tmpBuf);

View File

@ -167,7 +167,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
if (fileSize.i64 < 1) if (fileSize.i64 < 1)
{ {
fclose(fp); (void)fclose(fp);
return NULL; return NULL;
} }
@ -175,7 +175,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
if (!buffer) if (!buffer)
{ {
fclose(fp); (void)fclose(fp);
return NULL; return NULL;
} }
@ -186,7 +186,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
readSize = fileSize.s; readSize = fileSize.s;
} }
fclose(fp); (void)fclose(fp);
if (readSize < 1) if (readSize < 1)
{ {

View File

@ -1327,16 +1327,16 @@ static void print_entry(FILE* fp, WINPR_FORMAT_ARG const char* fmt, const char*
{ {
char buffer[32] = { 0 }; char buffer[32] = { 0 };
strncpy(buffer, what, MIN(size, sizeof(buffer) - 1)); strncpy(buffer, what, MIN(size, sizeof(buffer) - 1));
fprintf(fp, fmt, buffer); (void)fprintf(fp, fmt, buffer);
} }
static WINPR_NORETURN(void usage(const char* app, const char* invalid)) static WINPR_NORETURN(void usage(const char* app, const char* invalid))
{ {
FILE* fp = stdout; FILE* fp = stdout;
fprintf(fp, "Invalid argument '%s'\n", invalid); (void)fprintf(fp, "Invalid argument '%s'\n", invalid);
fprintf(fp, "Usage: %s <arg>[ <arg> ...]\n", app); (void)fprintf(fp, "Usage: %s <arg>[ <arg> ...]\n", app);
fprintf(fp, "Arguments:\n"); (void)fprintf(fp, "Arguments:\n");
print_entry(fp, "\t%s<pcap file>\n", options.spcap, sizeof(options.spcap)); print_entry(fp, "\t%s<pcap file>\n", options.spcap, sizeof(options.spcap));
print_entry(fp, "\t%s<cert file>\n", options.scert, sizeof(options.scert)); print_entry(fp, "\t%s<cert file>\n", options.scert, sizeof(options.scert));
print_entry(fp, "\t%s<key file>\n", options.skey, sizeof(options.skey)); print_entry(fp, "\t%s<key file>\n", options.skey, sizeof(options.skey));
@ -1420,7 +1420,7 @@ int main(int argc, char* argv[])
goto fail; goto fail;
/* Open the server socket and start listening. */ /* Open the server socket and start listening. */
sprintf_s(name, sizeof(name), "tfreerdp-server.%ld", port); (void)sprintf_s(name, sizeof(name), "tfreerdp-server.%ld", port);
file = GetKnownSubPath(KNOWN_PATH_TEMP, name); file = GetKnownSubPath(KNOWN_PATH_TEMP, name);
if (!file) if (!file)

View File

@ -51,7 +51,7 @@ static const char* strsignal(int signum)
static void cleanup_handler(int signum) static void cleanup_handler(int signum)
{ {
printf("\n"); (void)printf("\n");
WLog_INFO(TAG, "caught signal %s [%d], starting cleanup...", strsignal(signum), signum); WLog_INFO(TAG, "caught signal %s [%d], starting cleanup...", strsignal(signum), signum);
WLog_INFO(TAG, "stopping all connections."); WLog_INFO(TAG, "stopping all connections.");
@ -60,11 +60,11 @@ static void cleanup_handler(int signum)
static void pf_server_register_signal_handlers(void) static void pf_server_register_signal_handlers(void)
{ {
signal(SIGINT, cleanup_handler); (void)signal(SIGINT, cleanup_handler);
signal(SIGTERM, cleanup_handler); (void)signal(SIGTERM, cleanup_handler);
#ifndef _WIN32 #ifndef _WIN32
signal(SIGQUIT, cleanup_handler); (void)signal(SIGQUIT, cleanup_handler);
signal(SIGKILL, cleanup_handler); (void)signal(SIGKILL, cleanup_handler);
#endif #endif
} }

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