-/* $Id: mfile.c,v 1.65 2006-05-10 08:13:17 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: mfile.c,v 1.66 2006-06-07 10:14:39 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
if (directory)
*directory = d->name;
if (max_bytes)
- *max_bytes = d->max_bytes;
+ {
+ /* possible loss of data. But it's just statistics and lies */
+ *max_bytes = (double) d->max_bytes;
+ }
if (used_bytes)
- *used_bytes = d->max_bytes - d->avail_bytes;
+ {
+ /* possible loss of data. But it's just statistics and lies */
+ *used_bytes = (double) (d->max_bytes - d->avail_bytes);
+ }
return 1;
}
/*
-/* $Id: api.h,v 1.35 2006-05-30 13:21:13 adam Exp $
+/* $Id: api.h,v 1.36 2006-06-07 10:14:40 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
#endif
typedef struct {
- int processed;
- int inserted;
- int updated;
- int deleted;
+ zint processed;
+ zint inserted;
+ zint updated;
+ zint deleted;
long utime;
long stime;
} ZebraTransactionStatus;
-/* $Id: recctrl.h,v 1.20 2006-05-19 13:49:34 adam Exp $
+/* $Id: recctrl.h,v 1.21 2006-06-07 10:14:40 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
int flagShowRecords;
int seqno[256];
char match_criteria[256];
- int staticrank;
+ zint staticrank;
void (*schemaAdd)(struct recExtractCtrl *p, Odr_oid *oid);
data1_handle dh;
void *handle;
-/* $Id: extract.c,v 1.218 2006-05-30 13:44:44 adam Exp $
+/* $Id: extract.c,v 1.219 2006-06-07 10:14:40 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
if (zebra_rec_keys_rewind(reckeys))
{
- int startSeq = -1;
+ zint startSeq = -1;
const char *str;
size_t slen;
struct it_key key;
if (key.mem[0] == ch)
{
- int woff;
+ zint woff;
if (startSeq == -1)
startSeq = seqno;
struct it_key key_in;
while(zebra_rec_keys_read(reckeys, &str, &slen, &key_in))
{
- int ord = key_in.mem[0];
+ int ord = CAST_ZINT_TO_INT(key_in.mem[0]);
for (p = ord_list; p ; p = p->next)
if (p->ord == ord)
(char*)zh->reg->key_buf + zh->reg->key_buf_used;
/* encode the ordinal value (field/use/attribute) .. */
- ch = (int) key_in.mem[0];
+ ch = CAST_ZINT_TO_INT(key_in.mem[0]);
zh->reg->key_buf_used +=
key_SU_encode(ch, (char*)zh->reg->key_buf +
zh->reg->key_buf_used);
{
char dst_buf[IT_MAX_WORD];
char *dst_term = dst_buf;
- int ord, seqno;
+ int ord;
+ zint seqno;
int index_type;
+
assert(key.len <= 4 && key.len > 2);
- seqno = (int) key.mem[key.len-1];
- ord = key.mem[0];
+ seqno = key.mem[key.len-1];
+ ord = CAST_ZINT_TO_INT(key.mem[0]);
zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type,
0/* db */, 0 /* string_index */);
while (zebra_rec_keys_read(reckeys, &str, &slen, &key))
{
char dst_buf[IT_MAX_WORD];
- int seqno;
+ zint seqno;
int index_type;
+ int ord = CAST_ZINT_TO_INT(key.mem[0]);
const char *db = 0;
assert(key.len <= 4 && key.len > 2);
- zebraExplain_lookup_ord(zh->reg->zei,
- key.mem[0], &index_type, &db, 0);
+ zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, &db, 0);
- seqno = (int) key.mem[key.len-1];
+ seqno = key.mem[key.len-1];
zebra_term_untrans(zh, index_type, dst_buf, str);
- yaz_log(YLOG_LOG, "ord=" ZINT_FORMAT " seqno=%d term=%s",
- key.mem[0], seqno, dst_buf);
+ yaz_log(YLOG_LOG, "ord=%d seqno=" ZINT_FORMAT
+ " term=%s", ord, seqno, dst_buf);
}
}
}
while (zebra_rec_keys_read(reckeys, &str, &slen, &key_in))
{
- int ord = (int) key_in.mem[0];
+ int ord = CAST_ZINT_TO_INT(key_in.mem[0]);
sortIdx_type(sortIdx, ord);
if (cmd == 1)
-/* $Id: invstat.c,v 1.51 2006-05-19 23:20:24 adam Exp $
+/* $Id: invstat.c,v 1.52 2006-06-07 10:14:41 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
{
ISAMB_PP pp;
struct it_key key;
- int cat = (int) (isam_p & 3);
+ int cat = CAST_ZINT_TO_INT(isam_p & 3);
int level;
zint size;
zint blocks;
stat_info.no_isam_entries[i]);
if (stat_info.no_isam_entries[i])
- fprintf (stdout, " %8d %f",
- (int) ((1023.0 + (double)
- isamc_block_used(zh->reg->isamc, i) *
- isamc_block_size(zh->reg->isamc,i))/1024),
- ((double) isamc_block_used(zh->reg->isamc, i) *
+ fprintf(stdout, " %8d %f",
+ (int) ((1023.0 + (double)
+ isamc_block_used(zh->reg->isamc, i) *
+ isamc_block_size(zh->reg->isamc,i))/1024),
+ ((double) isamc_block_used(zh->reg->isamc, i) *
isamc_block_size(zh->reg->isamc,i))/
- stat_info.no_isam_entries[i]);
+ stat_info.no_isam_entries[i]);
fprintf (stdout, "\n");
}
}
-/* $Id: recindex.c,v 1.49 2006-05-10 12:30:02 adam Exp $
+/* $Id: recindex.c,v 1.50 2006-06-07 10:14:41 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
{
int r;
zint pos = (sysno-1)*itemsize;
- int off = (int) (pos%RIDX_CHUNK);
+ int off = CAST_ZINT_TO_INT(pos%RIDX_CHUNK);
int sz1 = RIDX_CHUNK - off; /* sz1 is size of buffer to read.. */
if (sz1 > itemsize)
static void write_indx(Records p, SYSNO sysno, void *buf, int itemsize)
{
zint pos = (sysno-1)*itemsize;
- int off = (int) (pos%RIDX_CHUNK);
+ int off = CAST_ZINT_TO_INT(pos%RIDX_CHUNK);
int sz1 = RIDX_CHUNK - off; /* sz1 is size of buffer to read.. */
if (sz1 > itemsize)
freeblock = entry.next;
assert(freeblock > 0);
- dst_type = (int) (freeblock & 7);
+ dst_type = CAST_ZINT_TO_INT(freeblock & 7);
assert(dst_type < REC_BLOCK_TYPES);
freeblock = freeblock / 8;
while (freeblock)
cptr = p->tmp_buf + no_written;
}
block_prev = block_free;
- no_written += (int)(p->head.block_size[dst_type]) - sizeof(zint);
+ no_written += CAST_ZINT_TO_INT(p->head.block_size[dst_type])
+ - sizeof(zint);
p->head.block_used[dst_type]++;
}
assert(block_prev != -1);
}
for (i = 0; i<REC_BLOCK_TYPES; i++)
{
- if (!(p->data_BFile[i] = bf_open(bfs, p->data_fname[i],
- (int) (p->head.block_size[i]),
- rw)))
+ if (!(p->data_BFile[i] =
+ bf_open(bfs, p->data_fname[i],
+ CAST_ZINT_TO_INT(p->head.block_size[i]), rw)))
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "bf_open %s", p->data_fname[i]);
ret = ZEBRA_FAIL;
for (i = 0; i<REC_NO_INFO; i++)
{
- if (*out_offset + (int) rec->size[i] + 20 > *out_size)
+ if (*out_offset + CAST_ZINT_TO_INT(rec->size[i]) + 20 > *out_size)
{
int new_size = *out_offset + rec->size[i] + 65536;
char *np = (char *) xmalloc(new_size);
-/* $Id: reckeys.c,v 1.5 2006-05-22 13:28:00 adam Exp $
+/* $Id: reckeys.c,v 1.6 2006-06-07 10:14:41 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
{
unsigned h = 0;
size_t i;
+ int j;
for (i = 0; i<len; i++)
h = h * 65509 + buf[i];
- for (i = 0; i<key->len; i++)
- h = h * 65509 + key->mem[i];
+ for (j = 0; j<key->len; j++)
+ h = h * 65509 + CAST_ZINT_TO_INT(key->mem[j]);
return &p->entries[h % (unsigned) p->hash_size];
}
-/* $Id: retrieve.c,v 1.41 2006-05-19 23:20:24 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: retrieve.c,v 1.42 2006-06-07 10:14:41 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
while(zebra_rec_keys_read(keys, &str, &slen, &key_in))
{
int i;
- int ord = key_in.mem[0];
+ int ord = CAST_ZINT_TO_INT(key_in.mem[0]);
int index_type;
const char *db = 0;
int set = 0;
-/* $Id: zebraapi.c,v 1.219 2006-05-30 13:21:16 adam Exp $
+/* $Id: zebraapi.c,v 1.220 2006-06-07 10:14:41 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
zh->records_processed, zh->records_inserted,
zh->records_updated, zh->records_deleted);
- status->processed = (int) zh->records_processed;
- status->inserted = (int) zh->records_inserted;
- status->updated = (int) zh->records_updated;
- status->deleted = (int) zh->records_deleted;
+ status->processed = zh->records_processed;
+ status->inserted = zh->records_inserted;
+ status->updated = zh->records_updated;
+ status->deleted = zh->records_deleted;
zebra_get_state (zh, &val, &seqno);
if (val != 'd')
-/* $Id: zserver.c,v 1.146 2006-05-10 08:13:23 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: zserver.c,v 1.147 2006-06-07 10:14:41 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
se->subqueryExpression->u.term->termComment = 0;
se->subqueryInterpretation = 0;
se->subqueryRecommendation = 0;
- if (count > 2000000000)
- count = 2000000000;
- se->subqueryCount = odr_intdup(r->stream, (int) count);
+ if (count > 2147483646)
+ count = 2147483647;
+ se->subqueryCount = odr_intdup(r->stream, CAST_ZINT_TO_INT(count));
se->subqueryWeight = 0;
se->resultsByDB = 0;
}
}
-int bend_search (void *handle, bend_search_rr *r)
+int bend_search(void *handle, bend_search_rr *r)
{
ZebraHandle zh = (ZebraHandle) handle;
zint zhits = 0;
zebra_result(zh, &r->errcode, &r->errstring);
else
{
- if (zhits > 2147483646)
- r->hits = 2147483647;
- else
- r->hits = (int) zhits;
+ if (zhits > 2147483646)
+ zhits = 2147483647;
+ r->hits = CAST_ZINT_TO_INT(zhits);
search_terms (zh, r);
}
break;
-/* $Id: zsets.c,v 1.106 2006-06-06 21:01:30 adam Exp $
+/* $Id: zsets.c,v 1.107 2006-06-07 10:14:42 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
{
RSFD rfd = rset_open(rset, RSETF_READ);
struct rank_control *rc = rank_class->control;
- double score;
+ int score;
zint count = 0;
void *handle =
-/* $Id: snippet.c,v 1.6 2006-05-10 08:13:46 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: snippet.c,v 1.7 2006-06-07 10:14:42 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.