void Finalise(const StringData &data) { /* Find the plural form with the most amount of cases. */ int max_plural_forms = 0; for (uint i = 0; i < lengthof(_plural_forms); i++) { max_plural_forms = max(max_plural_forms, _plural_forms[i].plural_count); } fprintf(this->fh, "\n" "static const uint LANGUAGE_PACK_VERSION = 0x%X;\n" "static const uint LANGUAGE_MAX_PLURAL = %d;\n" "static const uint LANGUAGE_MAX_PLURAL_FORMS = %d;\n\n", (uint)data.Version(), (uint)lengthof(_plural_forms), max_plural_forms ); fprintf(this->fh, "#endif /* TABLE_STRINGS_H */\n"); this->FileWriter::Finalise(); if (CompareFiles(this->filename, this->real_filename)) { /* files are equal. tmp.xxx is not needed */ unlink(this->filename); } else { /* else rename tmp.xxx into filename */ #if defined(WIN32) || defined(WIN64) unlink(this->real_filename); #endif if (rename(this->filename, this->real_filename) == -1) error("rename() failed"); } }