mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1656515 - Decompress multilocale.txt if necessary r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D86604
This commit is contained in:
parent
df36200714
commit
3b1e388971
@ -297,12 +297,24 @@ static bool GetGREFileContents(const char* aFilePath, nsCString* aOutString) {
|
||||
// Look for the requested file in omnijar.
|
||||
RefPtr<CacheAwareZipReader> zip = Omnijar::GetReader(Omnijar::GRE);
|
||||
if (zip) {
|
||||
uint32_t length;
|
||||
const uint8_t* data = zip->GetData(aFilePath, &length);
|
||||
if (!data) {
|
||||
const auto item = zip->GetItem(aFilePath);
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
aOutString->Assign(reinterpret_cast<const char*>(data), length);
|
||||
|
||||
MOZ_ASSERT(item->RealSize());
|
||||
|
||||
auto data = MakeUnique<uint8_t[]>(item->RealSize());
|
||||
CacheAwareZipCursor cursor(item, zip, data.get(), item->RealSize());
|
||||
|
||||
uint32_t count;
|
||||
cursor.Read(&count);
|
||||
|
||||
if (count != item->RealSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aOutString->Assign(reinterpret_cast<const char*>(data.get()), count);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user