mirror of https://github.com/FreeRDP/FreeRDP
commit
6a64fe121b
|
@ -21,6 +21,7 @@ Checks: >
|
||||||
-altera-id-dependent-backward-branch,
|
-altera-id-dependent-backward-branch,
|
||||||
-altera-struct-pack-align,
|
-altera-struct-pack-align,
|
||||||
-altera-unroll-loops,
|
-altera-unroll-loops,
|
||||||
|
-cppcoreguidelines-interfaces-global-init,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-assignment-in-if-condition,
|
-bugprone-assignment-in-if-condition,
|
||||||
-bugprone-macro-parentheses,
|
-bugprone-macro-parentheses,
|
||||||
|
|
|
@ -167,7 +167,7 @@ static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||||
ifman.output_pending = FALSE;
|
ifman.output_pending = FALSE;
|
||||||
ifman.output_interface_id = InterfaceId;
|
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);
|
// 0x%08"PRIX32"\n", InterfaceId, MessageId, FunctionId);
|
||||||
|
|
||||||
switch (InterfaceId)
|
switch (InterfaceId)
|
||||||
|
|
|
@ -288,7 +288,7 @@ void AppDelegate_EmbedWindowEventHandler(void *ctx, const EmbedWindowEventArgs *
|
||||||
void AppDelegate_ResizeWindowEventHandler(void *ctx, const ResizeWindowEventArgs *e)
|
void AppDelegate_ResizeWindowEventHandler(void *ctx, const ResizeWindowEventArgs *e)
|
||||||
{
|
{
|
||||||
rdpContext *context = (rdpContext *)ctx;
|
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)
|
if (_singleDelegate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -375,7 +375,7 @@ static int mf_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSiz
|
||||||
inputSample->lpVtbl->Release(inputSample);
|
inputSample->lpVtbl->Release(inputSample);
|
||||||
return 1;
|
return 1;
|
||||||
error:
|
error:
|
||||||
fprintf(stderr, "mf_decompress error\n");
|
(void)fprintf(stderr, "mf_decompress error\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -922,21 +922,21 @@ static void dump_cmd(const RDPGFX_SURFACE_COMMAND* cmd, UINT32 frameId)
|
||||||
FILE* fp = fopen(fname, "w");
|
FILE* fp = fopen(fname, "w");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "frameid: %" PRIu32 "\n", frameId);
|
(void)fprintf(fp, "frameid: %" PRIu32 "\n", frameId);
|
||||||
fprintf(fp, "surfaceId: %" PRIu32 "\n", cmd->surfaceId);
|
(void)fprintf(fp, "surfaceId: %" PRIu32 "\n", cmd->surfaceId);
|
||||||
fprintf(fp, "codecId: %" PRIu32 "\n", cmd->codecId);
|
(void)fprintf(fp, "codecId: %" PRIu32 "\n", cmd->codecId);
|
||||||
fprintf(fp, "contextId: %" PRIu32 "\n", cmd->contextId);
|
(void)fprintf(fp, "contextId: %" PRIu32 "\n", cmd->contextId);
|
||||||
fprintf(fp, "format: %" PRIu32 "\n", cmd->format);
|
(void)fprintf(fp, "format: %" PRIu32 "\n", cmd->format);
|
||||||
fprintf(fp, "left: %" PRIu32 "\n", cmd->left);
|
(void)fprintf(fp, "left: %" PRIu32 "\n", cmd->left);
|
||||||
fprintf(fp, "top: %" PRIu32 "\n", cmd->top);
|
(void)fprintf(fp, "top: %" PRIu32 "\n", cmd->top);
|
||||||
fprintf(fp, "right: %" PRIu32 "\n", cmd->right);
|
(void)fprintf(fp, "right: %" PRIu32 "\n", cmd->right);
|
||||||
fprintf(fp, "bottom: %" PRIu32 "\n", cmd->bottom);
|
(void)fprintf(fp, "bottom: %" PRIu32 "\n", cmd->bottom);
|
||||||
fprintf(fp, "width: %" PRIu32 "\n", cmd->width);
|
(void)fprintf(fp, "width: %" PRIu32 "\n", cmd->width);
|
||||||
fprintf(fp, "height: %" PRIu32 "\n", cmd->height);
|
(void)fprintf(fp, "height: %" PRIu32 "\n", cmd->height);
|
||||||
fprintf(fp, "length: %" PRIu32 "\n", cmd->length);
|
(void)fprintf(fp, "length: %" PRIu32 "\n", cmd->length);
|
||||||
|
|
||||||
char* bdata = crypto_base64_encode_ex(cmd->data, cmd->length, FALSE);
|
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);
|
free(bdata);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,7 +407,7 @@ static BOOL test_rop(HGDI_DC hdcDst, HGDI_DC hdcSrc, HGDI_BITMAP hBmpSrc, HGDI_B
|
||||||
|
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
fail:
|
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;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -920,7 +920,7 @@ static BOOL load_layout_file(void)
|
||||||
FILE* fp = winpr_fopen("/tmp/kbd.json", "w");
|
FILE* fp = winpr_fopen("/tmp/kbd.json", "w");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
goto end;
|
goto end;
|
||||||
fprintf(fp, "%s", str);
|
(void)fprintf(fp, "%s", str);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
|
|
|
@ -45,7 +45,7 @@ message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
|
||||||
include(CommonConfigOptions)
|
include(CommonConfigOptions)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
|
|
|
@ -38,7 +38,7 @@ message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
|
||||||
include(CommonConfigOptions)
|
include(CommonConfigOptions)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
|
|
|
@ -39,22 +39,22 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
|
|
||||||
if (hComm && (hComm != INVALID_HANDLE_VALUE))
|
if (hComm && (hComm != INVALID_HANDLE_VALUE))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(
|
||||||
"CreateFileA failure: could create a handle on a not yet defined device: %s\n",
|
stderr, "CreateFileA failure: could create a handle on a not yet defined device: %s\n",
|
||||||
lpFileName);
|
lpFileName);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = DefineCommDevice(lpFileName, "/dev/ttyS0");
|
success = DefineCommDevice(lpFileName, "/dev/ttyS0");
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: %s\n", lpFileName);
|
(void)fprintf(stderr, "DefineCommDevice failure: %s\n", lpFileName);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
0, (HANDLE)1234); /* invalid parmaeter */
|
0, (HANDLE)1234); /* invalid parmaeter */
|
||||||
if (hComm != INVALID_HANDLE_VALUE)
|
if (hComm != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(
|
||||||
"CreateFileA failure: could create a handle with some invalid parameters %s\n",
|
stderr, "CreateFileA failure: could create a handle with some invalid parameters %s\n",
|
||||||
lpFileName);
|
lpFileName);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
|
|
||||||
if (!hComm || (hComm == INVALID_HANDLE_VALUE))
|
if (!hComm || (hComm == INVALID_HANDLE_VALUE))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CreateFileA failure: %s GetLastError() = 0x%08x\n", lpFileName,
|
(void)fprintf(stderr, "CreateFileA failure: %s GetLastError() = 0x%08x\n", lpFileName,
|
||||||
GetLastError());
|
GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -86,29 +86,31 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
success = GetCommState(hComm, &dcb);
|
success = GetCommState(hComm, &dcb);
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: GetLastError() = Ox%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: GetLastError() = Ox%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"BaudRate: %" PRIu32 " ByteSize: %" PRIu8 " Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
|
"BaudRate: %" PRIu32 " ByteSize: %" PRIu8 " Parity: %" PRIu8 " StopBits: %" PRIu8
|
||||||
|
"\n",
|
||||||
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
|
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
|
||||||
|
|
||||||
if (!GetCommProperties(hComm, &commProp))
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((commProp.dwSettableBaud & BAUD_57600) <= 0)
|
if ((commProp.dwSettableBaud & BAUD_57600) <= 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "BAUD_57600 unsupported!\n");
|
(void)fprintf(stderr, "BAUD_57600 unsupported!\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((commProp.dwSettableBaud & BAUD_14400) > 0)
|
if ((commProp.dwSettableBaud & BAUD_14400) > 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "BAUD_14400 supported!\n");
|
(void)fprintf(stderr, "BAUD_14400 supported!\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +123,7 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: GetLastError() = 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: GetLastError() = 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,14 +131,14 @@ int TestCommConfig(int argc, char* argv[])
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: GetLastError() = 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: GetLastError() = 0x%x\n", GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.BaudRate != CBR_57600) || (dcb.ByteSize != 8) || (dcb.Parity != NOPARITY) ||
|
if ((dcb.BaudRate != CBR_57600) || (dcb.ByteSize != 8) || (dcb.Parity != NOPARITY) ||
|
||||||
(dcb.StopBits != ONESTOPBIT))
|
(dcb.StopBits != ONESTOPBIT))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"Got an unexpeted value among: BaudRate: %" PRIu32 " ByteSize: %" PRIu8
|
"Got an unexpeted value among: BaudRate: %" PRIu32 " ByteSize: %" PRIu8
|
||||||
" Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
|
" Parity: %" PRIu8 " StopBits: %" PRIu8 "\n",
|
||||||
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
|
dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits);
|
||||||
|
|
|
@ -35,21 +35,21 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hComm == INVALID_HANDLE_VALUE)
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &dcb))
|
if (!GetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
|
|
||||||
if (!SetCommState(hComm, &dcb))
|
if (!SetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,13 +77,13 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &dcb))
|
if (!GetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.ByteSize != 5) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != MARKPARITY))
|
if ((dcb.ByteSize != 5) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != MARKPARITY))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test1 failed.\n");
|
(void)fprintf(stderr, "test1 failed.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
|
|
||||||
if (!SetCommState(hComm, &dcb))
|
if (!SetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,19 +103,19 @@ int TestControlSettings(int argc, char* argv[])
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &dcb))
|
if (!GetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.ByteSize != 8) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != NOPARITY))
|
if ((dcb.ByteSize != 8) || (dcb.StopBits != ONESTOPBIT) || (dcb.Parity != NOPARITY))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test2 failed.\n");
|
(void)fprintf(stderr, "test2 failed.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ int TestGetCommState(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ int TestGetCommState(int argc, char* argv[])
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,48 +43,48 @@ int TestHandflow(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hComm == INVALID_HANDLE_VALUE)
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
||||||
if (!test_SerialSys(hComm))
|
if (!test_SerialSys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure\n");
|
(void)fprintf(stderr, "test_SerCxSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCxSys); */
|
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCxSys); */
|
||||||
/* if (!test_SerCxSys(hComm)) */
|
/* if (!test_SerCxSys(hComm)) */
|
||||||
/* { */
|
/* { */
|
||||||
/* fprintf(stderr, "test_SerCxSys failure\n"); */
|
/* (void)fprintf(stderr, "test_SerCxSys failure\n"); */
|
||||||
/* return EXIT_FAILURE; */
|
/* return EXIT_FAILURE; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys); */
|
/* _comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys); */
|
||||||
/* if (!test_SerCx2Sys(hComm)) */
|
/* if (!test_SerCx2Sys(hComm)) */
|
||||||
/* { */
|
/* { */
|
||||||
/* fprintf(stderr, "test_SerCxSys failure\n"); */
|
/* (void)fprintf(stderr, "test_SerCxSys failure\n"); */
|
||||||
/* return EXIT_FAILURE; */
|
/* return EXIT_FAILURE; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,20 +39,20 @@ static BOOL test_SerCxSys(HANDLE hComm)
|
||||||
|
|
||||||
if (tcgetattr(((WINPR_COMM*)hComm)->fd, ¤tTermios) < 0)
|
if (tcgetattr(((WINPR_COMM*)hComm)->fd, ¤tTermios) < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "tcgetattr failure.\n");
|
(void)fprintf(stderr, "tcgetattr failure.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.XonChar == '\0') || (dcb.XoffChar == '\0'))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static BOOL test_SerCxSys(HANDLE hComm)
|
||||||
if ((dcb.XonChar != currentTermios.c_cc[VSTART]) ||
|
if ((dcb.XonChar != currentTermios.c_cc[VSTART]) ||
|
||||||
(dcb.XoffChar != currentTermios.c_cc[VSTOP]))
|
(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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ static BOOL test_SerCxSys(HANDLE hComm)
|
||||||
dcb.XoffChar = XonChar;
|
dcb.XoffChar = XonChar;
|
||||||
if (!SetCommState(hComm, &dcb))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +80,13 @@ static BOOL test_SerCxSys(HANDLE hComm)
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.XonChar != XoffChar) || (dcb.XoffChar != XonChar))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,13 +94,14 @@ static BOOL test_SerCxSys(HANDLE hComm)
|
||||||
dcb.XonChar = dcb.XoffChar;
|
dcb.XonChar = dcb.XoffChar;
|
||||||
if (SetCommState(hComm, &dcb))
|
if (SetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed because "
|
(void)fprintf(stderr,
|
||||||
|
"test_SerCxSys failure, SetCommState() was supposed to failed because "
|
||||||
"XonChar and XoffChar are the same\n");
|
"XonChar and XoffChar are the same\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (GetLastError() != ERROR_INVALID_PARAMETER)
|
if (GetLastError() != ERROR_INVALID_PARAMETER)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed with "
|
(void)fprintf(stderr, "test_SerCxSys failure, SetCommState() was supposed to failed with "
|
||||||
"GetLastError()=ERROR_INVALID_PARAMETER\n");
|
"GetLastError()=ERROR_INVALID_PARAMETER\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -115,14 +116,14 @@ static BOOL test_SerCx2Sys(HANDLE hComm)
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hComm, &dcb))
|
if (!GetCommState(hComm, &dcb))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure; GetLastError(): %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dcb.ErrorChar != '\0') || (dcb.EofChar != '\0') || (dcb.EvtChar != '\0') ||
|
if ((dcb.ErrorChar != '\0') || (dcb.EofChar != '\0') || (dcb.EvtChar != '\0') ||
|
||||||
(dcb.XonChar != '\0') || (dcb.XoffChar != '\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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,41 +138,41 @@ int TestSerialChars(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hComm == INVALID_HANDLE_VALUE)
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
||||||
if (!test_SerCxSys(hComm))
|
if (!test_SerCxSys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure\n");
|
(void)fprintf(stderr, "test_SerCxSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
||||||
if (!test_SerCx2Sys(hComm))
|
if (!test_SerCx2Sys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure\n");
|
(void)fprintf(stderr, "test_SerCxSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,13 +61,13 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcb.fParity)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcb.fParity)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,13 +107,13 @@ static BOOL test_fParity(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%08" PRIx32 "\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcb.fParity)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +146,12 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (dcb.BaudRate != CBR_115200)
|
if (dcb.BaudRate != CBR_115200)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_115200)\n",
|
(void)fprintf(stderr, "SetCommState failure: could not set BaudRate=%d (CBR_115200)\n",
|
||||||
CBR_115200);
|
CBR_115200);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,12 +170,13 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (dcb.BaudRate != CBR_57600)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +185,8 @@ static BOOL test_SerialSys(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: unexpected support of BaudRate=%d (CBR_128000)\n",
|
(void)fprintf(stderr,
|
||||||
|
"SetCommState failure: unexpected support of BaudRate=%d (CBR_128000)\n",
|
||||||
CBR_128000);
|
CBR_128000);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +216,7 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,20 +225,20 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
result = SetCommState(hComm, &dcb);
|
result = SetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
|
(void)fprintf(stderr, "SetCommState failure: 0x%08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = GetCommState(hComm, &dcb);
|
result = GetCommState(hComm, &dcb);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "GetCommState failure: 0x%x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(&dcb, &dcb2, sizeof(DCB)) != 0)
|
if (memcmp(&dcb, &dcb2, sizeof(DCB)) != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"DCB is different after SetCommState() whereas it should have not changed\n");
|
"DCB is different after SetCommState() whereas it should have not changed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +250,7 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
/* fParity tests */
|
/* fParity tests */
|
||||||
if (!test_fParity(hComm))
|
if (!test_fParity(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_fParity failure\n");
|
(void)fprintf(stderr, "test_fParity failure\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,69 +265,69 @@ int TestSetCommState(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hComm == INVALID_HANDLE_VALUE)
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_generic failure (SerialDriverUnknown)\n");
|
(void)fprintf(stderr, "test_generic failure (SerialDriverUnknown)\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_generic failure (SerialDriverSerialSys)\n");
|
(void)fprintf(stderr, "test_generic failure (SerialDriverSerialSys)\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (!test_SerialSys(hComm))
|
if (!test_SerialSys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerialSys failure\n");
|
(void)fprintf(stderr, "test_SerialSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_generic failure (SerialDriverSerCxSys)\n");
|
(void)fprintf(stderr, "test_generic failure (SerialDriverSerCxSys)\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (!test_SerCxSys(hComm))
|
if (!test_SerCxSys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure\n");
|
(void)fprintf(stderr, "test_SerCxSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_generic failure (SerialDriverSerCx2Sys)\n");
|
(void)fprintf(stderr, "test_generic failure (SerialDriverSerCx2Sys)\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (!test_SerCx2Sys(hComm))
|
if (!test_SerCx2Sys(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCx2Sys failure\n");
|
(void)fprintf(stderr, "test_SerCx2Sys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,19 +42,19 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
|
|
||||||
if (!SetCommTimeouts(hComm, &timeouts))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetCommTimeouts(hComm, &timeouts2))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(&timeouts, &timeouts2, sizeof(COMMTIMEOUTS)) != 0)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
timeouts.ReadTotalTimeoutConstant = MAXULONG;
|
timeouts.ReadTotalTimeoutConstant = MAXULONG;
|
||||||
if (SetCommTimeouts(hComm, &timeouts))
|
if (SetCommTimeouts(hComm, &timeouts))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(
|
||||||
|
stderr,
|
||||||
"SetCommTimeouts succeeded with ReadIntervalTimeout and ReadTotalTimeoutConstant "
|
"SetCommTimeouts succeeded with ReadIntervalTimeout and ReadTotalTimeoutConstant "
|
||||||
"set to MAXULONG. GetLastError: 0x%08x\n",
|
"set to MAXULONG. GetLastError: 0x%08x\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
|
@ -72,7 +73,8 @@ static BOOL test_generic(HANDLE hComm)
|
||||||
|
|
||||||
if (GetLastError() != ERROR_INVALID_PARAMETER)
|
if (GetLastError() != ERROR_INVALID_PARAMETER)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
(void)fprintf(
|
||||||
|
stderr,
|
||||||
"SetCommTimeouts failure, expected GetLastError to return ERROR_INVALID_PARAMETER "
|
"SetCommTimeouts failure, expected GetLastError to return ERROR_INVALID_PARAMETER "
|
||||||
"and got: 0x%08x\n",
|
"and got: 0x%08x\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
|
@ -90,48 +92,48 @@ int TestTimeouts(int argc, char* argv[])
|
||||||
|
|
||||||
if (stat("/dev/ttyS0", &statbuf) < 0)
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
result = DefineCommDevice("COM1", "/dev/ttyS0");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
(void)fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hComm == INVALID_HANDLE_VALUE)
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerialSys failure\n");
|
(void)fprintf(stderr, "test_SerialSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCxSys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCxSys failure\n");
|
(void)fprintf(stderr, "test_SerCxSys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
_comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys);
|
||||||
if (!test_generic(hComm))
|
if (!test_generic(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "test_SerCx2Sys failure\n");
|
(void)fprintf(stderr, "test_SerCx2Sys failure\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CloseHandle(hComm))
|
if (!CloseHandle(hComm))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
(void)fprintf(stderr, "CloseHandle failure, GetLastError()=%08x\n", GetLastError());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ int TestCryptoRand(int argc, char* argv[])
|
||||||
winpr_RAND(rnd, sizeof(rnd));
|
winpr_RAND(rnd, sizeof(rnd));
|
||||||
|
|
||||||
str = winpr_BinToHexString(rnd, sizeof(rnd), FALSE);
|
str = winpr_BinToHexString(rnd, sizeof(rnd), FALSE);
|
||||||
// fprintf(stderr, "Rand: %s\n", str);
|
// (void)fprintf(stderr, "Rand: %s\n", str);
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
if (memcmp(rnd, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0)
|
if (memcmp(rnd, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0)
|
||||||
|
|
|
@ -332,7 +332,8 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E
|
||||||
if (locked)
|
if (locked)
|
||||||
ReleaseMutex(mutex);
|
ReleaseMutex(mutex);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "WARNING: InterlockedCompareExchange64 operation might have failed\n");
|
(void)fprintf(stderr,
|
||||||
|
"WARNING: InterlockedCompareExchange64 operation might have failed\n");
|
||||||
|
|
||||||
return previousValue;
|
return previousValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ static int start_threads(size_t count, HANDLE* threads)
|
||||||
|
|
||||||
if (!threads[i])
|
if (!threads[i])
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: CreateThread [%" PRIuz "] failure\n", __func__, i);
|
(void)fprintf(stderr, "%s: CreateThread [%" PRIuz "] failure\n", __func__, i);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ static int close_threads(DWORD count, HANDLE* threads)
|
||||||
|
|
||||||
if (!CloseHandle(threads[i]))
|
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;
|
rc = -1;
|
||||||
}
|
}
|
||||||
threads[i] = NULL;
|
threads[i] = NULL;
|
||||||
|
@ -71,21 +71,21 @@ static BOOL TestWaitForAll(void)
|
||||||
/* WaitForAll, timeout */
|
/* WaitForAll, timeout */
|
||||||
if (start_threads(ARRAYSIZE(threads), threads))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, 10);
|
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, 10);
|
||||||
if (ret != WAIT_TIMEOUT)
|
if (ret != WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 10 failed, ret=%d\n",
|
(void)fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 10 failed, ret=%d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static BOOL TestWaitForAll(void)
|
||||||
fail:
|
fail:
|
||||||
if (close_threads(ARRAYSIZE(threads), threads))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,20 +107,20 @@ static BOOL TestWaitOne(void)
|
||||||
/* WaitForAll, timeout */
|
/* WaitForAll, timeout */
|
||||||
if (start_threads(ARRAYSIZE(threads), threads))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, INFINITE);
|
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, INFINITE);
|
||||||
if (ret > (WAIT_OBJECT_0 + ARRAYSIZE(threads)))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ static BOOL TestWaitOne(void)
|
||||||
fail:
|
fail:
|
||||||
if (close_threads(ARRAYSIZE(threads), threads))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,27 +142,28 @@ static BOOL TestWaitOneTimeout(void)
|
||||||
/* WaitForAll, timeout */
|
/* WaitForAll, timeout */
|
||||||
if (start_threads(ARRAYSIZE(threads), threads))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 1);
|
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 1);
|
||||||
if (ret != WAIT_TIMEOUT)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
rc = TRUE;
|
rc = TRUE;
|
||||||
fail:
|
fail:
|
||||||
if (close_threads(ARRAYSIZE(threads), threads))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
|
||||||
/* WaitForAll, timeout */
|
/* WaitForAll, timeout */
|
||||||
if (start_threads(ARRAYSIZE(threads), threads))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,14 +186,15 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
|
||||||
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 0);
|
const DWORD ret = WaitForMultipleObjects(ARRAYSIZE(threads), threads, FALSE, 0);
|
||||||
if (ret != WAIT_TIMEOUT)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForMultipleObjects(ARRAYSIZE(threads), threads, TRUE, INFINITE) != WAIT_OBJECT_0)
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +202,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
|
||||||
fail:
|
fail:
|
||||||
if (close_threads(ARRAYSIZE(threads), threads))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +216,7 @@ static BOOL TestDetach(void)
|
||||||
/* WaitForAll, timeout */
|
/* WaitForAll, timeout */
|
||||||
if (start_threads(ARRAYSIZE(threads), threads))
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +224,7 @@ static BOOL TestDetach(void)
|
||||||
fail:
|
fail:
|
||||||
if (close_threads(ARRAYSIZE(threads), threads))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue