Merge pull request #10525 from akallabeth/warn-fixes-err33-c

[warnings] fix cert-err33-c
This commit is contained in:
akallabeth 2024-08-29 10:35:57 +02:00 committed by GitHub
commit 4439240fd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)
{
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(dev_name, (PATH_MAX - 1), "/dev/dsp%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);

View File

@ -111,7 +111,7 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
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_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -128,8 +128,9 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
goto error_out;
}
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->cName, ARRAYSIZE(pAddin->cName), "%s", table->name);
(void)sprintf_s(pAddin->cSubsystem, ARRAYSIZE(pAddin->cSubsystem), "%s",
subsystems[j].name);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -190,23 +191,23 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
if (pszName && pszSubsystem && pszType)
{
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-%s-%s.%s",
pszName, pszSubsystem, pszType, pszExtension);
(void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-%s-%s.%s",
pszName, pszSubsystem, pszType, pszExtension);
}
else if (pszName && pszType)
{
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-?-%s.%s",
pszName, pszType, pszExtension);
(void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-?-%s.%s",
pszName, pszType, pszExtension);
}
else if (pszName)
{
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client*.%s", pszName,
pszExtension);
(void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client*.%s",
pszName, pszExtension);
}
else
{
sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "?-client*.%s",
pszExtension);
(void)sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "?-client*.%s",
pszExtension);
}
cchPattern = strnlen(pszPattern, cchPattern);
@ -567,10 +568,10 @@ static DWORD WINAPI channel_client_thread_proc(LPVOID userdata)
if (error && internals->ctx)
{
char msg[128];
_snprintf(msg, 127,
"%s_virtual_channel_client_thread reported an"
" error",
internals->channel_name);
(void)_snprintf(msg, 127,
"%s_virtual_channel_client_thread reported an"
" error",
internals->channel_name);
setChannelError(internals->ctx, error, msg);
}
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))
{
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);
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 |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name),
CLIPRDR_SVC_CHANNEL_NAME);
(void)sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name),
CLIPRDR_SVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
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)
{
_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;
}
@ -79,7 +79,7 @@ const char* CB_MSG_FLAGS_STRING(UINT16 msgFlags, char* buffer, size_t size)
winpr_str_append("NONE", buffer, size, "");
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, "|");
return buffer;
}

View File

@ -1997,8 +1997,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_E
drdynvc->channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name),
DRDYNVC_SVC_CHANNEL_NAME);
(void)sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name),
DRDYNVC_SVC_CHANNEL_NAME);
drdynvc->state = DRDYNVC_STATE_INITIAL;
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 |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name),
ENCOMSP_SVC_CHANNEL_NAME);
(void)sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name),
ENCOMSP_SVC_CHANNEL_NAME);
CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx =
(CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
WINPR_ASSERT(pEntryPointsEx);

View File

@ -138,7 +138,7 @@ static const char* location_version_str(UINT32 version, char* buffer, size_t siz
break;
}
_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, version);
(void)_snprintf(buffer, size, "%s [0x%08" PRIx32 "]", str, version);
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(size > 0);
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);
(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);
}
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)
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.name = printer_dev->port;
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);
if (RemoteApplicationFile && RemoteApplicationCmdLine)
{
_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", RemoteApplicationCmdLine,
RemoteApplicationFile);
(void)_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", RemoteApplicationCmdLine,
RemoteApplicationFile);
exec.RemoteApplicationArguments = argsAndFile;
}
else if (RemoteApplicationFile)

View File

@ -677,7 +677,7 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
rail->sendHandshake = TRUE;
rail->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
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;
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)
{
_snprintf(buffer, length, "%s[0x%04" PRIx16 "]", rail_get_order_type_string(orderType),
orderType);
(void)_snprintf(buffer, length, "%s[0x%04" PRIx16 "]", rail_get_order_type_string(orderType),
orderType);
return buffer;
}
@ -594,7 +594,7 @@ const char* rail_handshake_ex_flags_to_string(UINT32 flags, char* buffer, size_t
if (len < 1)
return NULL;
_snprintf(buffer, len, "{");
(void)_snprintf(buffer, len, "{");
char* fbuffer = &buffer[1];
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, "|");
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, "}");
return buffer;
}

View File

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

View File

@ -738,11 +738,11 @@ static BOOL isAutomountLocation(const char* path)
size_t length = 0;
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"))
snprintf(buffer, sizeof(buffer), location, uname);
(void)snprintf(buffer, sizeof(buffer), location, uname);
else
snprintf(buffer, sizeof(buffer), "%s", location);
(void)snprintf(buffer, sizeof(buffer), "%s", location);
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);
}
fclose(f);
(void)fclose(f);
return ERROR_SUCCESS;
}
#endif
@ -2311,7 +2311,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS p
rdpdr->channelDef.options =
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;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -191,7 +191,7 @@ static void rdpsnd_oss_open_mixer(rdpsndOssPlugin* oss)
return;
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)
{
@ -218,7 +218,7 @@ static BOOL rdpsnd_oss_open(rdpsndDevicePlugin* device, const AUDIO_FORMAT* form
return TRUE;
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);

View File

@ -1227,9 +1227,9 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, D
if (error && rdpsnd && rdpsnd->rdpcontext)
{
char buffer[8192];
_snprintf(buffer, sizeof(buffer),
"%s rdpsnd_virtual_channel_open_event_ex reported an error",
rdpsnd_is_dyn_str(rdpsnd->dynamic));
(void)_snprintf(buffer, sizeof(buffer),
"%s rdpsnd_virtual_channel_open_event_ex reported an error",
rdpsnd_is_dyn_str(rdpsnd->dynamic));
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)
{
char buffer[8192];
_snprintf(buffer, sizeof(buffer), "%s reported an error",
rdpsnd_is_dyn_str(plugin->dynamic));
(void)_snprintf(buffer, sizeof(buffer), "%s reported an error",
rdpsnd_is_dyn_str(plugin->dynamic));
setChannelError(plugin->rdpcontext, error, buffer);
}
}
@ -1576,7 +1576,8 @@ FREERDP_ENTRY_POINT(BOOL VCAPITYPE rdpsnd_VirtualChannelEntryEx(PCHANNEL_ENTRY_P
return FALSE;
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;
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);
ctlHeader->msgType = msgType;
sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME);
(void)sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME);
ctlHeader->ch.DataLength = 4 + msgSize;
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 |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name),
REMDESK_SVC_CHANNEL_NAME);
(void)sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name),
REMDESK_SVC_CHANNEL_NAME);
remdesk->Version = 2;
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)
{
ctlHeader->msgType = msgType;
sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME);
(void)sprintf_s(ctlHeader->ch.ChannelName, ARRAYSIZE(ctlHeader->ch.ChannelName),
REMDESK_CHANNEL_CTL_NAME);
ctlHeader->ch.DataLength = 4 + msgSize;
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;
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;
}
@ -1504,12 +1504,12 @@ static void tsmf_signal_handler(int s)
if (s == SIGINT)
{
signal(s, SIG_DFL);
(void)signal(s, SIG_DFL);
kill(getpid(), s);
}
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 };
va_list ap;
va_start(ap, error);
vsnprintf(buffer, sizeof(buffer), fmt, ap);
(void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
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:
bus_number = libusb_get_bus_number(pdev->libusb_dev);
device_address = libusb_get_device_address(pdev->libusb_dev);
sprintf_s(deviceLocation, sizeof(deviceLocation),
"Port_#%04" PRIu8 ".Hub_#%04" PRIu8 "", device_address, bus_number);
(void)sprintf_s(deviceLocation, sizeof(deviceLocation),
"Port_#%04" PRIu8 ".Hub_#%04" PRIu8 "", device_address, bus_number);
len = strnlen(deviceLocation,
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;
WLog_Print(urbdrc->log, WLOG_DEBUG, " Port: %d", pdev->port_number);
/* 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);
}

View File

@ -80,33 +80,33 @@ static int func_container_id_generate(IUDEVICE* pdev, char* strContainerId)
else
p = path;
sprintf_s((char*)containerId, sizeof(containerId), "%04" PRIX16 "%04" PRIX16 "%s", idVendor,
idProduct, p);
(void)sprintf_s((char*)containerId, sizeof(containerId), "%04" PRIX16 "%04" PRIX16 "%s",
idVendor, idProduct, p);
/* format */
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 "}",
containerId[0], containerId[1], containerId[2], containerId[3], containerId[4],
containerId[5], containerId[6], containerId[7], containerId[8], containerId[9],
containerId[10], containerId[11], containerId[12], containerId[13], containerId[14],
containerId[15]);
(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 "}",
containerId[0], containerId[1], containerId[2], containerId[3], containerId[4],
containerId[5], containerId[6], containerId[7], containerId[8], containerId[9],
containerId[10], containerId[11], containerId[12], containerId[13],
containerId[14], containerId[15]);
return 0;
}
static int func_instance_id_generate(IUDEVICE* pdev, char* strInstanceId, size_t len)
{
char instanceId[17] = { 0 };
sprintf_s(instanceId, sizeof(instanceId), "\\%s", pdev->getPath(pdev));
(void)sprintf_s(instanceId, sizeof(instanceId), "\\%s", pdev->getPath(pdev));
/* format */
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 "",
instanceId[0], instanceId[1], instanceId[2], instanceId[3], instanceId[4],
instanceId[5], instanceId[6], instanceId[7], instanceId[8], instanceId[9],
instanceId[10], instanceId[11], instanceId[12], instanceId[13], instanceId[14],
instanceId[15]);
(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 "",
instanceId[0], instanceId[1], instanceId[2], instanceId[3], instanceId[4],
instanceId[5], instanceId[6], instanceId[7], instanceId[8], instanceId[9],
instanceId[10], instanceId[11], instanceId[12], instanceId[13], instanceId[14],
instanceId[15]);
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 idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT);
const UINT16 bcdDevice = (UINT16)pdev->query_device_descriptor(pdev, BCD_DEVICE);
sprintf_s(HardwareIds[1], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "", idVendor, idProduct);
sprintf_s(HardwareIds[0], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "&REV_%04" PRIX16 "", idVendor, idProduct,
bcdDevice);
(void)sprintf_s(HardwareIds[1], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "", idVendor, idProduct);
(void)sprintf_s(HardwareIds[0], DEVICE_HARDWARE_ID_SIZE,
"USB\\VID_%04" PRIX16 "&PID_%04" PRIX16 "&REV_%04" PRIX16 "", idVendor,
idProduct, bcdDevice);
}
{
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)))
{
sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\Class_%02" PRIX8 "",
bDeviceClass);
sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "", bDeviceClass,
bDeviceSubClass);
sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "&Prot_%02" PRIX8 "",
bDeviceClass, bDeviceSubClass, bDeviceProtocol);
(void)sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "", bDeviceClass);
(void)sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "", bDeviceClass,
bDeviceSubClass);
(void)sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\Class_%02" PRIX8 "&SubClass_%02" PRIX8 "&Prot_%02" PRIX8 "",
bDeviceClass, bDeviceSubClass, bDeviceProtocol);
}
else
{
sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\DevClass_00");
sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00");
sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00&Prot_00");
(void)sprintf_s(CompatibilityIds[2], DEVICE_COMPATIBILITY_ID_SIZE, "USB\\DevClass_00");
(void)sprintf_s(CompatibilityIds[1], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00");
(void)sprintf_s(CompatibilityIds[0], DEVICE_COMPATIBILITY_ID_SIZE,
"USB\\DevClass_00&SubClass_00&Prot_00");
}
}
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 };
if (!addPort)
sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name);
(void)sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name);
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))
return nullptr;

