diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 76478415a8..05d78494d7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,15 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-09-23 17:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbcomp.h + * minor formatting + + * harbour/source/rdd/dbfnsx/dbfnsx1.c + ! fixed false corruption RT error generated due to missing reset + on cached current key offset - thanks to Jaroslav Janik for + information and self contain example + 2009-09-23 16:30 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * contrib/hbmemio/memio.c diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 44591539d8..a35fd07588 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -383,9 +383,9 @@ extern const BYTE hb_comp_pcode_len[]; #define HB_COMPFLAG_ARRSTR HB_SM_ARRSTR /* 16 -ks strings as array of bytes */ #define HB_COMPFLAG_EXTOPT HB_SM_EXTOPT /* 32 -ko clipper incompatible optimizations */ #define HB_COMPFLAG_RT_MACRO HB_SM_RT_MACRO /* 64 -kr */ -#define HB_COMPFLAG_OPTJUMP 256 /* -kj turn off jump optimalization */ -#define HB_COMPFLAG_HB_INLINE 512 /* -ki hb_inLine(...) { ... } support */ -#define HB_COMPFLAG_MACROTEXT 1024 /* -kM turn off macrotext substitution */ +#define HB_COMPFLAG_OPTJUMP 0x0100 /* -kj turn off jump optimalization */ +#define HB_COMPFLAG_HB_INLINE 0x0200 /* -ki hb_inLine(...) { ... } support */ +#define HB_COMPFLAG_MACROTEXT 0x0400 /* -kM turn off macrotext substitution */ #define HB_COMP_ISSUPPORTED(flag) ( HB_COMP_PARAM->supported & (flag) ) diff --git a/harbour/source/rdd/dbfnsx/dbfnsx1.c b/harbour/source/rdd/dbfnsx/dbfnsx1.c index 55aa1df761..0a7b78e4c0 100644 --- a/harbour/source/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/source/rdd/dbfnsx/dbfnsx1.c @@ -1257,6 +1257,7 @@ static void hb_nsxDiscardBuffers( LPNSXINDEX pIndex ) { pIndex->lpTags[ i ]->RootBlock = 0; pIndex->lpTags[ i ]->stackLevel = 0; + pIndex->lpTags[ i ]->CurKeyOffset = 0; } } @@ -2106,13 +2107,12 @@ static HB_ERRCODE hb_nsxIndexHeaderRead( LPNSXINDEX pIndex ) pIndex->Version = ulVersion; pIndex->NextAvail = ulNext; pIndex->FileSize = ulFileSize; - for( i = 1; i < pIndex->iTags; i++ ) + for( i = 0; i < pIndex->iTags; i++ ) { pIndex->lpTags[ i ]->HeadBlock = hb_nsxIndexTagFind( &pIndex->HeaderBuff, pIndex->lpTags[ i ]->TagName ); if( !pIndex->lpTags[ i ]->HeadBlock ) pIndex->lpTags[ i ]->RootBlock = 0; - pIndex->lpTags[ i ]->CurKeyOffset = 0; } } } @@ -3096,6 +3096,8 @@ static BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, if( ! pPage ) { hb_xfree( pKeyBuff ); + pTag->CurKeyOffset = 0; + pTag->stackLevel = 0; return FALSE; } pNewKey = hb_nsxKeyNew( iLen ); @@ -3128,6 +3130,7 @@ static BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, if( ! pPage ) { hb_nsxKeyFree( pNewKey ); + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; return FALSE; } @@ -3156,6 +3159,7 @@ static BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, if( ! pPage ) { hb_nsxKeyFree( pNewKey ); + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; return FALSE; } @@ -3165,11 +3169,13 @@ static BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, hb_nsxPageKeyAdd( pTag, pPage, 0, pNewKey ); pTag->RootBlock = pPage->Page; pTag->HdrChanged = TRUE; + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; hb_nsxKeyFree( pNewKey ); } } hb_nsxPageRelease( pTag, pPage ); + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; return TRUE; } @@ -3412,6 +3418,7 @@ static BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey ) hb_nsxKeyFree( pKeyNew ); } } + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; return fResult; } @@ -5680,6 +5687,7 @@ static void hb_nsxSortOut( LPNSXSORTINFO pSort ) return; pSort->ulLastRec = pTag->CurKeyInfo->rec; memcpy( pSort->pLastKey, pTag->CurKeyInfo->val, iLen ); + pTag->CurKeyOffset = 0; pTag->stackLevel = 0; }