[warnings] cast return of fprintf (void)

fprintf returns a value. Not using it is mostly fine, but it generates
noise when compiling with all warnings on, so cast to (void)
This commit is contained in:
akallabeth 2024-09-06 08:56:12 +02:00
parent 590fbcf005
commit 2170cc65e3
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
16 changed files with 168 additions and 158 deletions

View File

@ -167,7 +167,7 @@ static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
ifman.output_pending = FALSE;
ifman.output_interface_id = InterfaceId;
// fprintf(stderr, "InterfaceId: 0x%08"PRIX32" MessageId: 0x%08"PRIX32" FunctionId:
// (void)fprintf(stderr, "InterfaceId: 0x%08"PRIX32" MessageId: 0x%08"PRIX32" FunctionId:
// 0x%08"PRIX32"\n", InterfaceId, MessageId, FunctionId);
switch (InterfaceId)

View File

@ -288,7 +288,7 @@ void AppDelegate_EmbedWindowEventHandler(void *ctx, const EmbedWindowEventArgs *
void AppDelegate_ResizeWindowEventHandler(void *ctx, const ResizeWindowEventArgs *e)
{
rdpContext *context = (rdpContext *)ctx;
fprintf(stderr, "ResizeWindowEventHandler: %d %d\n", e->width, e->height);
(void)fprintf(stderr, "ResizeWindowEventHandler: %d %d\n", e->width, e->height);
if (_singleDelegate)
{

View File

@ -375,7 +375,7 @@ static int mf_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSiz
inputSample->lpVtbl->Release(inputSample);
return 1;
error:
fprintf(stderr, "mf_decompress error\n");
(void)fprintf(stderr, "mf_decompress error\n");
return -1;
}

View File

@ -922,21 +922,21 @@ static void dump_cmd(const RDPGFX_SURFACE_COMMAND* cmd, UINT32 frameId)
FILE* fp = fopen(fname, "w");
if (!fp)
return;
fprintf(fp, "frameid: %" PRIu32 "\n", frameId);
fprintf(fp, "surfaceId: %" PRIu32 "\n", cmd->surfaceId);
fprintf(fp, "codecId: %" PRIu32 "\n", cmd->codecId);
fprintf(fp, "contextId: %" PRIu32 "\n", cmd->contextId);
fprintf(fp, "format: %" PRIu32 "\n", cmd->format);
fprintf(fp, "left: %" PRIu32 "\n", cmd->left);
fprintf(fp, "top: %" PRIu32 "\n", cmd->top);
fprintf(fp, "right: %" PRIu32 "\n", cmd->right);
fprintf(fp, "bottom: %" PRIu32 "\n", cmd->bottom);
fprintf(fp, "width: %" PRIu32 "\n", cmd->width);
fprintf(fp, "height: %" PRIu32 "\n", cmd->height);
fprintf(fp, "length: %" PRIu32 "\n", cmd->length);
(void)fprintf(fp, "frameid: %" PRIu32 "\n", frameId);
(void)fprintf(fp, "surfaceId: %" PRIu32 "\n", cmd->surfaceId);
(void)fprintf(fp, "codecId: %" PRIu32 "\n", cmd->codecId);
(void)fprintf(fp, "contextId: %" PRIu32 "\n", cmd->contextId);
(void)fprintf(fp, "format: %" PRIu32 "\n", cmd->format);
(void)fprintf(fp, "left: %" PRIu32 "\n", cmd->left);
(void)fprintf(fp, "top: %" PRIu32 "\n", cmd->top);
(void)fprintf(fp, "right: %" PRIu32 "\n", cmd->right);
(void)fprintf(fp, "bottom: %" PRIu32 "\n", cmd->bottom);
(void)fprintf(fp, "width: %" PRIu32 "\n", cmd->width);
(void)fprintf(fp, "height: %" PRIu32 "\n", cmd->height);
(void)fprintf(fp, "length: %" PRIu32 "\n", cmd->length);
char* bdata = crypto_base64_encode_ex(cmd->data, cmd->length, FALSE);
fprintf(fp, "data: %s\n", bdata);
(void)fprintf(fp, "data: %s\n", bdata);
free(bdata);
fclose(fp);
}

View File

@ -407,7 +407,7 @@ static BOOL test_rop(HGDI_DC hdcDst, HGDI_DC hdcSrc, HGDI_BITMAP hBmpSrc, HGDI_B
success = TRUE;
fail:
fprintf(stderr, "[%s] ROP=%s returned %d\n", __func__, gdi_rop_to_string(rop), success);
(void)fprintf(stderr, "[%s] ROP=%s returned %d\n", __func__, gdi_rop_to_string(rop), success);
return success;
}

View File

@ -920,7 +920,7 @@ static BOOL load_layout_file(void)
FILE* fp = winpr_fopen("/tmp/kbd.json", "w");
if (!fp)
goto end;
fprintf(fp, "%s", str);
(void)fprintf(fp, "%s", str);
fclose(fp);
}
end:

