From 7aa6a7611b835c143adfabd1f0dc03e47a7984f0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 8 Feb 2010 23:17:09 +0000 Subject: [PATCH] 2010-02-09 00:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/pp/pplib.c * src/common/hbprintf.c * src/rtl/gtclip.c * src/rdd/dbfntx/dbfntx1.c * src/rdd/dbfnsx/dbfnsx1.c * src/rdd/dbfcdx/dbfcdx1.c * src/rdd/dbffpt/dbffpt1.c * src/compiler/hbpcode.c * include/hbgtcore.h * contrib/hbbmcdx/bmdbfcdx.c * contrib/hbbtree/hb_btree.h * contrib/hbbtree/hb_btree.c ! Fixed remaining type conversion problems after doing live testing on win/bcc. Please test it on other platforms. * config/rules.mk + Enabled HB_LEGACY_TYPES_OFF on default Harbour builds. This is required to keep new type usage enforced. --- harbour/ChangeLog | 26 ++++++++++++++++++++++++-- harbour/config/rules.mk | 2 ++ harbour/contrib/hbbmcdx/bmdbfcdx.c | 4 ++-- harbour/contrib/hbbtree/hb_btree.c | 18 +++++++++--------- harbour/contrib/hbbtree/hb_btree.h | 8 ++++---- harbour/include/hbgtcore.h | 4 ++-- harbour/src/common/hbprintf.c | 4 ++-- harbour/src/compiler/hbpcode.c | 2 +- harbour/src/pp/pplib.c | 6 +++--- harbour/src/rdd/dbfcdx/dbfcdx1.c | 4 ++-- harbour/src/rdd/dbffpt/dbffpt1.c | 6 +++--- harbour/src/rdd/dbfnsx/dbfnsx1.c | 4 ++-- harbour/src/rdd/dbfntx/dbfntx1.c | 4 ++-- harbour/src/rtl/gtclip.c | 8 ++++---- 14 files changed, 62 insertions(+), 38 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aeff3bb488..32610224f0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,28 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-09 00:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/pp/pplib.c + * src/common/hbprintf.c + * src/rtl/gtclip.c + * src/rdd/dbfntx/dbfntx1.c + * src/rdd/dbfnsx/dbfnsx1.c + * src/rdd/dbfcdx/dbfcdx1.c + * src/rdd/dbffpt/dbffpt1.c + * src/compiler/hbpcode.c + * include/hbgtcore.h + * contrib/hbbmcdx/bmdbfcdx.c + * contrib/hbbtree/hb_btree.h + * contrib/hbbtree/hb_btree.c + ! Fixed remaining type conversion problems after doing + live testing on win/bcc. + Please test it on other platforms. + + * config/rules.mk + + Enabled HB_LEGACY_TYPES_OFF on default Harbour + builds. This is required to keep new type usage + enforced. + 2010-02-08 23:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwin/gtwin.c * include/hbrddcdx.h @@ -205,8 +227,8 @@ ; TODO: - Verify with grep script [DONE] - - Verify with HB_USER_CFLAGS=-DHB_LEGACY_TYPES_OFF - - Make HB_LEGACY_TYPES_OFF default for Harbour builds. + - Verify with HB_USER_CFLAGS=-DHB_LEGACY_TYPES_OFF [DONE] + - Make HB_LEGACY_TYPES_OFF default for Harbour builds. [DONE] - Tie HB_LEGACY_TYPES_OFF to HB_LEGACY_LEVEL3 - Replace current windows.h inclusion hack with regular method - Delete hacks dealing with former type chaos: diff --git a/harbour/config/rules.mk b/harbour/config/rules.mk index d51c1efb84..414270c846 100644 --- a/harbour/config/rules.mk +++ b/harbour/config/rules.mk @@ -16,6 +16,8 @@ ifeq ($(HB_BUILD_UNICODE),yes) HB_CFLAGS := -DUNICODE $(HB_CFLAGS) endif +HB_CFLAGS := -DHB_LEGACY_TYPES_OFF $(HB_CFLAGS) + ifeq ($(HB_DYN_COPT),) OBJ_DYN_POSTFIX := else diff --git a/harbour/contrib/hbbmcdx/bmdbfcdx.c b/harbour/contrib/hbbmcdx/bmdbfcdx.c index 2d3dca84d7..7989ec5541 100644 --- a/harbour/contrib/hbbmcdx/bmdbfcdx.c +++ b/harbour/contrib/hbbmcdx/bmdbfcdx.c @@ -1516,7 +1516,7 @@ static HB_BOOL hb_cdxIndexUnLockWrite( LPCDXINDEX pIndex ) pIndex->fFlush = HB_TRUE; pIndex->fChanged = HB_FALSE; } - hb_fileFlush( pIndex->pFile, TRUE ); + hb_fileFlush( pIndex->pFile, HB_TRUE ); #ifdef HB_CDX_DBGCODE if( ! pIndex->WrLck || pIndex->RdLck ) hb_errInternal( 9108, "hb_cdxIndexUnLockWrite: unlock error (*)", NULL, NULL ); @@ -1584,7 +1584,7 @@ static void hb_cdxIndexDiscardBuffers( LPCDXINDEX pIndex ) pTag->CurKey->rec = 0; pTag = pTag->pNext; } - hb_fileFlush( pIndex->pFile, FALSE ); + hb_fileFlush( pIndex->pFile, HB_FALSE ); } /* diff --git a/harbour/contrib/hbbtree/hb_btree.c b/harbour/contrib/hbbtree/hb_btree.c index aac888c9a6..aefaafc088 100644 --- a/harbour/contrib/hbbtree/hb_btree.c +++ b/harbour/contrib/hbbtree/hb_btree.c @@ -394,7 +394,7 @@ static void ioBufferScan( struct hb_BTree * pBTree, HB_ULONG page ) for ( thisptr = pBTree->ioBuffer; thisptr && !BTREENODEISNULL( pBTree, thisptr->xPage.ulPage ) && thisptr->xPage.ulPage != page && thisptr->next; thisptr = thisptr->next ) - ; + {}; /* only shuffle the buffers if the target buffer is not the root buffer */ if ( thisptr != pBTree->ioBuffer ) @@ -669,7 +669,7 @@ static void Prune( struct hb_BTree * pBTree, HB_ULONG ulNode ) HB_ULONG n; for ( thisptr = pBTree->ioBuffer; thisptr && thisptr->xPage.ulPage != ulNode; thisptr = thisptr->next ) - ; + {}; if ( thisptr->prev ) thisptr->prev->next = thisptr->next; if ( thisptr->next ) thisptr->next->prev = thisptr->prev; @@ -1207,7 +1207,7 @@ static void Successor( struct hb_BTree * pBTree, HB_ULONG ulNode, int iPosition for ( tmpnode = BranchGet( pBTree, ulNode, iPosition ); !BTREENODEISNULL( pBTree, BranchGet( pBTree, tmpnode, 0 ) ); tmpnode = BranchGet( pBTree, tmpnode, 0 ) ) - ; + {}; KeySet( pBTree, ulNode, iPosition, ( buffer = KeyGet( pBTree, tmpnode, 1, NULL ) ) ); BufferRelease( buffer ); } @@ -1362,7 +1362,7 @@ HB_BOOL hb_BTreeDelete( struct hb_BTree * pBTree, const char *target, HB_LONG lD } #if 0 else - ; /* error - key does not exist */ + {}; /* error - key does not exist */ #endif } else @@ -1382,7 +1382,7 @@ void hb_BTreeGoTop( struct hb_BTree * pBTree ) HB_ULONG ulLastNode; for ( ulLastNode = ulNode = pBTree->ulRootPage; !BTREENODEISNULL( pBTree, ulNode ); ulLastNode = ulNode, ulNode = BranchGet( pBTree, ulNode, 0 ) ) - ; + {}; if ( BTREENODEISNULL( pBTree, ulLastNode ) ) CLEARKEYDATA( pBTree ); @@ -1396,14 +1396,14 @@ void hb_BTreeGoBottom( struct hb_BTree * pBTree ) HB_ULONG ulLastNode; for ( ulLastNode = ulNode = pBTree->ulRootPage; !BTREENODEISNULL( pBTree, ulNode ); ulLastNode = ulNode, ulNode = BranchGet( pBTree, ulNode, CountGet( pBTree, ulNode ) ) ) - ; + {}; if ( BTREENODEISNULL( pBTree, ulLastNode ) ) CLEARKEYDATA( pBTree ); else KeyGet( pBTree, ulLastNode, CountGet( pBTree, ulLastNode ), pBTree->pThisKeyData ); } -LONG hb_BTreeSkip( struct hb_BTree * pBTree, HB_LONG records ) +HB_LONG hb_BTreeSkip( struct hb_BTree * pBTree, HB_LONG records ) { HB_LONG results = 0; int iPosition; @@ -1667,7 +1667,7 @@ const char * hb_BTreeKey( struct hb_BTree * pBTree ) return ( const char * )pBTree->pThisKeyData->szKey; } -LONG hb_BTreeData( struct hb_BTree * pBTree ) +HB_LONG hb_BTreeData( struct hb_BTree * pBTree ) { return pBTree->pThisKeyData->xData.lData; } @@ -1687,7 +1687,7 @@ static int BTree_SetTreeIndex( struct hb_BTree * pBTree ) return -1; for ( n = 0; n < s_BTree_List_Count && s_BTree_List[ n ] != NULL; n++ ) - ; + {}; if ( n == s_BTree_List_Count ) { diff --git a/harbour/contrib/hbbtree/hb_btree.h b/harbour/contrib/hbbtree/hb_btree.h index 5be88d680b..f01357683e 100644 --- a/harbour/contrib/hbbtree/hb_btree.h +++ b/harbour/contrib/hbbtree/hb_btree.h @@ -43,16 +43,16 @@ HB_EXTERN_BEGIN struct hb_BTree; struct hb_BTree * hb_BTreeNew( const char * FileName, HB_USHORT usPageSize, HB_USHORT usKeySize, HB_ULONG ulFlags, HB_ULONG ulBuffers ); -struct hb_BTree *hb_BTreeOpen( const char *FileName, HB_ULONG ulFlags, HB_ULONG ulBuffers ); +struct hb_BTree * hb_BTreeOpen( const char *FileName, HB_ULONG ulFlags, HB_ULONG ulBuffers ); void hb_BTreeClose( struct hb_BTree * pBTree ); HB_BOOL hb_BTreeInsert( struct hb_BTree * pBTree, const char * szKey, PHB_ITEM pData ); HB_BOOL hb_BTreeDelete( struct hb_BTree * pBTree, const char * szKey, HB_LONG lData ); void hb_BTreeGoTop( struct hb_BTree * pBTree ); void hb_BTreeGoBottom( struct hb_BTree * pBTree ); -HB_BOOL hb_BTreeSeek( struct hb_BTree * pBTree, const char *szKey, HB_LONG lData, HB_BOOL bSoftSeek ); -LONG hb_BTreeSkip( struct hb_BTree * pBTree, HB_LONG records ); +HB_BOOL hb_BTreeSeek( struct hb_BTree * pBTree, const char * szKey, HB_LONG lData, HB_BOOL bSoftSeek ); +HB_LONG hb_BTreeSkip( struct hb_BTree * pBTree, HB_LONG records ); const char * hb_BTreeKey( struct hb_BTree * pBTree ); -LONG hb_BTreeData( struct hb_BTree * pBTree ); +HB_LONG hb_BTreeData( struct hb_BTree * pBTree ); PHB_ITEM hb_BTreeDataItem( struct hb_BTree * pBTree ); HB_EXTERN_END diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index e4cf84512e..ecba82bf4a 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -598,8 +598,8 @@ extern int hb_gt_chrmapinit( int * piTransTbl, const char * pszTerm, HB_BOOL fS extern HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE ulLen ); extern HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE * pulLen ); #if defined( HB_OS_WIN ) -extern HB_BOOL hb_gt_winapi_setClipboard( UINT uFormat, const char * szClipData, HB_SIZE ulLen ); -extern HB_BOOL hb_gt_winapi_getClipboard( UINT uFormat, char ** pszClipData, HB_SIZE * pulLen ); +extern HB_BOOL hb_gt_winapi_setClipboard( HB_UINT uFormat, const char * szClipData, HB_SIZE ulLen ); +extern HB_BOOL hb_gt_winapi_getClipboard( HB_UINT uFormat, char ** pszClipData, HB_SIZE * pulLen ); extern int hb_gt_winapi_getKbdState( void ); extern void hb_gt_winapi_setKbdState( int kbdShifts ); extern void hb_gt_winapi_tone( double dFrequency, double dDuration ); diff --git a/harbour/src/common/hbprintf.c b/harbour/src/common/hbprintf.c index d802559185..2b9fc72ce7 100644 --- a/harbour/src/common/hbprintf.c +++ b/harbour/src/common/hbprintf.c @@ -176,8 +176,8 @@ optimized. # define _x_double int #endif #ifndef __NO_LONGLONG__ -# define _x_longlong LONGLONG -# define _x_ulonglong ULONGLONG +# define _x_longlong HB_LONGLONG +# define _x_ulonglong HB_ULONGLONG #else # define _x_longlong long # define _x_ulonglong unsigned long diff --git a/harbour/src/compiler/hbpcode.c b/harbour/src/compiler/hbpcode.c index a0fc58d619..6f7f1d800f 100644 --- a/harbour/src/compiler/hbpcode.c +++ b/harbour/src/compiler/hbpcode.c @@ -493,7 +493,7 @@ static HB_PCODE_FUNC_PTR s_psize_table[] = hb_p_threadstatics /* HB_P_THREADSTATICS */ }; -LONG hb_compPCodeSize( PFUNCTION pFunc, HB_ULONG ulOffset ) +HB_LONG hb_compPCodeSize( PFUNCTION pFunc, HB_ULONG ulOffset ) { HB_LONG lSize = 0; HB_BYTE opcode = pFunc->pCode[ ulOffset ]; diff --git a/harbour/src/pp/pplib.c b/harbour/src/pp/pplib.c index f2612539ab..29ef78f6bf 100644 --- a/harbour/src/pp/pplib.c +++ b/harbour/src/pp/pplib.c @@ -75,7 +75,7 @@ static void hb_pp_ErrorMessage( void * cargo, const char * szMsgTable[], PHB_ITEM pError; hb_snprintf( szMsgBuf, sizeof( szMsgBuf ), szMsgTable[ iCode - 1 ], szParam1, szParam2 ); - pError = hb_errRT_New( ES_ERROR, "PP", 1001, ( ULONG ) iCode, szMsgBuf, + pError = hb_errRT_New( ES_ERROR, "PP", 1001, ( HB_ULONG ) iCode, szMsgBuf, NULL, 0, EF_NONE | EF_CANDEFAULT ); hb_errLaunch( pError ); hb_errRelease( pError ); @@ -229,7 +229,7 @@ HB_FUNC( __PP_ADDRULE ) if( pState ) { const char * szText = hb_parc( 2 ); - ULONG ulLen = hb_parclen( 2 ); + HB_SIZE ulLen = hb_parclen( 2 ); if( szText ) { @@ -270,7 +270,7 @@ HB_FUNC( __PP_PROCESS ) if( pState ) { - ULONG ulLen = hb_parclen( 2 ); + HB_SIZE ulLen = hb_parclen( 2 ); if( ulLen ) { diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 2866735554..94618ec52e 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -1364,7 +1364,7 @@ static HB_BOOL hb_cdxIndexUnLockWrite( LPCDXINDEX pIndex ) pIndex->fFlush = HB_TRUE; pIndex->fChanged = HB_FALSE; } - hb_fileFlush( pIndex->pFile, TRUE ); + hb_fileFlush( pIndex->pFile, HB_TRUE ); #ifdef HB_CDX_DBGCODE if( ! pIndex->WrLck || pIndex->RdLck ) hb_errInternal( 9108, "hb_cdxIndexUnLockWrite: unlock error (*)", NULL, NULL ); @@ -1432,7 +1432,7 @@ static void hb_cdxIndexDiscardBuffers( LPCDXINDEX pIndex ) pTag->CurKey->rec = 0; pTag = pTag->pNext; } - hb_fileFlush( pIndex->pFile, FALSE ); + hb_fileFlush( pIndex->pFile, HB_FALSE ); } /* diff --git a/harbour/src/rdd/dbffpt/dbffpt1.c b/harbour/src/rdd/dbffpt/dbffpt1.c index 03f357b67a..ba1eb9de2b 100644 --- a/harbour/src/rdd/dbffpt/dbffpt1.c +++ b/harbour/src/rdd/dbffpt/dbffpt1.c @@ -197,7 +197,7 @@ static HB_BOOL hb_fptFileUnLockEx( FPTAREAP pArea ) { if( pArea->fShared ) { - hb_fileFlush( pArea->pMemoFile, FALSE ); + hb_fileFlush( pArea->pMemoFile, HB_FALSE ); return hb_fileLock( pArea->pMemoFile, FPT_LOCKPOS, FPT_LOCKSIZE, FL_UNLOCK ); } else @@ -211,7 +211,7 @@ static HB_BOOL hb_fptFileUnLockSh( FPTAREAP pArea ) { if( pArea->fShared ) { - hb_fileFlush( pArea->pMemoFile, FALSE ); + hb_fileFlush( pArea->pMemoFile, HB_FALSE ); return hb_fileLock( pArea->pMemoFile, FPT_LOCKPOS, FPT_LOCKSIZE, FL_UNLOCK ); } else @@ -250,7 +250,7 @@ static HB_BOOL hb_fptRootBlockUnLock( FPTAREAP pArea ) { if( pArea->fShared ) { - hb_fileFlush( pArea->pMemoFile, FALSE ); + hb_fileFlush( pArea->pMemoFile, HB_FALSE ); return hb_fileLock( pArea->pMemoFile, FPT_ROOTBLOCK_OFFSET, 4, FL_UNLOCK ); } else diff --git a/harbour/src/rdd/dbfnsx/dbfnsx1.c b/harbour/src/rdd/dbfnsx/dbfnsx1.c index f31f88e415..2621ad8a11 100644 --- a/harbour/src/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -1246,7 +1246,7 @@ static void hb_nsxDiscardBuffers( LPNSXINDEX pIndex ) pIndex->lpTags[ i ]->stackLevel = 0; pIndex->lpTags[ i ]->CurKeyOffset = 0; } - hb_fileFlush( pIndex->pFile, FALSE ); + hb_fileFlush( pIndex->pFile, HB_FALSE ); } /* @@ -2278,7 +2278,7 @@ static HB_BOOL hb_nsxIndexUnLockWrite( LPNSXINDEX pIndex ) } else { - hb_fileFlush( pIndex->pFile, TRUE ); + hb_fileFlush( pIndex->pFile, HB_TRUE ); pIndex->fValidHeader = HB_FALSE; fOK = hb_dbfLockIdxFile( pIndex->pFile, pIndex->pArea->dbfarea.bLockType, FL_UNLOCK, &pIndex->ulLockPos ); diff --git a/harbour/src/rdd/dbfntx/dbfntx1.c b/harbour/src/rdd/dbfntx/dbfntx1.c index d705690276..b3de5a46b4 100644 --- a/harbour/src/rdd/dbfntx/dbfntx1.c +++ b/harbour/src/rdd/dbfntx/dbfntx1.c @@ -1012,7 +1012,7 @@ static void hb_ntxDiscardBuffers( LPNTXINDEX pIndex ) if( pIndex->iTags ) pIndex->lpTags[ 0 ]->stackLevel = 0; } - hb_fileFlush( pIndex->DiskFile, FALSE ); + hb_fileFlush( pIndex->DiskFile, HB_FALSE ); } /* @@ -2170,7 +2170,7 @@ static HB_BOOL hb_ntxIndexUnLockWrite( LPNTXINDEX pIndex ) } else { - hb_fileFlush( pIndex->DiskFile, TRUE ); + hb_fileFlush( pIndex->DiskFile, HB_TRUE ); pIndex->fValidHeader = HB_FALSE; fOK = hb_dbfLockIdxFile( pIndex->DiskFile, pIndex->Owner->dbfarea.bLockType, FL_UNLOCK, &pIndex->ulLockPos ); diff --git a/harbour/src/rtl/gtclip.c b/harbour/src/rtl/gtclip.c index 02e142d666..ffb87ad64e 100644 --- a/harbour/src/rtl/gtclip.c +++ b/harbour/src/rtl/gtclip.c @@ -110,7 +110,7 @@ HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE *pulLen ) #if defined( HB_OS_WIN ) -HB_BOOL hb_gt_winapi_setClipboard( UINT uFormat, const char * szClipData, HB_SIZE ulLen ) +HB_BOOL hb_gt_winapi_setClipboard( HB_UINT uFormat, const char * szClipData, HB_SIZE ulLen ) { HB_BOOL fResult = HB_FALSE; @@ -142,20 +142,20 @@ HB_BOOL hb_gt_winapi_setClipboard( UINT uFormat, const char * szClipData, HB_SIZ } ( void ) GlobalUnlock( hglbCopy ); /* Place the handle on the clipboard. */ - SetClipboardData( uFormat, hglbCopy ); + SetClipboardData( ( UINT ) uFormat, hglbCopy ); } CloseClipboard(); } return fResult; } -HB_BOOL hb_gt_winapi_getClipboard( UINT uFormat, char ** pszClipData, HB_SIZE * pulLen ) +HB_BOOL hb_gt_winapi_getClipboard( HB_UINT uFormat, char ** pszClipData, HB_SIZE * pulLen ) { *pulLen = 0; *pszClipData = NULL; if( IsClipboardFormatAvailable( uFormat ) && OpenClipboard( NULL ) ) { - HGLOBAL hglb = GetClipboardData( uFormat ); + HGLOBAL hglb = GetClipboardData( ( UINT ) uFormat ); if( hglb ) { LPTSTR lptstr = ( LPTSTR ) GlobalLock( hglb );