diff options
author | Peng Wu <alexepico@gmail.com> | 2014-03-13 14:29:42 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2014-03-13 14:29:42 +0800 |
commit | 7c540af4894471116aadfed6a0b92d344938c1f0 (patch) | |
tree | 0b1786217a97d756f7053bc8087e5e0c5f5644c9 | |
parent | fb3a4831ffc38392cf0a821134604035db259fa6 (diff) | |
download | libzhuyin-7c540af4894471116aadfed6a0b92d344938c1f0.tar.gz libzhuyin-7c540af4894471116aadfed6a0b92d344938c1f0.tar.xz libzhuyin-7c540af4894471116aadfed6a0b92d344938c1f0.zip |
extend zhuyin_in_chewing_keyboard function
-rw-r--r-- | src/storage/pinyin_parser2.cpp | 12 | ||||
-rw-r--r-- | src/zhuyin.cpp | 4 | ||||
-rw-r--r-- | 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. |