From bf151a64005ea2aa2867583fbb1597a25857367a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 6 Jun 2009 00:15:16 +0000 Subject: [PATCH] 2009-06-06 02:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rdd/dbfnsx/dbfnsx1.c ! fixed stupid typo in C else block scope which caused false alarm about corrupted index. Many thanks to Vitor Mangabeira for information and self contain example. --- harbour/ChangeLog | 6 ++++ harbour/source/rdd/dbfnsx/dbfnsx1.c | 43 ++++++++++++++++------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3c8723effb..241b4fdb43 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-06 02:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rdd/dbfnsx/dbfnsx1.c + ! fixed stupid typo in C else block scope which caused false alarm + about corrupted index. Many thanks to Vitor Mangabeira for information + and self contain example. + 2009-06-06 01:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * bin/hb-mkdyn.bat ! Applied version number change to this file, too. diff --git a/harbour/source/rdd/dbfnsx/dbfnsx1.c b/harbour/source/rdd/dbfnsx/dbfnsx1.c index 614d1596cd..04e7500233 100644 --- a/harbour/source/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/source/rdd/dbfnsx/dbfnsx1.c @@ -2401,30 +2401,35 @@ static BOOL hb_nsxTagGetCurKey( LPTAGINFO pTag, LPPAGEINFO pPage, USHORT uiKey ) if( hb_nsxIsLeaf( pPage ) ) { if( uiKey >= pPage->uiKeys ) + { pTag->CurKeyInfo->rec = pTag->CurKeyInfo->page = 0; - else if( pTag->CurKeyInfo->rec == 0 || - pTag->CurKeyInfo->page != pPage->Page || - uiKey < pTag->CurKeyNo || pTag->CurKeyOffset == 0 ) - { - pTag->CurKeyOffset = NSX_LEAFKEYOFFSET; - pTag->CurKeyNo = ( USHORT ) -1; - hb_nsxTagGetPrevKey( pTag, pTag->CurKeyInfo->val, pTag->stackLevel - 1 ); } - pTag->CurKeyInfo->page = pPage->Page; - - while( pTag->CurKeyNo != uiKey ) + else { - pTag->CurKeyOffset = hb_nsxLeafGetKey( pTag, pPage, - pTag->CurKeyOffset, - pTag->CurKeyInfo->val, - &pTag->CurKeyInfo->rec ); - if( pTag->CurKeyOffset == 0 ) + if( pTag->CurKeyInfo->rec == 0 || + pTag->CurKeyInfo->page != pPage->Page || + uiKey < pTag->CurKeyNo || pTag->CurKeyOffset == 0 ) { - hb_nsxCorruptError( pTag->pIndex ); - pTag->CurKeyInfo->rec = 0; - return FALSE; + pTag->CurKeyOffset = NSX_LEAFKEYOFFSET; + pTag->CurKeyNo = ( USHORT ) -1; + hb_nsxTagGetPrevKey( pTag, pTag->CurKeyInfo->val, pTag->stackLevel - 1 ); + } + pTag->CurKeyInfo->page = pPage->Page; + + while( pTag->CurKeyNo != uiKey ) + { + pTag->CurKeyOffset = hb_nsxLeafGetKey( pTag, pPage, + pTag->CurKeyOffset, + pTag->CurKeyInfo->val, + &pTag->CurKeyInfo->rec ); + if( pTag->CurKeyOffset == 0 ) + { + hb_nsxCorruptError( pTag->pIndex ); + pTag->CurKeyInfo->rec = 0; + return FALSE; + } + pTag->CurKeyNo++; } - pTag->CurKeyNo++; } } else if( uiKey && uiKey <= pPage->uiKeys )