From 4048ddce6dbd0f270215b810ae0ab964584fffa0 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Tue, 29 Nov 2011 20:15:50 -0500 Subject: [PATCH] libfreerdp-core: More strings cleanup. - Comment out unused lookup tables. - ifdef tables where appropriate. - Change declarations to produce read-only sections. See also: http://blog.flameeyes.eu/2007/12/19/array-of-pointers-and-array-of-arrays --- libfreerdp-core/activation.c | 4 +++- libfreerdp-core/capabilities.c | 4 +++- libfreerdp-core/info.c | 4 +++- libfreerdp-core/license.c | 8 +++++--- libfreerdp-core/ntlmssp.c | 2 ++ libfreerdp-core/rdp.c | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/libfreerdp-core/activation.c b/libfreerdp-core/activation.c index 4ea8647f7..a6efb74cf 100644 --- a/libfreerdp-core/activation.c +++ b/libfreerdp-core/activation.c @@ -19,7 +19,8 @@ #include "activation.h" -uint8 CTRLACTION_STRINGS[][32] = +/* +static const char* const CTRLACTION_STRINGS[] = { "", "CTRLACTION_REQUEST_CONTROL", @@ -27,6 +28,7 @@ uint8 CTRLACTION_STRINGS[][32] = "CTRLACTION_DETACH", "CTRLACTION_COOPERATE" }; +*/ void rdp_write_synchronize_pdu(STREAM* s, rdpSettings* settings) { diff --git a/libfreerdp-core/capabilities.c b/libfreerdp-core/capabilities.c index da6130605..70fab1070 100644 --- a/libfreerdp-core/capabilities.c +++ b/libfreerdp-core/capabilities.c @@ -19,7 +19,8 @@ #include "capabilities.h" -uint8 CAPSET_TYPE_STRINGS[][32] = +/* +static const char* const CAPSET_TYPE_STRINGS[] = { "Unknown", "General", @@ -53,6 +54,7 @@ uint8 CAPSET_TYPE_STRINGS[][32] = "Bitmap Codecs", "Frame Acknowledge" }; +*/ /* CODEC_GUID_REMOTEFX 0x76772F12BD724463AFB3B73C9C6F7886 */ #define CODEC_GUID_REMOTEFX "\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86" diff --git a/libfreerdp-core/info.c b/libfreerdp-core/info.c index acb591f24..6c1794091 100644 --- a/libfreerdp-core/info.c +++ b/libfreerdp-core/info.c @@ -24,13 +24,15 @@ #define INFO_TYPE_LOGON_PLAIN_NOTIFY 0x00000002 #define INFO_TYPE_LOGON_EXTENDED_INF 0x00000003 -uint8 INFO_TYPE_LOGON_STRINGS[][32] = +/* +static const char* const INFO_TYPE_LOGON_STRINGS[] = { "Logon Info V1", "Logon Info V2", "Logon Plain Notify", "Logon Extended Info" }; +*/ /** * Read SYSTEM_TIME structure (TS_SYSTEMTIME).\n diff --git a/libfreerdp-core/license.c b/libfreerdp-core/license.c index 46f27596c..690dafdc5 100644 --- a/libfreerdp-core/license.c +++ b/libfreerdp-core/license.c @@ -21,7 +21,8 @@ #include "license.h" -uint8 LICENSE_MESSAGE_STRINGS[][32] = +#ifdef WITH_DEBUG_LICENSE +static const char* const LICENSE_MESSAGE_STRINGS[] = { "", "License Request", @@ -39,7 +40,7 @@ uint8 LICENSE_MESSAGE_STRINGS[][32] = "Error Alert" }; -uint8 error_codes[][32] = +static const char* const error_codes[] = { "ERR_UNKNOWN", "ERR_INVALID_SERVER_CERTIFICATE", @@ -56,7 +57,7 @@ uint8 error_codes[][32] = "ERR_INVALID_MESSAGE_LENGTH" }; -uint8 state_transitions[][32] = +static const char* const state_transitions[] = { "ST_UNKNOWN", "ST_TOTAL_ABORT", @@ -64,6 +65,7 @@ uint8 state_transitions[][32] = "ST_RESET_PHASE_TO_START", "ST_RESEND_LAST_MESSAGE" }; +#endif /** * Read a licensing preamble.\n diff --git a/libfreerdp-core/ntlmssp.c b/libfreerdp-core/ntlmssp.c index 20ddc23bf..3dbe5d36f 100644 --- a/libfreerdp-core/ntlmssp.c +++ b/libfreerdp-core/ntlmssp.c @@ -75,6 +75,7 @@ static const char server_sign_magic[] = "session key to server-to-client signing static const char client_seal_magic[] = "session key to client-to-server sealing key magic constant"; static const char server_seal_magic[] = "session key to server-to-client sealing key magic constant"; +#ifdef WITH_DEBUG_NLA static const char* const NTLMSSP_NEGOTIATE_STRINGS[] = { "NTLMSSP_NEGOTIATE_56", @@ -125,6 +126,7 @@ static const char* const AV_PAIRS_STRINGS[] = "MsvAvTargetName", "MsvChannelBindings" }; +#endif /** * Set NTLMSSP username. diff --git a/libfreerdp-core/rdp.c b/libfreerdp-core/rdp.c index 737742161..7ba54e3aa 100644 --- a/libfreerdp-core/rdp.c +++ b/libfreerdp-core/rdp.c @@ -23,7 +23,7 @@ #include "per.h" #include "redirection.h" -uint8 DATA_PDU_TYPE_STRINGS[][32] = +static const char* const DATA_PDU_TYPE_STRINGS[] = { "", "", /* 0x00 - 0x01 */ "Update", /* 0x02 */