Set language size to be MAX_DESCRIPTION_LENGTH, not MAX_LINE_LENGTH.
This commit is contained in:
parent
693ed5f032
commit
7eefeeed86
|
@ -30,7 +30,7 @@ static HashTable table;
|
||||||
|
|
||||||
void setLanguage(char *applicationName, char *languageCode)
|
void setLanguage(char *applicationName, char *languageCode)
|
||||||
{
|
{
|
||||||
char language[MAX_LINE_LENGTH], c[MAX_LINE_LENGTH];
|
char language[MAX_DESCRIPTION_LENGTH], c[MAX_LINE_LENGTH];
|
||||||
char **key, **value;
|
char **key, **value;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char *lang;
|
char *lang;
|
||||||
|
@ -54,7 +54,7 @@ void setLanguage(char *applicationName, char *languageCode)
|
||||||
|
|
||||||
if (c[0] != '\0')
|
if (c[0] != '\0')
|
||||||
{
|
{
|
||||||
STRNCPY(language, c, MAX_LINE_LENGTH);
|
STRNCPY(language, c, MAX_DESCRIPTION_LENGTH);
|
||||||
|
|
||||||
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH);
|
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH);
|
||||||
|
|
||||||
|
@ -68,14 +68,14 @@ void setLanguage(char *applicationName, char *languageCode)
|
||||||
#else
|
#else
|
||||||
if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG")))
|
if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG")))
|
||||||
{
|
{
|
||||||
STRNCPY(language, lang, MAX_LINE_LENGTH);
|
STRNCPY(language, lang, MAX_DESCRIPTION_LENGTH);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
STRNCPY(language, languageCode, MAX_LINE_LENGTH);
|
STRNCPY(language, languageCode, MAX_DESCRIPTION_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
strtok(language, ".");
|
strtok(language, ".");
|
||||||
|
|
Loading…
Reference in New Issue