From cda6da120aff1d3e228a9e99f0435ce862e05e12 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 22 Aug 2011 19:12:53 +0800 Subject: fixes phrase index logger --- src/storage/phrase_index.h | 4 ++-- src/storage/phrase_index_logger.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/storage') diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index 17d81c4..e1d4de6 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -137,14 +137,14 @@ public: void append_pronunciation(PinyinKey * pinyin, guint32 freq); void remove_nth_pronunciation(size_t index); - bool operator == (PhraseItem & rhs){ + bool operator == (const PhraseItem & rhs) const{ if (m_chunk.size() != rhs.m_chunk.size()) return false; return memcmp(m_chunk.begin(), rhs.m_chunk.begin(), m_chunk.size()) == 0; } - bool operator != (PhraseItem & rhs){ + bool operator != (const PhraseItem & rhs) const{ return ! (*this == rhs); } }; diff --git a/src/storage/phrase_index_logger.h b/src/storage/phrase_index_logger.h index 95f8e8b..c74169d 100644 --- a/src/storage/phrase_index_logger.h +++ b/src/storage/phrase_index_logger.h @@ -98,9 +98,10 @@ public: m_chunk->get_content(offset, &token, sizeof(phrase_token_t)); offset += sizeof(phrase_token_t); + oldone->set_size(0); newone->set_size(0); + switch(log_type){ case LOG_ADD_RECORD:{ - oldone->set_size(0); size_t len = 0; m_chunk->get_content(offset, &len, sizeof(size_t)); offset += sizeof(size_t); @@ -109,7 +110,6 @@ public: break; } case LOG_REMOVE_RECORD:{ - newone->set_size(0); size_t len = 0; m_chunk->get_content(offset, &len, sizeof(size_t)); offset += sizeof(size_t); -- cgit