From cfea3f833351b8ee7a7467f92ba84bd87d5ec5ef Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 28 Nov 2009 09:38:11 +0000 Subject: [PATCH] 2009-11-28 10:37 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/filesys.c * src/rtl/fssize.c * src/rdd/dbfcdx/dbfcdx1.c * contrib/hbtip/utils.c * contrib/hbwin/win_prn1.c * contrib/hbbmcdx/bmdbfcdx.c * contrib/hbbtree/hb_btree.c ! Fixed to use Harbour FS_* constants in hb_fsSeek*() calls (instead of SEEK_* ones). --- harbour/ChangeLog | 11 +++++++++++ harbour/contrib/hbbmcdx/bmdbfcdx.c | 2 +- harbour/contrib/hbbtree/hb_btree.c | 12 ++++++------ harbour/contrib/hbtip/utils.c | 6 +++--- harbour/contrib/hbwin/win_prn1.c | 4 ++-- harbour/src/rdd/dbfcdx/dbfcdx1.c | 2 +- harbour/src/rtl/filesys.c | 6 +++--- harbour/src/rtl/fssize.c | 2 +- 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d5d7bd1e02..82f80a2348 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-28 10:37 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/filesys.c + * src/rtl/fssize.c + * src/rdd/dbfcdx/dbfcdx1.c + * contrib/hbtip/utils.c + * contrib/hbwin/win_prn1.c + * contrib/hbbmcdx/bmdbfcdx.c + * contrib/hbbtree/hb_btree.c + ! Fixed to use Harbour FS_* constants in hb_fsSeek*() calls + (instead of SEEK_* ones). + 2009-11-28 04:02 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/fm.c * minor formatting diff --git a/harbour/contrib/hbbmcdx/bmdbfcdx.c b/harbour/contrib/hbbmcdx/bmdbfcdx.c index 411805ed42..f77d304cf0 100644 --- a/harbour/contrib/hbbmcdx/bmdbfcdx.c +++ b/harbour/contrib/hbbmcdx/bmdbfcdx.c @@ -9701,7 +9701,7 @@ static void hb_cdxSortGetPageKey( LPCDXSORTINFO pSort, ULONG ulPage, ULONG ulKeys = HB_MIN( pSort->ulPgKeys, pSort->pSwapPage[ ulPage ].ulKeys ); ULONG ulSize = ulKeys * ( iLen + 4 ); - if( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, SEEK_SET ) != pSort->pSwapPage[ ulPage ].nOffset || + if( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, FS_SET ) != pSort->pSwapPage[ ulPage ].nOffset || hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, ulSize ) != ulSize ) { hb_errInternal( 9303, "hb_cdxSortGetPageKey: Read error from temporary file.", NULL, NULL ); diff --git a/harbour/contrib/hbbtree/hb_btree.c b/harbour/contrib/hbbtree/hb_btree.c index dd9d9407a3..d288ae80f4 100644 --- a/harbour/contrib/hbbtree/hb_btree.c +++ b/harbour/contrib/hbbtree/hb_btree.c @@ -441,7 +441,7 @@ static void ioBufferAlloc( struct hb_BTree * pBTree, ULONG ulBuffers ) static void ioBufferWrite( struct hb_BTree * pBTree, ioBuffer_T *thisptr ) { - hb_fsSeek( pBTree->hFile, thisptr->ulPage, SEEK_SET ); + hb_fsSeek( pBTree->hFile, thisptr->ulPage, FS_SET ); if ( hb_fsWrite( pBTree->hFile, thisptr->Buffer, pBTree->usPageSize ) != pBTree->usPageSize ) { hb_RaiseError( HB_BTree_WriteError_EC, "write error", "ioBufferWrite*", 0 ); @@ -459,7 +459,7 @@ static void ioBufferRead( struct hb_BTree * pBTree, ULONG ulNode ) thisptr->IsDirty = FALSE; } thisptr->ulPage = ulNode; - hb_fsSeek( pBTree->hFile, thisptr->ulPage, SEEK_SET ); + hb_fsSeek( pBTree->hFile, thisptr->ulPage, FS_SET ); hb_fsRead( pBTree->hFile, thisptr->Buffer, pBTree->usPageSize ); } @@ -705,7 +705,7 @@ static void HeaderWrite( struct hb_BTree * pBTree ) /* TODO: store this to a temp buffer and write the buffer */ /* TODO: write this info in a non-endian method */ - hb_fsSeek( pBTree->hFile, 0, SEEK_SET ); + hb_fsSeek( pBTree->hFile, 0, FS_SET ); if ( hb_fsWrite( pBTree->hFile, HEADER_ID, sizeof( HEADER_ID ) ) + hb_fsWrite( pBTree->hFile, ( const BYTE * )&pBTree->ulFreePage, sizeof( pBTree->ulFreePage ) ) + /* 4 bytes */ @@ -750,7 +750,7 @@ static ULONG Grow( struct hb_BTree * pBTree ) { BYTE *buffer = pBTree->ioBuffer->Buffer; - pBTree->ioBuffer->ulPage = hb_fsSeek( pBTree->hFile, 0, SEEK_END ); + pBTree->ioBuffer->ulPage = hb_fsSeek( pBTree->hFile, 0, FS_END ); hb_xmemset( buffer, '\0', pBTree->usPageSize ); if ( pBTree->usPageSize != hb_fsWrite( pBTree->hFile, buffer, pBTree->usPageSize ) ) { @@ -759,7 +759,7 @@ static ULONG Grow( struct hb_BTree * pBTree ) } else { - pBTree->ioBuffer->ulPage = hb_fsSeek( pBTree->hFile, pBTree->ulFreePage, SEEK_SET ); + pBTree->ioBuffer->ulPage = hb_fsSeek( pBTree->hFile, pBTree->ulFreePage, FS_SET ); hb_fsRead( pBTree->hFile, ( BYTE * )&pBTree->ulFreePage, sizeof( pBTree->ulFreePage ) ); } pBTree->ioBuffer->IsDirty = TRUE; @@ -790,7 +790,7 @@ static void Prune( struct hb_BTree * pBTree, ULONG ulNode ) } else { - hb_fsSeek( pBTree->hFile, ulNode, SEEK_SET ); + hb_fsSeek( pBTree->hFile, ulNode, FS_SET ); if ( hb_fsWrite( pBTree->hFile, ( const BYTE * )&pBTree->ulFreePage, sizeof( pBTree->ulFreePage ) ) != sizeof( pBTree->ulFreePage ) ) { hb_RaiseError( HB_BTree_WriteError_EC, "write error", "Prune*", 0 ); diff --git a/harbour/contrib/hbtip/utils.c b/harbour/contrib/hbtip/utils.c index e096189b7a..0b45bae7f0 100644 --- a/harbour/contrib/hbtip/utils.c +++ b/harbour/contrib/hbtip/utils.c @@ -478,13 +478,13 @@ static const char * s_findFileMimeType( HB_FHANDLE fileIn ) int iLen; ULONG ulPos; - ulPos = hb_fsSeek( fileIn, 0, SEEK_CUR ); - hb_fsSeek( fileIn, 0, SEEK_SET ); + ulPos = hb_fsSeek( fileIn, 0, FS_RELATIVE ); + hb_fsSeek( fileIn, 0, FS_SET ); iLen = hb_fsRead( fileIn, buf, sizeof( buf ) ); if( iLen > 0 ) { - hb_fsSeek( fileIn, ulPos, SEEK_SET ); + hb_fsSeek( fileIn, ulPos, FS_SET ); return s_findStringMimeType( buf, iLen ); } diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index e32799c21e..a23afb6f6c 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -539,13 +539,13 @@ HB_FUNC( WIN_LOADBITMAPFILE ) if( fhnd != FS_ERROR ) { - ULONG ulSize = hb_fsSeek( fhnd, 0, SEEK_END ); + ULONG ulSize = hb_fsSeek( fhnd, 0, FS_END ); if( ulSize > 2 && ulSize <= ( 32 * 1024 * 1024 ) ) { BITMAPFILEHEADER * pbmfh = ( BITMAPFILEHEADER * ) hb_xgrab( ulSize ); - hb_fsSeek( fhnd, 0, SEEK_SET ); + hb_fsSeek( fhnd, 0, FS_SET ); if( hb_fsReadLarge( fhnd, pbmfh, ulSize ) == ulSize && pbmfh->bfType == *( WORD * ) "BM" ) hb_retclen( ( char * ) pbmfh, ( HB_SIZE ) ulSize ); diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index a130164443..ea0193e2aa 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -8919,7 +8919,7 @@ static void hb_cdxSortGetPageKey( LPCDXSORTINFO pSort, ULONG ulPage, ULONG ulKeys = HB_MIN( pSort->ulPgKeys, pSort->pSwapPage[ ulPage ].ulKeys ); ULONG ulSize = ulKeys * ( iLen + 4 ); - if( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, SEEK_SET ) != pSort->pSwapPage[ ulPage ].nOffset || + if( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, FS_SET ) != pSort->pSwapPage[ ulPage ].nOffset || hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, ulSize ) != ulSize ) { hb_errInternal( 9303, "hb_cdxSortGetPageKey: Read error from temporary file.", NULL, NULL ); diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index dd6f37ca00..8e115f19d5 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -3195,11 +3195,11 @@ BOOL hb_fsEof( HB_FHANDLE hFileHandle ) HB_FOFFSET endPos; HB_FOFFSET newPos; - curPos = hb_fsSeekLarge( hFileHandle, 0L, SEEK_CUR ); + curPos = hb_fsSeekLarge( hFileHandle, 0L, FS_RELATIVE ); if( curPos != -1 ) { - endPos = hb_fsSeekLarge( hFileHandle, 0L, SEEK_END ); - newPos = hb_fsSeekLarge( hFileHandle, curPos, SEEK_SET ); + endPos = hb_fsSeekLarge( hFileHandle, 0L, FS_END ); + newPos = hb_fsSeekLarge( hFileHandle, curPos, FS_SET ); fResult = ( endPos != -1 && newPos == curPos ); } else diff --git a/harbour/src/rtl/fssize.c b/harbour/src/rtl/fssize.c index 5332463bbd..c45708e447 100644 --- a/harbour/src/rtl/fssize.c +++ b/harbour/src/rtl/fssize.c @@ -134,7 +134,7 @@ HB_FOFFSET hb_fsFSize( const char * pszFileName, BOOL bUseDirEntry ) { HB_FOFFSET ulPos; - ulPos = hb_fsSeekLarge( hFileHandle, 0, SEEK_END ); + ulPos = hb_fsSeekLarge( hFileHandle, 0, FS_END ); hb_fsClose( hFileHandle ); return ulPos; }