View File

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

View File

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

View File

@ -539,10 +539,10 @@ static char* xf_window_get_title(rdpSettings* settings)
return NULL;
if (!port)
sprintf_s(windowTitle, size, "%s %s", prefix, name);
(void)sprintf_s(windowTitle, size, "%s %s", prefix, name);
else
sprintf_s(windowTitle, size, "%s %s:%i", prefix, name,
freerdp_settings_get_uint32(settings, FreeRDP_ServerPort));
(void)sprintf_s(windowTitle, size, "%s %s:%i", prefix, name,
freerdp_settings_get_uint32(settings, FreeRDP_ServerPort));
return windowTitle;
}
@ -1749,7 +1749,7 @@ static void xf_PanningChangeEventHandler(void* context, const PanningChangeEvent
static BOOL xfreerdp_client_global_init(void)
{
setlocale(LC_ALL, "");
(void)setlocale(LC_ALL, "");
if (freerdp_handle_signals() != 0)
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 arg[2048] = { 0 };
_snprintf(command, sizeof(command), "xevent %s", xeventName);
_snprintf(arg, sizeof(arg), "%lu", (unsigned long)xfc->window->handle);
(void)_snprintf(command, sizeof(command), "xevent %s", xeventName);
(void)_snprintf(arg, sizeof(arg), "%lu", (unsigned long)xfc->window->handle);
if (!run_action_script(xfc, command, arg, action_script_run, NULL))
return FALSE;
return TRUE;

View File

@ -533,7 +533,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
if (!match)
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))
return -1;

View File

@ -194,7 +194,7 @@ BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_act
goto fail;
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");
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)
{
char* context = NULL;
strtok_s(buffer, "\n", &context);
(void)strtok_s(buffer, "\n", &context);
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 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;
}

View File

@ -458,7 +458,7 @@ static BOOL client_cli_authenticate_raw(freerdp* instance, rdp_auth_reason reaso
{
size_t username_size = 0;
printf("%s", prompt[0]);
fflush(stdout);
(void)fflush(stdout);
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;
printf("%s", prompt[1]);
fflush(stdout);
(void)fflush(stdout);
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 "): ",
gateway ? "gateway authentication" : "logon", count - 1);
fflush(stdout);
(void)fflush(stdout);
if (!fgets(input, 10, stdin))
{
WLog_ERR(TAG, "could not read from stdin");
@ -631,7 +631,7 @@ static DWORD client_cli_accept_certificate(freerdp* instance)
while (1)
{
printf("Do you trust the above certificate? (Y/T/N) ");
fflush(stdout);
(void)fflush(stdout);
answer = freerdp_interruptible_getc(instance->context, stdin);
if ((answer == EOF) || feof(stdin))
@ -943,7 +943,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
while (isConsentMandatory)
{
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);
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.
}
if (file->fp)
fclose(file->fp);
(void)fclose(file->fp);
file->fp = NULL;
}
@ -1705,9 +1705,11 @@ static CliprdrFuseFile* clip_data_dir_new(CliprdrFileContext* file_context, BOOL
}
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
_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;
@ -1863,8 +1865,8 @@ static BOOL set_selection_for_clip_data_entry(CliprdrFileContext* file_context,
return FALSE;
}
_snprintf(fuse_file->filename_with_root, path_length, "%s/%s",
clip_data_dir->filename_with_root, filename);
(void)_snprintf(fuse_file->filename_with_root, path_length, "%s/%s",
clip_data_dir->filename_with_root, filename);
free(filename);
fuse_file->filename = strrchr(fuse_file->filename_with_root, '/') + 1;
@ -2098,7 +2100,8 @@ static BOOL create_base_path(CliprdrFileContext* file)
WINPR_ASSERT(file);
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);
if (!file->path)
@ -2120,7 +2123,7 @@ static void cliprdr_local_file_free(CliprdrLocalFile* file)
if (file->fp)
{
WLog_Print(file->context->log, WLOG_DEBUG, "closing file %s, discarding entry", file->name);
fclose(file->fp);
(void)fclose(file->fp);
}
free(file->name);
*file = empty;
@ -2366,7 +2369,7 @@ static CliprdrFuseFile* fuse_file_new_root(CliprdrFileContext* file_context)
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->ino = FUSE_ROOT_ID;

View File

