diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a1c4b40889..2b62bb1752 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2008-01-23 02:24 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbrddntx.h + ! fixed type of Signature field in tag structure + + * harbour/source/rdd/dbfntx/dbfntx1.c + ! fixed possible leaving locked index when number of tags + exceed 63. 63 is maximum number of tags in multi tag NTX + file + ! fixed typo in HB_TRACE message + % simplify NTXNODE data access in RDDINFO method + + * harbour/source/rdd/dbfcdx/dbfcdx1.c + * formatting, some minor cleanup and fixed typo in comment + 2008-01-18 02:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbrddads/make_b32.bat * contrib/hbrddads/make_vc.bat diff --git a/harbour/include/hbrddntx.h b/harbour/include/hbrddntx.h index 08bcc8fcfc..1d78fde4c2 100644 --- a/harbour/include/hbrddntx.h +++ b/harbour/include/hbrddntx.h @@ -212,13 +212,13 @@ typedef struct _TAGINFO HB_NTXSCOPE top; HB_NTXSCOPE bottom; - BOOL fTagName; /* remove */ + USHORT Signature; + + BOOL fTagName; BOOL fUsrDescend; BOOL AscendKey; BOOL UniqueKey; - BOOL Signature; - BOOL Custom; BOOL ChgOnly; BOOL Partial; diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index 89daa7d586..bed95ec850 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -705,7 +705,7 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag, case 'L': pItem = hb_itemPutL( pItem, pKey->val[0] == 'T' ); break; - default: + default: if ( pItem ) hb_itemClear( pItem ); else @@ -772,7 +772,8 @@ static BOOL hb_cdxEvalCond( CDXAREAP pArea, PHB_ITEM pCondItem, BOOL fSetWA ) int iCurrArea = 0; BOOL fRet; - if ( fSetWA ) { + if ( fSetWA ) + { iCurrArea = hb_rddGetCurrentWorkAreaNumber(); if ( iCurrArea != pArea->uiArea ) hb_rddSelectWorkAreaNumber( pArea->uiArea ); @@ -7398,7 +7399,9 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo uiLen = 1; break; case 'C': - uiLen = HB_CDXMAXKEY( hb_itemGetCLen( pResult ) ); + uiLen = hb_itemGetCLen( pResult ); + if( uiLen > CDX_MAXKEY ) + uiLen = CDX_MAXKEY; break; default: bType = 'U'; @@ -7406,6 +7409,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo } hb_itemRelease( pResult ); + /* Make sure KEY has proper type and iLen is not 0 */ if ( bType == 'U' || uiLen == 0 ) { hb_vmDestroyBlockOrMacro( pKeyExp ); @@ -7426,10 +7430,10 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo if ( pArea->lpdbOrdCondInfo->itmCobFor ) /* If we have a codeblock for the conditional expression, use it */ pForExp = hb_itemNew( pArea->lpdbOrdCondInfo->itmCobFor ); - else if ( pArea->lpdbOrdCondInfo->abFor ) + else if ( szFor ) { /* Otherwise, try compiling the conditional expression string */ - if ( SELF_COMPILE( (AREAP) pArea, pArea->lpdbOrdCondInfo->abFor ) == FAILURE ) + if ( SELF_COMPILE( (AREAP) pArea, ( BYTE * ) szFor ) == FAILURE ) { hb_vmDestroyBlockOrMacro( pKeyExp ); SELF_GOTO( ( AREAP ) pArea, ulRecNo ); @@ -7471,7 +7475,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo * The following scheme implemented: * 1. abBagName == NULL -> add the Tag to the structural index * 2. atomBagName == NULL -> overwrite any index file of abBagName - * 3. ads the Tag to index file + * 3. add the Tag to index file */ hb_cdxCreateFName( pArea, ( char * ) pOrderInfo->abBagName, @@ -7541,8 +7545,8 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo if ( !fNewFile ) fNewFile = ( hb_fsSeekLarge( hFile, 0, FS_END ) == 0 ); } - - } while ( bRetry ); + } + while ( bRetry ); if ( hFile != FS_ERROR ) { diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index 1fa6d4ed3d..2bc9c64e32 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -5983,7 +5983,7 @@ static ERRCODE ntxClose( NTXAREAP pArea ) static ERRCODE ntxStructSize( NTXAREAP pArea, USHORT * uiSize ) { - HB_TRACE(HB_TR_DEBUG, ("ntxStrucSize(%p, %p)", pArea, uiSize)); + HB_TRACE(HB_TR_DEBUG, ("ntxStructSize(%p, %p)", pArea, uiSize)); HB_SYMBOL_UNUSED( pArea ); * uiSize = sizeof( NTXAREA ); @@ -6293,7 +6293,8 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) if( fOld ) fOld = ( hb_fsSeekLarge( hFile, 0, FS_END ) != 0 ); } - } while( bRetry ); + } + while( bRetry ); if( hFile == FS_ERROR ) { @@ -6354,6 +6355,8 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) if( ! iTag && pIndex->iTags == CTX_MAX_TAGS ) { + if( fLocked ) + hb_ntxIndexUnLockWrite( pIndex ); hb_vmDestroyBlockOrMacro( pKeyExp ); if( pForExp != NULL ) hb_vmDestroyBlockOrMacro( pForExp ); @@ -7465,7 +7468,7 @@ static ERRCODE ntxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ HB_TRACE(HB_TR_DEBUG, ("ntxRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem)); - pData = ( LPDBFDATA ) pRDD->lpvCargo; + pData = NTXNODE_DATA( pRDD ); switch( uiIndex ) { @@ -7494,9 +7497,9 @@ static ERRCODE ntxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ #if defined( HB_NTX_NOMULTITAG ) hb_itemPutL( pItem, FALSE ); #else - BOOL fMultiTag = NTXNODE_DATA( pRDD )->fMultiTag; + BOOL fMultiTag = pData->fMultiTag; if( hb_itemType( pItem ) == HB_IT_LOGICAL ) - NTXNODE_DATA( pRDD )->fMultiTag = hb_itemGetL( pItem ); + pData->fMultiTag = hb_itemGetL( pItem ); hb_itemPutL( pItem, fMultiTag ); #endif break; @@ -7504,36 +7507,36 @@ static ERRCODE ntxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ case RDDI_SORTRECNO: { - BOOL fSortRecNo = NTXNODE_DATA( pRDD )->fSortRecNo; + BOOL fSortRecNo = pData->fSortRecNo; if( hb_itemType( pItem ) == HB_IT_LOGICAL ) - NTXNODE_DATA( pRDD )->fSortRecNo = hb_itemGetL( pItem ); + pData->fSortRecNo = hb_itemGetL( pItem ); hb_itemPutL( pItem, fSortRecNo ); break; } case RDDI_STRUCTORD: { - BOOL fStruct = NTXNODE_DATA( pRDD )->fStruct; + BOOL fStruct = pData->fStruct; if( hb_itemType( pItem ) == HB_IT_LOGICAL ) - NTXNODE_DATA( pRDD )->fStruct = hb_itemGetL( pItem ); + pData->fStruct = hb_itemGetL( pItem ); hb_itemPutL( pItem, fStruct ); break; } case RDDI_STRICTSTRUCT: { - BOOL fStrictStruct = NTXNODE_DATA( pRDD )->fStrictStruct; + BOOL fStrictStruct = pData->fStrictStruct; if( hb_itemType( pItem ) == HB_IT_LOGICAL ) - NTXNODE_DATA( pRDD )->fStrictStruct = hb_itemGetL( pItem ); + pData->fStrictStruct = hb_itemGetL( pItem ); hb_itemPutL( pItem, fStrictStruct ); break; } case RDDI_MULTIKEY: { - BOOL fMultiKey = NTXNODE_DATA( pRDD )->fMultiKey; + BOOL fMultiKey = pData->fMultiKey; if( hb_itemType( pItem ) == HB_IT_LOGICAL ) - NTXNODE_DATA( pRDD )->fMultiKey = hb_itemGetL( pItem ); + pData->fMultiKey = hb_itemGetL( pItem ); hb_itemPutL( pItem, fMultiKey ); break; }