From: Adam Dickmeiss Date: Wed, 7 Jun 2006 10:50:08 +0000 (+0000) Subject: Changed some types from int to zint + added a few casts X-Git-Tag: before.bug.529~77 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=afa71e9ea1ff3707654936324c30703a618852ff;p=idzebra-moved-to-github.git Changed some types from int to zint + added a few casts --- diff --git a/include/idzebra/api.h b/include/idzebra/api.h index fb6efea..17c2ac9 100644 --- a/include/idzebra/api.h +++ b/include/idzebra/api.h @@ -1,4 +1,4 @@ -/* $Id: api.h,v 1.36 2006-06-07 10:14:40 adam Exp $ +/* $Id: api.h,v 1.37 2006-06-07 10:50:08 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -76,7 +76,7 @@ typedef struct { /** Scan Term Descriptor */ typedef struct { - int occurrences; /* scan term occurrences */ + zint occurrences; /* scan term occurrences */ char *term; /* scan term string */ } ZebraScanEntry; diff --git a/include/idzebra/recctrl.h b/include/idzebra/recctrl.h index 3f20cb0..6b4bb9e 100644 --- a/include/idzebra/recctrl.h +++ b/include/idzebra/recctrl.h @@ -1,4 +1,4 @@ -/* $Id: recctrl.h,v 1.21 2006-06-07 10:14:40 adam Exp $ +/* $Id: recctrl.h,v 1.22 2006-06-07 10:50:08 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -99,7 +99,7 @@ struct recRetrieveCtrl { char *encoding; /* preferred character encoding */ zint localno; /* local id of record */ int score; /* score 0-1000 or -1 if none */ - int staticrank; /* static rank >= 0, 0 if none */ + zint staticrank; /* static rank >= 0, 0 if none */ int recordSize; /* size of record in bytes */ char *fname; /* name of file (or NULL if internal) */ data1_handle dh; diff --git a/index/ranksimilarity.c b/index/ranksimilarity.c index 81add45..9455bcc 100644 --- a/index/ranksimilarity.c +++ b/index/ranksimilarity.c @@ -1,4 +1,4 @@ -/* $Id: ranksimilarity.c,v 1.9 2006-05-19 23:20:24 adam Exp $ +/* $Id: ranksimilarity.c,v 1.10 2006-06-07 10:50:08 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -366,7 +366,12 @@ static int calc (void *set_handle, zint sysno, zint staticrank, /* staticrank = 0 is highest, MAXINT lowest */ - score = INT_MAX - staticrank; /* but score is reverse (logical) */ + if (staticrank >= INT_MAX) + score = 0; + else + { /* but score is reverse (logical) */ + score = INT_MAX - CAST_ZINT_TO_INT(staticrank); + } /* debugging statistics output */ diff --git a/index/rankstatic.c b/index/rankstatic.c index cc86ca1..d313fe3 100644 --- a/index/rankstatic.c +++ b/index/rankstatic.c @@ -1,4 +1,4 @@ -/* $Id: rankstatic.c,v 1.7 2006-05-19 23:20:24 adam Exp $ +/* $Id: rankstatic.c,v 1.8 2006-06-07 10:50:08 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -148,7 +148,10 @@ static int calc (void *set_handle, zint sysno, zint staticrank, /* if we set *stop_flag = 1, we stop processing (of result set list) */ /* staticrank = 0 is highest, MAXINT lowest */ - return INT_MAX - staticrank; /* but score is reverse (logical) */ + if (staticrank >= INT_MAX) + return 0; + /* but score is reverse (logical) */ + return INT_MAX - CAST_ZINT_TO_INT(staticrank); } /* diff --git a/index/zrpn.c b/index/zrpn.c index f5ec05c..8cc6515 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.216 2006-06-06 21:01:30 adam Exp $ +/* $Id: zrpn.c,v 1.217 2006-06-07 10:50:08 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -199,7 +199,7 @@ static int term_pre(ZebraMaps zebra_maps, int reg_type, const char **src, } -static void esc_str(char *out_buf, int out_size, +static void esc_str(char *out_buf, size_t out_size, const char *in_buf, int in_size) { int k; diff --git a/index/zserver.c b/index/zserver.c index 129fbe2..1b67f8f 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -1,4 +1,4 @@ -/* $Id: zserver.c,v 1.147 2006-06-07 10:14:41 adam Exp $ +/* $Id: zserver.c,v 1.148 2006-06-07 10:50:09 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -368,7 +368,8 @@ static int bend_scan (void *handle, bend_scan_rr *r) for (i = 0; i < r->num_entries; i++) { r->entries[i].term = entries[i].term; - r->entries[i].occurrences = entries[i].occurrences; + r->entries[i].occurrences = + CAST_ZINT_TO_INT(entries[i].occurrences); } } else diff --git a/util/snippet.c b/util/snippet.c index b900c1b..dcd8b71 100644 --- a/util/snippet.c +++ b/util/snippet.c @@ -1,4 +1,4 @@ -/* $Id: snippet.c,v 1.7 2006-06-07 10:14:42 adam Exp $ +/* $Id: snippet.c,v 1.8 2006-06-07 10:50:09 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -95,9 +95,9 @@ zebra_snippets *zebra_snippets_window(zebra_snippets *doc, zebra_snippets *hit, while(1) { - int window_start; - int first_seq_no_best_window = 0; - int last_seq_no_best_window = 0; + zint window_start; + zint first_seq_no_best_window = 0; + zint last_seq_no_best_window = 0; int number_best_window = 0; zebra_snippet_word *hit_w, *doc_w; int min_ord = 0; /* not set yet */ @@ -118,7 +118,7 @@ zebra_snippets *zebra_snippets_window(zebra_snippets *doc, zebra_snippets *hit, { zebra_snippet_word *look_w = hit_w; int number_this = 0; - int seq_no_last = 0; + zint seq_no_last = 0; while (look_w && look_w->seqno < hit_w->seqno + window_size) { if (look_w->ord == ord)