@ -100,10 +100,10 @@ static BOOL freerdp_client_print_codepages(const char* arg)
char buffer[2048] = { 0 };
if (strnlen(page->subLanguageSymbol, ARRAYSIZE(page->subLanguageSymbol)) > 0)
_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol,
page->subLanguageSymbol);
(void)_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol,
page->subLanguageSymbol);
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,
page->primaryLanguage, page->subLanguage);
}
@ -2857,7 +2857,7 @@ static int parse_kbd_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
if (!tmp)
rc = COMMAND_LINE_ERROR_MEMORY;
else
_snprintf(tmp, tlen, "%s,%s", old, now);
(void)_snprintf(tmp, tlen, "%s,%s", old, now);
free(now);
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)
{
WLog_ERR(TAG, "RDP file %s is empty", name);
fclose(fp);
(void)fclose(fp);
return FALSE;
}
@ -1036,7 +1036,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
if (!buffer)
{
fclose(fp);
(void)fclose(fp);
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;
}
fclose(fp);
(void)fclose(fp);
if (read_size < 1)
{
@ -1390,7 +1390,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
if (!unicodestr)
{
free(buffer);
fclose(fp);
(void)fclose(fp);
return FALSE;
}
@ -1400,7 +1400,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
{
free(buffer);
free(unicodestr);
fclose(fp);
(void)fclose(fp);
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)
{
free(buffer);
fclose(fp);
(void)fclose(fp);
return FALSE;
}
}
fflush(fp);
(void)fflush(fp);
status = fclose(fp);
}
@ -1652,7 +1652,7 @@ static ADDIN_ARGV* rdp_file_to_args(const char* channel, const char* values)
if (!str)
goto fail;
_snprintf(str, len, "device:%s", val);
(void)_snprintf(str, len, "device:%s", val);
rc = freerdp_addin_argv_add_argument(args, str);
free(str);
if (!rc)

View File

@ -12,8 +12,9 @@ static char* resize(char** buffer, size_t* size, size_t increment)
char* tmp = realloc(*buffer, nsize);
if (!tmp)
{
fprintf(stderr, "Could not reallocate string buffer from %" PRIuz " to %" PRIuz " bytes.\n",
*size, nsize);
(void)fprintf(stderr,
"Could not reallocate string buffer from %" PRIuz " to %" PRIuz " bytes.\n",
*size, nsize);
free(*buffer);
return NULL;
}
@ -113,24 +114,24 @@ int main(int argc, char* argv[])
size_t elements = sizeof(global_cmd_args) / sizeof(global_cmd_args[0]);
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");
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;
}
/* The tag used as header in the manpage */
fprintf(fp, "<refsect1>\n");
fprintf(fp, "\t<title>Options</title>\n");
fprintf(fp, "\t\t<variablelist>\n");
(void)fprintf(fp, "<refsect1>\n");
(void)fprintf(fp, "\t<title>Options</title>\n");
(void)fprintf(fp, "\t\t<variablelist>\n");
/* Iterate over argument struct and write data to docbook 4.5
* compatible XML */
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;
}
@ -141,31 +142,31 @@ int main(int argc, char* argv[])
char* alias = tr_esc_str(arg->Alias, FALSE);
char* format = tr_esc_str(arg->Format, TRUE);
char* text = tr_esc_str(arg->Text, FALSE);
fprintf(fp, "\t\t\t<varlistentry>\n");
(void)fprintf(fp, "\t\t\t<varlistentry>\n");
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)
fprintf(fp, "%s", arg->Default ? "-" : "+");
(void)fprintf(fp, "%s", arg->Default ? "-" : "+");
else
fprintf(fp, "/");
(void)fprintf(fp, "/");
fprintf(fp, "%s</option>", name);
(void)fprintf(fp, "%s</option>", name);
if (format)
{
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)
fprintf(fp, "]");
(void)fprintf(fp, "]");
}
fprintf(fp, "</term>\n");
(void)fprintf(fp, "</term>\n");
if (alias == name)
break;
@ -176,36 +177,36 @@ int main(int argc, char* argv[])
if (text)
{
fprintf(fp, "\t\t\t\t<listitem>\n");
fprintf(fp, "\t\t\t\t\t<para>");
(void)fprintf(fp, "\t\t\t\t<listitem>\n");
(void)fprintf(fp, "\t\t\t\t\t<para>");
if (text)
fprintf(fp, "%s", text);
(void)fprintf(fp, "%s", text);
if (arg->Flags & COMMAND_LINE_VALUE_BOOL &&
(!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)
{
char* value = tr_esc_str(arg->Default, FALSE);
fprintf(fp, " (default:%s)", value);
(void)fprintf(fp, " (default:%s)", value);
free(value);
}
fprintf(fp, "</para>\n");
fprintf(fp, "\t\t\t\t</listitem>\n");
(void)fprintf(fp, "</para>\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(format);
free(text);
}
fprintf(fp, "\t\t</variablelist>\n");
fprintf(fp, "\t</refsect1>\n");
fclose(fp);
(void)fprintf(fp, "\t\t</variablelist>\n");
(void)fprintf(fp, "\t</refsect1>\n");
(void)fclose(fp);
fprintf(stdout, "successfully generated '%s'\n", fname);
(void)fprintf(stdout, "successfully generated '%s'\n", fname);
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 TEST_ERROR(format, ...) \
do \
{ \
fprintf(stderr, format, ##__VA_ARGS__); \
printref(); \
printf(format, ##__VA_ARGS__); \
fflush(stdout); \
#define TEST_ERROR(format, ...) \
do \
{ \
(void)fprintf(stderr, format, ##__VA_ARGS__); \
printref(); \
(void)printf(format, ##__VA_ARGS__); \
(void)fflush(stdout); \
} while (0)
#define TEST_FAILURE(format, ...) \
do \
{ \
printref(); \
printf(" FAILURE "); \
printf(format, ##__VA_ARGS__); \
fflush(stdout); \
#define TEST_FAILURE(format, ...) \
do \
{ \
printref(); \
(void)printf(" FAILURE "); \
(void)printf(format, ##__VA_ARGS__); \
(void)fflush(stdout); \
} while (0)
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();
printf("Failure: overridden argument %d is %s but it should be %s\n", index,
actual_argument, expected_argument);
fflush(stdout);
(void)fflush(stdout);
*rc = -1;
}
}

View File

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

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,
PIXEL_FORMAT_XRGB32, 0, 0, 0, width, height, NULL);
printf("clear_decompress example %" PRIu32 " status: %d\n", nr, status);
fflush(stdout);
(void)printf("clear_decompress example %" PRIu32 " status: %d\n", nr, status);
(void)fflush(stdout);
rc = (status == 0);
fail:
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;
ms /= 1000000.0;
fprintf(stdout, "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
__func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
(void)fprintf(stdout,
"[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
__func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
if (!rc)
break;
}
@ -72,9 +73,10 @@ static BOOL TestFreeRDPImageCopy_no_overlap(UINT32 w, UINT32 h, UINT32 srcFormat
double ms = end - start;
ms /= 1000000.0;
fprintf(stdout, "[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
__func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
(void)fprintf(stdout,
"[%s] copied %" PRIu32 "x%" PRIu32 " [%-20s] -> [%-20s] in %lf ms [%s]\n",
__func__, w, h, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat), ms, rc ? "success" : "failure");
if (!rc)
break;
}
@ -106,8 +108,8 @@ int TestFreeRDPCodecCopy(int argc, char* argv[])
if ((errno != 0) || (width == 0) || (height == 0))
{
char buffer[128] = { 0 };
fprintf(stderr, "%s failed: width=%" PRIu32 ", height=%" PRIu32 ", errno=%s\n",
__func__, width, height, winpr_strerror(errno, buffer, sizeof(buffer)));
(void)fprintf(stderr, "%s failed: width=%" PRIu32 ", height=%" PRIu32 ", errno=%s\n",
__func__, width, height, winpr_strerror(errno, buffer, sizeof(buffer)));
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,
height, 0, NULL, &dstSize);
BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat));
printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat));
fflush(stdout);
(void)printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat));
(void)fflush(stdout);
printf("TODO: Skipping unfinished test!");
rc = TRUE;
goto fail;
@ -5539,8 +5539,8 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap,
fail:
free(compressedBitmap);
free(decompressedBitmap);
printf("\n");
fflush(stdout);
(void)printf("\n");
(void)fflush(stdout);
return rc;
}
@ -5548,9 +5548,9 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
const UINT32 dstFormat)
{
BOOL rc = FALSE;
printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat));
fflush(stdout);
(void)printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat));
(void)fflush(stdout);
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;
fail:
printf("\n");
fflush(stdout);
(void)printf("\n");
(void)fflush(stdout);
return rc;
}

View File

