From b9475c32c2301968e846972f386fdbc6a9589f16 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Fri, 25 Jan 2002 18:36:19 +0000 Subject: [PATCH] 2002-01-25 21:35 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 4 ++++ harbour/source/rdd/dbfntx/dbfntx1.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 27dca35057..a56bc0c103 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -7,6 +7,10 @@ For example: 2002-12-01 23:12 UTC+0100 Foo Bar */ + + Based on an original idea from Ron Pinkas. Some little portions + are borrowed from xHarbour. + 2002-01-26 13:03 UTC+0100 Patrick Mast * Changed enttry in Changelog 2002-01-25 22:30 from Alexander to Luiz diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index 29fcd503d4..47b64d48a8 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -1659,7 +1659,7 @@ static void hb_ntxRootPage( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTITEM static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTITEM* ppKey, LPSORTITEM pKeyRoot ) { - BYTE *key1, *key2; + char *key1, *key2; short int nPage, iPage; USHORT itemLength = sizeof( ULONG ) + pTag->KeyLength; LPSORTITEM pKey = *ppKey; @@ -1678,14 +1678,14 @@ static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTI { key2 = ( (LPPAGEITEM) ( pSwapPage->page + itemLength*pSwapPage->curkey ) )->key; - if( !key1 || memcmp( key1,key2,pTag->KeyLength ) > 0 ) + if( !key1 || memcmp( (BYTE*)key1,(BYTE*)key2,pTag->KeyLength ) > 0 ) { nPage = iPage; key1 = key2; } } } - if( ( pKey && !key1 ) || ( pKey && memcmp( key1,pKey->key,pTag->KeyLength ) > 0 ) ) + if( ( pKey && !key1 ) || ( pKey && memcmp( (BYTE*)key1,(BYTE*)pKey->key,pTag->KeyLength ) > 0 ) ) { pKeyRoot->rec_no = pKey->rec_no; memcpy( pKeyRoot->key, pKey->key, pTag->KeyLength ); @@ -1711,7 +1711,7 @@ static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTI { hb_fsSeek( pSortInfo->tempHandle, pSwapPage->offset + pageItemLength*pSwapPage->numReadkeys , SEEK_SET ); - nRead = hb_fsRead( pSortInfo->tempHandle, pSwapPage->page, + nRead = hb_fsRead( pSortInfo->tempHandle, (BYTE*)pSwapPage->page, ( (pSwapPage->numAllkeys-pSwapPage->numReadkeys < maxKeys)? pSwapPage->numAllkeys-pSwapPage->numReadkeys:maxKeys ) * pageItemLength ); pSwapPage->numkeys = nRead/pageItemLength; @@ -1769,7 +1769,7 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo ) { pSwapPage = (LPSWAPPAGE) ( pSortInfo->swappages + sizeof(SWAPPAGE)*i ); hb_fsSeek( pSortInfo->tempHandle, pSwapPage->offset, SEEK_SET ); - nRead = hb_fsRead( pSortInfo->tempHandle, pSwapPage->page, + nRead = hb_fsRead( pSortInfo->tempHandle, (BYTE*)pSwapPage->page, ( (pSwapPage->numAllkeys-pSwapPage->numReadkeys < maxKeysSwapPage)? pSwapPage->numAllkeys-pSwapPage->numReadkeys:maxKeysSwapPage ) * pageItemLength ); pSwapPage->numkeys = nRead/pageItemLength; @@ -1995,7 +1995,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) while( --nAttemptLeft ) { tmpnam( pszTempName ); - sortInfo.tempHandle = hb_fsCreate( pszTempName,FC_NORMAL ); + sortInfo.tempHandle = hb_fsCreate( (BYTE*)pszTempName,FC_NORMAL ); if( sortInfo.tempHandle != FS_ERROR ) break; }