Commit b7233c84 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed bug on platforms were buffers returned by getenv() shall not be

free()'ed. Added French (default) in locale handling.
parent 0a56c4f1
...@@ -360,39 +360,46 @@ LCID WINAPI GetSystemDefaultLCID() ...@@ -360,39 +360,46 @@ LCID WINAPI GetSystemDefaultLCID()
*/ */
LANGID WINAPI GetUserDefaultLangID() LANGID WINAPI GetUserDefaultLangID()
{ {
char *buf=NULL; /* caching result, if defined from environment, which should (?) not change during a WINE session */
char *lang,*country,*charset,*dialect,*next; static LANGID userLCID = 0;
int ret=0;
if (Options.language) return Languages[Options.language].langid; if (Options.language) {
return Languages[Options.language].langid;
buf=getenv("LANGUAGE");
if (!buf) buf=getenv("LANG");
if (!buf) buf=getenv("LC_ALL");
if (!buf) buf=getenv("LC_MESSAGES");
if (!buf) return MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT );
if (!strcmp(buf,"POSIX") || !strcmp(buf,"C")) {
free(buf);
return MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT );
} }
lang=buf; if (userLCID == 0) {
char *buf=NULL;
do { char *lang,*country,*charset,*dialect,*next;
next=strchr(lang,':'); if (next) *next++='\0'; int ret=0;
dialect=strchr(lang,'@'); if (dialect) *dialect++='\0';
charset=strchr(lang,'.'); if (charset) *charset++='\0'; buf=getenv("LANGUAGE");
country=strchr(lang,'_'); if (country) *country++='\0'; if (!buf) buf=getenv("LANG");
if (!buf) buf=getenv("LC_ALL");
ret=MAIN_GetLanguageID(lang, country, charset, dialect); if (!buf) buf=getenv("LC_MESSAGES");
if (!buf) return userLCID = MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT );
lang=next;
if (!strcmp(buf,"POSIX") || !strcmp(buf,"C")) {
} while (lang && !ret); return MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT );
}
free(buf);
return (LANGID)ret; lang=buf;
do {
next=strchr(lang,':'); if (next) *next++='\0';
dialect=strchr(lang,'@'); if (dialect) *dialect++='\0';
charset=strchr(lang,'.'); if (charset) *charset++='\0';
country=strchr(lang,'_'); if (country) *country++='\0';
ret=MAIN_GetLanguageID(lang, country, charset, dialect);
lang=next;
} while (lang && !ret);
/* FIXME : are strings returned by getenv() to be free()'ed ? */
userLCID = (LANGID)ret;
}
return userLCID;
} }
/*********************************************************************** /***********************************************************************
...@@ -496,6 +503,10 @@ LANG_BEGIN (LANG_FINNISH, SUBLANG_DEFAULT) /*0x040B*/ ...@@ -496,6 +503,10 @@ LANG_BEGIN (LANG_FINNISH, SUBLANG_DEFAULT) /*0x040B*/
#include "nls/fin.nls" #include "nls/fin.nls"
LANG_END LANG_END
LANG_BEGIN (LANG_FRENCH, SUBLANG_DEFAULT) /*0x040C*/
#include "nls/fra.nls"
LANG_END
LANG_BEGIN (LANG_ITALIAN, SUBLANG_ITALIAN) /*0x410*/ LANG_BEGIN (LANG_ITALIAN, SUBLANG_ITALIAN) /*0x410*/
#include "nls/ita.nls" #include "nls/ita.nls"
LANG_END LANG_END
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment