summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-05-28 15:34:24 +0800
committerPeng Wu <alexepico@gmail.com>2015-05-28 15:34:24 +0800
commit619ed8a8d8e2ec2d4c64c6922c4a190033dfe6ee (patch)
tree64e028f449cf5dc0956a77a8db822a5c462c5f2a
parent76db8f184c3ed7e09195e4168bc3453e4d38b148 (diff)
downloadlibpinyin-619ed8a8d8e2ec2d4c64c6922c4a190033dfe6ee.tar.gz
libpinyin-619ed8a8d8e2ec2d4c64c6922c4a190033dfe6ee.tar.xz
libpinyin-619ed8a8d8e2ec2d4c64c6922c4a190033dfe6ee.zip
update pinyin_token_get_phrase function
-rw-r--r--src/pinyin.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 35ab5ce..76c5521 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2467,20 +2467,9 @@ bool pinyin_token_get_phrase(pinyin_instance_t * instance,
guint * len,
gchar ** utf8_str) {
pinyin_context_t * & context = instance->m_context;
- PhraseItem item;
- ucs4_t buffer[MAX_PHRASE_LENGTH];
- int retval = context->m_phrase_index->get_phrase_item(token, item);
- if (ERROR_OK != retval)
- return false;
-
- item.get_phrase_string(buffer);
- guint length = item.get_phrase_length();
- if (len)
- *len = length;
- if (utf8_str)
- *utf8_str = g_ucs4_to_utf8(buffer, length, NULL, NULL, NULL);
- return true;
+ return _token_get_phrase(context->m_phrase_index,
+ token, len, utf8_str);
}
bool pinyin_token_get_n_pronunciation(pinyin_instance_t * instance,