summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-11-28 18:43:03 +0800
committerPeng Wu <alexepico@gmail.com>2011-11-28 18:43:03 +0800
commitf151299744268571e9910ab5c10a6c688027fbe4 (patch)
tree491bc88196da2a9a9ff40d367c185e33dba03cfc
parent3a77085a17a66bcd9d231dfcefbbf886e79cfe82 (diff)
downloadlibpinyin-f151299744268571e9910ab5c10a6c688027fbe4.tar.gz
libpinyin-f151299744268571e9910ab5c10a6c688027fbe4.tar.xz
libpinyin-f151299744268571e9910ab5c10a6c688027fbe4.zip
fixes full pinyin parser2
-rw-r--r--src/storage/pinyin_parser2.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index fcfa72f..1b6af3c 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -195,8 +195,8 @@ bool FullPinyinParser2::parse_one_key (guint32 options, ChewingKey & key,
ChewingKeyRest & key_rest,
const char * pinyin, int len) const {
/* "'" are not accepted in parse_one_key. */
- assert(NULL == strchr(pinyin, '\''));
gchar * input = g_strndup(pinyin, len);
+ assert(NULL == strchr(input, '\''));
guint16 tone = CHEWING_ZERO_TONE; guint16 tone_pos = 0;
guint16 parsed_len = len;
@@ -255,7 +255,7 @@ int FullPinyinParser2::parse (guint32 options, ChewingKeyVector & keys,
gchar * input = g_strndup(str, len);
parse_value_t * curstep = NULL, * nextstep = NULL;
- for (i = 0; i < len; ) {
+ for (i = 0; i < len; ++i) {
if (input[i] == '\'') {
curstep = &g_array_index(m_parse_steps, parse_value_t, i);
nextstep = &g_array_index(m_parse_steps, parse_value_t, i + 1);
@@ -278,7 +278,6 @@ int FullPinyinParser2::parse (guint32 options, ChewingKeyVector & keys,
break;
}
next_sep = k;
- i = next_sep;
}
/* dynamic programming here. */