@ -296,18 +296,18 @@ static BYTE* test_progressive_load_file(const char* path, const char* file, size
if (!buffer)
{
fclose(fp);
(void)fclose(fp);
return NULL;
}
if (fread(buffer, *size, 1, fp) != 1)
{
free(buffer);
fclose(fp);
(void)fclose(fp);
return NULL;
}
fclose(fp);
(void)fclose(fp);
return buffer;
}
@ -1171,14 +1171,14 @@ static void free_cmd(RDPGFX_SURFACE_COMMAND* cmd)
static WINPR_NORETURN(void usage(const char* name))
{
FILE* fp = stdout;
fprintf(fp, "%s <directory> <width> <height>\n", name);
(void)fprintf(fp, "%s <directory> <width> <height>\n", name);
exit(-1);
}
static void print_codec_stats(const char* name, UINT64 timeNS)
{
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[])
@ -1259,7 +1259,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
break;
@ -1280,7 +1281,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
break;
@ -1294,7 +1296,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
break;
@ -1314,7 +1317,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
break;
@ -1337,7 +1341,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
break;
@ -1348,7 +1353,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
success = -1;
}
@ -1360,7 +1366,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
success = -1;
}
@ -1372,7 +1379,8 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
success = -1;
}
@ -1384,14 +1392,15 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
success = -1;
}
break;
default:
fprintf(stderr, "unexpected codec %s [0x%08" PRIx32 "]",
rdpgfx_get_codec_id_string(cmd.codecId), cmd.codecId);
(void)fprintf(stderr, "unexpected codec %s [0x%08" PRIx32 "]",
rdpgfx_get_codec_id_string(cmd.codecId), cmd.codecId);
success = -1;
break;
}
@ -1415,13 +1424,13 @@ static int test_dump(int argc, char* argv[])
const UINT64 end = winpr_GetTickCount64NS();
const UINT64 diff = end - start;
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;
}
region16_clear(&invalid);
}
free_cmd(&cmd);
fclose(fp);
(void)fclose(fp);
}
fail:
@ -1464,11 +1473,11 @@ int TestFreeRDPCodecProgressive(int argc, char* argv[])
WINPR_UNUSED(argv);
GetSystemTime(&systemTime);
sprintf_s(name, sizeof(name),
"EGFX_PROGRESSIVE_MS_SAMPLE-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16
"%02" PRIu16 "%02" PRIu16 "%04" PRIu16,
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
(void)sprintf_s(name, sizeof(name),
"EGFX_PROGRESSIVE_MS_SAMPLE-%04" PRIu16 "%02" PRIu16 "%02" PRIu16 "%02" PRIu16
"%02" PRIu16 "%02" PRIu16 "%04" PRIu16,
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
ms_sample_path = _strdup(CMAKE_CURRENT_SOURCE_DIR);
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)))
{
fprintf(stderr,
"expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16
") and have (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16 ")\n",
i, src2->left, src2->top, src2->right, src2->bottom, src1->left, src1->top,
src1->right, src1->bottom);
(void)fprintf(stderr,
"expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16
") and have (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16 ")\n",
i, src2->left, src2->top, src2->right, src2->bottom, src1->left,
src1->top, src1->right, src1->bottom);
return FALSE;
}
}
@ -709,57 +709,57 @@ static int test_norbert2_case(void)
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;
}
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;
}
if (nbRects != 1)
{
fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __func__,
nbRects);
(void)fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __func__,
nbRects);
goto out;
}
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;
}
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;
}
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;
}
if (nbRects != 2)
{
fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __func__,
nbRects);
(void)fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __func__,
nbRects);
goto out;
}
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;
}
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;
}
@ -849,7 +849,7 @@ int TestFreeRDPRegion(int argc, char* argv[])
for (int i = 0; tests[i].func; i++)
{
testNb++;
fprintf(stderr, "%d: %s\n", testNb, tests[i].name);
(void)fprintf(stderr, "%d: %s\n", testNb, tests[i].name);
retCode = tests[i].func();
if (retCode < 0)
@ -857,7 +857,7 @@ int TestFreeRDPRegion(int argc, char* argv[])
}
if (retCode < 0)
fprintf(stderr, "failed for test %d\n", testNb);
(void)fprintf(stderr, "failed for test %d\n", testNb);
return retCode;
}

View File

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

View File

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

View File

@ -146,7 +146,7 @@ int freerdp_addin_set_argument_value(ADDIN_ARGV* args, const char* option, const
if (!str)
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++)
{
@ -184,7 +184,7 @@ int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, const char* previous,
if (!str)
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++)
{
@ -1977,7 +1977,7 @@ char* freerdp_rail_support_flags_to_string(UINT32 flags, char* buffer, size_t le
if ((flags & ~mask) != 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, "|");
}
return buffer;
@ -2181,11 +2181,11 @@ const char* freerdp_supported_color_depths_string(UINT16 mask, char* buffer, siz
if (invalid != 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, "|");
}
char hex[32] = { 0 };
_snprintf(hex, sizeof(hex), "[0x%04" PRIx16 "]", mask);
(void)_snprintf(hex, sizeof(hex), "[0x%04" PRIx16 "]", mask);
return buffer;
}

View File

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

View File

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

View File

@ -4884,7 +4884,7 @@ const char* rdp_input_flag_string(UINT16 flags, char* buffer, size_t len)
{
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, "");
if ((flags & INPUT_FLAG_SCANCODES) != 0)
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)
return FALSE;
sprintf_s(spn, length, "%s/%s", service, hostname);
(void)sprintf_s(spn, length, "%s/%s", service, hostname);
}
if (!spn)
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* 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;
}
@ -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* 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;
}
@ -1275,7 +1275,7 @@ void setChannelError(rdpContext* context, UINT errorNum, WINPR_FORMAT_ARG const
WINPR_ASSERT(context);
context->channelErrorNum = errorNum;
vsnprintf(context->errorDescription, 499, format, ap);
(void)vsnprintf(context->errorDescription, 499, format, ap);
va_end(ap);
SetEvent(context->channelErrorEvent);
}

View File

@ -373,7 +373,7 @@ static char* guid2str(const GUID* guid)
if (rpcStatus != RPC_S_OK)
return NULL;
sprintf_s(bracedGuid, sizeof(bracedGuid), "{%s}", strguid);
(void)sprintf_s(bracedGuid, sizeof(bracedGuid), "{%s}", strguid);
RpcStringFreeA(&strguid);
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), "|");
}
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);
return buffer;
}
@ -294,7 +294,7 @@ static BOOL rdg_write_chunked(BIO* bio, wStream* sPacket)
int status = 0;
wStream* sChunk = NULL;
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);
if (!sChunk)
@ -1716,7 +1716,7 @@ static int rdg_write_chunked_data_packet(rdpRdg* rdg, const BYTE* buf, int isize
if (size < 1)
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);
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];
if (current->code == code)
{
sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
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];
if (current->code == code)
{
sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s", current->name);
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];
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;
}
}
sprintf_s(buffer, ARRAYSIZE(buffer), "%s [0x%08" PRIX32 "]", "UNKNOWN", code);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), "%s [0x%08" PRIX32 "]", "UNKNOWN", code);
out:
return buffer;
}

View File

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

View File

