summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-06-21 13:06:33 +0800
committerPeng Wu <alexepico@gmail.com>2012-06-21 13:06:33 +0800
commit606b4b110302fad6590eca56cba7108681b8b434 (patch)
treef062b173011b21143538d7f12bc8f5710f695d97 /src/storage
parent9aa87d6bdadf9492a3c09d49841e23052c043d16 (diff)
downloadlibpinyin-606b4b110302fad6590eca56cba7108681b8b434.tar.gz
libpinyin-606b4b110302fad6590eca56cba7108681b8b434.tar.xz
libpinyin-606b4b110302fad6590eca56cba7108681b8b434.zip
add ErrorResult
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/chewing_large_table.cpp14
-rw-r--r--src/storage/phrase_large_table.cpp14
2 files changed, 14 insertions, 14 deletions
diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp
index cfcb987..9185976 100644
--- a/src/storage/chewing_large_table.cpp
+++ b/src/storage/chewing_large_table.cpp
@@ -484,7 +484,7 @@ int ChewingBitmapIndexLevel::remove_index(int phrase_length,
if (length_array)
return length_array->remove_index(phrase_length - 1, keys + 1, token);
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
}
int ChewingLengthIndexLevel::add_index(int phrase_length,
@@ -535,7 +535,7 @@ int ChewingLengthIndexLevel::remove_index(int phrase_length,
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if (m_chewing_array_indexes->len <= phrase_length)
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
#define CASE(len) case len: \
{ \
@@ -543,7 +543,7 @@ int ChewingLengthIndexLevel::remove_index(int phrase_length,
(m_chewing_array_indexes, \
ChewingArrayIndexLevel<len> *, len); \
if (NULL == array) \
- return REMOVE_ITEM_DONOT_EXISTS; \
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS; \
return array->remove_index(keys, token); \
}
@@ -588,14 +588,14 @@ int ChewingArrayIndexLevel<phrase_length>::add_index
for (cur_elem = range.first;
cur_elem != range.second; ++cur_elem) {
if (cur_elem->m_token == token)
- return INSERT_ITEM_EXISTS;
+ return ERROR_INSERT_ITEM_EXISTS;
if (cur_elem->m_token > token)
break;
}
int offset = (cur_elem - begin) * sizeof(IndexItem);
m_chunk.insert_content(offset, &add_elem, sizeof(IndexItem));
- return INSERT_OK;
+ return ERROR_OK;
}
template<int phrase_length>
@@ -619,11 +619,11 @@ int ChewingArrayIndexLevel<phrase_length>::remove_index
}
if (cur_elem == range.second)
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
int offset = (cur_elem - begin) * sizeof(IndexItem);
m_chunk.remove_content(offset, sizeof(IndexItem));
- return REMOVE_OK;
+ return ERROR_OK;
}
diff --git a/src/storage/phrase_large_table.cpp b/src/storage/phrase_large_table.cpp
index 9e5e2d6..195024e 100644
--- a/src/storage/phrase_large_table.cpp
+++ b/src/storage/phrase_large_table.cpp
@@ -238,7 +238,7 @@ int PhraseBitmapIndexLevel::remove_index( int phrase_length, /* in */ ucs4_t phr
PhraseLengthIndexLevel * &length_array = m_phrase_length_indexes[first_key];
if ( length_array )
return length_array->remove_index(phrase_length, phrase, token);
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
}
int PhraseLengthIndexLevel::add_index( int phrase_length, /* in */ ucs4_t phrase[], /* in */ phrase_token_t token){
@@ -282,13 +282,13 @@ int PhraseLengthIndexLevel::add_index( int phrase_length, /* in */ ucs4_t phrase
int PhraseLengthIndexLevel::remove_index( int phrase_length, /* in */ ucs4_t phrase[], /* out */ phrase_token_t & token){
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if ( m_phrase_array_indexes -> len <= phrase_length )
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
#define CASE(len) case len: \
{ \
PhraseArrayIndexLevel<len> * &array = g_array_index \
(m_phrase_array_indexes, PhraseArrayIndexLevel<len> *, len); \
if ( !array ) \
- return REMOVE_ITEM_DONOT_EXISTS; \
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS; \
return array->remove_index(phrase, token); \
}
@@ -328,14 +328,14 @@ int PhraseArrayIndexLevel<phrase_length>::add_index(/* in */ ucs4_t phrase[], /*
assert(range.second - range.first <= 1);
if ( range.second - range.first == 1 )
- return INSERT_ITEM_EXISTS;
+ return ERROR_INSERT_ITEM_EXISTS;
PhraseIndexItem<phrase_length> * cur_elem = range.first;
int offset = (cur_elem - buf_begin) *
sizeof(PhraseIndexItem<phrase_length>);
m_chunk.insert_content(offset, &new_elem,
sizeof(PhraseIndexItem<phrase_length> ));
- return INSERT_OK;
+ return ERROR_OK;
}
template<size_t phrase_length>
@@ -352,13 +352,13 @@ int PhraseArrayIndexLevel<phrase_length>::remove_index(/* in */ ucs4_t phrase[],
assert(range.second - range.first <= 1);
PhraseIndexItem<phrase_length> * cur_elem = range.first;
if ( range.first == range.second || cur_elem == buf_end)
- return REMOVE_ITEM_DONOT_EXISTS;
+ return ERROR_REMOVE_ITEM_DONOT_EXISTS;
token = cur_elem->m_token;
int offset = (cur_elem - buf_begin) *
sizeof(PhraseIndexItem<phrase_length>);
m_chunk.remove_content(offset, sizeof (PhraseIndexItem<phrase_length>));
- return REMOVE_OK;
+ return ERROR_OK;
}
bool PhraseLargeTable::load_text(FILE * infile){