diff options
author | Peng Wu <alexepico@gmail.com> | 2015-04-21 15:04:27 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-04-21 15:04:27 +0800 |
commit | 8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc (patch) | |
tree | 1870d5999275367a932d2b2a2e9ed8aec4c08d12 /src/storage/flexible_ngram_kyotodb.h | |
parent | 107f642630eed151e859583d493ee677b5b063b9 (diff) | |
download | libpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.tar.gz libpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.tar.xz libpinyin-8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc.zip |
fixes bugs
Diffstat (limited to 'src/storage/flexible_ngram_kyotodb.h')
-rw-r--r-- | src/storage/flexible_ngram_kyotodb.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/storage/flexible_ngram_kyotodb.h b/src/storage/flexible_ngram_kyotodb.h index 660681e..1c1b1db 100644 --- a/src/storage/flexible_ngram_kyotodb.h +++ b/src/storage/flexible_ngram_kyotodb.h @@ -392,8 +392,10 @@ public: const char * kbuf = (char *) &index; const size_t ksiz = sizeof(phrase_token_t); - const int32_t vsiz = m_db->check(kbuf, ksiz); - if (-1 != vsiz) { /* success */ + int32_t vsiz = m_db->check(kbuf, ksiz); + if (-1 == vsiz) { /* not found. */ + vsiz = sizeof(ArrayHeader); + } else { /* found */ m_chunk.set_size(vsiz); char * vbuf = (char *) m_chunk.begin(); assert(vsiz == m_db->get(kbuf, ksiz, vbuf, vsiz)); |