From 77eb93b4b7857b1b9a44123aac363d9eb1912cc1 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 10 Jul 2018 12:21:38 +0200 Subject: [PATCH] Made internal functions static to help compiler optimize. --- libfreerdp/core/connection.c | 4 +++- libfreerdp/core/connection.h | 1 - libfreerdp/core/nego.c | 14 ++++++++++---- libfreerdp/core/nego.h | 12 ------------ libfreerdp/core/settings.c | 8 ++++---- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index 6f3536a18..d13c0c8df 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -167,6 +167,8 @@ * and server-side applications). */ +static int rdp_client_connect_finalize(rdpRdp* rdp); + /** * Establish RDP Connection based on the settings given in the 'rdp' parameter. * @msdn{cc240452} @@ -482,7 +484,7 @@ BOOL rdp_client_reconnect(rdpRdp* rdp) return status; } -static BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; +static const BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; static BOOL rdp_client_establish_keys(rdpRdp* rdp) { diff --git a/libfreerdp/core/connection.h b/libfreerdp/core/connection.h index 1fddae24f..f811c748d 100644 --- a/libfreerdp/core/connection.h +++ b/libfreerdp/core/connection.h @@ -66,7 +66,6 @@ FREERDP_LOCAL BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, FREERDP_LOCAL BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s); FREERDP_LOCAL int rdp_client_connect_license(rdpRdp* rdp, wStream* s); FREERDP_LOCAL int rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s); -FREERDP_LOCAL int rdp_client_connect_finalize(rdpRdp* rdp); FREERDP_LOCAL int rdp_client_transition_to_state(rdpRdp* rdp, int state); FREERDP_LOCAL BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s); diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index dcfc6ffab..e7211ab10 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -63,6 +63,12 @@ static const char PROTOCOL_SECURITY_STRINGS[9][4] = static BOOL nego_transport_connect(rdpNego* nego); static BOOL nego_transport_disconnect(rdpNego* nego); static BOOL nego_security_connect(rdpNego* nego); +static BOOL nego_send_preconnection_pdu(rdpNego* nego); +static BOOL nego_recv_response(rdpNego* nego); +static void nego_send(rdpNego* nego); +static void nego_process_negotiation_request(rdpNego* nego, wStream* s); +static void nego_process_negotiation_response(rdpNego* nego, wStream* s); +static void nego_process_negotiation_failure(rdpNego* nego, wStream* s); /** * Negotiate protocol security and connect. @@ -369,7 +375,7 @@ BOOL nego_send_preconnection_pdu(rdpNego* nego) * @param nego */ -void nego_attempt_ext(rdpNego* nego) +static void nego_attempt_ext(rdpNego* nego) { nego->RequestedProtocols = PROTOCOL_NLA | PROTOCOL_TLS | PROTOCOL_EXT; WLog_DBG(TAG, "Attempting NLA extended security"); @@ -414,7 +420,7 @@ void nego_attempt_ext(rdpNego* nego) * @param nego */ -void nego_attempt_nla(rdpNego* nego) +static void nego_attempt_nla(rdpNego* nego) { nego->RequestedProtocols = PROTOCOL_NLA | PROTOCOL_TLS; WLog_DBG(TAG, "Attempting NLA security"); @@ -457,7 +463,7 @@ void nego_attempt_nla(rdpNego* nego) * @param nego */ -void nego_attempt_tls(rdpNego* nego) +static void nego_attempt_tls(rdpNego* nego) { nego->RequestedProtocols = PROTOCOL_TLS; WLog_DBG(TAG, "Attempting TLS security"); @@ -496,7 +502,7 @@ void nego_attempt_tls(rdpNego* nego) * @param nego */ -void nego_attempt_rdp(rdpNego* nego) +static void nego_attempt_rdp(rdpNego* nego) { nego->RequestedProtocols = PROTOCOL_RDP; WLog_DBG(TAG, "Attempting RDP security"); diff --git a/libfreerdp/core/nego.h b/libfreerdp/core/nego.h index c03d68d86..af3696de1 100644 --- a/libfreerdp/core/nego.h +++ b/libfreerdp/core/nego.h @@ -120,22 +120,10 @@ typedef struct rdp_nego rdpNego; FREERDP_LOCAL BOOL nego_connect(rdpNego* nego); FREERDP_LOCAL BOOL nego_disconnect(rdpNego* nego); -FREERDP_LOCAL BOOL nego_send_preconnection_pdu(rdpNego* nego); - -FREERDP_LOCAL void nego_attempt_ext(rdpNego* nego); -FREERDP_LOCAL void nego_attempt_nla(rdpNego* nego); -FREERDP_LOCAL void nego_attempt_tls(rdpNego* nego); -FREERDP_LOCAL void nego_attempt_rdp(rdpNego* nego); - -FREERDP_LOCAL void nego_send(rdpNego* nego); FREERDP_LOCAL int nego_recv(rdpTransport* transport, wStream* s, void* extra); -FREERDP_LOCAL BOOL nego_recv_response(rdpNego* nego); FREERDP_LOCAL BOOL nego_read_request(rdpNego* nego, wStream* s); FREERDP_LOCAL BOOL nego_send_negotiation_request(rdpNego* nego); -FREERDP_LOCAL void nego_process_negotiation_request(rdpNego* nego, wStream* s); -FREERDP_LOCAL void nego_process_negotiation_response(rdpNego* nego, wStream* s); -FREERDP_LOCAL void nego_process_negotiation_failure(rdpNego* nego, wStream* s); FREERDP_LOCAL BOOL nego_send_negotiation_response(rdpNego* nego); FREERDP_LOCAL rdpNego* nego_new(rdpTransport* transport); diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index d73251eb0..27e50c18d 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -66,7 +66,7 @@ static const char client_dll[] = "C:\\Windows\\System32\\mstscax.dll"; #define GLYPH_CACHE_KEY CLIENT_KEY "\\GlyphCache" #define POINTER_CACHE_KEY CLIENT_KEY "\\PointerCache" -void settings_client_load_hkey_local_machine(rdpSettings* settings) +static void settings_client_load_hkey_local_machine(rdpSettings* settings) { HKEY hKey; LONG status; @@ -218,7 +218,7 @@ void settings_client_load_hkey_local_machine(rdpSettings* settings) } } -void settings_server_load_hkey_local_machine(rdpSettings* settings) +static void settings_server_load_hkey_local_machine(rdpSettings* settings) { HKEY hKey; LONG status; @@ -242,7 +242,7 @@ void settings_server_load_hkey_local_machine(rdpSettings* settings) RegCloseKey(hKey); } -void settings_load_hkey_local_machine(rdpSettings* settings) +static void settings_load_hkey_local_machine(rdpSettings* settings) { if (settings->ServerMode) settings_server_load_hkey_local_machine(settings); @@ -250,7 +250,7 @@ void settings_load_hkey_local_machine(rdpSettings* settings) settings_client_load_hkey_local_machine(settings); } -BOOL settings_get_computer_name(rdpSettings* settings) +static BOOL settings_get_computer_name(rdpSettings* settings) { DWORD nSize = 0; CHAR* computerName;