View File

@ -39,22 +39,22 @@ int TestCommConfig(int argc, char* argv[])
if (hComm && (hComm != INVALID_HANDLE_VALUE))
{
fprintf(stderr,
"CreateFileA failure: could create a handle on a not yet defined device: %s\n",
lpFileName);
(void)fprintf(
stderr, "CreateFileA failure: could create a handle on a not yet defined device: %s\n",
lpFileName);
return EXIT_FAILURE;
}
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
success = DefineCommDevice(lpFileName, "/dev/ttyS0");
if (!success)
{
fprintf(stderr, "DefineCommDevice failure: %s\n", lpFileName);
(void)fprintf(stderr, "DefineCommDevice failure: %s\n", lpFileName);
return EXIT_FAILURE;
}
@ -64,9 +64,9 @@ int TestCommConfig(int argc, char* argv[])
0, (HANDLE)1234); /* invalid parmaeter */
if (hComm != INVALID_HANDLE_VALUE)
{
fprintf(stderr,
"CreateFileA failure: could create a handle with some invalid parameters %s\n",
lpFileName);
(void)fprintf(
stderr, "CreateFileA failure: could create a handle with some invalid parameters %s\n",
lpFileName);
return EXIT_FAILURE;
}
@ -74,8 +74,8 @@ int TestCommConfig(int argc, char* argv[])
if (!hComm || (hComm == INVALID_HANDLE_VALUE))
{
fprintf(stderr, "CreateFileA failure: %s GetLastError() = 0x%08x\n", lpFileName,
GetLastError());
(void)fprintf(stderr, "CreateFileA failure: %s GetLastError() = 0x%08x\n", lpFileName,
GetLastError());
return EXIT_FAILURE;
}
@ -86,29 +86,31 @@ int TestCommConfig(int argc, char* argv[])
success = GetCommState(hComm, &dcb);
if (!success)
{
fprintf(stderr, "GetCommState failure: GetLastError() = Ox%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: GetLastError() = Ox%x\n", GetLastError());
return EXIT_FAILURE;
}
fprintf(stderr,
"BaudRate: %" PRIu32 " ByteSize: %" PRIu8 " Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
(void)fprintf(stderr,
"BaudRate: %" PRIu32 " ByteSize: %" PRIu8 " Parity: %" PRIu8 " StopBits: %" PRIu8
"\n",
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
if (!GetCommProperties(hComm, &commProp))
{
fprintf(stderr, "GetCommProperties failure: GetLastError(): 0x%08x\n", GetLastError());
(void)fprintf(stderr, "GetCommProperties failure: GetLastError(): 0x%08x\n",
GetLastError());
return EXIT_FAILURE;
}
if ((commProp.dwSettableBaud & BAUD_57600) <= 0)
{
fprintf(stderr, "BAUD_57600 unsupported!\n");
(void)fprintf(stderr, "BAUD_57600 unsupported!\n");
return EXIT_FAILURE;
}
if ((commProp.dwSettableBaud & BAUD_14400) > 0)
{
fprintf(stderr, "BAUD_14400 supported!\n");
(void)fprintf(stderr, "BAUD_14400 supported!\n");
return EXIT_FAILURE;
}
@ -121,7 +123,7 @@ int TestCommConfig(int argc, char* argv[])
if (!success)
{
fprintf(stderr, "SetCommState failure: GetLastError() = 0x%x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: GetLastError() = 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
@ -129,17 +131,17 @@ int TestCommConfig(int argc, char* argv[])
if (!success)
{
fprintf(stderr, "GetCommState failure: GetLastError() = 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: GetLastError() = 0x%x\n", GetLastError());
return 0;
}
if ((dcb.BaudRate != CBR_57600) || (dcb.ByteSize != 8) || (dcb.Parity != NOPARITY) ||
(dcb.StopBits != ONESTOPBIT))
{
fprintf(stderr,
"Got an unexpeted value among: BaudRate: %" PRIu32 " ByteSize: %" PRIu8
" Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
(void)fprintf(stderr,
"Got an unexpeted value among: BaudRate: %" PRIu32 " ByteSize: %" PRIu8
" Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
}
CloseHandle(hComm);

View File

@ -35,21 +35,21 @@ int TestControlSettings(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
result = DefineCommDevice("COM1", "/dev/ttyS0");
if (!result)
{
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
@ -57,7 +57,7 @@ int TestControlSettings(int argc, char* argv[])
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
@ -69,7 +69,7 @@ int TestControlSettings(int argc, char* argv[])
if (!SetCommState(hComm, &dcb))
{
fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
@ -77,13 +77,13 @@ int TestControlSettings(int argc, char* argv[])
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
if ((dcb.ByteSize != 5) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != MARKPARITY))
{
fprintf(stderr, "test1 failed.\n");
(void)fprintf(stderr, "test1 failed.\n");
return FALSE;
}
@ -95,7 +95,7 @@ int TestControlSettings(int argc, char* argv[])
if (!SetCommState(hComm, &dcb))
{
fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
@ -103,19 +103,19 @@ int TestControlSettings(int argc, char* argv[])
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
if ((dcb.ByteSize != 8) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != NOPARITY))
{
fprintf(stderr, "test2 failed.\n");
(void)fprintf(stderr, "test2 failed.\n");
return FALSE;
}
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -83,7 +83,7 @@ int TestGetCommState(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
@ -131,7 +131,7 @@ int TestGetCommState(int argc, char* argv[])
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -43,48 +43,48 @@ int TestHandflow(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
result = DefineCommDevice("COM1", "/dev/ttyS0");
if (!result)
{
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
if (!test_SerialSys(hComm))
{
fprintf(stderr, "test_SerCxSys failure\n");
(void)fprintf(stderr, "test_SerCxSys failure\n");
return EXIT_FAILURE;
}
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCxSys); */
/* if (!test_SerCxSys(hComm)) */
/* { */
/* fprintf(stderr, "test_SerCxSys failure\n"); */
/* (void)fprintf(stderr, "test_SerCxSys failure\n"); */
/* return EXIT_FAILURE; */
/* } */
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys); */
/* if (!test_SerCx2Sys(hComm)) */
/* { */
/* fprintf(stderr, "test_SerCxSys failure\n"); */
/* (void)fprintf(stderr, "test_SerCxSys failure\n"); */
/* return EXIT_FAILURE; */
/* } */
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -39,20 +39,20 @@ static BOOL test_SerCxSys(HANDLE hComm)
if (tcgetattr(((WINPR_COMM*)hComm)->fd, &currentTermios) < 0)
{
fprintf(stderr, "tcgetattr failure.\n");
(void)fprintf(stderr, "tcgetattr failure.\n");
return FALSE;
}
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
return FALSE;
}
if ((dcb.XonChar == '\0') || (dcb.XoffChar == '\0'))
{
fprintf(stderr, "test_SerCxSys failure, expected XonChar and XoffChar to be set\n");
(void)fprintf(stderr, "test_SerCxSys failure, expected XonChar and XoffChar to be set\n");
return FALSE;
}
@ -60,7 +60,7 @@ static BOOL test_SerCxSys(HANDLE hComm)
if ((dcb.XonChar != currentTermios.c_cc[VSTART]) ||
(dcb.XoffChar != currentTermios.c_cc[VSTOP]))
{
fprintf(stderr, "test_SerCxSys failure, could not retrieve XonChar and XoffChar\n");
(void)fprintf(stderr, "test_SerCxSys failure, could not retrieve XonChar and XoffChar\n");
return FALSE;
}
@ -72,7 +72,7 @@ static BOOL test_SerCxSys(HANDLE hComm)
dcb.XoffChar = XonChar;
if (!SetCommState(hComm, &dcb))
{
fprintf(stderr, "SetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
return FALSE;
}
@ -80,13 +80,13 @@ static BOOL test_SerCxSys(HANDLE hComm)
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure, GetLastError(): 0x%08x\n", GetLastError());
return FALSE;
}
if ((dcb.XonChar != XoffChar) || (dcb.XoffChar != XonChar))
{
fprintf(stderr, "test_SerCxSys, expected XonChar and XoffChar to be swapped\n");
(void)fprintf(stderr, "test_SerCxSys, expected XonChar and XoffChar to be swapped\n");
return FALSE;
}
@ -94,14 +94,15 @@ static BOOL test_SerCxSys(HANDLE hComm)
dcb.XonChar = dcb.XoffChar;
if (SetCommState(hComm, &dcb))
{
fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed because "
"XonChar and XoffChar are the same\n");
(void)fprintf(stderr,
"test_SerCxSys failure, SetCommState() was supposed to failed because "
"XonChar and XoffChar are the same\n");
return FALSE;
}
if (GetLastError() != ERROR_INVALID_PARAMETER)
{
fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed with "
"GetLastError()=ERROR_INVALID_PARAMETER\n");
(void)fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed with "
"GetLastError()=ERROR_INVALID_PARAMETER\n");
return FALSE;
}
@ -115,14 +116,14 @@ static BOOL test_SerCx2Sys(HANDLE hComm)
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hComm, &dcb))
{
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
return FALSE;
}
if ((dcb.ErrorChar != '\0') || (dcb.EofChar != '\0') || (dcb.EvtChar != '\0') ||
(dcb.XonChar != '\0') || (dcb.XoffChar != '\0'))
{
fprintf(stderr, "test_SerCx2Sys failure, expected all characters to be: '\\0'\n");
(void)fprintf(stderr, "test_SerCx2Sys failure, expected all characters to be: '\\0'\n");
return FALSE;
}
@ -137,41 +138,41 @@ int TestSerialChars(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
result = DefineCommDevice("COM1", "/dev/ttyS0");
if (!result)
{
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
if (!test_SerCxSys(hComm))
{
fprintf(stderr, "test_SerCxSys failure\n");
(void)fprintf(stderr, "test_SerCxSys failure\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
if (!test_SerCx2Sys(hComm))
{
fprintf(stderr, "test_SerCxSys failure\n");
(void)fprintf(stderr, "test_SerCxSys failure\n");
return EXIT_FAILURE;
}
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -44,7 +44,7 @@ static BOOL test_fParity(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
@ -53,7 +53,7 @@ static BOOL test_fParity(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
@ -61,13 +61,13 @@ static BOOL test_fParity(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
if (!dcb.fParity)
{
fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of TRUE\n", dcb.fParity);
(void)fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of TRUE\n", dcb.fParity);
return FALSE;
}
@ -76,7 +76,7 @@ static BOOL test_fParity(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
@ -84,13 +84,13 @@ static BOOL test_fParity(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
if (dcb.fParity)
{
fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of FALSE\n", dcb.fParity);
(void)fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of FALSE\n", dcb.fParity);
return FALSE;
}
@ -99,7 +99,7 @@ static BOOL test_fParity(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
@ -107,13 +107,13 @@ static BOOL test_fParity(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
return FALSE;
}
if (!dcb.fParity)
{
fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of TRUE\n", dcb.fParity);
(void)fprintf(stderr, "unexpected fParity: %" PRIu32 " instead of TRUE\n", dcb.fParity);
return FALSE;
}
@ -129,7 +129,7 @@ static BOOL test_SerialSys(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
@ -138,7 +138,7 @@ static BOOL test_SerialSys(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
return FALSE;
}
@ -146,13 +146,13 @@ static BOOL test_SerialSys(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
if (dcb.BaudRate != CBR_115200)
{
fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_115200)\n",
CBR_115200);
(void)fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_115200)\n",
CBR_115200);
return FALSE;
}
@ -162,7 +162,7 @@ static BOOL test_SerialSys(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
@ -170,12 +170,13 @@ static BOOL test_SerialSys(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
if (dcb.BaudRate != CBR_57600)
{
fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_57600)\n", CBR_57600);
(void)fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_57600)\n",
CBR_57600);
return FALSE;
}
@ -184,8 +185,9 @@ static BOOL test_SerialSys(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (result)
{
fprintf(stderr, "SetCommState failure: unexpected support of BaudRate=%d (CBR_128000)\n",
CBR_128000);
(void)fprintf(stderr,
"SetCommState failure: unexpected support of BaudRate=%d (CBR_128000)\n",
CBR_128000);
return FALSE;
}
@ -214,7 +216,7 @@ static BOOL test_generic(HANDLE hComm)
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
@ -223,21 +225,21 @@ static BOOL test_generic(HANDLE hComm)
result = SetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
(void)fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
return FALSE;
}
result = GetCommState(hComm, &dcb);
if (!result)
{
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
return FALSE;
}
if (memcmp(&dcb, &dcb2, sizeof(DCB)) != 0)
{
fprintf(stderr,
"DCB is different after SetCommState() whereas it should have not changed\n");
(void)fprintf(stderr,
"DCB is different after SetCommState() whereas it should have not changed\n");
return FALSE;
}
@ -248,7 +250,7 @@ static BOOL test_generic(HANDLE hComm)
/* fParity tests */
if (!test_fParity(hComm))
{
fprintf(stderr, "test_fParity failure\n");
(void)fprintf(stderr, "test_fParity failure\n");
return FALSE;
}
@ -263,69 +265,69 @@ int TestSetCommState(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
result = DefineCommDevice("COM1", "/dev/ttyS0");
if (!result)
{
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
if (!test_generic(hComm))
{
fprintf(stderr, "test_generic failure (SerialDriverUnknown)\n");
(void)fprintf(stderr, "test_generic failure (SerialDriverUnknown)\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_generic failure (SerialDriverSerialSys)\n");
(void)fprintf(stderr, "test_generic failure (SerialDriverSerialSys)\n");
return EXIT_FAILURE;
}
if (!test_SerialSys(hComm))
{
fprintf(stderr, "test_SerialSys failure\n");
(void)fprintf(stderr, "test_SerialSys failure\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_generic failure (SerialDriverSerCxSys)\n");
(void)fprintf(stderr, "test_generic failure (SerialDriverSerCxSys)\n");
return EXIT_FAILURE;
}
if (!test_SerCxSys(hComm))
{
fprintf(stderr, "test_SerCxSys failure\n");
(void)fprintf(stderr, "test_SerCxSys failure\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_generic failure (SerialDriverSerCx2Sys)\n");
(void)fprintf(stderr, "test_generic failure (SerialDriverSerCx2Sys)\n");
return EXIT_FAILURE;
}
if (!test_SerCx2Sys(hComm))
{
fprintf(stderr, "test_SerCx2Sys failure\n");
(void)fprintf(stderr, "test_SerCx2Sys failure\n");
return EXIT_FAILURE;
}
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -42,19 +42,19 @@ static BOOL test_generic(HANDLE hComm)
if (!SetCommTimeouts(hComm, &timeouts))
{
fprintf(stderr, "SetCommTimeouts failure, GetLastError: 0x%08x\n", GetLastError());
(void)fprintf(stderr, "SetCommTimeouts failure, GetLastError: 0x%08x\n", GetLastError());
return FALSE;
}
if (!GetCommTimeouts(hComm, &timeouts2))
{
fprintf(stderr, "GetCommTimeouts failure, GetLastError: 0x%08x\n", GetLastError());
(void)fprintf(stderr, "GetCommTimeouts failure, GetLastError: 0x%08x\n", GetLastError());
return FALSE;
}
if (memcmp(&timeouts, &timeouts2, sizeof(COMMTIMEOUTS)) != 0)
{
fprintf(stderr, "TestTimeouts failure, didn't get back the same timeouts.\n");
(void)fprintf(stderr, "TestTimeouts failure, didn't get back the same timeouts.\n");
return FALSE;
}
@ -63,19 +63,21 @@ static BOOL test_generic(HANDLE hComm)
timeouts.ReadTotalTimeoutConstant = MAXULONG;
if (SetCommTimeouts(hComm, &timeouts))
{
fprintf(stderr,
"SetCommTimeouts succeeded with ReadIntervalTimeout and ReadTotalTimeoutConstant "
"set to MAXULONG. GetLastError: 0x%08x\n",
GetLastError());
(void)fprintf(
stderr,
"SetCommTimeouts succeeded with ReadIntervalTimeout and ReadTotalTimeoutConstant "
"set to MAXULONG. GetLastError: 0x%08x\n",
GetLastError());
return FALSE;
}
if (GetLastError() != ERROR_INVALID_PARAMETER)
{
fprintf(stderr,
"SetCommTimeouts failure, expected GetLastError to return ERROR_INVALID_PARAMETER "
"and got: 0x%08x\n",
GetLastError());
(void)fprintf(
stderr,
"SetCommTimeouts failure, expected GetLastError to return ERROR_INVALID_PARAMETER "
"and got: 0x%08x\n",
GetLastError());
return FALSE;
}
@ -90,48 +92,48 @@ int TestTimeouts(int argc, char* argv[])
if (stat("/dev/ttyS0", &statbuf) < 0)
{
fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
(void)fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n");
return EXIT_SUCCESS;
}
result = DefineCommDevice("COM1", "/dev/ttyS0");
if (!result)
{
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hComm == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
(void)fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError());
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_SerialSys failure\n");
(void)fprintf(stderr, "test_SerialSys failure\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_SerCxSys failure\n");
(void)fprintf(stderr, "test_SerCxSys failure\n");
return EXIT_FAILURE;
}
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
if (!test_generic(hComm))
{
fprintf(stderr, "test_SerCx2Sys failure\n");
(void)fprintf(stderr, "test_SerCx2Sys failure\n");
return EXIT_FAILURE;
}
if (!CloseHandle(hComm))
{
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
return EXIT_FAILURE;
}

View File

@ -14,7 +14,7 @@ int TestCryptoRand(int argc, char* argv[])
winpr_RAND(rnd, sizeof(rnd));
str = winpr_BinToHexString(rnd, sizeof(rnd), FALSE);
// fprintf(stderr, "Rand: %s\n", str);
// (void)fprintf(stderr, "Rand: %s\n", str);
free(str);
if (memcmp(rnd, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0)

View File

@ -332,7 +332,8 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E
if (locked)
ReleaseMutex(mutex);
else
fprintf(stderr, "WARNING: InterlockedCompareExchange64 operation might have failed\n");
(void)fprintf(stderr,
"WARNING: InterlockedCompareExchange64 operation might have failed\n");
return previousValue;
}

View File

@ -34,7 +34,7 @@ static int start_threads(size_t count, HANDLE* threads)
if (!threads[i])
{
fprintf(stderr, "%s: CreateThread [%" PRIuz "] failure\n", __func__, i);
(void)fprintf(stderr, "%s: CreateThread [%" PRIuz "] failure\n", __func__, i);
return -1;
}
}
@ -55,7 +55,7 @@ static int close_threads(DWORD count, HANDLE* threads)
if (!CloseHandle(threads[i]))
{
fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __func__, i);
(void)fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __func__, i);
rc = -1;
}
threads[i] = NULL;
@ -71,21 +71,21 @@ static BOOL TestWaitForAll(void)
/* WaitForAll, timeout */
if (start_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: start_threads failed\n", __func__);
(void)fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail;
}
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, 10);
if (ret != WAIT_TIMEOUT)
{
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 10 failed, ret=%d\n",
__func__, ret);
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 10 failed, ret=%d\n",
__func__, ret);
goto fail;
}
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail;
}
@ -93,7 +93,7 @@ static BOOL TestWaitForAll(void)
fail:
if (close_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: close_threads failed\n", __func__);
(void)fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE;
}
@ -107,20 +107,20 @@ static BOOL TestWaitOne(void)
/* WaitForAll, timeout */
if (start_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: start_threads failed\n", __func__);
(void)fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail;
}
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, INFINITE);
if (ret > (WAIT_OBJECT_0 + ARRAYSIZE(threads)))
{
fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __func__);
(void)fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __func__);
goto fail;
}
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail;
}
@ -128,7 +128,7 @@ static BOOL TestWaitOne(void)
fail:
if (close_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: close_threads failed\n", __func__);
(void)fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE;
}
@ -142,27 +142,28 @@ static BOOL TestWaitOneTimeout(void)
/* WaitForAll, timeout */
if (start_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: start_threads failed\n", __func__);
(void)fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail;
}
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 1);
if (ret != WAIT_TIMEOUT)
{
fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __func__, ret);
(void)fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __func__,
ret);
goto fail;
}
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail;
}
rc = TRUE;
fail:
if (close_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: close_threads failed\n", __func__);
(void)fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE;
}
@ -176,7 +177,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
/* WaitForAll, timeout */
if (start_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: start_threads failed\n", __func__);
(void)fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail;
}
@ -185,14 +186,15 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 0);
if (ret != WAIT_TIMEOUT)
{
fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __func__, ret);
(void)fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __func__,
ret);
goto fail;
}
}
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail;
}
@ -200,7 +202,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
fail:
if (close_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: close_threads failed\n", __func__);
(void)fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE;
}
@ -214,7 +216,7 @@ static BOOL TestDetach(void)
/* WaitForAll, timeout */
if (start_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: start_threads failed\n", __func__);
(void)fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail;
}
@ -222,7 +224,7 @@ static BOOL TestDetach(void)
fail:
if (close_threads(ARRAYSIZE(threads), threads))
{
fprintf(stderr, "%s: close_threads failed\n", __func__);
(void)fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE;
}