summaryrefslogtreecommitdiffstats
path: root/libfreerdp/common/settings.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libfreerdp/common/settings.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c
index 34712c8..3beba43 100644
--- a/libfreerdp/common/settings.c
+++ b/libfreerdp/common/settings.c
@@ -237,6 +237,33 @@ BOOL freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
return TRUE;
}
+BOOL freerdp_device_collection_del(rdpSettings* settings, const RDPDR_DEVICE* device)
+{
+ WINPR_ASSERT(settings);
+
+ if (!device)
+ return FALSE;
+
+ const UINT32 count = settings->DeviceCount;
+ for (size_t x = 0; x < count; x++)
+ {
+ const RDPDR_DEVICE* cur = settings->DeviceArray[x];
+ if (cur == device)
+ {
+ for (size_t y = x + 1; y < count; y++)
+ {
+ RDPDR_DEVICE* next = settings->DeviceArray[y];
+ settings->DeviceArray[y - 1] = next;
+ }
+ settings->DeviceArray[count - 1] = NULL;
+ settings->DeviceCount--;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, const char* name)
{
RDPDR_DEVICE* device = NULL;
@@ -392,6 +419,9 @@ fail:
void freerdp_device_free(RDPDR_DEVICE* device)
{
+ if (!device)
+ return;
+
union
{
RDPDR_DEVICE* dev;
@@ -403,8 +433,6 @@ void freerdp_device_free(RDPDR_DEVICE* device)
} cnv;
cnv.dev = device;
- if (!cnv.dev)
- return;
switch (device->Type)
{
@@ -1166,8 +1194,10 @@ BOOL freerdp_settings_set_value_for_name(rdpSettings* settings, const char* name
case RDP_SETTINGS_TYPE_BOOL:
{
- BOOL val = _strnicmp(value, "TRUE", 5) == 0;
- if (!val && _strnicmp(value, "FALSE", 6) != 0)
+ const BOOL val = (_strnicmp(value, "TRUE", 5) == 0) || (_strnicmp(value, "ON", 5) == 0);
+ const BOOL nval =
+ (_strnicmp(value, "FALSE", 6) == 0) || (_strnicmp(value, "OFF", 6) == 0);
+ if (!val && !nval)
return parsing_fail(name, "BOOL", value);
return freerdp_settings_set_bool(settings, (FreeRDP_Settings_Keys_Bool)index, val);
}