diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 17a7800ae8..64accf6fc8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +2001-02-06 12:00 GMT+3 Alexander Kresin + * harbour/source/rdd/dbfntx/dbfntx1.c + * fixed problem with correct movement via CA Clipper created ntx file + 2001-02-05 16:15 UTC-0500 David G. Holm * source/compiler/harbour.l * source/pp/pragma.c diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index cff3b1b44b..380dc70829 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -287,23 +287,32 @@ static int hb_ntxTagFindCurrentKey( LPPAGEINFO pPage, LONG lBlock, LPKEYINFO pKe pPage->CurKey = 0; if( pPage->uiKeys > 0 ) { - while( k > 0 && pPage->CurKey < pPage->uiKeys ) + while( k > 0 && pPage->CurKey <= pPage->uiKeys ) { p = pPage->pKeys + pPage->CurKey; - k = hb_ntxItemCompare( pKey->pItem, p->pItem, bExact ); - // k > 0 : pKey->pItem > p->pItem - if( !pPage->TagParent->AscendKey ) - k = -k; - if( k == 0 && lBlock == NTX_MAX_REC_NUM ) - k = 1; - if( k == 0 && lBlock != NTX_IGNORE_REC_NUM ) + if( pPage->CurKey == pPage->uiKeys ) { - if( lBlock > p->Xtra ) - k = 1; - else if( lBlock < p->Xtra ) - k = -1; + if( !p->Tag ) + break; + k = -1; } - if( k <= 0 || pPage->CurKey == pPage->uiKeys - 1 || + else + { + k = hb_ntxItemCompare( pKey->pItem, p->pItem, bExact ); + /* k > 0 : pKey->pItem > p->pItem */ + if( !pPage->TagParent->AscendKey ) + k = -k; + if( k == 0 && lBlock == NTX_MAX_REC_NUM ) + k = 1; + if( k == 0 && lBlock != NTX_IGNORE_REC_NUM ) + { + if( lBlock > p->Xtra ) + k = 1; + else if( lBlock < p->Xtra ) + k = -1; + } + } + if( k <= 0 || ( k == 0 && p->Xtra != pPage->TagParent->Owner->Owner->ulRecNo ) ) /* pKey <= p */ { @@ -468,7 +477,8 @@ static BOOL hb_ntxPageReadNextKey( LPTAGINFO pTag ) pPage->CurKey = hb_ntxPageFindCurrentKey( pPage,pTag->CurKeyInfo->Xtra ); if( pPage->CurKey ) { - if( pPage->CurKey < pPage->uiKeys ) + if( pPage->CurKey < pPage->uiKeys || + ( pPage->CurKey == pPage->uiKeys && ( pPage->pKeys+pPage->CurKey )->Tag ) ) { while( ( pPage->pKeys+pPage->CurKey )->Tag ) {