add safe guard
authorPeng Wu <alexepico@gmail.com>
Wed, 29 Feb 2012 05:31:28 +0000 (13:31 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 29 Feb 2012 05:31:28 +0000 (13:31 +0800)
src/storage/ngram.cpp

index c05eb6b575901dd2bcbcc5fdfeef692ea5d7eb81..dbb9267dd13ee0f43475eb81d808d31aa3895183 100644 (file)
@@ -443,12 +443,12 @@ bool merge_single_gram(SingleGram * merged, const SingleGram * system,
     merged_chunk.set_content(0, &merged_total, sizeof(guint32));
 
     const SingleGramItem * cur_system = (const SingleGramItem *)
-        ((const char *)(system->m_chunk.begin()) + sizeof(guint32));
+        (((const char *)(system->m_chunk.begin())) + sizeof(guint32));
     const SingleGramItem * system_end = (const SingleGramItem *)
         system->m_chunk.end();
 
     const SingleGramItem * cur_user = (const SingleGramItem *)
-        ((const char *)(user->m_chunk.begin()) + sizeof(guint32));
+        (((const char *)(user->m_chunk.begin())) + sizeof(guint32));
     const SingleGramItem * user_end = (const SingleGramItem *)
         user->m_chunk.end();