From dffefbf2faee02ce58bc8d3659a4b250d46c838b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 29 Jun 2005 12:31:46 +0000 Subject: [PATCH] Fixed a bug in ISAMB splitting. A new block was attempted to be read while it was not yet flushed to disc. Should now be fixed. --- isamb/isamb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/isamb/isamb.c b/isamb/isamb.c index 0ee485c..9f8fb84 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,4 +1,4 @@ -/* $Id: isamb.c,v 1.79 2005-04-25 10:45:28 adam Exp $ +/* $Id: isamb.c,v 1.80 2005-06-29 12:31:46 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -732,11 +732,12 @@ int insert_int (ISAMB b, struct ISAMB_block *p, void *lookahead_item, p->size = dst - dst_buf; assert (p->size >= 0); - if (p->size <= b->file[p->cat].head.block_max) { /* it fits OK in this block */ memcpy (startp, dst_buf, dst - dst_buf); + + close_block(b, sub_p2); } else { @@ -754,6 +755,9 @@ int insert_int (ISAMB b, struct ISAMB_block *p, void *lookahead_item, src = dst_buf; endp = dst; + p->dirty = 1; + close_block(b, sub_p2); + half = src + b->file[p->cat].head.block_size/2; decode_ptr(&src, &pos); @@ -807,8 +811,7 @@ int insert_int (ISAMB b, struct ISAMB_block *p, void *lookahead_item, (*sp)->no_items = p->no_items - no_items_first_half; p->no_items = no_items_first_half; } - p->dirty = 1; - close_block(b, sub_p2); + p->dirty = 1; } close_block(b, sub_p1); (*b->method->codec.stop)(c1); -- 1.7.10.4