diff options
author | Peng Wu <alexepico@gmail.com> | 2011-09-09 11:23:48 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-09-09 11:26:40 +0800 |
commit | f990d3004fed619377d5f5d0bd64f6201ce91c26 (patch) | |
tree | ba3a11f3c1fa126da7abab8805692c4e751669e6 /src/lookup/pinyin_lookup.cpp | |
parent | 0b69e5f53462d0d44fcd69bb2a963785ea423fe2 (diff) | |
download | libpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.tar.gz libpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.tar.xz libpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.zip |
merge duplicated convert to utf8 functions
Diffstat (limited to 'src/lookup/pinyin_lookup.cpp')
-rw-r--r-- | src/lookup/pinyin_lookup.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/lookup/pinyin_lookup.cpp b/src/lookup/pinyin_lookup.cpp index b543321..4e67c49 100644 --- a/src/lookup/pinyin_lookup.cpp +++ b/src/lookup/pinyin_lookup.cpp @@ -494,24 +494,6 @@ bool PinyinLookup::train_result(PinyinKeyVector keys, CandidateConstraints const return true; } -bool PinyinLookup::convert_to_utf8(MatchResults results, /* out */ char * & result_string){ - result_string = g_strdup(""); - for ( size_t i = 0; i < results->len; ++i){ - phrase_token_t * token = &g_array_index(results, phrase_token_t, i); - if ( null_token == *token ) - continue; - m_phrase_index->get_phrase_item(*token, m_cache_phrase_item); - utf16_t buffer[MAX_PHRASE_LENGTH]; - m_cache_phrase_item.get_phrase_string(buffer); - guint8 length = m_cache_phrase_item.get_phrase_length(); - gchar * phrase = g_utf16_to_utf8(buffer, length, NULL, NULL, NULL); - char * tmp = result_string; - result_string = g_strconcat(result_string, phrase, NULL); - g_free(tmp); g_free(phrase); - } - return true; -} - bool PinyinLookup::add_constraint(CandidateConstraints constraints, size_t index, phrase_token_t token){ if ( m_phrase_index->get_phrase_item(token, m_cache_phrase_item) ) return false; |