mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 08:19:19 +00:00
GUI: U32: Write block sizes as Uint32BE
- Changes made in create_translations tool and translations.cpp - After converting po files to UTF-8, length of block did not fit in 16 bits. This commit addresses that.
This commit is contained in:
parent
546fe374df
commit
810b7cfccc
@ -291,8 +291,14 @@ void TranslationManager::loadTranslationsInfoDat() {
|
||||
// Get number of translations
|
||||
int nbTranslations = in.readUint16BE();
|
||||
|
||||
for (int i = 0; i < nbTranslations + 2; i++) {
|
||||
in.readUint16BE(); // skip
|
||||
// Skip translation description & size for the original language (english) block
|
||||
for (int i = 0; i < 2; i++) {
|
||||
in.readUint16BE();
|
||||
}
|
||||
|
||||
// Skip size of each translation block. Each is written in Uint32BE.
|
||||
for (int i = 0; i < nbTranslations; i++) {
|
||||
in.readUint32BE();
|
||||
}
|
||||
|
||||
// Read list of languages
|
||||
@ -348,10 +354,17 @@ void TranslationManager::loadLanguageDat(int index) {
|
||||
|
||||
// Get size of blocks to skip.
|
||||
int skipSize = 0;
|
||||
for (int i = 0; i < index + 2; ++i)
|
||||
|
||||
// Skip translation description & size for the original language (english) block
|
||||
for (int i = 0; i < 2; ++i)
|
||||
skipSize += in.readUint16BE();
|
||||
|
||||
// Skip size of each translation block. Each is written in Uint32BE.
|
||||
for (int i = 0; i < index; ++i)
|
||||
skipSize += in.readUint32BE();
|
||||
|
||||
// We also need to skip the remaining block sizes
|
||||
skipSize += 2 * (nbTranslations - index);
|
||||
skipSize += 4 * (nbTranslations - index); // 4 because block sizes are written in Uint32BE in the .dat file.
|
||||
|
||||
// Seek to start of block we want to read
|
||||
in.seek(skipSize, SEEK_CUR);
|
||||
|
@ -181,7 +181,7 @@ int main(int argc, char *argv[]) {
|
||||
len += 2 + stringSize(translations[lang]->entry(i)->msgstr);
|
||||
len += stringSize(translations[lang]->entry(i)->msgctxt);
|
||||
}
|
||||
writeUint16BE(outFile, len);
|
||||
writeUint32BE(outFile, len);
|
||||
}
|
||||
|
||||
// Write list of languages
|
||||
|
Loading…
x
Reference in New Issue
Block a user