From 7c540af4894471116aadfed6a0b92d344938c1f0 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 13 Mar 2014 14:29:42 +0800 Subject: extend zhuyin_in_chewing_keyboard function --- src/storage/pinyin_parser2.cpp | 12 ++++++++++-- src/zhuyin.cpp | 4 ++-- src/zhuyin.h | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index ac0f659..32cee92 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -671,8 +671,12 @@ int ChewingDiscreteParser2::parse(pinyin_option_t options, int maximum_len = 0; int i; /* probe the longest possible chewing string. */ for (i = 0; i < len; ++i) { - if (!in_chewing_scheme(options, str[i], NULL)) + gchar ** symbols = NULL; + if (!in_chewing_scheme(options, str[i], symbols)) { + g_strfreev(symbols); break; + } + g_strfreev(symbols); } maximum_len = i; @@ -1008,8 +1012,12 @@ int ChewingDaChenCP26Parser2::parse(pinyin_option_t options, int maximum_len = 0; int i; /* probe the longest possible chewing string. */ for (i = 0; i < len; ++i) { - if (!in_chewing_scheme(options, str[i], NULL)) + gchar ** symbols = NULL; + if (!in_chewing_scheme(options, str[i], symbols)) { + g_strfreev(symbols); break; + } + g_strfreev(symbols); } maximum_len = i; diff --git a/src/zhuyin.cpp b/src/zhuyin.cpp index f006831..129ac07 100644 --- a/src/zhuyin.cpp +++ b/src/zhuyin.cpp @@ -957,10 +957,10 @@ size_t zhuyin_parse_more_chewings(zhuyin_instance_t * instance, } bool zhuyin_in_chewing_keyboard(zhuyin_instance_t * instance, - const char key, const char ** symbol) { + const char key, gchar *** symbols) { zhuyin_context_t * & context = instance->m_context; return context->m_chewing_parser->in_chewing_scheme - (context->m_options, key, symbol); + (context->m_options, key, *symbols); } #if 0 diff --git a/src/zhuyin.h b/src/zhuyin.h index c05e553..d69a828 100644 --- a/src/zhuyin.h +++ b/src/zhuyin.h @@ -312,14 +312,14 @@ size_t zhuyin_parse_more_chewings(zhuyin_instance_t * instance, * zhuyin_in_chewing_keyboard: * @instance: the zhuyin instance. * @key: the input key. - * @symbol: the chewing symbol. + * @symbols: the chewing symbols must be freed by g_strfreev. * @returns: whether the key is in current chewing scheme. * * Check whether the input key is in current chewing scheme. * */ bool zhuyin_in_chewing_keyboard(zhuyin_instance_t * instance, - const char key, const char ** symbol); + const char key, gchar *** symbols); /** * zhuyin_guess_candidates: * @instance: the zhuyin instance. -- cgit