diff options
author | Peng Wu <alexepico@gmail.com> | 2012-02-21 10:44:27 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-02-21 10:44:27 +0800 |
commit | 5deda46d8f6c8e922cc31e7958d3558589bb7260 (patch) | |
tree | 8ed8469112717a14dfd58dc543c54da5cd239c06 /src/pinyin.cpp | |
parent | 1ddce5136799a57d5c1fb745a747abdb76c6f9f3 (diff) | |
download | libpinyin-5deda46d8f6c8e922cc31e7958d3558589bb7260.tar.gz libpinyin-5deda46d8f6c8e922cc31e7958d3558589bb7260.tar.xz libpinyin-5deda46d8f6c8e922cc31e7958d3558589bb7260.zip |
update pinyin.cpp
Diffstat (limited to 'src/pinyin.cpp')
-rw-r--r-- | src/pinyin.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp index e1ec93e..deaa7c6 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -329,15 +329,15 @@ bool pinyin_phrase_segment(pinyin_instance_t * instance, pinyin_context_t * & context = instance->m_context; const glong num_of_chars = g_utf8_strlen(sentence, -1); - glong utf16_len = 0; - utf16_t * utf16 = g_utf8_to_utf16(sentence, -1, NULL, &utf16_len, NULL); + glong ucs4_len = 0; + ucs4_t * ucs4_str = g_utf8_to_ucs4(sentence, -1, NULL, &ucs4_len, NULL); - g_return_val_if_fail(num_of_chars == utf16_len, FALSE); + g_return_val_if_fail(num_of_chars == ucs4_len, FALSE); bool retval = context->m_phrase_lookup->get_best_match - (utf16_len, utf16, instance->m_match_results); + (ucs4_len, ucs4_str, instance->m_match_results); - g_free(utf16); + g_free(ucs4_str); return retval; } @@ -590,12 +590,12 @@ bool pinyin_translate_token(pinyin_instance_t * instance, phrase_token_t token, char ** word){ pinyin_context_t * & context = instance->m_context; PhraseItem item; - utf16_t buffer[MAX_PHRASE_LENGTH]; + ucs4_t buffer[MAX_PHRASE_LENGTH]; int retval = context->m_phrase_index->get_phrase_item(token, item); item.get_phrase_string(buffer); guint8 length = item.get_phrase_length(); - *word = g_utf16_to_utf8(buffer, length, NULL, NULL, NULL); + *word = g_ucs4_to_utf8(buffer, length, NULL, NULL, NULL); return ERROR_OK == retval; } |