diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cef33dd997..9b2729353a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,12 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-21 13:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbrddcdx.h + * harbour/source/rdd/dbfcdx/dbfcdx1.c + + added support for numeric indexes which store keys as modified + 32bit big endian integer values - undocumented VFP hack. + 2009-04-21 12:35 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added support for ${hb_self} in .hbm files. diff --git a/harbour/include/hbrddcdx.h b/harbour/include/hbrddcdx.h index e3f4fdfff5..d0b770ee48 100644 --- a/harbour/include/hbrddcdx.h +++ b/harbour/include/hbrddcdx.h @@ -193,7 +193,8 @@ typedef struct _CDXTAGHEADER BYTE keySize [ 2 ]; /* key length */ BYTE indexOpt; /* index options see CDX_TYPE_* */ BYTE indexSig; /* index signature */ - BYTE reserved2[ 484 ]; + BYTE reserved2[ 478 ]; + BYTE codepage[ 6 ]; /* VFP codepage */ BYTE ignoreCase[ 2 ]; /* 1 = ignore case, key converted to upper */ BYTE ascendFlg[ 2 ]; /* 0 = ascending 1 = descending */ BYTE forExpPos[ 2 ]; /* offset of filter expression */ diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index 31ff0e849b..2f3e634d54 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -669,9 +669,18 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, ULONG ulRec, LP } break; case 'N': - d = hb_itemGetND( pItem ); - HB_DBL2ORD( &d, ptr ); - ulLen = 8; + if( pTag->uiLen == 4 ) + { + UINT32 uiVal = ( UINT32 ) hb_itemGetNI( pItem ) + 0x80000000; + HB_PUT_BE_UINT32( ptr, uiVal ); + ulLen = 4; + } + else + { + d = hb_itemGetND( pItem ); + HB_DBL2ORD( &d, ptr ); + ulLen = 8; + } break; case 'D': d = ( double ) hb_itemGetDL( pItem ); @@ -742,8 +751,16 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag, } break; case 'N': - HB_ORD2DBL( pKey->val, &d ); - pItem = hb_itemPutND( pItem, d ); + if( pKey->len == 4 ) + { + INT32 iVal = ( INT32 ) ( HB_GET_BE_UINT32( pKey->val ) ) - 0x80000000; + pItem = hb_itemPutNI( pItem, iVal ); + } + else + { + HB_ORD2DBL( pKey->val, &d ); + pItem = hb_itemPutND( pItem, d ); + } break; case 'D': HB_ORD2DBL( pKey->val, &d ); @@ -3663,7 +3680,7 @@ static void hb_cdxTagLoad( LPCDXTAG pTag ) SELF_GOTO( ( AREAP ) pTag->pIndex->pArea, ulRecNo ); if( pTag->uiLen > CDX_MAXKEY || pTag->uiType == 'U' || - ( pTag->uiType == 'N' && pTag->uiLen != 8 ) || + ( pTag->uiType == 'N' && pTag->uiLen != 8 && pTag->uiLen != 4 ) || ( pTag->uiType == 'D' && pTag->uiLen != 8 ) || ( pTag->uiType == 'T' && pTag->uiLen != 8 ) || ( pTag->uiType == 'L' && pTag->uiLen != 1 ) ) @@ -9592,9 +9609,18 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, BOOL fReindex ) case HB_IT_INTEGER: case HB_IT_LONG: case HB_IT_DOUBLE: - d = hb_itemGetND( pItem ); - HB_DBL2ORD( &d, &cTemp[0] ); - hb_cdxSortKeyAdd( pSort, pArea->ulRecNo, cTemp, 8 ); + if( pTag->uiLen == 4 ) + { + UINT32 uiVal = ( UINT32 ) hb_itemGetNI( pItem ) + 0x80000000; + HB_PUT_BE_UINT32( &cTemp[0], uiVal ); + hb_cdxSortKeyAdd( pSort, pArea->ulRecNo, cTemp, 4 ); + } + else + { + d = hb_itemGetND( pItem ); + HB_DBL2ORD( &d, &cTemp[0] ); + hb_cdxSortKeyAdd( pSort, pArea->ulRecNo, cTemp, 8 ); + } break; case HB_IT_DATE: