X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isamb%2Fisamb.c;h=70fcccd551e7f9acccaffc67383bcee5688071dd;hb=97e5c7f8db1ea9f806bf4bca38dee837c32d2e6f;hp=5baed000f310998863e570027dbac0e2c6366942;hpb=18bc39eefdab1b2860c0e2f77a7c5fd822eb315d;p=idzebra-moved-to-github.git diff --git a/isamb/isamb.c b/isamb/isamb.c index 5baed00..70fcccd 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,4 +1,4 @@ -/* $Id: isamb.c,v 1.40 2004-06-02 23:05:55 adam Exp $ +/* $Id: isamb.c,v 1.41 2004-06-03 00:23:48 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -1534,6 +1534,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilb) if (!p) return 0; +again: while (p->offset == p->size) { int pos, item_len; @@ -1548,6 +1549,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilb) assert (!p->leaf); } + assert(!p->leaf); src = p->bytes + p->offset; decode_ptr (&src, &item_len); @@ -1604,10 +1606,18 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilb) } assert (p->offset < p->size); assert (p->leaf); - src = p->bytes + p->offset; - (*pp->isamb->method->code_item)(ISAMC_DECODE, p->decodeClientData, + while(1) + { + char *dst0 = dst; + src = p->bytes + p->offset; + (*pp->isamb->method->code_item)(ISAMC_DECODE, p->decodeClientData, &dst, &src); - p->offset = src - (char*) p->bytes; + p->offset = src - (char*) p->bytes; + if (!untilb || (*pp->isamb->method->compare_item)(untilb, dst0) <= 1) + break; + dst = dst0; + if (p->offset == p->size) goto again; + } /* key_logdump_txt(LOG_DEBUG,buf, "isamb_pp_read returning 1"); */ return 1; }