commit
fd099d38c7
@ -3,7 +3,7 @@ set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
|
||||
set (WITH_SERVER ON CACHE BOOL "qa default")
|
||||
set (WITH_SAMPLE ON CACHE BOOL "qa default")
|
||||
set (WITH_VERBOSE_WINPR_ASSERT OFF CACHE BOOL "qa default")
|
||||
set (WITH_VERBOSE_WARNINGS ON CACHE BOOL "preload")
|
||||
set (ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload")
|
||||
set (BUILD_SHARED_LIBS OFF CACHE BOOL "qa default")
|
||||
|
||||
set (BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "qa default")
|
||||
|
@ -1,6 +1,6 @@
|
||||
set (BUILD_TESTING ON CACHE BOOL "qa default")
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
|
||||
set (WITH_VERBOSE_WARNINGS ON CACHE BOOL "preload")
|
||||
set (ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload")
|
||||
set (WITH_MANPAGES ON CACHE BOOL "qa default")
|
||||
set (WITH_SAMPLE ON CACHE BOOL "qa default")
|
||||
set (WITH_SERVER ON CACHE BOOL "qa default")
|
||||
@ -19,9 +19,6 @@ set (WITH_WINPR_UTILS_IMAGE_JPEG ON CACHE BOOL "qa default")
|
||||
set (WITH_WINPR_UTILS_IMAGE_WEBP ON CACHE BOOL "qa default")
|
||||
set (WITH_WINPR_UTILS_IMAGE_PNG ON CACHE BOOL "qa default")
|
||||
|
||||
set (CMAKE_C_FLAGS "-Weverything -Wno-exit-time-destructors -Wno-cast-align -Wno-documentation -Wno-documentation-unknown-command -Wno-padded -Wno-covered-switch-default -Wno-declaration-after-statement" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_FLAGS "-Weverything -Wno-exit-time-destructors -Wno-cast-align -Wno-documentation -Wno-documentation-unknown-command -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-covered-switch-default -Wno-declaration-after-statement" CACHE STRING "qa default")
|
||||
|
||||
set (BUILD_WITH_CLANG_TIDY ON CACHE BOOL "qa default")
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClangDetectTool.cmake)
|
||||
|
@ -1491,29 +1491,34 @@ static UINT change_lock(CliprdrFileContext* file, UINT32 lockId, BOOL lock)
|
||||
WINPR_ASSERT(file);
|
||||
|
||||
HashTable_Lock(file->local_streams);
|
||||
CliprdrLocalStream* stream = HashTable_GetItemValue(file->local_streams, &lockId);
|
||||
if (lock && !stream)
|
||||
|
||||
{
|
||||
stream = cliprdr_local_stream_new(file, lockId, NULL, 0);
|
||||
if (!HashTable_Insert(file->local_streams, &lockId, stream))
|
||||
CliprdrLocalStream* stream = HashTable_GetItemValue(file->local_streams, &lockId);
|
||||
if (lock && !stream)
|
||||
{
|
||||
rc = ERROR_INTERNAL_ERROR;
|
||||
cliprdr_local_stream_free(stream);
|
||||
stream = NULL;
|
||||
stream = cliprdr_local_stream_new(file, lockId, NULL, 0);
|
||||
if (!HashTable_Insert(file->local_streams, &lockId, stream))
|
||||
{
|
||||
rc = ERROR_INTERNAL_ERROR;
|
||||
cliprdr_local_stream_free(stream);
|
||||
stream = NULL;
|
||||
}
|
||||
file->local_lock_id = lockId;
|
||||
}
|
||||
if (stream)
|
||||
{
|
||||
stream->locked = lock;
|
||||
stream->lockId = lockId;
|
||||
}
|
||||
file->local_lock_id = lockId;
|
||||
}
|
||||
if (stream)
|
||||
{
|
||||
stream->locked = lock;
|
||||
stream->lockId = lockId;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc): HashTable_Insert ownership stream
|
||||
if (!lock)
|
||||
{
|
||||
if (!HashTable_Foreach(file->local_streams, local_stream_discard, file))
|
||||
rc = ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
HashTable_Unlock(file->local_streams);
|
||||
return rc;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ static BOOL monitor_has_gaps(const rdpSettings* settings, UINT32 start, UINT32 c
|
||||
|
||||
static UINT32** alloc_array(size_t count)
|
||||
{
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-unix.MallocSizeof)
|
||||
BYTE* array = calloc(count * sizeof(uintptr_t), count * sizeof(UINT32));
|
||||
UINT32** dst = (UINT32**)array;
|
||||
UINT32* val = (UINT32*)(array + count * sizeof(uintptr_t));
|
||||
@ -484,7 +484,7 @@ static BOOL find_path_exists_with_dijkstra(UINT32** graph, size_t count, UINT32
|
||||
parent[y] = nextnode;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
pos++;
|
||||
}
|
||||
|
||||
BOOL rc = TRUE;
|
||||
@ -510,6 +510,7 @@ static BOOL find_path_exists_with_dijkstra(UINT32** graph, size_t count, UINT32
|
||||
|
||||
static BOOL freerdp_settings_client_monitors_have_gaps(const rdpSettings* settings)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
const UINT32 count = freerdp_settings_get_uint32(settings, FreeRDP_MonitorCount);
|
||||
if (count <= 1)
|
||||
return FALSE;
|
||||
@ -522,10 +523,12 @@ static BOOL freerdp_settings_client_monitors_have_gaps(const rdpSettings* settin
|
||||
const rdpMonitor* monitor =
|
||||
freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorDefArray, x);
|
||||
if (monitor_has_gaps(settings, x, count, monitor, graph))
|
||||
return TRUE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
const BOOL rc = find_path_exists_with_dijkstra(graph, count, 0);
|
||||
rc = !find_path_exists_with_dijkstra(graph, count, 0);
|
||||
|
||||
fail:
|
||||
free((void*)graph);
|
||||
|
||||
return rc;
|
||||
@ -556,6 +559,12 @@ static BOOL freerdp_settings_client_monitors_check_primary_and_origin(const rdpS
|
||||
|
||||
struct bounds_t bounds = { 0 };
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
WLog_WARN(TAG, "Monitor configuration empty.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (UINT32 x = 0; x < count; x++)
|
||||
{
|
||||
const rdpMonitor* monitor =
|
||||
@ -574,17 +583,16 @@ static BOOL freerdp_settings_client_monitors_check_primary_and_origin(const rdpS
|
||||
rc = FALSE;
|
||||
}
|
||||
havePrimary = TRUE;
|
||||
|
||||
if ((monitor->x == 0) && (monitor->y == 0))
|
||||
foundOrigin = TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
if ((monitor->x == 0) && (monitor->y == 0))
|
||||
{
|
||||
if ((monitor->x == 0) && (monitor->y == 0))
|
||||
if (foundOrigin)
|
||||
{
|
||||
WLog_ERR(TAG, "Monitor configuration does have non-primary at origin 0/0");
|
||||
WLog_ERR(TAG, "Monitor configuration does have multiple origin 0/0");
|
||||
rc = FALSE;
|
||||
}
|
||||
foundOrigin = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -614,11 +622,6 @@ static BOOL freerdp_settings_client_monitors_check_primary_and_origin(const rdpS
|
||||
rc = FALSE;
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
WLog_WARN(TAG, "Monitor configuration empty.");
|
||||
return TRUE;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <freerdp/codecs.h>
|
||||
|
||||
#include "settings_property_lists.h"
|
||||
#include "../settings.h"
|
||||
|
||||
static BOOL log_result(BOOL value, const char* fkt)
|
||||
{
|
||||
@ -13,6 +14,13 @@ static BOOL log_result(BOOL value, const char* fkt)
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOL log_result_case(BOOL value, const char* fkt, size_t testcase)
|
||||
{
|
||||
(void)fprintf(stderr, "TestSettings [%s] testcase %" PRIuz " returned %s\n", fkt, testcase,
|
||||
value ? "TRUE" : "FALSE");
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOL compare(const ADDIN_ARGV* got, const ADDIN_ARGV* expect)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
@ -929,6 +937,373 @@ fail:
|
||||
freerdp_settings_free(settings);
|
||||
return log_result(rc, __func__);
|
||||
}
|
||||
|
||||
struct validity_test_case
|
||||
{
|
||||
BOOL expected;
|
||||
size_t count;
|
||||
const rdpMonitor* monitors;
|
||||
};
|
||||
|
||||
static BOOL prepare_monitor_array(rdpSettings* settings, const struct validity_test_case* testcase)
|
||||
{
|
||||
WINPR_ASSERT(settings);
|
||||
WINPR_ASSERT(testcase);
|
||||
|
||||
const size_t count = freerdp_settings_get_uint32(settings, FreeRDP_MonitorDefArraySize);
|
||||
if (count < testcase->count)
|
||||
{
|
||||
(void)fprintf(stderr, "MonitorDefArraySize=%" PRIuz ", but testcase requires %" PRIuz "\n",
|
||||
count, testcase->count);
|
||||
return FALSE;
|
||||
}
|
||||
for (size_t x = 0; x < testcase->count; x++)
|
||||
{
|
||||
const rdpMonitor* monitor = &testcase->monitors[x];
|
||||
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_MonitorDefArray, x, monitor))
|
||||
return FALSE;
|
||||
}
|
||||
return freerdp_settings_set_uint32(settings, FreeRDP_MonitorCount, testcase->count);
|
||||
}
|
||||
|
||||
static BOOL test_validity_check(void)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
rdpSettings* settings = freerdp_settings_new(0);
|
||||
if (!settings)
|
||||
goto fail;
|
||||
|
||||
const rdpMonitor single_monitor_valid[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor single_monitor_invalid_1[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 192,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor single_monitor_invalid_2[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 192,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor single_monitor_invalid_3[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 192,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor single_monitor_invalid_4[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 192,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor multi_monitor_valid[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 1920,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 0,
|
||||
.y = 1080,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = -1920,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 0,
|
||||
.y = -1080,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 3840,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 5760,
|
||||
.y = -1079,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 7680,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 7680,
|
||||
.y = 1080,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 7680,
|
||||
.y = -1080,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 7680,
|
||||
.y = -2160,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 9599,
|
||||
.y = -3240,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
};
|
||||
const rdpMonitor multi_monitor_invalid_1[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 1920,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor multi_monitor_invalid_2[] = {
|
||||
{ .x = 1,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 1920,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor multi_monitor_invalid_3[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 1921,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
const rdpMonitor multi_monitor_invalid_4[] = {
|
||||
{ .x = 0,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = FALSE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } },
|
||||
{ .x = 1919,
|
||||
.y = 0,
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.is_primary = TRUE,
|
||||
.orig_screen = 0,
|
||||
.attributes = { .physicalWidth = 100,
|
||||
.physicalHeight = 100,
|
||||
.orientation = ORIENTATION_PREFERENCE_LANDSCAPE,
|
||||
.desktopScaleFactor = 100,
|
||||
.deviceScaleFactor = 100 } }
|
||||
};
|
||||
|
||||
const struct validity_test_case tests[] = {
|
||||
{ TRUE, ARRAYSIZE(single_monitor_valid), single_monitor_valid },
|
||||
{ FALSE, ARRAYSIZE(single_monitor_invalid_1), single_monitor_invalid_1 },
|
||||
{ FALSE, ARRAYSIZE(single_monitor_invalid_2), single_monitor_invalid_2 },
|
||||
{ FALSE, ARRAYSIZE(single_monitor_invalid_3), single_monitor_invalid_3 },
|
||||
{ FALSE, ARRAYSIZE(single_monitor_invalid_4), single_monitor_invalid_4 },
|
||||
{ TRUE, ARRAYSIZE(multi_monitor_valid), multi_monitor_valid },
|
||||
{ FALSE, ARRAYSIZE(multi_monitor_invalid_1), multi_monitor_invalid_1 },
|
||||
{ FALSE, ARRAYSIZE(multi_monitor_invalid_2), multi_monitor_invalid_2 },
|
||||
{ FALSE, ARRAYSIZE(multi_monitor_invalid_3), multi_monitor_invalid_3 },
|
||||
{ FALSE, ARRAYSIZE(multi_monitor_invalid_4), multi_monitor_invalid_4 },
|
||||
};
|
||||
|
||||
rc = TRUE;
|
||||
for (size_t x = 0; x < ARRAYSIZE(tests); x++)
|
||||
{
|
||||
const struct validity_test_case* cur = &tests[x];
|
||||
|
||||
if (!prepare_monitor_array(settings, cur))
|
||||
rc = log_result_case(FALSE, __func__, x);
|
||||
else
|
||||
{
|
||||
const BOOL res = freerdp_settings_check_client_after_preconnect(settings);
|
||||
if (res != cur->expected)
|
||||
{
|
||||
rc = log_result_case(FALSE, __func__, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
freerdp_settings_free(settings);
|
||||
return log_result(rc, __func__);
|
||||
}
|
||||
|
||||
int TestSettings(int argc, char* argv[])
|
||||
{
|
||||
int rc = -1;
|
||||
@ -950,6 +1325,8 @@ int TestSettings(int argc, char* argv[])
|
||||
goto fail;
|
||||
if (!test_pointer_array())
|
||||
goto fail;
|
||||
if (!test_validity_check())
|
||||
goto fail;
|
||||
|
||||
settings = freerdp_settings_new(0);
|
||||
|
||||
|
@ -49,6 +49,9 @@ option(UWAC_HAVE_PIXMAN_REGION "Use PIXMAN or FreeRDP for region calculations" "
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/)
|
||||
include(CommonConfigOptions)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(strerror_r UWAC_HAVE_STRERROR_R)
|
||||
|
||||
# Check for cmake compatibility (enable/disable features)
|
||||
include(FindFeature)
|
||||
|
||||
|
@ -402,8 +402,9 @@ UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err)
|
||||
|
||||
if (ret->display == NULL)
|
||||
{
|
||||
char buffer[256] = { 0 };
|
||||
(void)fprintf(stderr, "failed to connect to Wayland display %s: %s\n", name,
|
||||
strerror(errno));
|
||||
uwac_strerror(errno, buffer, sizeof(buffer)));
|
||||
*err = UWAC_ERROR_UNABLE_TO_CONNECT;
|
||||
goto out_free;
|
||||
}
|
||||
|
@ -75,8 +75,11 @@ static struct wl_buffer* create_pointer_buffer(UwacSeat* seat, const void* src,
|
||||
wl_shm_pool_destroy(pool);
|
||||
|
||||
if (munmap(data, size) < 0)
|
||||
{
|
||||
char buffer[256] = { 0 };
|
||||
(void)fprintf(stderr, "%s: munmap(%p, %zu) failed with [%d] %s\n", __func__, data, size,
|
||||
errno, strerror(errno));
|
||||
errno, uwac_strerror(errno, buffer, sizeof(buffer)));
|
||||
}
|
||||
|
||||
error_mmap:
|
||||
close(fd);
|
||||
|
@ -24,6 +24,9 @@
|
||||
#define UWAC_UTILS_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <uwac/config.h>
|
||||
|
||||
#define min(a, b) (a) < (b) ? (a) : (b)
|
||||
|
||||
@ -44,4 +47,16 @@ char* xstrdup(const char* s);
|
||||
|
||||
void* xrealloc(void* p, size_t s);
|
||||
|
||||
static inline char* uwac_strerror(int dw, char* dmsg, size_t size)
|
||||
{
|
||||
#ifdef __STDC_LIB_EXT1__
|
||||
(void)strerror_s(dw, dmsg, size);
|
||||
#elif defined(UWAC_HAVE_STRERROR_R)
|
||||
(void)strerror_r(dw, dmsg, size);
|
||||
#else
|
||||
(void)_snprintf(dmsg, size, "%s", strerror(dw));
|
||||
#endif
|
||||
return dmsg;
|
||||
}
|
||||
|
||||
#endif /* UWAC_UTILS_H_ */
|
||||
|
@ -7,5 +7,6 @@
|
||||
#cmakedefine UWAC_HAVE_SYSLOG_H
|
||||
#cmakedefine UWAC_HAVE_JOURNALD_H
|
||||
#cmakedefine UWAC_HAVE_PIXMAN_REGION
|
||||
#cmakedefine UWAC_HAVE_STRERROR_R
|
||||
|
||||
#endif /* UWAC_CONFIG_H */
|
||||
|
@ -215,6 +215,7 @@ if(NOT IOS)
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(strerror_r WINPR_HAVE_STRERROR_R)
|
||||
check_function_exists(getlogin_r WINPR_HAVE_GETLOGIN_R)
|
||||
check_function_exists(getpwuid_r WINPR_HAVE_GETPWUID_R)
|
||||
check_struct_has_member("struct tm" tm_gmtoff time.h WINPR_HAVE_TM_GMTOFF)
|
||||
|
@ -28,11 +28,16 @@
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
|
||||
|
||||
#ifndef __SECSTATUS_DEFINED__
|
||||
typedef LONG SECURITY_STATUS;
|
||||
#define __SECSTATUS_DEFINED__
|
||||
#endif
|
||||
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
typedef ULONG_PTR NCRYPT_HANDLE;
|
||||
typedef ULONG_PTR NCRYPT_PROV_HANDLE;
|
||||
typedef ULONG_PTR NCRYPT_KEY_HANDLE;
|
||||
|
@ -665,7 +665,11 @@ BOOL SetThreadPriority(HANDLE hThread, int nPriority)
|
||||
WINPR_THREAD* thread = (WINPR_THREAD*)Object;
|
||||
const int rc = pthread_setschedprio(thread->thread, sched_priority);
|
||||
if (rc != 0)
|
||||
WLog_ERR(TAG, "pthread_setschedprio(%d) %s [%d]", sched_priority, strerror(rc), rc);
|
||||
{
|
||||
char buffer[256] = { 0 };
|
||||
WLog_ERR(TAG, "pthread_setschedprio(%d) %s [%d]", sched_priority,
|
||||
winpr_strerror(rc, buffer, sizeof(buffer)), rc);
|
||||
}
|
||||
return rc == 0;
|
||||
#else
|
||||
WLog_WARN(TAG, "pthread_setschedprio(%d) not implemented, requires POSIX 2008 or later",
|
||||
|
@ -233,9 +233,9 @@ fail:
|
||||
char* winpr_strerror(INT32 dw, char* dmsg, size_t size)
|
||||
{
|
||||
#ifdef __STDC_LIB_EXT1__
|
||||
strerror_s(dw, dmsg, size);
|
||||
(void)strerror_s(dw, dmsg, size);
|
||||
#elif defined(WINPR_HAVE_STRERROR_R)
|
||||
strerror_r(dw, dmsg, size);
|
||||
(void)strerror_r(dw, dmsg, size);
|
||||
#else
|
||||
(void)_snprintf(dmsg, size, "%s", strerror(dw));
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user