File novel-pinyin-abuild.patch of Package novel-pinyin
Index: scim-novel-pinyin-0.2.6/src/storage/pinyin_large_table.cpp
===================================================================
--- scim-novel-pinyin-0.2.6.orig/src/storage/pinyin_large_table.cpp
+++ scim-novel-pinyin-0.2.6/src/storage/pinyin_large_table.cpp
@@ -206,7 +206,7 @@ PinyinLengthIndexLevel::~PinyinLengthInd
delete array; \
break; \
}
- for ( int i = 0 ; i < m_pinyin_array_indexes->len; ++i){
+ for ( guint32 i = 0 ; i < m_pinyin_array_indexes->len; ++i){
switch (i){
CASE(0);
CASE(1);
@@ -232,7 +232,7 @@ PinyinLengthIndexLevel::~PinyinLengthInd
#undef CASE
}
-int PinyinLengthIndexLevel::search( int phrase_length,
+int PinyinLengthIndexLevel::search( guint32 phrase_length,
/* in */ PinyinCustomSettings * custom,
/* in */ PinyinKey keys[],
/* out */ PhraseIndexRanges ranges){
@@ -352,7 +352,7 @@ int PinyinBitmapIndexLevel::remove_index
return REMOVE_ITEM_DONOT_EXISTS;
}
-int PinyinLengthIndexLevel::add_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
+int PinyinLengthIndexLevel::add_index( guint32 phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if ( m_pinyin_array_indexes -> len <= phrase_length )
g_array_set_size(m_pinyin_array_indexes, phrase_length + 1);
@@ -387,7 +387,7 @@ int PinyinLengthIndexLevel::add_index( i
#undef CASE
}
-int PinyinLengthIndexLevel::remove_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
+int PinyinLengthIndexLevel::remove_index( guint32 phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if ( m_pinyin_array_indexes -> len <= phrase_length )
return false;
@@ -485,7 +485,7 @@ bool PinyinLargeTable::load_text(FILE *
while ( !feof(infile)){
fscanf(infile, "%s", pinyin);
fscanf(infile, "%s", phrase);
- fscanf(infile, "%ld", &token);
+ fscanf(infile, "%u", &token);
fscanf(infile, "%ld", &freq);
PinyinDefaultParser parser;
@@ -565,13 +565,13 @@ bool PinyinBitmapIndexLevel::store(Memor
bool PinyinLengthIndexLevel::load(MemoryChunk * chunk, table_offset_t offset, table_offset_t end){
char * buf_begin = (char *) chunk->begin();
- guint32 nindex = *((guint32 *)(buf_begin + offset));
+ int nindex = *((int *)(buf_begin + offset));
table_offset_t * index = (table_offset_t *)
(buf_begin + offset + sizeof(guint32));
table_offset_t phrase_begin, phrase_end = *index;
m_pinyin_array_indexes = g_array_new(FALSE, TRUE, sizeof(void *));
- for ( size_t i = 1; i <= nindex; i++){
+ for ( int i = 1; i <= nindex; i++){
phrase_begin = phrase_end;
index++;
phrase_end = *index;
Index: scim-novel-pinyin-0.2.6/src/storage/pinyin_large_table.h
===================================================================
--- scim-novel-pinyin-0.2.6.orig/src/storage/pinyin_large_table.h
+++ scim-novel-pinyin-0.2.6/src/storage/pinyin_large_table.h
@@ -77,11 +77,11 @@ public:
bool store(MemoryChunk * new_chunk, table_offset_t offset, table_offset_t& end);
/*search/add_index method */
- int search( int phrase_length, /* in */ PinyinCustomSettings * custom,
+ int search( guint32 phrase_length, /* in */ PinyinCustomSettings * custom,
/* in */ PinyinKey keys[],
/* out */ PhraseIndexRanges ranges);
- int add_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token);
- int remove_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token);
+ int add_index( guint32 phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token);
+ int remove_index( guint32 phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token);
};
template<size_t phrase_length>
Index: scim-novel-pinyin-0.2.6/src/storage/pinyin_base.cpp
===================================================================
--- scim-novel-pinyin-0.2.6.orig/src/storage/pinyin_base.cpp
+++ scim-novel-pinyin-0.2.6/src/storage/pinyin_base.cpp
@@ -1134,7 +1134,7 @@ PinyinDefaultParser::parse (const Pinyin
DefaultParserCache cache = g_array_new (FALSE, TRUE, sizeof (DefaultParserCacheElement));
g_array_set_size(cache, len);
- for ( size_t index = 0 ; index < len ; index++){
+ for ( int index = 0 ; index < len ; index++){
DefaultParserCacheElement * element =
&g_array_index(cache,DefaultParserCacheElement, index);
*element = elm;