@ -285,7 +285,7 @@ static const char* tsg_component_id_to_string(UINT16 ComponentId, char* buffer,
}
#undef ENTRY
_snprintf(buffer, bytelen, "%s [0x%04" PRIx16 "]", str, ComponentId);
(void)_snprintf(buffer, bytelen, "%s [0x%04" PRIx16 "]", str, ComponentId);
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(flags);
_snprintf(buffer, size,
"enableAllRedirections=%s, disableAllRedirections=%s, driveRedirectionDisabled=%s, "
"printerRedirectionDisabled=%s, portRedirectionDisabled=%s, reserved=%s, "
"clipboardRedirectionDisabled=%s, pnpRedirectionDisabled=%s",
tsg_bool_to_string(flags->enableAllRedirections),
tsg_bool_to_string(flags->disableAllRedirections),
tsg_bool_to_string(flags->driveRedirectionDisabled),
tsg_bool_to_string(flags->printerRedirectionDisabled),
tsg_bool_to_string(flags->portRedirectionDisabled),
tsg_bool_to_string(flags->reserved),
tsg_bool_to_string(flags->clipboardRedirectionDisabled),
tsg_bool_to_string(flags->pnpRedirectionDisabled));
(void)_snprintf(
buffer, size,
"enableAllRedirections=%s, disableAllRedirections=%s, driveRedirectionDisabled=%s, "
"printerRedirectionDisabled=%s, portRedirectionDisabled=%s, reserved=%s, "
"clipboardRedirectionDisabled=%s, pnpRedirectionDisabled=%s",
tsg_bool_to_string(flags->enableAllRedirections),
tsg_bool_to_string(flags->disableAllRedirections),
tsg_bool_to_string(flags->driveRedirectionDisabled),
tsg_bool_to_string(flags->printerRedirectionDisabled),
tsg_bool_to_string(flags->portRedirectionDisabled), tsg_bool_to_string(flags->reserved),
tsg_bool_to_string(flags->clipboardRedirectionDisabled),
tsg_bool_to_string(flags->pnpRedirectionDisabled));
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)
{
_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, "|");
}
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
(void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
winpr_str_append(msg, buffer, size, "|");
return buffer;
}
@ -204,10 +204,10 @@ static const char* rdp_early_client_caps_string(UINT32 flags, char* buffer, size
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, "|");
}
_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
(void)_snprintf(msg, sizeof(msg), "[0x%08" PRIx32 "]", flags);
winpr_str_append(msg, buffer, size, "|");
return buffer;
}
@ -744,49 +744,49 @@ char* gcc_block_type_string(UINT16 type, char* buffer, size_t size)
switch (type)
{
case CS_CORE:
_snprintf(buffer, size, "CS_CORE [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_CORE [0x%04" PRIx16 "]", type);
break;
case CS_SECURITY:
_snprintf(buffer, size, "CS_SECURITY [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_SECURITY [0x%04" PRIx16 "]", type);
break;
case CS_NET:
_snprintf(buffer, size, "CS_NET [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_NET [0x%04" PRIx16 "]", type);
break;
case CS_CLUSTER:
_snprintf(buffer, size, "CS_CLUSTER [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_CLUSTER [0x%04" PRIx16 "]", type);
break;
case CS_MONITOR:
_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
break;
case CS_MCS_MSGCHANNEL:
_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_MONITOR [0x%04" PRIx16 "]", type);
break;
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;
case CS_UNUSED1:
_snprintf(buffer, size, "CS_UNUSED1 [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "CS_UNUSED1 [0x%04" PRIx16 "]", type);
break;
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;
case SC_CORE:
_snprintf(buffer, size, "SC_CORE [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "SC_CORE [0x%04" PRIx16 "]", type);
break;
case SC_SECURITY:
_snprintf(buffer, size, "SC_SECURITY [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "SC_SECURITY [0x%04" PRIx16 "]", type);
break;
case SC_NET:
_snprintf(buffer, size, "SC_NET [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "SC_NET [0x%04" PRIx16 "]", type);
break;
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;
case SC_MULTITRANSPORT:
_snprintf(buffer, size, "SC_MULTITRANSPORT [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "SC_MULTITRANSPORT [0x%04" PRIx16 "]", type);
break;
default:
_snprintf(buffer, size, "UNKNOWN [0x%04" PRIx16 "]", type);
(void)_snprintf(buffer, size, "UNKNOWN [0x%04" PRIx16 "]", type);
break;
}
return buffer;

View File

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

View File

@ -1282,7 +1282,7 @@ static const char* nego_rdp_neg_rsp_flags_str(UINT32 flags)
{
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)
winpr_str_append("EXTENDED_CLIENT_DATA_SUPPORTED", buffer, sizeof(buffer), "|");
if (flags & DYNVC_GFX_PROTOCOL_SUPPORTED)

View File

@ -466,7 +466,7 @@ static const char* primary_order_string(UINT32 orderType)
if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
return buffer;
}
static const char* secondary_order_string(UINT32 orderType)
@ -486,7 +486,7 @@ static const char* secondary_order_string(UINT32 orderType)
if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
return buffer;
}
static const char* altsec_order_string(BYTE orderType)
@ -506,7 +506,7 @@ static const char* altsec_order_string(BYTE orderType)
if (orderType < ARRAYSIZE(orders))
fmt = orders[orderType];
sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
(void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
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 ";
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);
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, "");
{
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, "");
}
return buffer;
@ -2244,7 +2244,7 @@ rdpRdp* rdp_new(rdpContext* context)
rdp->log = WLog_Get(RDP_TAG);
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);
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, "|");
if (flags == 0)
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, "");
return buffer;
}
@ -2687,7 +2687,7 @@ const char* rdp_security_flag_string(UINT32 securityFlags, char* buffer, size_t
{
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, "");
}
return buffer;

View File

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

View File

@ -68,7 +68,7 @@ static void delete_file(char* path)
break;
}
fclose(fp);
(void)fclose(fp);
}
}
@ -577,7 +577,7 @@ static BOOL smartcard_hw_enumerateCerts(const rdpSettings* settings, LPCWSTR csp
if (!scopeStr)
goto out;
_snprintf(scopeStr, readerSz + 5, "\\\\.\\%s\\", reader);
(void)_snprintf(scopeStr, readerSz + 5, "\\\\.\\%s\\", reader);
scope = ConvertUtf8NToWCharAlloc(scopeStr, readerSz + 5, NULL);
free(scopeStr);
@ -664,7 +664,7 @@ static BOOL smartcard_hw_enumerateCerts(const rdpSettings* settings, LPCWSTR csp
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'",
providerNameStr);
}

View File

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

View File

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

View File

