diff --git a/libfreerdp/locale/keyboard_layout.c b/libfreerdp/locale/keyboard_layout.c index 9b666049c..8661ffb00 100644 --- a/libfreerdp/locale/keyboard_layout.c +++ b/libfreerdp/locale/keyboard_layout.c @@ -313,7 +313,7 @@ fail: const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutID) { - int i; + size_t i; for (i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_TABLE); i++) { @@ -338,7 +338,7 @@ const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutID) DWORD freerdp_keyboard_get_layout_id_from_name(const char* name) { - int i; + size_t i; for (i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_TABLE); i++) { diff --git a/libfreerdp/locale/locale.c b/libfreerdp/locale/locale.c index c461397db..0ae7e5563 100644 --- a/libfreerdp/locale/locale.c +++ b/libfreerdp/locale/locale.c @@ -631,14 +631,13 @@ static const LOCALE_KEYBOARD_LAYOUTS LOCALE_KEYBOARD_LAYOUTS_TABLE[] = { XHOSA, { 0x00000409, 0x00000409, 0x0, 0x0, 0x0 } }, }; -BOOL freerdp_get_system_language_and_country_codes(char* language, char* country) +static BOOL freerdp_get_system_language_and_country_codes(char* language, char* country) { int dot; DWORD nSize; int underscore; char* env_lang = NULL; LPCSTR lang = "LANG"; - /* LANG = _. */ nSize = GetEnvironmentVariableA(lang, NULL, 0); @@ -650,9 +649,10 @@ BOOL freerdp_get_system_language_and_country_codes(char* language, char* country if (!env_lang) return FALSE; - if (GetEnvironmentVariableA(lang, env_lang, nSize) != nSize - 1) /* Get locale from environment variable LANG */ + if (GetEnvironmentVariableA(lang, env_lang, + nSize) != nSize - 1) /* Get locale from environment variable LANG */ { - free (env_lang); + free(env_lang); return FALSE; } @@ -688,18 +688,18 @@ BOOL freerdp_get_system_language_and_country_codes(char* language, char* country return TRUE; } -SYSTEM_LOCALE* freerdp_detect_system_locale() +static SYSTEM_LOCALE* freerdp_detect_system_locale(void) { - int i; + size_t i; char language[4]; char country[10]; SYSTEM_LOCALE* locale = NULL; - freerdp_get_system_language_and_country_codes(language, country); for (i = 0; i < ARRAYSIZE(SYSTEM_LOCALE_TABLE); i++) { - if ((strcmp(language, SYSTEM_LOCALE_TABLE[i].language) == 0) && (strcmp(country, SYSTEM_LOCALE_TABLE[i].country) == 0)) + if ((strcmp(language, SYSTEM_LOCALE_TABLE[i].language) == 0) && + (strcmp(country, SYSTEM_LOCALE_TABLE[i].country) == 0)) { locale = (SYSTEM_LOCALE*) &SYSTEM_LOCALE_TABLE[i]; break; @@ -709,10 +709,9 @@ SYSTEM_LOCALE* freerdp_detect_system_locale() return locale; } -DWORD freerdp_get_system_locale_id() +DWORD freerdp_get_system_locale_id(void) { SYSTEM_LOCALE* locale; - locale = freerdp_detect_system_locale(); if (locale != NULL) @@ -723,7 +722,7 @@ DWORD freerdp_get_system_locale_id() const char* freerdp_get_system_locale_name_from_id(DWORD localeId) { - int index; + size_t index; for (index = 0; index < ARRAYSIZE(LOCALE_NAME_TABLE); index++) { @@ -736,11 +735,10 @@ const char* freerdp_get_system_locale_name_from_id(DWORD localeId) int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId) { - int i, j; + size_t i, j; char language[4]; char country[10]; SYSTEM_LOCALE* locale; - freerdp_get_system_language_and_country_codes(language, country); if ((strcmp(language, "C") == 0) || (strcmp(language, "POSIX") == 0)) @@ -761,7 +759,6 @@ int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId) if (LOCALE_KEYBOARD_LAYOUTS_TABLE[i].locale == locale->code) { /* Locale found in list of default keyboard layouts */ - for (j = 0; j < 5; j++) { if (LOCALE_KEYBOARD_LAYOUTS_TABLE[i].keyboardLayouts[j] == ENGLISH_UNITED_STATES)