projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug #529. On Unix, combine pthreed locks with file locking because file
[idzebra-moved-to-github.git]
/
index
/
recindex.c
diff --git
a/index/recindex.c
b/index/recindex.c
index
bef5034
..
c3f560e
100644
(file)
--- a/
index/recindex.c
+++ b/
index/recindex.c
@@
-1,5
+1,5
@@
-/* $Id: recindex.c,v 1.47 2006-03-26 14:17:01 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: recindex.c,v 1.50 2006-06-07 10:14:41 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
Index Data ApS
This file is part of the Zebra server.
@@
-106,7
+106,7
@@
static int read_indx(Records p, SYSNO sysno, void *buf, int itemsize,
{
int r;
zint pos = (sysno-1)*itemsize;
{
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)
int sz1 = RIDX_CHUNK - off; /* sz1 is size of buffer to read.. */
if (sz1 > itemsize)
@@
-127,7
+127,7
@@
static int read_indx(Records p, SYSNO sysno, void *buf, int itemsize,
static void write_indx(Records p, SYSNO sysno, void *buf, int itemsize)
{
zint pos = (sysno-1)*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)
int sz1 = RIDX_CHUNK - off; /* sz1 is size of buffer to read.. */
if (sz1 > itemsize)
@@
-152,7
+152,7
@@
static ZEBRA_RES rec_release_blocks(Records p, SYSNO sysno)
freeblock = entry.next;
assert(freeblock > 0);
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)
assert(dst_type < REC_BLOCK_TYPES);
freeblock = freeblock / 8;
while (freeblock)
@@
-259,7
+259,8
@@
static ZEBRA_RES rec_write_tmp_buf(Records p, int size, SYSNO *sysnos)
cptr = p->tmp_buf + no_written;
}
block_prev = block_free;
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);
p->head.block_used[dst_type]++;
}
assert(block_prev != -1);
@@
-345,9
+346,9
@@
Records rec_open(BFiles bfs, int rw, int compression_method)
}
for (i = 0; i<REC_BLOCK_TYPES; i++)
{
}
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;
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "bf_open %s", p->data_fname[i]);
ret = ZEBRA_FAIL;
@@
-432,7
+433,7
@@
static void rec_cache_flush_block1(Records p, Record rec, Record last_rec,
for (i = 0; i<REC_NO_INFO; i++)
{
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);
{
int new_size = *out_offset + rec->size[i] + 65536;
char *np = (char *) xmalloc(new_size);
@@
-955,8
+956,9
@@
Record rec_cp(Record rec)
else
{
n->size[i] = rec->size[i];
else
{
n->size[i] = rec->size[i];
- n->info[i] = (char *) xmalloc(rec->size[i]);
+ n->info[i] = (char *) xmalloc(rec->size[i]+1);
memcpy(n->info[i], rec->info[i], rec->size[i]);
memcpy(n->info[i], rec->info[i], rec->size[i]);
+ n->info[i][rec->size[i]] = '\0';
}
return n;
}
}
return n;
}
@@
-977,3
+979,11
@@
char *rec_strdup(const char *s, size_t *len)
return p;
}
return p;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+