summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-07-21 15:13:31 +0800
committerPeng Wu <alexepico@gmail.com>2016-07-21 15:13:31 +0800
commit0ba361964b810f06839f67ddfbfba39fb75b6a70 (patch)
treeb43583105b310a101c53bddd618858c3ebf93441 /src/storage
parenteb08ebb49b4823b17c749cde377c0aa1c6fe76ea (diff)
downloadlibpinyin-0ba361964b810f06839f67ddfbfba39fb75b6a70.tar.gz
libpinyin-0ba361964b810f06839f67ddfbfba39fb75b6a70.tar.xz
libpinyin-0ba361964b810f06839f67ddfbfba39fb75b6a70.zip
fixes fill_matrix function
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/phonetic_key_matrix.cpp5
-rw-r--r--src/storage/phonetic_key_matrix.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp
index 66a1d4b..c86d365 100644
--- a/src/storage/phonetic_key_matrix.cpp
+++ b/src/storage/phonetic_key_matrix.cpp
@@ -30,7 +30,8 @@ namespace pinyin{
/* zero ChewingKey for "'" symbol and last key in fill_matrix function. */
bool fill_matrix(PhoneticKeyMatrix * matrix,
ChewingKeyVector keys,
- ChewingKeyRestVector key_rests) {
+ ChewingKeyRestVector key_rests,
+ size_t parsed_len) {
matrix->clear_all();
assert(keys->len == key_rests->len);
@@ -44,7 +45,7 @@ bool fill_matrix(PhoneticKeyMatrix * matrix,
key_rest = &g_array_index(key_rests, ChewingKeyRest, key_rests->len - 1);
/* one extra slot for the last key. */
- size_t length = key_rest->m_raw_end + 1;
+ size_t length = parsed_len + 1;
matrix->set_size(length);
/* fill keys and key rests. */
diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h
index 75ea2aa..0497a62 100644
--- a/src/storage/phonetic_key_matrix.h
+++ b/src/storage/phonetic_key_matrix.h
@@ -177,7 +177,8 @@ public:
*/
bool fill_matrix(PhoneticKeyMatrix * matrix,
ChewingKeyVector keys,
- ChewingKeyRestVector key_rests);
+ ChewingKeyRestVector key_rests,
+ size_t parsed_len);
/**
* resplit_step: