Skip to content

Commit

Permalink
voicedb/langdb: fix section offsets > 2^16
Browse files Browse the repository at this point in the history
  • Loading branch information
rhdunn committed Jul 6, 2015
1 parent d7613dd commit f58c8ca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libcainteoir/synthesizer/compiler.cpp
Expand Up @@ -61,7 +61,7 @@ struct binary_file_writer
{
}

void begin_section(const char *magic, uint16_t section_size, bool has_pstr_fields);
void begin_section(const char *magic, uint32_t section_size, bool has_pstr_fields);
void end_section();

void u8(uint8_t u) { fputc(u, mOutput); }
Expand All @@ -84,7 +84,7 @@ struct binary_file_writer
std::map<std::string, uint32_t> mStringTable;
};

void binary_file_writer::begin_section(const char *magic, uint16_t section_size, bool has_pstr_fields)
void binary_file_writer::begin_section(const char *magic, uint32_t section_size, bool has_pstr_fields)
{
mOffset += section_size;
if (has_pstr_fields)
Expand Down Expand Up @@ -748,7 +748,7 @@ tts::compile_language(const char *aFileName, FILE *aOutput)

if (!conditionals.empty())
{
uint16_t entries = conditionals.size() * tts::CONDRULE_TABLE_ENTRY_SIZE;
uint32_t entries = conditionals.size() * tts::CONDRULE_TABLE_ENTRY_SIZE;
out.begin_section("CND", tts::CONDRULE_TABLE_SIZE + entries, true);
out.u16(conditionals.size());
for (const auto &entry : conditionals)
Expand All @@ -762,7 +762,7 @@ tts::compile_language(const char *aFileName, FILE *aOutput)

for (auto &classdef : classdefs)
{
uint16_t entries = (classdef.second.size() + 1) * tts::CLASSDEF_TABLE_ENTRY_SIZE;
uint32_t entries = (classdef.second.size() + 1) * tts::CLASSDEF_TABLE_ENTRY_SIZE;
out.begin_section("CLS", tts::CLASSDEF_TABLE_SIZE + entries, true);
out.u16(classdef.second.size() + 1);
out.u8(classdef.first);
Expand All @@ -776,7 +776,7 @@ tts::compile_language(const char *aFileName, FILE *aOutput)
{
group.second.push_back({ {}, { nullptr, nullptr }});

uint16_t entries = group.second.size() * tts::LEXICAL_REWRITE_RULES_TABLE_ENTRY_SIZE;
uint32_t entries = group.second.size() * tts::LEXICAL_REWRITE_RULES_TABLE_ENTRY_SIZE;
out.begin_section("LRR", tts::LEXICAL_REWRITE_RULES_TABLE_SIZE + entries, true);
out.u16(group.second.size());
out.u8(group.first);
Expand All @@ -792,7 +792,7 @@ tts::compile_language(const char *aFileName, FILE *aOutput)
{
group.second.push_back({ {}, { nullptr, nullptr }});

uint16_t entries = group.second.size() * tts::LETTER_TO_PHONEME_TABLE_ENTRY_SIZE;
uint32_t entries = group.second.size() * tts::LETTER_TO_PHONEME_TABLE_ENTRY_SIZE;
out.begin_section("L2P", tts::LETTER_TO_PHONEME_TABLE_SIZE + entries, true);
out.u16(group.second.size());
out.u8(group.first);
Expand Down Expand Up @@ -822,7 +822,7 @@ tts::compile_language(const char *aFileName, FILE *aOutput)

if (!words.empty())
{
uint16_t entries = words.size() * tts::DICTIONARY_TABLE_ENTRY_SIZE;
uint32_t entries = words.size() * tts::DICTIONARY_TABLE_ENTRY_SIZE;
out.begin_section("DIC", tts::DICTIONARY_TABLE_SIZE + entries, true);
out.u16(words.size());
for (const auto &entry : words)
Expand Down

0 comments on commit f58c8ca

Please sign in to comment.