core: Fix issues in settings copy code
This code fixes an issue where some settings were lost when copying settings around. I.e. the device count was first set but then calling `freerdp_settings_set_pointer_len` caused the device count to be reset to 0 because we passed `NULL` for the data value. This means the count got lost upon the first copy and further copies also resulted in losing the array data (because the count was set to 0). This PR fixes this issue by first resetting the array and afterwards setting the correct count value.
This commit is contained in:
parent
5d3b7ef0c2
commit
a5aad5159c
@ -1012,10 +1012,10 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
|
||||
|
||||
if (len < count)
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_DeviceCount, count))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_pointer_len(_settings, FreeRDP_DeviceArray, NULL, len))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_DeviceCount, count))
|
||||
goto out_fail;
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
@ -1031,10 +1031,10 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
|
||||
|
||||
if (len < count)
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_StaticChannelCount, count))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_pointer_len(_settings, FreeRDP_StaticChannelArray, NULL, len))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_StaticChannelCount, count))
|
||||
goto out_fail;
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
@ -1051,12 +1051,10 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
|
||||
|
||||
if (len < count)
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_DynamicChannelCount, count))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_DynamicChannelCount, count))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_pointer_len(_settings, FreeRDP_DynamicChannelArray, NULL, len))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint32(_settings, FreeRDP_DynamicChannelCount, count))
|
||||
goto out_fail;
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user