From 63cca4dd16a7d2156689e28f4027d069ab5ea33b Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 1 Jul 2016 14:39:28 +0800 Subject: fixes warnings --- src/storage/phrase_index.cpp | 11 +++++++---- src/storage/phrase_index_logger.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/storage') diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index 4b03285..217bf4f 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -337,7 +337,7 @@ bool SubPhraseIndex::load(MemoryChunk * chunk, char * buf_begin = (char *)chunk->begin(); chunk->get_content(offset, &m_total_freq, sizeof(guint32)); offset += sizeof(guint32); - table_offset_t index_one, index_two, index_three; + table_offset_t index_one = 0, index_two = 0, index_three = 0; chunk->get_content(offset, &index_one, sizeof(table_offset_t)); offset += sizeof(table_offset_t); chunk->get_content(offset, &index_two, sizeof(table_offset_t)); @@ -430,7 +430,8 @@ bool SubPhraseIndex::diff(SubPhraseIndex * oldone, PhraseIndexLogger * logger){ } bool SubPhraseIndex::merge(PhraseIndexLogger * logger){ - LOG_TYPE log_type; phrase_token_t token; + LOG_TYPE log_type = LOG_INVALID_RECORD; + phrase_token_t token = null_token; MemoryChunk oldchunk, newchunk; PhraseItem olditem, newitem, item, * tmpitem; @@ -739,7 +740,8 @@ bool _compute_new_header(PhraseIndexLogger * logger, phrase_token_t value, guint32 & new_total_freq) { - LOG_TYPE log_type; phrase_token_t token; + LOG_TYPE log_type = LOG_INVALID_RECORD; + phrase_token_t token = null_token; MemoryChunk oldchunk, newchunk; PhraseItem olditem, newitem; @@ -804,7 +806,8 @@ static bool _mask_out_records(PhraseIndexLogger * oldlogger, phrase_token_t mask, phrase_token_t value, PhraseIndexLogger * newlogger) { - LOG_TYPE log_type; phrase_token_t token; + LOG_TYPE log_type = LOG_INVALID_RECORD; + phrase_token_t token = null_token; MemoryChunk oldchunk, newchunk; while(oldlogger->has_next_record()) { diff --git a/src/storage/phrase_index_logger.h b/src/storage/phrase_index_logger.h index 06f933e..ae00009 100644 --- a/src/storage/phrase_index_logger.h +++ b/src/storage/phrase_index_logger.h @@ -42,6 +42,7 @@ namespace pinyin{ enum LOG_TYPE{ + LOG_INVALID_RECORD = 0, LOG_ADD_RECORD = 1, LOG_REMOVE_RECORD, LOG_MODIFY_RECORD, -- cgit