@ -694,7 +694,7 @@ char* freerdp_tcp_address_to_string(const struct sockaddr_storage* addr, BOOL* p
break;
case AF_UNIX:
sprintf_s(ipAddress, ARRAYSIZE(ipAddress), "127.0.0.1");
(void)sprintf_s(ipAddress, ARRAYSIZE(ipAddress), "127.0.0.1");
break;
default:
@ -779,7 +779,7 @@ struct addrinfo* freerdp_tcp_resolve_host(const char* hostname, int port, int ai
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;
}

View File

@ -78,7 +78,7 @@ static int testTimeout(int port)
char arg1[] = "/v:192.0.2.1:XXXXX";
char* argv[] = { "test", "/v:192.0.2.1:XXXXX" };
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;
start = GetTickCount();
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" };
int rc = 0;
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;
rc = runInstance(ARRAYSIZE(argv), argv, args->arg, 5000);
@ -216,7 +216,7 @@ static BOOL prepare_certificates(const char* path)
"winpr-makecert" CMAKE_EXECUTABLE_SUFFIX);
if (!exe)
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);
free(exe);
@ -246,7 +246,7 @@ static int testSuccess(int port)
char* path = NULL;
char* wpath = NULL;
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;
if (!exe)
@ -281,7 +281,7 @@ static int testSuccess(int port)
if (!commandLine)
goto fail;
_snprintf(commandLine, commandLineLen, "%s --port=%d", exe, port);
(void)_snprintf(commandLine, commandLineLen, "%s --port=%d", exe, port);
si.cb = sizeof(si);
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)
{
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;
}
@ -305,19 +305,19 @@ static BOOL format_uint(char* buffer, size_t size, UINT64 value, UINT16 intType,
switch (intType)
{
case 0:
_snprintf(buffer, size, "%" PRIu64, lvalue);
(void)_snprintf(buffer, size, "%" PRIu64, lvalue);
return TRUE;
case 1:
_snprintf(buffer, size, "0x%" PRIx64, lvalue);
(void)_snprintf(buffer, size, "0x%" PRIx64, lvalue);
return TRUE;
case 2:
if (max < UINT64_MAX)
_snprintf(buffer, size, "%" PRIu64, max + 1);
(void)_snprintf(buffer, size, "%" PRIu64, max + 1);
else
_snprintf(buffer, size, "too large a number");
(void)_snprintf(buffer, size, "too large a number");
return FALSE;
default:
_snprintf(buffer, size, "not a number value");
(void)_snprintf(buffer, size, "not a number value");
return FALSE;
}
}
@ -327,16 +327,16 @@ static BOOL print_negative(char* buffer, size_t size, INT64 value, INT64 min)
switch (min)
{
case INT16_MIN:
_snprintf(buffer, size, "%" PRId16, (INT16)value);
(void)_snprintf(buffer, size, "%" PRId16, (INT16)value);
return FALSE;
case INT32_MIN:
_snprintf(buffer, size, "%" PRId32, (INT32)value);
(void)_snprintf(buffer, size, "%" PRId32, (INT32)value);
return FALSE;
case INT64_MIN:
_snprintf(buffer, size, "%" PRId64, (INT64)value);
(void)_snprintf(buffer, size, "%" PRId64, (INT64)value);
return FALSE;
default:
_snprintf(buffer, size, "too small a number");
(void)_snprintf(buffer, size, "too small a number");
return FALSE;
}
}
@ -345,23 +345,23 @@ static BOOL print_xpositive(char* buffer, size_t size, INT64 value, INT64 max)
{
if (value < 0)
{
_snprintf(buffer, size, "%" PRId64, value);
(void)_snprintf(buffer, size, "%" PRId64, value);
return TRUE;
}
switch (max)
{
case INT16_MAX:
_snprintf(buffer, size, "%" PRIx16, (INT16)value);
(void)_snprintf(buffer, size, "%" PRIx16, (INT16)value);
return FALSE;
case INT32_MAX:
_snprintf(buffer, size, "%" PRIx32, (INT32)value);
(void)_snprintf(buffer, size, "%" PRIx32, (INT32)value);
return FALSE;
case INT64_MAX:
_snprintf(buffer, size, "%" PRIx64, (INT64)value);
(void)_snprintf(buffer, size, "%" PRIx64, (INT64)value);
return FALSE;
default:
_snprintf(buffer, size, "too small a number");
(void)_snprintf(buffer, size, "too small a number");
return FALSE;
}
}
@ -374,25 +374,25 @@ static BOOL format_int(char* buffer, size_t size, INT64 value, UINT16 intType, I
switch (intType)
{
case 0:
_snprintf(buffer, size, "%" PRId64, lvalue);
(void)_snprintf(buffer, size, "%" PRId64, lvalue);
return TRUE;
case 1:
print_xpositive(buffer, size, lvalue, max);
return TRUE;
case 2:
if (max < INT64_MAX)
_snprintf(buffer, size, "%" PRId64, max + 1);
(void)_snprintf(buffer, size, "%" PRId64, max + 1);
else
_snprintf(buffer, size, "too large a number");
(void)_snprintf(buffer, size, "too large a number");
return FALSE;
case 3:
if (min < INT64_MIN)
print_negative(buffer, size, min - 1, INT64_MIN);
else
_snprintf(buffer, size, "too small a number");
(void)_snprintf(buffer, size, "too small a number");
return FALSE;
default:
_snprintf(buffer, size, "not a number value");
(void)_snprintf(buffer, size, "not a number value");
return FALSE;
}
}
@ -403,37 +403,37 @@ static BOOL format_bool(char* buffer, size_t size, UINT16 intType)
switch (intType)
{
case 0:
_snprintf(buffer, size, "FALSE");
(void)_snprintf(buffer, size, "FALSE");
return TRUE;
case 1:
_snprintf(buffer, size, "FaLsE");
(void)_snprintf(buffer, size, "FaLsE");
return TRUE;
case 2:
_snprintf(buffer, size, "False");
(void)_snprintf(buffer, size, "False");
return TRUE;
case 3:
_snprintf(buffer, size, "false");
(void)_snprintf(buffer, size, "false");
return TRUE;
case 4:
_snprintf(buffer, size, "falseentry");
(void)_snprintf(buffer, size, "falseentry");
return FALSE;
case 5:
_snprintf(buffer, size, "TRUE");
(void)_snprintf(buffer, size, "TRUE");
return TRUE;
case 6:
_snprintf(buffer, size, "TrUe");
(void)_snprintf(buffer, size, "TrUe");
return TRUE;
case 7:
_snprintf(buffer, size, "True");
(void)_snprintf(buffer, size, "True");
return TRUE;
case 8:
_snprintf(buffer, size, "true");
(void)_snprintf(buffer, size, "true");
return TRUE;
case 9:
_snprintf(buffer, size, "someentry");
(void)_snprintf(buffer, size, "someentry");
return FALSE;
default:
_snprintf(buffer, size, "ok");
(void)_snprintf(buffer, size, "ok");
return FALSE;
}
}
@ -574,7 +574,7 @@ static BOOL check_key_helpers(size_t key, const char* stype)
break;
case RDP_SETTINGS_TYPE_STRING:
expect = TRUE;
_snprintf(value, sizeof(value), "somerandomstring");
(void)_snprintf(value, sizeof(value), "somerandomstring");
break;
case RDP_SETTINGS_TYPE_POINTER:
expect = FALSE;

View File

@ -27,11 +27,11 @@ static BOOL test_entry_read_write(void)
winpr_RAND(tmp, sizeof(tmp));
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);
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;
}
@ -39,8 +39,8 @@ static BOOL test_entry_read_write(void)
sr = Stream_New(NULL, 1024);
if (!sr || !sw)
{
fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw,
(void*)sr);
(void)fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw,
(void*)sr);
goto fail;
}
@ -53,7 +53,7 @@ static BOOL test_entry_read_write(void)
goto fail;
if (!stream_dump_write_line(fp, 0, sw))
goto fail;
fclose(fp);
(void)fclose(fp);
fp = fopen(name, "rb");
if (!fp)
@ -63,21 +63,21 @@ static BOOL test_entry_read_write(void)
if (entrysize != offset)
{
fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n", __func__,
offset, entrysize);
(void)fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n",
__func__, offset, entrysize);
goto fail;
}
if (Stream_Length(sr) != Stream_Capacity(sw))
{
fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__,
Stream_Length(sr), Stream_Capacity(sw));
(void)fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__,
Stream_Length(sr), Stream_Capacity(sw));
goto fail;
}
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;
}
rc = TRUE;
@ -85,11 +85,11 @@ fail:
Stream_Free(sr, TRUE);
Stream_Free(sw, TRUE);
if (fp)
fclose(fp);
(void)fclose(fp);
if (name)
DeleteFileA(name);
free(name);
fprintf(stderr, "xxxxxxxxxxxxx %d\n", rc);
(void)fprintf(stderr, "xxxxxxxxxxxxx %d\n", 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, "|");
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("{", buffer, size, "}");

View File

@ -532,13 +532,13 @@ static BOOL window_order_supported(const rdpSettings* settings, UINT32 fieldFlag
}
}
#define DUMP_APPEND(buffer, size, ...) \
do \
{ \
char* b = (buffer); \
size_t s = (size); \
size_t pos = strnlen(b, s); \
_snprintf(&b[pos], s - pos, __VA_ARGS__); \
#define DUMP_APPEND(buffer, size, ...) \
do \
{ \
char* b = (buffer); \
size_t s = (size); \
size_t pos = strnlen(b, s); \
(void)_snprintf(&b[pos], s - pos, __VA_ARGS__); \
} while (0)
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 };
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)
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;
}
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);

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,
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);
}

View File

@ -116,12 +116,12 @@ BOOL freerdp_certificate_store_save_data(rdpCertificateStore* store, const rdpCe
if (!fp)
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;
fail:
if (fp)
fclose(fp);
(void)fclose(fp);
free(path);
return rc;
}

View File

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

View File

