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
Proper assert for sub entry size
[idzebra-moved-to-github.git]
/
isamb
/
isamb.c
diff --git
a/isamb/isamb.c
b/isamb/isamb.c
index
57ebb84
..
b09ea62
100644
(file)
--- a/
isamb/isamb.c
+++ b/
isamb/isamb.c
@@
-1,5
+1,5
@@
-/* $Id: isamb.c,v 1.60 2004-11-29 21:53:00 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+/* $Id: isamb.c,v 1.64 2005-01-02 23:24:07 adam Exp $
+ Copyright (C) 1995-2005
Index Data Aps
This file is part of the Zebra server.
Index Data Aps
This file is part of the Zebra server.
@@
-21,9
+21,9
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
*/
#include <string.h>
*/
#include <string.h>
+#include <yaz/log.h>
#include <yaz/xmalloc.h>
#include <yaz/xmalloc.h>
-#include <yaz/ylog.h>
-#include <isamb.h>
+#include <idzebra/isamb.h>
#include <assert.h>
#ifndef ISAMB_DEBUG
#include <assert.h>
#ifndef ISAMB_DEBUG
@@
-205,10
+205,14
@@
ISAMB isamb_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method,
isamb->file[i].head.first_block = ISAMB_CACHE_ENTRY_SIZE/b_size+1;
isamb->file[i].head.last_block = isamb->file[i].head.first_block;
isamb->file[i].head.block_size = b_size;
isamb->file[i].head.first_block = ISAMB_CACHE_ENTRY_SIZE/b_size+1;
isamb->file[i].head.last_block = isamb->file[i].head.first_block;
isamb->file[i].head.block_size = b_size;
+#if ISAMB_PTR_CODEC
if (i == isamb->no_cat-1 || b_size > 128)
isamb->file[i].head.block_offset = 8;
else
isamb->file[i].head.block_offset = 4;
if (i == isamb->no_cat-1 || b_size > 128)
isamb->file[i].head.block_offset = 8;
else
isamb->file[i].head.block_offset = 4;
+#else
+ isamb->file[i].head.block_offset = 11;
+#endif
isamb->file[i].head.block_max =
b_size - isamb->file[i].head.block_offset;
isamb->file[i].head.free_list = 0;
isamb->file[i].head.block_max =
b_size - isamb->file[i].head.block_offset;
isamb->file[i].head.free_list = 0;
@@
-1094,7
+1098,7
@@
ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream)
char *dst = p2->bytes + p2->size;
encode_ptr (&dst, p->pos);
char *dst = p2->bytes + p2->size;
encode_ptr (&dst, p->pos);
- assert (sub_size < 40);
+ assert (sub_size < 80 && sub_size > 1);
encode_ptr (&dst, sub_size);
memcpy (dst, sub_item, sub_size);
dst += sub_size;
encode_ptr (&dst, sub_size);
memcpy (dst, sub_item, sub_size);
dst += sub_size;
@@
-1129,6
+1133,8
@@
ISAMB_PP isamb_pp_open_x (ISAMB isamb, ISAMB_P pos, int *level, int scope)
ISAMB_PP pp = xmalloc (sizeof(*pp));
int i;
ISAMB_PP pp = xmalloc (sizeof(*pp));
int i;
+ assert(pos);
+
pp->isamb = isamb;
pp->block = xmalloc (ISAMB_MAX_LEVEL * sizeof(*pp->block));
pp->isamb = isamb;
pp->block = xmalloc (ISAMB_MAX_LEVEL * sizeof(*pp->block));
@@
-1152,8
+1158,6
@@
ISAMB_PP isamb_pp_open_x (ISAMB isamb, ISAMB_P pos, int *level, int scope)
pp->no_blocks++;
if (p->leaf)
break;
pp->no_blocks++;
if (p->leaf)
break;
-
-
decode_ptr (&src, &pos);
p->offset = src - p->bytes;
pp->level++;
decode_ptr (&src, &pos);
p->offset = src - p->bytes;
pp->level++;