Reformatting

This commit is contained in:
Martin Fleisz 2019-07-17 15:48:26 +02:00 committed by akallabeth
parent 26bbb459b2
commit 397db534d2

View File

@ -529,8 +529,7 @@ static SSIZE_T freerdp_client_parse_rdp_file_add_line(rdpFile* file, const char*
return index;
}
static BOOL freerdp_client_parse_rdp_file_string(rdpFile* file, char* name, char* value,
int index)
static BOOL freerdp_client_parse_rdp_file_string(rdpFile* file, char* name, char* value, int index)
{
BOOL ret = TRUE;
char* valueA = _strdup(value);
@ -553,14 +552,13 @@ static BOOL freerdp_client_parse_rdp_file_option(rdpFile* file, const char* opti
return freerdp_client_add_option(file, option);
}
BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, const BYTE* buffer,
size_t size)
BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, const BYTE* buffer, size_t size)
{
return freerdp_client_parse_rdp_file_buffer_ex(file, buffer, size, NULL);
}
BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer,
size_t size, rdp_file_fkt_parse parse)
BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer, size_t size,
rdp_file_fkt_parse parse)
{
BOOL rc = FALSE;
int index;
@ -639,7 +637,6 @@ BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer,
if (parse && parse(file->context, name, *type, value))
{
}
else if (*type == 'i')
{
@ -676,8 +673,7 @@ BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name)
return freerdp_client_parse_rdp_file_ex(file, name, NULL);
}
BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name,
rdp_file_fkt_parse parse)
BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_fkt_parse parse)
{
BOOL status;
BYTE* buffer;
@ -736,10 +732,18 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name,
}
#define WRITE_ALL_SETTINGS TRUE
#define SETTING_MODIFIED(_settings, _field) (WRITE_ALL_SETTINGS || _settings->SettingsModified[FreeRDP_##_field])
#define SETTING_MODIFIED_SET(_target, _settings, _field) if SETTING_MODIFIED(_settings, _field) _target = _settings->_field
#define SETTING_MODIFIED_SET_STRING(_target, _settings, _field) do { if SETTING_MODIFIED(_settings, _field) _target = _strdup(_settings->_field); \
if (!_target && _settings->_field) return FALSE; \
#define SETTING_MODIFIED(_settings, _field) \
(WRITE_ALL_SETTINGS || _settings->SettingsModified[FreeRDP_##_field])
#define SETTING_MODIFIED_SET(_target, _settings, _field) \
if \
SETTING_MODIFIED(_settings, _field) _target = _settings->_field
#define SETTING_MODIFIED_SET_STRING(_target, _settings, _field) \
do \
{ \
if \
SETTING_MODIFIED(_settings, _field) _target = _strdup(_settings->_field); \
if (!_target && _settings->_field) \
return FALSE; \
} while (0)
BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSettings* settings)
@ -826,8 +830,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
ConvertToUnicode(CP_UTF8, 0, buffer, length, &unicodestr, 0);
/* Write multi-byte header */
if ((length < 0) ||
(fwrite(BOM_UTF16_LE, sizeof(BYTE), 2, fp) != 2) ||
if ((length < 0) || (fwrite(BOM_UTF16_LE, sizeof(BYTE), 2, fp) != 2) ||
(fwrite(unicodestr, 2, (size_t)length, fp) != (size_t)length))
{
free(buffer);
@ -990,7 +993,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->AdministrativeSession)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession))
if (!freerdp_settings_set_bool(settings, FreeRDP_ConsoleSession,
file->AdministrativeSession))
return FALSE;
}
@ -1067,10 +1071,10 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
*
* Values:
*
* 0: If server authentication fails, connect to the computer without warning (Connect and dont warn me).
* 1: If server authentication fails, do not establish a connection (Do not connect).
* 2: If server authentication fails, show a warning and allow me to connect or refuse the connection (Warn me).
* 3: No authentication requirement is specified.
* 0: If server authentication fails, connect to the computer without warning (Connect and
* dont warn me). 1: If server authentication fails, do not establish a connection (Do not
* connect). 2: If server authentication fails, show a warning and allow me to connect or
* refuse the connection (Warn me). 3: No authentication requirement is specified.
*/
settings->AuthenticationLevel = file->AuthenticationLevel;
}
@ -1129,7 +1133,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~((size_t)file->GatewayAccessToken))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAccessToken, file->GatewayAccessToken))
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAccessToken,
file->GatewayAccessToken))
return FALSE;
}
@ -1209,7 +1214,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->AllowFontSmoothing)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing))
if (!freerdp_settings_set_bool(settings, FreeRDP_AllowFontSmoothing,
file->AllowFontSmoothing))
return FALSE;
}
@ -1282,13 +1288,15 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->RedirectSmartCards)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards))
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards,
file->RedirectSmartCards))
return FALSE;
}
if (~file->RedirectClipboard)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard))
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectClipboard,
file->RedirectClipboard))
return FALSE;
}
@ -1306,15 +1314,19 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->RedirectPosDevices)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) ||
!freerdp_settings_set_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts))
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSerialPorts,
file->RedirectComPorts) ||
!freerdp_settings_set_bool(settings, FreeRDP_RedirectParallelPorts,
file->RedirectComPorts))
return FALSE;
}
if (~file->RedirectComPorts)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) ||
!freerdp_settings_set_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts))
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSerialPorts,
file->RedirectComPorts) ||
!freerdp_settings_set_bool(settings, FreeRDP_RedirectParallelPorts,
file->RedirectComPorts))
return FALSE;
}
@ -1375,7 +1387,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~((size_t)file->PreconnectionBlob))
{
if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob, file->PreconnectionBlob) ||
if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob,
file->PreconnectionBlob) ||
!freerdp_settings_set_bool(settings, FreeRDP_SendPreconnectionPdu, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_VmConnectMode, TRUE))
return FALSE;