@ -58,7 +58,7 @@ int TestBase64(int argc, char* argv[])
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
testNb++;
fprintf(stderr, "%d:encode base64...", testNb);
(void)fprintf(stderr, "%d:encode base64...", testNb);
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))
{
fprintf(stderr, "ko, error for string %d\n", i);
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;
}
free(encoded);
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
testNb++;
fprintf(stderr, "%d:encode base64url...", testNb);
(void)fprintf(stderr, "%d:encode base64url...", testNb);
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))
{
fprintf(stderr, "ko, error for string %d\n", i);
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;
}
free(encoded);
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
testNb++;
fprintf(stderr, "%d:decode base64...", testNb);
(void)fprintf(stderr, "%d:decode base64...", testNb);
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) ||
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;
}
free(decoded);
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
testNb++;
fprintf(stderr, "%d:decode base64url...", testNb);
(void)fprintf(stderr, "%d:decode base64url...", testNb);
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) ||
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;
}
free(decoded);
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
testNb++;
fprintf(stderr, "%d:decode base64 errors...", testNb);
(void)fprintf(stderr, "%d:decode base64 errors...", testNb);
crypto_base64_decode("000", 3, &decoded, &outLen);
if (decoded)
{
fprintf(stderr, "ko, badly padded string\n");
(void)fprintf(stderr, "ko, badly padded string\n");
return -1;
}
@ -145,7 +145,7 @@ int TestBase64(int argc, char* argv[])
if (decoded)
{
fprintf(stderr, "ko, = in a wrong place\n");
(void)fprintf(stderr, "ko, = in a wrong place\n");
return -1;
}
@ -153,14 +153,14 @@ int TestBase64(int argc, char* argv[])
if (decoded)
{
fprintf(stderr, "ko, = in a wrong place\n");
(void)fprintf(stderr, "ko, = in a wrong place\n");
return -1;
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
testNb++;
/* 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* longStrExpected =
"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);
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;
}
free(encoded);
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
return 0;
}

View File

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

View File

@ -36,7 +36,7 @@ static char* certificate_path(const char* filename)
char* result = calloc(1, flen);
if (!result)
return NULL;
_snprintf(result, flen, "%s%c%s", file, dirsep, filename);
(void)_snprintf(result, flen, "%s%c%s", file, dirsep, filename);
return result;
#else
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+");
if (f)
{
fwrite(line, strlen(line), 1, f);
fwrite("\n", 1, 1, f);
fclose(f);
(void)fwrite(line, strlen(line), 1, f);
(void)fwrite("\n", 1, 1, f);
(void)fclose(f);
}
}
}

View File

@ -130,7 +130,7 @@ static const char* general_name_type_label(int general_name_type)
else
{
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;
}
}

View File

@ -54,11 +54,11 @@ static char* card_id_and_name_a(const UUID* CardIdentifier, LPCSTR LookupName)
if (!id)
return NULL;
snprintf(id, len, "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X\\%s", CardIdentifier->Data1,
CardIdentifier->Data2, CardIdentifier->Data3, CardIdentifier->Data4[0],
CardIdentifier->Data4[1], CardIdentifier->Data4[2], CardIdentifier->Data4[3],
CardIdentifier->Data4[4], CardIdentifier->Data4[5], CardIdentifier->Data4[6],
CardIdentifier->Data4[7], LookupName);
(void)snprintf(id, len, "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X\\%s",
CardIdentifier->Data1, CardIdentifier->Data2, CardIdentifier->Data3,
CardIdentifier->Data4[0], CardIdentifier->Data4[1], CardIdentifier->Data4[2],
CardIdentifier->Data4[3], CardIdentifier->Data4[4], CardIdentifier->Data4[5],
CardIdentifier->Data4[6], CardIdentifier->Data4[7], LookupName);
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)
return NULL;
_snprintf(buffer, size - 1,
"[top/left=%" PRId32 "x%" PRId32 "-bottom/right%" PRId32 "x%" PRId32 "]", rect->top,
rect->left, rect->bottom, rect->right);
(void)_snprintf(buffer, size - 1,
"[top/left=%" PRId32 "x%" PRId32 "-bottom/right%" PRId32 "x%" PRId32 "]",
rect->top, rect->left, rect->bottom, rect->right);
buffer[size - 1] = '\0';
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)
return NULL;
_snprintf(buffer, size - 1, "[%" PRId32 "x%" PRId32 "-%" PRId32 "x%" PRId32 "]", rgn->x, rgn->y,
rgn->w, rgn->h);
(void)_snprintf(buffer, size - 1, "[%" PRId32 "x%" PRId32 "-%" PRId32 "x%" PRId32 "]", rgn->x,
rgn->y, rgn->w, rgn->h);
buffer[size - 1] = '\0';
return buffer;

View File

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

View File

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

View File

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

View File

@ -168,7 +168,7 @@ static char* gdi_convert_postfix_to_infix(const char* postfix)
cl = 1;
dl = al + bl + cl + 3;
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);
free(a);
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");
fflush(stdout);
(void)fflush(stdout);
}
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));
test_dump_bitmap(hBmpActual, "Actual");
test_dump_bitmap(hBmpExpected, "Expected");
fflush(stdout);
fflush(stderr);
(void)fflush(stdout);
(void)fflush(stderr);
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 };
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 */
if ((strcmp(name, buffer) == 0))
return current;

View File

@ -24,8 +24,8 @@ static BOOL similar(const BYTE* src, const BYTE* dst, size_t size)
if (abs(diff) > 4)
{
fprintf(stderr, "%" PRIuz " %02" PRIX8 " : %02" PRIX8 " diff=%d\n", x, src[x], dst[x],
abs(diff));
(void)fprintf(stderr, "%" PRIuz " %02" PRIX8 " : %02" PRIX8 " diff=%d\n", x, src[x],
dst[x], abs(diff));
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))
{
fprintf(
(void)fprintf(
stderr,
"Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %" PRIuz
"\n",
@ -72,7 +72,7 @@ static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 for
if (dA != fill)
{
fprintf(
(void)fprintf(
stderr,
"[%s] Invalid destination alpha value 0x%02X [expected 0x%02X] at position %" PRIuz
"\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'))
x++;
fprintf(stderr,
"Buffer underflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz "]\n",
d, 'A', buffer, start, x);
(void)fprintf(stderr,
"Buffer underflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz
"]\n",
d, 'A', buffer, start, x);
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'))
x++;
fprintf(stderr,
"Buffer overflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz "]\n", d,
'A', buffer, start, x);
(void)fprintf(stderr,
"Buffer overflow detected %02" PRIx8 " != %02X %s [%" PRIuz "-%" PRIuz
"]\n",
d, 'A', buffer, start, x);
return FALSE;
}
}
@ -202,9 +204,10 @@ static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi)
PROFILER_DEFINE(yuvSplit)
awidth = roi.width + 16 - roi.width % 16;
aheight = roi.height + 16 - roi.height % 16;
fprintf(stderr,
"Running YUVCombine on frame size %" PRIu32 "x%" PRIu32 " [%" PRIu32 "x%" PRIu32 "]\n",
roi.width, roi.height, awidth, aheight);
(void)fprintf(stderr,
"Running YUVCombine on frame size %" PRIu32 "x%" PRIu32 " [%" PRIu32 "x%" PRIu32
"]\n",
roi.width, roi.height, awidth, aheight);
PROFILER_CREATE(yuvCombine, "YUV420CombineToYUV444")
PROFILER_CREATE(yuvSplit, "YUV444SplitToYUV420")
rect.left = 0;
@ -432,8 +435,8 @@ static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
return FALSE;
}
fprintf(stderr, "Running AVC%s on frame size %" PRIu32 "x%" PRIu32 "\n", use444 ? "444" : "420",
roi.width, roi.height);
(void)fprintf(stderr, "Running AVC%s on frame size %" PRIu32 "x%" PRIu32 "\n",
use444 ? "444" : "420", roi.width, roi.height);
/* Test RGB to YUV444 conversion and vice versa */
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)
{
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))
{
fprintf(stderr, "Mismatch in Y planes!");
(void)fprintf(stderr, "Mismatch in Y planes!");
rc = FALSE;
}
if (check_for_mismatches(planesA[1], planesB[1], uvsize))
{
fprintf(stderr, "Mismatch in U planes!");
(void)fprintf(stderr, "Mismatch in U planes!");
rc = FALSE;
}
if (check_for_mismatches(planesA[2], planesB[2], uvsize))
{
fprintf(stderr, "Mismatch in V planes!");
(void)fprintf(stderr, "Mismatch in V planes!");
rc = FALSE;
}
@ -743,8 +746,8 @@ static BOOL TestPrimitiveRgbToLumaChroma(primitives_t* prims, prim_size_t roi, U
if (!fkt || !gen)
return FALSE;
fprintf(stderr, "Running AVC444 on frame size %" PRIu32 "x%" PRIu32 "\n", roi.width,
roi.height);
(void)fprintf(stderr, "Running AVC444 on frame size %" PRIu32 "x%" PRIu32 "\n", roi.width,
roi.height);
/* Test RGB to YUV444 conversion and vice versa */
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;
if (t < 0.0f)
sprintf(output, "%f", t);
(void)sprintf(output, "%f", t);
else if (i == 0)
sprintf(output, "%d", (int)(t + 0.5f));
(void)sprintf(output, "%d", (int)(t + 0.5f));
else if (t < 1e+3f)
sprintf(output, "%3d", i);
(void)sprintf(output, "%3d", i);
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)
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)
sprintf(output, "%3d,%03d,000,000", i / 1000000000, (i % 1000000000) / 1000000);
(void)sprintf(output, "%3d,%03d,000,000", i / 1000000000, (i % 1000000000) / 1000000);
else
sprintf(output, "%f", t);
(void)sprintf(output, "%f", t);
}
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)
{
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;
}

