diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 70bc5ec520..45d3e00190 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-31 21:22 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/gtwvg/gtwvg.c + * contrib/gtwvg/wvggui.c + * contrib/hbmemio/memio.c + * contrib/hbnetio/netiocli.c + * src/rtl/gtwvt/gtwvt.c + * do not end macros with ';' to avoid uncrustify warning + and wrong formatting as a consequence + ; QUESTION: There is conditional macros having the same + issue in hsx.c and gtxwc.c. Is the inactive branch + still or ever needed there or can it be deleted? + 2012-10-31 21:08 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/gtalleg/gtalleg.c + cleaned multiline macro to be more readable diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 19ee3e243a..e0cdebe539 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -105,8 +105,8 @@ static HB_GT_FUNCS SuperTable; #define HB_GTWVT_GET(p) ( ( PHB_GTWVT ) HB_GTLOCAL( p ) ) static HB_CRITICAL_NEW( s_wvtMtx ); -#define HB_WVT_LOCK hb_threadEnterCriticalSection( &s_wvtMtx ); -#define HB_WVT_UNLOCK hb_threadLeaveCriticalSection( &s_wvtMtx ); +#define HB_WVT_LOCK() hb_threadEnterCriticalSection( &s_wvtMtx ) +#define HB_WVT_UNLOCK() hb_threadLeaveCriticalSection( &s_wvtMtx ) #if ( ( defined( _MSC_VER ) && ( _MSC_VER <= 1200 || defined( HB_OS_WIN_CE ) ) ) || \ defined( __DMC__ ) ) && !defined( HB_ARCH_64BIT ) @@ -189,7 +189,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) int iCount = s_wvtCount, iPos = 0; PHB_GTWVT pWVT = NULL; - HB_WVT_LOCK + HB_WVT_LOCK(); while( iCount && iPos < WVT_MAX_WINDOWS ) { @@ -205,7 +205,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) ++iPos; } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return pWVT; } @@ -214,7 +214,7 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) { HB_BOOL fOK = HB_FALSE; - HB_WVT_LOCK + HB_WVT_LOCK(); if( s_wvtCount < WVT_MAX_WINDOWS ) { @@ -238,7 +238,7 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) while( iPos < WVT_MAX_WINDOWS ); } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return fOK; } @@ -247,7 +247,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) { int iIndex; - HB_WVT_LOCK + HB_WVT_LOCK(); s_wvtWindows[ pWVT->iHandle ] = NULL; if( --s_wvtCount == 0 ) { @@ -342,7 +342,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) hb_xfree( pWVT ); - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); } static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index c1b1a9b74f..0ddf42656a 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -92,8 +92,8 @@ static HB_GT_FUNCS SuperTable; #define HB_GTWVT_GET(p) ( ( PHB_GTWVT ) HB_GTLOCAL( p ) ) static HB_CRITICAL_NEW( s_wvtMtx ); -#define HB_WVT_LOCK hb_threadEnterCriticalSection( &s_wvtMtx ); -#define HB_WVT_UNLOCK hb_threadLeaveCriticalSection( &s_wvtMtx ); +#define HB_WVT_LOCK() hb_threadEnterCriticalSection( &s_wvtMtx ) +#define HB_WVT_UNLOCK() hb_threadLeaveCriticalSection( &s_wvtMtx ) static PHB_GTWVT s_wvtWindows[ WVT_MAX_WINDOWS ]; static int s_wvtCount = 0; @@ -144,7 +144,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) int iCount = s_wvtCount, iPos = 0; PHB_GTWVT pWVT = NULL; - HB_WVT_LOCK + HB_WVT_LOCK(); while( iCount && iPos < WVT_MAX_WINDOWS ) { @@ -160,7 +160,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) ++iPos; } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return pWVT; } @@ -169,7 +169,7 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) { HB_BOOL fOK = HB_FALSE; - HB_WVT_LOCK + HB_WVT_LOCK(); if( s_wvtCount < WVT_MAX_WINDOWS ) { @@ -190,14 +190,14 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) while( iPos < WVT_MAX_WINDOWS ); } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return fOK; } static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) { - HB_WVT_LOCK + HB_WVT_LOCK(); s_wvtWindows[ pWVT->iHandle ] = NULL; @@ -207,7 +207,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) UnregisterClass( s_szClassName, pWVT->hInstance ); } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); if( pWVT->hWindowTitle ) hb_strfree( pWVT->hWindowTitle ); diff --git a/harbour/contrib/hbmemio/memio.c b/harbour/contrib/hbmemio/memio.c index 808e69fed7..0b2188cfe5 100644 --- a/harbour/contrib/hbmemio/memio.c +++ b/harbour/contrib/hbmemio/memio.c @@ -125,8 +125,8 @@ static HB_ERRCODE s_error; static HB_CRITICAL_NEW( s_mtx ); -#define HB_MEMFSMT_LOCK hb_threadEnterCriticalSection( &s_mtx ); -#define HB_MEMFSMT_UNLOCK hb_threadLeaveCriticalSection( &s_mtx ); +#define HB_MEMFSMT_LOCK() hb_threadEnterCriticalSection( &s_mtx ) +#define HB_MEMFSMT_UNLOCK() hb_threadLeaveCriticalSection( &s_mtx ) static void memfsInodeFree( PHB_MEMFS_INODE pInode ); @@ -308,9 +308,9 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsFileExists( const char * szName ) { HB_BOOL bRet; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); bRet = memfsInodeFind( szName, NULL ) != 0; - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return bRet; } @@ -320,10 +320,10 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsDelete( const char * szName ) PHB_MEMFS_INODE pInode; HB_ULONG ulFile; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); if( ( ulFile = memfsInodeFind( szName, NULL ) ) == 0 ) { - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return HB_FALSE; } pInode = s_fs.pInodes[ ulFile - 1 ]; @@ -335,7 +335,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsDelete( const char * szName ) if( --pInode->uiCount == 0 ) memfsInodeFree( pInode ); - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return HB_TRUE; } @@ -344,22 +344,22 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsRename( const char * szName, const char * szNewN { HB_ULONG ulInode; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); if( ( ulInode = memfsInodeFind( szName, NULL ) ) == 0 ) { - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); /* File not found */ return HB_FALSE; } if( memfsInodeFind( szNewName, NULL ) ) { - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); /* File already exists */ return HB_FALSE; } hb_xfree( s_fs.pInodes[ ulInode - 1 ]->szName ); s_fs.pInodes[ ulInode - 1 ]->szName = hb_strdup( szNewName ); - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return HB_TRUE; } @@ -382,7 +382,7 @@ HB_MEMFS_EXPORT HB_FHANDLE hb_memfsOpen( const char * szName, HB_USHORT uiFlags ( ( uiFlags & 0xf0 ) == FO_DENYWRITE ? FOX_DENYWRITE : ( ( uiFlags & 0xf0 ) == FO_DENYREAD ? FOX_DENYREAD : FOX_DENYNONE ) ) ); - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); ulInode = memfsInodeFind( szName, NULL ); @@ -443,7 +443,7 @@ HB_MEMFS_EXPORT HB_FHANDLE hb_memfsOpen( const char * szName, HB_USHORT uiFlags if( !pFile ) { - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return FS_ERROR; } pFile->pInode->uiDeny |= uiFlags & FOX_DENYFLAGS; @@ -454,7 +454,7 @@ HB_MEMFS_EXPORT HB_FHANDLE hb_memfsOpen( const char * szName, HB_USHORT uiFlags pFile->uiFlags = uiFlags; hFile = memfsHandleAlloc( pFile ); - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return hFile; } @@ -464,10 +464,10 @@ HB_MEMFS_EXPORT void hb_memfsClose( HB_FHANDLE hFile ) PHB_MEMFS_FILE pFile; PHB_MEMFS_INODE pInode; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); if( ( pFile = memfsHandleToFile( hFile ) ) == NULL ) { - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return; /* invalid handle */ } s_fs.pFiles[ hFile - 1 ] = NULL; @@ -485,7 +485,7 @@ HB_MEMFS_EXPORT void hb_memfsClose( HB_FHANDLE hFile ) pInode->uiCountWrite--; pInode->uiDeny ^= pFile->uiFlags & FOX_DENYFLAGS; } - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); hb_xfree( pFile ); } @@ -506,14 +506,14 @@ HB_MEMFS_EXPORT HB_SIZE hb_memfsReadAt( HB_FHANDLE hFile, void * pBuff, HB_SIZE if( llOffset < 0 || pInode->llSize <= llOffset ) return 0; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); if( pInode->llSize >= llOffset + ( HB_FOFFSET ) nCount ) nRead = nCount; else nRead = ( HB_SIZE ) ( pInode->llSize - llOffset ); memcpy( pBuff, pInode->pData + ( HB_SIZE ) llOffset, nRead ); - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); pFile->llPos = llOffset + ( HB_FOFFSET ) nCount; return nRead; } @@ -534,7 +534,7 @@ HB_MEMFS_EXPORT HB_SIZE hb_memfsWriteAt( HB_FHANDLE hFile, const void * pBuff, H if( llOffset < 0 ) return 0; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); /* Reallocate if neccesary */ if( pInode->llAlloc < llOffset + ( HB_FOFFSET ) nCount ) @@ -553,7 +553,7 @@ HB_MEMFS_EXPORT HB_SIZE hb_memfsWriteAt( HB_FHANDLE hFile, const void * pBuff, H if( pInode->llSize < llOffset + ( HB_FOFFSET ) nCount ) pInode->llSize = llOffset + ( HB_FOFFSET ) nCount; - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); pFile->llPos = llOffset + ( HB_FOFFSET ) nCount; return nCount; } @@ -588,7 +588,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset ) if( llOffset < 0 ) return HB_FALSE; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); /* Reallocate if neccesary */ if( pInode->llAlloc < llOffset ) @@ -611,7 +611,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset ) memset( pInode->pData + ( HB_SIZE ) llOffset, 0, ( HB_SIZE ) ( pInode->llAlloc - llOffset ) ); pInode->llSize = llOffset; - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); return HB_TRUE; } @@ -626,7 +626,7 @@ HB_MEMFS_EXPORT HB_FOFFSET hb_memfsSeek( HB_FHANDLE hFile, HB_FOFFSET llOffset, return 0; /* invalid handle */ pInode = pFile->pInode; - HB_MEMFSMT_LOCK + HB_MEMFSMT_LOCK(); if( uiFlags & FS_END ) llPos = pInode->llSize + llOffset; else if( uiFlags & FS_RELATIVE ) @@ -640,7 +640,7 @@ HB_MEMFS_EXPORT HB_FOFFSET hb_memfsSeek( HB_FHANDLE hFile, HB_FOFFSET llOffset, if( llPos > pInode->llSize ) llPos = pInode->llSize; - HB_MEMFSMT_UNLOCK + HB_MEMFSMT_UNLOCK(); pFile->llPos = llPos; return llPos; } diff --git a/harbour/contrib/hbnetio/netiocli.c b/harbour/contrib/hbnetio/netiocli.c index 9472184960..819dedc4c5 100644 --- a/harbour/contrib/hbnetio/netiocli.c +++ b/harbour/contrib/hbnetio/netiocli.c @@ -150,8 +150,8 @@ typedef struct } HB_CONDATA, * PHB_CONDATA; /* MT macros */ -#define HB_NETIO_LOCK hb_threadEnterCriticalSection( &s_netioMtx ); -#define HB_NETIO_UNLOCK hb_threadLeaveCriticalSection( &s_netioMtx ); +#define HB_NETIO_LOCK() hb_threadEnterCriticalSection( &s_netioMtx ) +#define HB_NETIO_UNLOCK() hb_threadLeaveCriticalSection( &s_netioMtx ) static HB_CRITICAL_NEW( s_netioMtx ); static HB_TSD_NEW( s_conData, sizeof( HB_CONDATA ), NULL, NULL ); @@ -587,19 +587,19 @@ static void s_fileConRegister( PHB_CONCLI conn ) { PHB_CONCLI * connPtr; - HB_NETIO_LOCK + HB_NETIO_LOCK(); connPtr = &s_connections; while( *connPtr ) connPtr = &( *connPtr )->next; *connPtr = conn; - HB_NETIO_UNLOCK + HB_NETIO_UNLOCK(); } static void s_fileConClose( PHB_CONCLI conn ) { if( hb_atomic_dec( &conn->used ) ) { - HB_NETIO_LOCK + HB_NETIO_LOCK(); if( hb_atomic_get( &conn->used ) == 0 ) { PHB_CONCLI * connPtr = &s_connections; @@ -615,7 +615,7 @@ static void s_fileConClose( PHB_CONCLI conn ) } else conn = NULL; /* reused by other thread */ - HB_NETIO_UNLOCK + HB_NETIO_UNLOCK(); if( conn ) s_fileConFree( conn ); @@ -626,7 +626,7 @@ static PHB_CONCLI s_fileConFind( const char * pszServer, int iPort ) { PHB_CONCLI conn; - HB_NETIO_LOCK + HB_NETIO_LOCK(); conn = s_connections; while( conn ) { @@ -637,7 +637,7 @@ static PHB_CONCLI s_fileConFind( const char * pszServer, int iPort ) } conn = conn->next; } - HB_NETIO_UNLOCK + HB_NETIO_UNLOCK(); return conn; } @@ -646,7 +646,7 @@ static HB_BOOL s_fileUsrDisconnect( const char * pszServer, int iPort ) { PHB_CONCLI conn, connClose = NULL; - HB_NETIO_LOCK + HB_NETIO_LOCK(); conn = s_connections; while( conn ) { @@ -661,7 +661,7 @@ static HB_BOOL s_fileUsrDisconnect( const char * pszServer, int iPort ) } conn = conn->next; } - HB_NETIO_UNLOCK + HB_NETIO_UNLOCK(); if( connClose ) s_fileConClose( connClose ); @@ -902,7 +902,7 @@ static PHB_CONCLI s_fileConnect( const char ** pFilename, if( conn != NULL && s_defaultInit ) { - HB_NETIO_LOCK + HB_NETIO_LOCK(); if( s_defaultInit ) { hb_strncpy( s_defaultConn.server, pszIpAddres, @@ -916,7 +916,7 @@ static PHB_CONCLI s_fileConnect( const char ** pFilename, memcpy( s_defaultConn.passwd, pszPasswd, iPassLen ); s_defaultInit = HB_FALSE; } - HB_NETIO_UNLOCK + HB_NETIO_UNLOCK(); } hb_xfree( pszIpAddres ); diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index 95db6e892d..42f722e997 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -104,8 +104,8 @@ static HB_GT_FUNCS SuperTable; #define HB_GTWVT_GET(p) ( ( PHB_GTWVT ) HB_GTLOCAL( p ) ) static HB_CRITICAL_NEW( s_wvtMtx ); -#define HB_WVT_LOCK hb_threadEnterCriticalSection( &s_wvtMtx ); -#define HB_WVT_UNLOCK hb_threadLeaveCriticalSection( &s_wvtMtx ); +#define HB_WVT_LOCK() hb_threadEnterCriticalSection( &s_wvtMtx ) +#define HB_WVT_UNLOCK() hb_threadLeaveCriticalSection( &s_wvtMtx ) #if ( ( defined( _MSC_VER ) && ( _MSC_VER <= 1200 || defined( HB_OS_WIN_CE ) ) ) || \ @@ -183,7 +183,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) int iCount = s_wvtCount, iPos = 0; PHB_GTWVT pWVT = NULL; - HB_WVT_LOCK + HB_WVT_LOCK(); while( iCount && iPos < WVT_MAX_WINDOWS ) { @@ -199,7 +199,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) ++iPos; } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return pWVT; } @@ -208,7 +208,7 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) { HB_BOOL fOK = HB_FALSE; - HB_WVT_LOCK + HB_WVT_LOCK(); if( s_wvtCount < WVT_MAX_WINDOWS ) { @@ -229,14 +229,14 @@ static HB_BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) while( iPos < WVT_MAX_WINDOWS ); } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); return fOK; } static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) { - HB_WVT_LOCK + HB_WVT_LOCK(); s_wvtWindows[ pWVT->iHandle ] = NULL; @@ -246,7 +246,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) UnregisterClass( s_szClassName, pWVT->hInstance ); } - HB_WVT_UNLOCK + HB_WVT_UNLOCK(); if( pWVT->hSelectCopy ) hb_strfree( pWVT->hSelectCopy );