summaryrefslogtreecommitdiffstats
path: root/src/lookup/phrase_lookup.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-09-09 11:23:48 +0800
committerPeng Wu <alexepico@gmail.com>2011-09-09 11:26:40 +0800
commitf990d3004fed619377d5f5d0bd64f6201ce91c26 (patch)
treeba3a11f3c1fa126da7abab8805692c4e751669e6 /src/lookup/phrase_lookup.cpp
parent0b69e5f53462d0d44fcd69bb2a963785ea423fe2 (diff)
downloadlibpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.tar.gz
libpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.tar.xz
libpinyin-f990d3004fed619377d5f5d0bd64f6201ce91c26.zip
merge duplicated convert to utf8 functions
Diffstat (limited to 'src/lookup/phrase_lookup.cpp')
-rw-r--r--src/lookup/phrase_lookup.cpp25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp
index c69f587..4966cef 100644
--- a/src/lookup/phrase_lookup.cpp
+++ b/src/lookup/phrase_lookup.cpp
@@ -280,28 +280,3 @@ bool PhraseLookup::final_step(MatchResults & results ){
//no need to reverse the result
return true;
}
-
-bool PhraseLookup::convert_to_utf8(MatchResults results, /* in */ const char * delimiter, /* out */ char * & result_string){
- //init variables
- if ( NULL == delimiter )
- delimiter = "";
- result_string = NULL;
-
- 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;
- if ( NULL == result_string )
- result_string = g_strdup(phrase);
- else
- result_string = g_strconcat(result_string, delimiter, phrase, NULL);
- g_free(tmp); g_free(phrase);
- }
- return true;
-}