void PhraseItem::remove_nth_pronunciation(size_t index){
guint8 phrase_length = get_phrase_length();
set_n_pronunciation(get_n_pronunciation() - 1);
- size_t offset = phrase_item_header + phrase_length * sizeof ( ucs4_t ) +
- index * (phrase_length * sizeof (ChewingKey) + sizeof(guint32));
+ size_t offset = phrase_item_header + phrase_length * sizeof(ucs4_t) +
+ index * (phrase_length * sizeof(ChewingKey) + sizeof(guint32));
m_chunk.remove_content(offset, phrase_length * sizeof(ChewingKey) + sizeof(guint32));
}
const table_offset_t * begin = (const table_offset_t *)m_phrase_index.begin();
const table_offset_t * end = (const table_offset_t *)m_phrase_index.end();
+ if (begin == end) {
+ /* skip empty sub phrase index. */
+ range.m_range_begin = 1;
+ range.m_range_end = 1;
+ return ERROR_OK;
+ }
+
/* remove trailing zeros. */
const table_offset_t * poffset = 0;
for (poffset = end - 1; poffset >= begin + 1; --poffset) {
namespace pinyin{
const pinyin_table_info_t pinyin_phrase_files[PHRASE_INDEX_LIBRARY_COUNT] =
{
- {NULL, NULL, NULL, NOT_USED},
- {"gb_char.table", "gb_char.bin", "gb_char.dbin", SYSTEM_FILE},
- {"gbk_char.table", "gbk_char.bin", "gbk_char.dbin", SYSTEM_FILE},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
-
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
-
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
- {NULL, NULL, NULL, NOT_USED},
-
- {NULL, NULL, "user.bin", USER_FILE}
+ {RESERVED, NULL, NULL, NULL, NOT_USED},
+ {GB_DICTIONARY, "gb_char.table", "gb_char.bin", "gb_char.dbin", SYSTEM_FILE},
+ {GBK_DICTIONARY, "gbk_char.table", "gbk_char.bin", "gbk_char.dbin", SYSTEM_FILE},
+
+ {MERGED_DICTIONARY, "merged.table", "merged.bin", "merged.dbin", SYSTEM_FILE},
+
+ {ART_DICTIONARY, "art.table", "art.bin", "art.dbin", DICTIONARY},
+ {CULTURE_DICTIONARY, "culture.table", "culture.bin", "culture.dbin", DICTIONARY},
+ {ECONOMY_DICTIONARY, "economy.table", "economy.bin", "economy.dbin", DICTIONARY},
+ {GEOLOGY_DICTIONARY, "geology.table", "geology.bin", "geology.dbin", DICTIONARY},
+ {HISTORY_DICTIONARY, "history.table", "history.bin", "history.dbin", DICTIONARY},
+
+ {LIFE_DICTIONARY, "life.table", "life.bin", "life.dbin", DICTIONARY},
+ {NATURE_DICTIONARY, "nature.table", "nature.bin", "nature.dbin", DICTIONARY},
+ {SCITECH_DICTIONARY, "scitech.table", "scitech.bin", "scitech.dbin", DICTIONARY},
+ {SOCIETY_DICTIONARY, "society.table", "society.bin", "society.dbin", DICTIONARY},
+ {SPORT_DICTIONARY, "sport.table", "sport.bin", "sport.dbin", DICTIONARY},
+
+ {RESERVED1, NULL, NULL, NULL, NOT_USED},
+
+ {USER_DICTIONARY, NULL, NULL, "user.bin", USER_FILE}
};