diff --git a/ChangeLog.txt b/ChangeLog.txt index a91224de04..a832499e03 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,26 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2025-01-24 12:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbwin/olecore.c + * pacified false MSVC warning. It's very seldom situation that I'm adding + code to pacify false compiler warnings anyhow in this case it cost in + practice nothing so I decided to do that. + + * contrib/xhb/hboutdbg.c + * src/rtl/gtcrs/gtcrs.c + * NULL pointer casting to pacify warning + + * src/pp/hbpp.c + % do not created new iLen variable but reuse the one previously declared + + * src/vm/classes.c + % allocate puiMsgIdx as array of HB_USHORT items instead of HB_SYMCNT. + This modification only reduces the memory usage and has no effect on + number of accepted symbols. + * changed 'HB_SYMCNT uiHashKey' to 'HB_SIZE nHashKey' to avoid explicit + casting in the code + 2025-01-24 10:10 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbssl/hbssl.hbm * added -Wno-error=deprecated-declarations to suppress errors in Solaris diff --git a/contrib/hbwin/olecore.c b/contrib/hbwin/olecore.c index 197e9584a6..cedd25dc45 100644 --- a/contrib/hbwin/olecore.c +++ b/contrib/hbwin/olecore.c @@ -2230,6 +2230,8 @@ HB_FUNC( WIN_OLEAUTO___ONERROR ) if( ! pDisp ) return; + dispid = ( DISPID ) 0; /* to pacify MSVC false warning */ + iPCount = hb_pcount(); szMethod = hb_itemGetSymbol( hb_stackBaseItem() )->szName; diff --git a/contrib/xhb/hboutdbg.c b/contrib/xhb/hboutdbg.c index b78f2b334b..69c5b03448 100644 --- a/contrib/xhb/hboutdbg.c +++ b/contrib/xhb/hboutdbg.c @@ -116,7 +116,7 @@ static void debugInit( void ) if( iFifoResult != EEXIST ) { s_iXtermPid = execlp( "xterm", "xterm", "-T", szDebugTitle, "-e", - "cat", szDebugName, NULL ); + "cat", szDebugName, ( char * ) NULL ); if( s_iXtermPid <= 0 ) { diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c index 34e0d493ce..7ec80a23f4 100644 --- a/src/pp/hbpp.c +++ b/src/pp/hbpp.c @@ -594,8 +594,8 @@ static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName, if( strlen( szLog ) >= 16 ) { long lJulian = 0, lMilliSec = 0; - int iLen = 16; + iLen = 16; if( szLog[ 16 ] == ' ' && szLog[ 17 ] == 'U' && szLog[ 18 ] == 'T' && szLog[ 19 ] == 'C' && ( szLog[ 20 ] == '+' || szLog[ 20 ] == '-' ) && diff --git a/src/rtl/gtcrs/gtcrs.c b/src/rtl/gtcrs/gtcrs.c index 65956fcbbb..149f845779 100644 --- a/src/rtl/gtcrs/gtcrs.c +++ b/src/rtl/gtcrs/gtcrs.c @@ -2163,7 +2163,7 @@ static InOutBase * create_newXterm( void ) ( void ) setgid( getgid() ); execlp( "xterm", "xterm", buf, "+sb", "-fg", "white", - "-bg", "black", "-fn", "fixed", "-T", "HB-XTERM Window", NULL ); + "-bg", "black", "-fn", "fixed", "-T", "HB-XTERM Window", ( char * ) NULL ); _exit( EXIT_FAILURE ); } close( masterfd ); diff --git a/src/vm/classes.c b/src/vm/classes.c index 0641436375..9a7898138a 100644 --- a/src/vm/classes.c +++ b/src/vm/classes.c @@ -167,10 +167,10 @@ typedef struct HB_USHORT uiFriendSyms; /* Number of friend function's symbols */ HB_USHORT uiFriendModule; /* Number of friend symbols in pFriendModule */ HB_USHORT uiMutexOffset; /* Offset in instance area to SYNC method mutex */ - HB_SYMCNT uiHashKey; + HB_SIZE nHashKey; #ifdef HB_MSG_POOL HB_USHORT uiMethodCount; - HB_SYMCNT * puiMsgIdx; + HB_USHORT * puiMsgIdx; #endif } CLASS, * PCLASS; @@ -181,12 +181,12 @@ typedef struct #define HASH_KEY ( ( 1 << HASHBITS ) - 1 ) #define HASH_KEYMAX ( 1 << ( 32 - BUCKETBITS ) ) #define hb_clsInited(p) ( (p)->pMethods != NULL ) -#define hb_clsBucketPos( p, m ) ( ( (p)->uiSymNum & (m) ) << BUCKETBITS ) +#define hb_clsBucketPos( p, m ) ( ( ( HB_SIZE ) (p)->uiSymNum & (m) ) << BUCKETBITS ) #ifdef HB_MSG_POOL # define hb_clsMthNum( p ) ( ( HB_SIZE ) ( p )->uiMethodCount ) #else -# define hb_clsMthNum( p ) ( ( ( HB_SIZE ) ( p )->uiHashKey + 1 ) << BUCKETBITS ) +# define hb_clsMthNum( p ) ( ( ( p )->nHashKey + 1 ) << BUCKETBITS ) #endif #if defined( HB_REAL_BLOCK_SCOPE ) @@ -196,7 +196,7 @@ typedef struct #endif #if ! defined( HB_CLASSY_BLOCK_SCOPE ) -# define hb_clsSenderOffset() hb_stackBaseProcOffset( 1 ) +# define hb_clsSenderOffset() hb_stackBaseProcOffset( 1 ) #endif @@ -374,7 +374,7 @@ static PHB_ITEM s_pClassMtx = NULL; /* --- */ #if 0 -static HB_SYMCNT hb_clsBucketPos( PHB_DYNS pMsg, HB_SYMCNT uiMask ) +static HB_SIZE hb_clsBucketPos( PHB_DYNS pMsg, HB_SIZE uiMask ) { /* we can use PHB_DYNS address as base for hash key. * This value is perfectly unique and we do not need anything more @@ -408,14 +408,14 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) HB_SIZE nNewHashKey, nLimit, n; #ifdef HB_MSG_POOL - HB_SYMCNT * puiMsgIdx; + HB_USHORT * puiMsgIdx; #else PMETHOD pNewMethods; #endif HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictRealloc(%p)", ( void * ) pClass ) ); - nNewHashKey = ( HB_SIZE ) pClass->uiHashKey + 1; + nNewHashKey = pClass->nHashKey + 1; nLimit = nNewHashKey << BUCKETBITS; do @@ -425,15 +425,15 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) hb_errInternal( 6002, "Could not realloc class message in __clsDictRealloc()", NULL, NULL ); #ifdef HB_MSG_POOL - puiMsgIdx = ( HB_SYMCNT * ) hb_xgrabz( ( nNewHashKey << BUCKETBITS ) * sizeof( HB_SYMCNT ) ); + puiMsgIdx = ( HB_USHORT * ) hb_xgrabz( ( nNewHashKey << BUCKETBITS ) * sizeof( HB_USHORT ) ); for( n = 0; n < nLimit; n++ ) { - HB_SYMCNT uiMsg = pClass->puiMsgIdx[ n ]; + HB_USHORT uiMsg = pClass->puiMsgIdx[ n ]; if( pClass->puiMsgIdx[ n ] ) { - HB_SYMCNT uiBucket = BUCKETSIZE; - HB_SYMCNT * puiIdx = puiMsgIdx + hb_clsBucketPos( + HB_USHORT uiBucket = BUCKETSIZE; + HB_USHORT * puiIdx = puiMsgIdx + hb_clsBucketPos( pClass->pMethods[ uiMsg ].pMessage, nNewHashKey - 1 ); do { @@ -457,7 +457,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) } while( n < nLimit ); - pClass->uiHashKey = ( HB_SYMCNT ) ( nNewHashKey - 1 ); + pClass->nHashKey = nNewHashKey - 1; hb_xfree( pClass->puiMsgIdx ); pClass->puiMsgIdx = puiMsgIdx; @@ -472,7 +472,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) if( pMessage ) { PMETHOD pMethod = pNewMethods + hb_clsBucketPos( pMessage, nNewHashKey - 1 ); - HB_SYMCNT uiBucket = BUCKETSIZE; + HB_USHORT uiBucket = BUCKETSIZE; do { @@ -496,7 +496,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) } while( n < nLimit ); - pClass->uiHashKey = ( HB_SYMCNT ) ( nNewHashKey - 1 ); + pClass->nHashKey = nNewHashKey - 1; hb_xfree( pClass->pMethods ); pClass->pMethods = pNewMethods; #endif @@ -504,21 +504,21 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) return HB_TRUE; } -static void hb_clsDictInit( PCLASS pClass, HB_SYMCNT uiHashKey ) +static void hb_clsDictInit( PCLASS pClass, HB_SIZE nHashKey ) { HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictInit(%p,%u)", ( void * ) pClass, uiHashKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictInit(%p,%" HB_PFS "u)", ( void * ) pClass, nHashKey ) ); - pClass->uiHashKey = uiHashKey; + pClass->nHashKey = nHashKey; #ifdef HB_MSG_POOL - nSize = ( ( ( HB_SIZE ) uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_SYMCNT ); - pClass->puiMsgIdx = ( HB_SYMCNT * ) hb_xgrabz( nSize ); + nSize = ( ( nHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_USHORT ); + pClass->puiMsgIdx = ( HB_USHORT * ) hb_xgrabz( nSize ); pClass->uiMethodCount = 1; pClass->pMethods = ( PMETHOD ) hb_xgrabz( sizeof( METHOD ) ); #else - nSize = ( ( ( HB_SIZE ) uiHashKey + 1 ) << BUCKETBITS ) * sizeof( METHOD ); + nSize = ( ( nHashKey + 1 ) << BUCKETBITS ) * sizeof( METHOD ); pClass->pMethods = ( PMETHOD ) hb_xgrabz( nSize ); #endif } @@ -527,11 +527,11 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) { #ifdef HB_MSG_POOL - HB_SYMCNT uiBucket, * puiMsgIdx; + HB_USHORT uiBucket, * puiMsgIdx; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); - puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); + puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->nHashKey ); uiBucket = BUCKETSIZE; do @@ -547,11 +547,11 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) #else PMETHOD pMethod; - HB_SYMCNT uiBucket; + HB_USHORT uiBucket; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); - pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); + pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->nHashKey ); uiBucket = BUCKETSIZE; do @@ -576,8 +576,8 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) #ifdef HB_MSG_POOL - HB_SYMCNT uiBucket = BUCKETSIZE, * puiMsgIdx = pClass->puiMsgIdx + - hb_clsBucketPos( pMsg, pClass->uiHashKey ); + HB_USHORT uiBucket = BUCKETSIZE, * puiMsgIdx = pClass->puiMsgIdx + + hb_clsBucketPos( pMsg, pClass->nHashKey ); do { @@ -597,8 +597,8 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) #else - PMETHOD pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); - HB_SYMCNT uiBucket = BUCKETSIZE; + PMETHOD pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->nHashKey ); + HB_USHORT uiBucket = BUCKETSIZE; do { @@ -637,12 +637,12 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) { #ifdef HB_MSG_POOL - HB_SYMCNT uiBucket, * puiMsgIdx; + HB_USHORT uiBucket, * puiMsgIdx; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); - puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); + puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->nHashKey ); uiBucket = BUCKETSIZE; do @@ -664,12 +664,12 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) #else PMETHOD pMethod; - HB_SYMCNT uiBucket; + HB_USHORT uiBucket; HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); - pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); - uiBucket = BUCKETSIZE; + pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->nHashKey ); + HB_USHORT = BUCKETSIZE; do { @@ -984,7 +984,7 @@ static void hb_clsCopyClass( PCLASS pClsDst, PCLASS pClsSrc ) HB_TRACE( HB_TR_DEBUG, ( "hb_clsCopyClass(%p,%p)", ( void * ) pClsDst, ( void * ) pClsSrc ) ); - hb_clsDictInit( pClsDst, pClsSrc->uiHashKey ); + hb_clsDictInit( pClsDst, pClsSrc->nHashKey ); pClsDst->fHasOnError = pClsSrc->fHasOnError; pClsDst->fHasDestructor = pClsSrc->fHasDestructor; @@ -1027,7 +1027,7 @@ static void hb_clsCopyClass( PCLASS pClsDst, PCLASS pClsSrc ) nLimit = hb_clsMthNum( pClsSrc ); #ifdef HB_MSG_POOL memcpy( pClsDst->puiMsgIdx, pClsSrc->puiMsgIdx, - ( ( ( HB_SIZE ) pClsSrc->uiHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_SYMCNT ) ); + ( ( pClsSrc->nHashKey + 1 ) << BUCKETBITS ) * sizeof( HB_USHORT ) ); pClsDst->uiMethodCount = pClsSrc->uiMethodCount; pClsDst->pMethods = ( PMETHOD ) hb_xrealloc( pClsDst->pMethods, nLimit * sizeof( METHOD ) ); @@ -1836,8 +1836,8 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, } #ifdef HB_MSG_POOL { - HB_SYMCNT uiBucket = BUCKETSIZE, * puiMsgIdx = - pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); + HB_USHORT uiBucket = BUCKETSIZE, * puiMsgIdx = + pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->nHashKey ); do {