View File

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

View File

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

View File

@ -135,7 +135,7 @@ static void fatal_handler(int signum)
sigemptyset(&this_mask);
sigaddset(&this_mask, signum);
pthread_sigmask(SIG_UNBLOCK, &this_mask, NULL);
raise(signum);
(void)raise(signum);
}
static const int term_signals[] = { SIGINT, SIGKILL, SIGQUIT, SIGSTOP, SIGTERM };
@ -204,7 +204,7 @@ int freerdp_handle_signals(void)
goto fail;
/* Ignore SIGPIPE signal. */
signal(SIGPIPE, SIG_IGN);
(void)signal(SIGPIPE, SIG_IGN);
handlers_registered = TRUE;
rc = 0;
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, "|");
{
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, "");
}
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))
{
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;
}
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;
}
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;
}
if (value != rvalue)
{
fprintf(stderr, "[%s(%" PRId32 ")] read invalid value %" PRId32 " from stream\n", __func__,
value, rvalue);
(void)fprintf(stderr, "[%s(%" PRId32 ")] read invalid value %" PRId32 " from stream\n",
__func__, value, rvalue);
return FALSE;
}
return TRUE;
@ -69,8 +70,9 @@ static BOOL test_signed_integer_write_oor(INT32 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",
__func__, value);
(void)fprintf(stderr,
"[%s(%" PRId32 ")] out of range value not detected and written to stream\n",
__func__, value);
return FALSE;
}
return TRUE;
@ -120,24 +122,25 @@ static BOOL test_float_read_write_equal(double 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;
}
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;
}
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;
}
const double diff = fabs(value - rvalue);
const UINT64 expdiff = diff * pow(10, exp);
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 TRUE;
@ -152,8 +155,8 @@ static BOOL test_floag_write_oor(double value)
if (freerdp_write_four_byte_float(s, value))
{
fprintf(stderr, "[%s(%lf)] out of range value not detected and written to stream\n",
__func__, value);
(void)fprintf(stderr, "[%s(%lf)] out of range value not detected and written to stream\n",
__func__, value);
return FALSE;
}
return TRUE;

View File

@ -91,7 +91,7 @@ int TestRingBuffer(int argc, char* argv[])
if (!ringbuffer_init(&ringBuffer, 10))
{
fprintf(stderr, "unable to initialize ringbuffer\n");
(void)fprintf(stderr, "unable to initialize ringbuffer\n");
return -1;
}
@ -102,24 +102,24 @@ int TestRingBuffer(int argc, char* argv[])
for (int i = 0; i < 50; 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) ||
!ringbuffer_write(&ringBuffer, tmpBuf, 5))
{
fprintf(stderr, "error when writing bytes\n");
(void)fprintf(stderr, "error when writing bytes\n");
return -1;
}
if (ringbuffer_used(&ringBuffer) != 15)
{
fprintf(stderr, "invalid used size got %" PRIuz " when I would expect 15\n",
ringbuffer_used(&ringBuffer));
(void)fprintf(stderr, "invalid used size got %" PRIuz " when I would expect 15\n",
ringbuffer_used(&ringBuffer));
return -1;
}
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;
}
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)
{
fprintf(stderr, "invalid byte at %d, got %" PRIu8 " instead of %d\n", i,
chunks[0].data[i], i % 5);
(void)fprintf(stderr, "invalid byte at %d, got %" PRIu8 " instead of %d\n", i,
chunks[0].data[i], i % 5);
return -1;
}
}
if (ringbuffer_used(&ringBuffer) != 5)
{
fprintf(stderr, "invalid used size after read got %" PRIuz " when I would expect 5\n",
ringbuffer_used(&ringBuffer));
(void)fprintf(stderr, "invalid used size after read got %" PRIuz " when I would expect 5\n",
ringbuffer_used(&ringBuffer));
return -1;
}
@ -147,28 +147,28 @@ int TestRingBuffer(int argc, char* argv[])
ringbuffer_peek(&ringBuffer, chunks, 11) != 2 || chunks[0].size != 10 ||
chunks[1].size != 1)
{
fprintf(stderr, "invalid read of splitted data\n");
(void)fprintf(stderr, "invalid read of splitted data\n");
return -1;
}
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))
{
fprintf(stderr, "peek returns some chunks\n");
(void)fprintf(stderr, "peek returns some chunks\n");
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++)
{
rb_ptr = ringbuffer_ensure_linear_write(&ringBuffer, 50);
if (!rb_ptr)
{
fprintf(stderr, "ringbuffer_ensure_linear_write() error\n");
(void)fprintf(stderr, "ringbuffer_ensure_linear_write() error\n");
return -1;
}
@ -176,7 +176,7 @@ int TestRingBuffer(int argc, char* argv[])
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;
}
@ -191,34 +191,34 @@ int TestRingBuffer(int argc, char* argv[])
if (ringbuffer_capacity(&ringBuffer) != 10)
{
fprintf(stderr, "not the expected capacity, have %" PRIuz " and expects 10\n",
ringbuffer_capacity(&ringBuffer));
(void)fprintf(stderr, "not the expected capacity, have %" PRIuz " and expects 10\n",
ringbuffer_capacity(&ringBuffer));
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++)
{
ringbuffer_ensure_linear_write(&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;
}
}
ringbuffer_commit_read_bytes(&ringBuffer, 50 * 1000);
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
ringbuffer_destroy(&ringBuffer);
fprintf(stderr, "%d: specific overlaps test...", ++testNo);
(void)fprintf(stderr, "%d: specific overlaps test...", ++testNo);
if (!test_overlaps())
{
fprintf(stderr, "ko\n");
(void)fprintf(stderr, "ko\n");
return -1;
}
fprintf(stderr, "ok\n");
(void)fprintf(stderr, "ok\n");
ringbuffer_destroy(&ringBuffer);
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)
{
fclose(fp);
(void)fclose(fp);
return NULL;
}
@ -175,7 +175,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
if (!buffer)
{
fclose(fp);
(void)fclose(fp);
return NULL;
}
@ -186,7 +186,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
readSize = fileSize.s;
}
fclose(fp);
(void)fclose(fp);
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 };
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))
{
FILE* fp = stdout;
fprintf(fp, "Invalid argument '%s'\n", invalid);
fprintf(fp, "Usage: %s <arg>[ <arg> ...]\n", app);
fprintf(fp, "Arguments:\n");
(void)fprintf(fp, "Invalid argument '%s'\n", invalid);
(void)fprintf(fp, "Usage: %s <arg>[ <arg> ...]\n", app);
(void)fprintf(fp, "Arguments:\n");
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<key file>\n", options.skey, sizeof(options.skey));
@ -1420,7 +1420,7 @@ int main(int argc, char* argv[])
goto fail;
/* 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);
if (!file)

View File

@ -51,7 +51,7 @@ static const char* strsignal(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, "stopping all connections.");
@ -60,11 +60,11 @@ static void cleanup_handler(int signum)
static void pf_server_register_signal_handlers(void)
{
signal(SIGINT, cleanup_handler);
signal(SIGTERM, cleanup_handler);
(void)signal(SIGINT, cleanup_handler);
(void)signal(SIGTERM, cleanup_handler);
#ifndef _WIN32
signal(SIGQUIT, cleanup_handler);
signal(SIGKILL, cleanup_handler);
(void)signal(SIGQUIT, cleanup_handler);
(void)signal(SIGKILL, cleanup_handler);
#endif
}

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