From 1eb4ed2559f761d0247381cdcda54ec105525645 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Mon, 29 Apr 2002 09:36:08 +0000 Subject: [PATCH] 2002-04-29 13:40 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 5 +++++ harbour/source/rdd/dbfntx/dbfntx1.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 93bc83383c..a2bfd0d419 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -7,6 +7,11 @@ For example: 2002-12-01 23:12 UTC+0100 Foo Bar */ + * source/rdd/dbcmd.c + * Bug fixed, which caused GPF's while opening of additive index + +2002-04-30 12:46 UTC+0300 Alexander Kresin + * include/hbrddntx.h * source/rdd/dbfntx/dbfntx1.c * Some changes, needed for custom indexes support diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index c19f0919e5..9f7d947e2f 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -1512,7 +1512,7 @@ static void hb_ntxTagBalance( LPTAGINFO pTag, int level ) LPPAGEINFO pPage = hb_ntxPageLoad( pTag->Owner, pTag->stack[level].page ); LPPAGEINFO pPageParent = hb_ntxPageLoad( pTag->Owner, pTag->stack[level+1].page ); - /* printf( "\nntxTagBalance - 0, %d %d %x %x",pTag->stackLevel,level,pPageParent->Page,pPage->Page ); */ + /* printf( "\nntxTagBalance-1, %d %d %x %x",pTag->stackLevel,level,pPageParent->Page,pPage->Page ); */ thiskey = pairkey = pTag->stack[level+1].ikey; do pairkey ++; @@ -1535,6 +1535,14 @@ static void hb_ntxTagBalance( LPTAGINFO pTag, int level ) else { pPagePair = hb_ntxPageLoad( pTag->Owner, KEYITEM( pPageParent, pairkey )->page ); + if( pPageParent->uiKeys == 1 && + ( pPage->uiKeys + pPagePair->uiKeys ) > pTag->MaxKeys - 2 ) + { + hb_ntxPageRelease( pPageParent ); + hb_ntxPageRelease( pPagePair ); + return; + } + if( pPagePair->uiKeys <= pTag->MaxKeys/2 ) { /* printf( "\nntxTagBalance - 10, %d %d",thiskey,pairkey ); */ @@ -1558,6 +1566,13 @@ static void hb_ntxTagBalance( LPTAGINFO pTag, int level ) else { pPagePair = hb_ntxPageLoad( pTag->Owner, KEYITEM( pPageParent, pairkey )->page ); + if( pPageParent->uiKeys == 1 && + ( pPage->uiKeys + pPagePair->uiKeys ) > pTag->MaxKeys - 2 ) + { + hb_ntxPageRelease( pPageParent ); + hb_ntxPageRelease( pPagePair ); + return; + } /* printf( "\nntxTagBalance - 3A %x %x %x %d",pPageParent->Page,pPage->Page,pPagePair->Page,pPagePair->uiKeys ); */ if( pPagePair->uiKeys <= pTag->MaxKeys/2 ) {