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
Added Doxyfile.
[idzebra-moved-to-github.git]
/
index
/
recindex.c
diff --git
a/index/recindex.c
b/index/recindex.c
index
10327c0
..
793898b
100644
(file)
--- a/
index/recindex.c
+++ b/
index/recindex.c
@@
-1,6
+1,6
@@
-/* $Id: recindex.c,v 1.38 2004-09-26 20:19:44 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
- Index Data Aps
+/* $Id: recindex.c,v 1.41 2005-01-15 19:38:26 adam Exp $
+ Copyright (C) 1995-2005
+ Index Data ApS
This file is part of the Zebra server.
This file is part of the Zebra server.
@@
-56,7
+56,7
@@
static void rec_write_head (Records p)
r = bf_write (p->index_BFile, 0, 0, sizeof(p->head), &p->head);
if (r)
{
r = bf_write (p->index_BFile, 0, 0, sizeof(p->head), &p->head);
if (r)
{
- logf (LOG_FATAL|LOG_ERRNO, "write head of %s", p->index_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write head of %s", p->index_fname);
exit (1);
}
}
exit (1);
}
}
@@
-67,7
+67,8
@@
static void rec_tmp_expand (Records p, int size)
p->tmp_size < p->head.block_size[REC_BLOCK_TYPES-1]*2)
{
xfree (p->tmp_buf);
p->tmp_size < p->head.block_size[REC_BLOCK_TYPES-1]*2)
{
xfree (p->tmp_buf);
- p->tmp_size = size + p->head.block_size[REC_BLOCK_TYPES-1]*2 + 2048;
+ p->tmp_size = size + (int)
+ (p->head.block_size[REC_BLOCK_TYPES-1])*2 + 2048;
p->tmp_buf = (char *) xmalloc (p->tmp_size);
}
}
p->tmp_buf = (char *) xmalloc (p->tmp_size);
}
}
@@
-85,10
+86,11
@@
static int read_indx (Records p, SYSNO sysno, void *buf, int itemsize,
r = bf_read (p->index_BFile, 1+pos/RIDX_CHUNK, off, sz1, buf);
if (r == 1 && sz1 < itemsize) /* boundary? - must read second part */
r = bf_read (p->index_BFile, 1+pos/RIDX_CHUNK, off, sz1, buf);
if (r == 1 && sz1 < itemsize) /* boundary? - must read second part */
- r = bf_read (p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1, buf + sz1);
+ r = bf_read (p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1,
+ (char*) buf + sz1);
if (r != 1 && !ignoreError)
{
if (r != 1 && !ignoreError)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in %s at pos %ld",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at pos %ld",
p->index_fname, (long) pos);
exit (1);
}
p->index_fname, (long) pos);
exit (1);
}
@@
-106,7
+108,8
@@
static void write_indx (Records p, SYSNO sysno, void *buf, int itemsize)
bf_write(p->index_BFile, 1+pos/RIDX_CHUNK, off, sz1, buf);
if (sz1 < itemsize) /* boundary? must write second part */
bf_write(p->index_BFile, 1+pos/RIDX_CHUNK, off, sz1, buf);
if (sz1 < itemsize) /* boundary? must write second part */
- bf_write(p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1, buf + sz1);
+ bf_write(p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1,
+ (char*) buf + sz1);
}
static void rec_release_blocks (Records p, SYSNO sysno)
}
static void rec_release_blocks (Records p, SYSNO sysno)
@@
-131,7
+134,7
@@
static void rec_release_blocks (Records p, SYSNO sysno)
first ? sizeof(block_and_ref) : sizeof(zint),
block_and_ref) != 1)
{
first ? sizeof(block_and_ref) : sizeof(zint),
block_and_ref) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in rec_del_single");
exit (1);
}
if (first)
exit (1);
}
if (first)
@@
-145,7
+148,7
@@
static void rec_release_blocks (Records p, SYSNO sysno)
if (bf_write (p->data_BFile[dst_type], freeblock, 0,
sizeof(block_and_ref), block_and_ref))
{
if (bf_write (p->data_BFile[dst_type], freeblock, 0,
sizeof(block_and_ref), block_and_ref))
{
- logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single");
exit (1);
}
return;
exit (1);
}
return;
@@
-156,7
+159,7
@@
static void rec_release_blocks (Records p, SYSNO sysno)
if (bf_write (p->data_BFile[dst_type], freeblock, 0, sizeof(freeblock),
&p->head.block_free[dst_type]))
{
if (bf_write (p->data_BFile[dst_type], freeblock, 0, sizeof(freeblock),
&p->head.block_free[dst_type]))
{
- logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single");
exit (1);
}
p->head.block_free[dst_type] = freeblock;
exit (1);
}
p->head.block_free[dst_type] = freeblock;
@@
-200,7
+203,7
@@
static void rec_write_tmp_buf (Records p, int size, SYSNO *sysnos)
block_free, 0, sizeof(*p->head.block_free),
&p->head.block_free[dst_type]) != 1)
{
block_free, 0, sizeof(*p->head.block_free),
&p->head.block_free[dst_type]) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in %s at free block " ZINT_FORMAT,
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at free block " ZINT_FORMAT,
p->data_fname[dst_type], block_free);
exit (1);
}
p->data_fname[dst_type], block_free);
exit (1);
}
@@
-225,7
+228,7
@@
static void 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 += p->head.block_size[dst_type] - sizeof(zint);
+ no_written += (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);
@@
-250,7
+253,7
@@
Records rec_open (BFiles bfs, int rw, int compression_method)
p->index_BFile = bf_open (bfs, p->index_fname, RIDX_CHUNK, rw);
if (p->index_BFile == NULL)
{
p->index_BFile = bf_open (bfs, p->index_fname, RIDX_CHUNK, rw);
if (p->index_BFile == NULL)
{
- logf (LOG_FATAL|LOG_ERRNO, "open %s", p->index_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", p->index_fname);
exit (1);
}
r = bf_read (p->index_BFile, 0, 0, 0, p->tmp_buf);
exit (1);
}
r = bf_read (p->index_BFile, 0, 0, 0, p->tmp_buf);
@@
-283,13
+286,13
@@
Records rec_open (BFiles bfs, int rw, int compression_method)
memcpy (&p->head, p->tmp_buf, sizeof(p->head));
if (memcmp (p->head.magic, REC_HEAD_MAGIC, sizeof(p->head.magic)))
{
memcpy (&p->head, p->tmp_buf, sizeof(p->head));
if (memcmp (p->head.magic, REC_HEAD_MAGIC, sizeof(p->head.magic)))
{
- logf (LOG_FATAL, "file %s has bad format", p->index_fname);
+ yaz_log (YLOG_FATAL, "file %s has bad format", p->index_fname);
exit (1);
}
version = atoi (p->head.version);
if (version != REC_VERSION)
{
exit (1);
}
version = atoi (p->head.version);
if (version != REC_VERSION)
{
- logf (LOG_FATAL, "file %s is version %d, but version"
+ yaz_log (YLOG_FATAL, "file %s is version %d, but version"
" %d is required", p->index_fname, version, REC_VERSION);
exit (1);
}
" %d is required", p->index_fname, version, REC_VERSION);
exit (1);
}
@@
-306,10
+309,10
@@
Records rec_open (BFiles bfs, int rw, int compression_method)
for (i = 0; i<REC_BLOCK_TYPES; i++)
{
if (!(p->data_BFile[i] = bf_open (bfs, p->data_fname[i],
for (i = 0; i<REC_BLOCK_TYPES; i++)
{
if (!(p->data_BFile[i] = bf_open (bfs, p->data_fname[i],
- p->head.block_size[i],
+ (int) (p->head.block_size[i]),
rw)))
{
rw)))
{
- logf (LOG_FATAL|LOG_ERRNO, "bf_open %s", p->data_fname[i]);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "bf_open %s", p->data_fname[i]);
exit (1);
}
}
exit (1);
}
}
@@
-490,10
+493,10
@@
static void rec_write_multiple (Records p, int saveCount)
&csize, out_buf, out_offset, 1, 0, 30);
if (i != BZ_OK)
{
&csize, out_buf, out_offset, 1, 0, 30);
if (i != BZ_OK)
{
- logf (LOG_WARN, "bzBuffToBuffCompress error code=%d", i);
+ yaz_log (YLOG_WARN, "bzBuffToBuffCompress error code=%d", i);
csize = 0;
}
csize = 0;
}
- logf (LOG_LOG, "compress %4d %5d %5d", ref_count, out_offset,
+ yaz_log (YLOG_LOG, "compress %4d %5d %5d", ref_count, out_offset,
csize);
#endif
break;
csize);
#endif
break;
@@
-688,17
+691,17
@@
static Record rec_get_int (Records p, SYSNO sysno)
i = bzBuffToBuffDecompress
#endif
(bz_buf, &bz_size, in_buf, in_size, 0, 0);
i = bzBuffToBuffDecompress
#endif
(bz_buf, &bz_size, in_buf, in_size, 0, 0);
- logf (LOG_LOG, "decompress %5d %5d", in_size, bz_size);
+ yaz_log (YLOG_LOG, "decompress %5d %5d", in_size, bz_size);
if (i == BZ_OK)
break;
if (i == BZ_OK)
break;
- logf (LOG_LOG, "failed");
+ yaz_log (YLOG_LOG, "failed");
xfree (bz_buf);
bz_size *= 2;
}
in_buf = bz_buf;
in_size = bz_size;
#else
xfree (bz_buf);
bz_size *= 2;
}
in_buf = bz_buf;
in_size = bz_size;
#else
- logf (LOG_FATAL, "cannot decompress record(s) in BZIP2 format");
+ yaz_log (YLOG_FATAL, "cannot decompress record(s) in BZIP2 format");
exit (1);
#endif
break;
exit (1);
#endif
break;