From cb9a4d5af85271d37190946d5ee82e25a5088488 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 8 Jan 2011 02:27:54 +0000 Subject: [PATCH] 2011-01-08 03:27 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/filesys.c + added new macros HB_WIN_IOREAD_LIMIT and HB_WIN_IOWRITE_LIMIT They are used to define maximal size of single IO read and write operations. In Win64 builds they are set by defauly to HB_U32_MAX. It's possible to rebuild Harbour with above macros setting some smaller limits. --- harbour/ChangeLog | 8 ++++++++ harbour/src/rtl/filesys.c | 32 ++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 531ca4fb55..3ea3c1012a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-08 03:27 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/filesys.c + + added new macros HB_WIN_IOREAD_LIMIT and HB_WIN_IOWRITE_LIMIT + They are used to define maximal size of single IO read and + write operations. In Win64 builds they are set by defauly + to HB_U32_MAX. It's possible to rebuild Harbour with above + macros setting some smaller limits. + 2011-01-07 16:41 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + contrib/hbide/format.ui + Added: dock-widget populated .ui to manage code formatting. diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index e6042325e0..3df504841f 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -195,6 +195,14 @@ #if !defined( INVALID_FILE_ATTRIBUTES ) #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) -1 ) #endif + #if defined( HB_OS_WIN_64 ) + #if !defined( HB_WIN_IOREAD_LIMIT ) + #define HB_WIN_IOREAD_LIMIT HB_U32_MAX + #endif + #if !defined( HB_WIN_IOWRITE_LIMIT ) + #define HB_WIN_IOWRITE_LIMIT HB_U32_MAX + #endif + #endif #endif #if defined( HB_USE_SHARELOCKS ) && defined( HB_USE_BSDLOCKS ) #include @@ -1510,7 +1518,7 @@ HB_SIZE hb_fsReadLarge( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount ) #if defined( HB_OS_WIN ) { -# if defined( HB_OS_WIN_64 ) +# if defined( HB_WIN_IOREAD_LIMIT ) HANDLE hWFileHandle = DosToWinHandle( hFileHandle ); BOOL bResult = TRUE; @@ -1522,9 +1530,9 @@ HB_SIZE hb_fsReadLarge( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount ) DWORD dwRead; /* Determine how much to read this time */ - if( nCount > ( HB_SIZE ) HB_U32_MAX ) + if( nCount > ( HB_SIZE ) HB_WIN_IOREAD_LIMIT ) { - dwToRead = HB_U32_MAX; + dwToRead = HB_WIN_IOREAD_LIMIT; nCount -= ( HB_SIZE ) dwToRead; } else @@ -1612,7 +1620,7 @@ HB_SIZE hb_fsWriteLarge( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCo if( nCount ) { -# if defined( HB_OS_WIN_64 ) +# if defined( HB_WIN_IOWRITE_LIMIT ) HANDLE hWFileHandle = DosToWinHandle( hFileHandle ); BOOL bResult = TRUE; @@ -1622,9 +1630,9 @@ HB_SIZE hb_fsWriteLarge( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCo DWORD dwWritten; /* Determine how much to write this time */ - if( nCount > ( HB_SIZE ) HB_U32_MAX ) + if( nCount > ( HB_SIZE ) HB_WIN_IOWRITE_LIMIT ) { - dwToWrite = HB_U32_MAX; + dwToWrite = HB_WIN_IOWRITE_LIMIT; nCount -= ( HB_SIZE ) dwToWrite; } else @@ -1732,7 +1740,7 @@ HB_SIZE hb_fsReadAt( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FO #else nRead = 0; # if defined( HB_OS_WIN ) -# if defined( HB_OS_WIN_64 ) +# if defined( HB_WIN_IOREAD_LIMIT ) { HANDLE hWFileHandle = DosToWinHandle( hFileHandle ); OVERLAPPED Overlapped; @@ -1747,9 +1755,9 @@ HB_SIZE hb_fsReadAt( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FO DWORD dwToRead; DWORD dwRead; - if( nCount > ( HB_SIZE ) HB_U32_MAX ) + if( nCount > ( HB_SIZE ) HB_WIN_IOREAD_LIMIT ) { - dwToRead = HB_U32_MAX; + dwToRead = HB_WIN_IOREAD_LIMIT; nCount -= ( HB_SIZE ) dwToRead; } else @@ -1863,7 +1871,7 @@ HB_SIZE hb_fsWriteAt( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCount #else nWritten = 0; # if defined( HB_OS_WIN ) -# if defined( HB_OS_WIN_64 ) +# if defined( HB_WIN_IOWRITE_LIMIT ) { HANDLE hWFileHandle = DosToWinHandle( hFileHandle ); OVERLAPPED Overlapped; @@ -1878,9 +1886,9 @@ HB_SIZE hb_fsWriteAt( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCount DWORD dwToWrite; DWORD dwWritten; - if( nCount > ( HB_SIZE ) HB_U32_MAX ) + if( nCount > ( HB_SIZE ) HB_WIN_IOWRITE_LIMIT ) { - dwToWrite = HB_U32_MAX; + dwToWrite = HB_WIN_IOWRITE_LIMIT; nCount -= ( HB_SIZE ) dwToWrite; } else