Bug 1463884 - patch 2 - Remove always-true argument aCheckEnvironment from gfxFcPlatformFontList::GetSampleLangForGroup. r=emilio

This commit is contained in:
Jonathan Kew 2018-05-28 10:09:25 +01:00
Родитель d3aa695c83
Коммит 1aec939dc5
2 изменённых файлов: 22 добавлений и 26 удалений

Просмотреть файл

@ -2429,8 +2429,7 @@ gfxFcPlatformFontList::TryLangForGroup(const nsACString& aOSLang,
void
gfxFcPlatformFontList::GetSampleLangForGroup(nsAtom* aLanguage,
nsACString& aLangStr,
bool aCheckEnvironment)
nsACString& aLangStr)
{
aLangStr.Truncate();
if (!aLanguage) {
@ -2459,32 +2458,30 @@ gfxFcPlatformFontList::GetSampleLangForGroup(nsAtom* aLanguage,
// -- check the environment for the user's preferred language that
// corresponds to this mozilla lang group.
if (aCheckEnvironment) {
const char *languages = getenv("LANGUAGE");
if (languages) {
const char separator = ':';
const char *languages = getenv("LANGUAGE");
if (languages) {
const char separator = ':';
for (const char *pos = languages; true; ++pos) {
if (*pos == '\0' || *pos == separator) {
if (languages < pos &&
TryLangForGroup(Substring(languages, pos),
aLanguage, aLangStr)) {
return;
}
if (*pos == '\0') {
break;
}
languages = pos + 1;
for (const char *pos = languages; true; ++pos) {
if (*pos == '\0' || *pos == separator) {
if (languages < pos &&
TryLangForGroup(Substring(languages, pos),
aLanguage, aLangStr)) {
return;
}
if (*pos == '\0') {
break;
}
languages = pos + 1;
}
}
const char *ctype = setlocale(LC_CTYPE, nullptr);
if (ctype &&
TryLangForGroup(nsDependentCString(ctype), aLanguage, aLangStr)) {
return;
}
}
const char *ctype = setlocale(LC_CTYPE, nullptr);
if (ctype &&
TryLangForGroup(nsDependentCString(ctype), aLanguage, aLangStr)) {
return;
}
if (mozLangGroup->defaultLang) {

Просмотреть файл

@ -328,8 +328,7 @@ public:
}
// map lang group ==> lang string
void GetSampleLangForGroup(nsAtom* aLanguage, nsACString& aLangStr,
bool aCheckEnvironment = true);
void GetSampleLangForGroup(nsAtom* aLanguage, nsACString& aLangStr);
static FT_Library GetFTLibrary();