summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-08-30 11:51:18 +0800
committerPeng Wu <alexepico@gmail.com>2022-08-30 11:51:18 +0800
commit20ad271a95ff149422a55b8dbe985c114a5a27e4 (patch)
tree20effac3046957c41ebdec4f3c83865c65062e7c /src/storage
parent008794423b00488ee45fb204bf5c6fc5205475cb (diff)
downloadlibpinyin-20ad271a95ff149422a55b8dbe985c114a5a27e4.tar.gz
libpinyin-20ad271a95ff149422a55b8dbe985c114a5a27e4.tar.xz
libpinyin-20ad271a95ff149422a55b8dbe985c114a5a27e4.zip
Fix Kyoto Cabinet usage
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/phrase_large_table3.h8
-rw-r--r--src/storage/phrase_large_table3_kyotodb.cpp3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/storage/phrase_large_table3.h b/src/storage/phrase_large_table3.h
index 40654bb..b4da01d 100644
--- a/src/storage/phrase_large_table3.h
+++ b/src/storage/phrase_large_table3.h
@@ -69,7 +69,8 @@ public:
static inline int reduce_tokens(const PhraseTokens tokens,
- TokenVector tokenarray) {
+ TokenVector tokenarray,
+ bool validate = true) {
int num = 0;
g_array_set_size(tokenarray, 0);
@@ -83,8 +84,9 @@ static inline int reduce_tokens(const PhraseTokens tokens,
g_array_append_vals(tokenarray, array->data, array->len);
}
- /* the following line will be removed in future after code are verified. */
- assert(0 <= num && num <= 4);
+ /* the following lines will be removed in future after code are verified. */
+ if (validate)
+ assert(0 <= num && num <= 4);
return num;
}
diff --git a/src/storage/phrase_large_table3_kyotodb.cpp b/src/storage/phrase_large_table3_kyotodb.cpp
index fcd8a03..2ff9990 100644
--- a/src/storage/phrase_large_table3_kyotodb.cpp
+++ b/src/storage/phrase_large_table3_kyotodb.cpp
@@ -238,6 +238,9 @@ int PhraseLargeTable3::search_suggestion(int phrase_length,
delete cursor;
return result;
}
+
+ bksiz = 0;
+ bkbuf = cursor->get_key(&bksiz);
}
delete cursor;