Merge "AAPT: Include empty locale in getLocales" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
19af4cc375
@@ -5999,16 +5999,14 @@ void ResTable::getLocales(Vector<String8>* locales, bool includeSystemLocales,
|
|||||||
char locale[RESTABLE_MAX_LOCALE_LEN];
|
char locale[RESTABLE_MAX_LOCALE_LEN];
|
||||||
|
|
||||||
forEachConfiguration(false, false, includeSystemLocales, [&](const ResTable_config& cfg) {
|
forEachConfiguration(false, false, includeSystemLocales, [&](const ResTable_config& cfg) {
|
||||||
if (cfg.locale != 0) {
|
cfg.getBcp47Locale(locale, mergeEquivalentLangs /* canonicalize if merging */);
|
||||||
cfg.getBcp47Locale(locale, mergeEquivalentLangs /* canonicalize if merging */);
|
|
||||||
|
|
||||||
const auto beginIter = locales->begin();
|
const auto beginIter = locales->begin();
|
||||||
const auto endIter = locales->end();
|
const auto endIter = locales->end();
|
||||||
|
|
||||||
auto iter = std::lower_bound(beginIter, endIter, locale, compareString8AndCString);
|
auto iter = std::lower_bound(beginIter, endIter, locale, compareString8AndCString);
|
||||||
if (iter == endIter || strcmp(iter->string(), locale) != 0) {
|
if (iter == endIter || strcmp(iter->string(), locale) != 0) {
|
||||||
locales->insertAt(String8(locale), std::distance(beginIter, iter));
|
locales->insertAt(String8(locale), std::distance(beginIter, iter));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user