mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r21134) -Change: perform some more stringent validity checking on the language files
This commit is contained in:
parent
17b514ccd1
commit
1ddc05e822
@ -935,7 +935,8 @@ static void WriteStringsH(const char *filename)
|
|||||||
fprintf(_output_file, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n\n", next - 1);
|
fprintf(_output_file, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n\n", next - 1);
|
||||||
|
|
||||||
fprintf(_output_file,
|
fprintf(_output_file,
|
||||||
"static const uint LANGUAGE_PACK_VERSION = 0x%X;\n\n", (uint)_hash
|
"static const uint LANGUAGE_PACK_VERSION = 0x%X;\n"
|
||||||
|
"static const uint LANGUAGE_MAX_PLURAL = %d;\n\n", (uint)_hash, (uint)lengthof(_plural_forms)
|
||||||
);
|
);
|
||||||
|
|
||||||
fprintf(_output_file, "#endif /* TABLE_STRINGS_H */\n");
|
fprintf(_output_file, "#endif /* TABLE_STRINGS_H */\n");
|
||||||
|
@ -1307,7 +1307,16 @@ bool LanguagePackHeader::IsValid() const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
this->ident == TO_LE32(LanguagePackHeader::IDENT) &&
|
this->ident == TO_LE32(LanguagePackHeader::IDENT) &&
|
||||||
this->version == TO_LE32(LANGUAGE_PACK_VERSION);
|
this->version == TO_LE32(LANGUAGE_PACK_VERSION) &&
|
||||||
|
this->plural_form < LANGUAGE_MAX_PLURAL &&
|
||||||
|
this->text_dir <= 1 &&
|
||||||
|
this->newgrflangid < MAX_LANG &&
|
||||||
|
StrValid(this->name, lastof(this->name)) &&
|
||||||
|
StrValid(this->own_name, lastof(this->own_name)) &&
|
||||||
|
StrValid(this->isocode, lastof(this->isocode)) &&
|
||||||
|
StrValid(this->digit_group_separator, lastof(this->digit_group_separator)) &&
|
||||||
|
StrValid(this->digit_group_separator_currency, lastof(this->digit_group_separator_currency)) &&
|
||||||
|
StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadLanguagePack(int lang_index)
|
bool ReadLanguagePack(int lang_index)
|
||||||
|
Loading…
Reference in New Issue
Block a user