diff --git a/ChangeLog.txt b/ChangeLog.txt index 00fab45b22..f11a796c72 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,32 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2024-12-11 19:35 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/xhb/hbcompat.ch + ! fixed HSetAACompatibility() #xtranslate + + * contrib/hbzebra/code39.c + * pacified warning, it's also fix for possible buffer overflow. + + * include/hbcomp.h + * src/compiler/genc.c + * src/compiler/hbmain.c + * replaced function hb_compFunctionMarkStatic() with + hb_compFunctionSetScope() + + * src/compiler/genc.c + * detect public prg functions written in C inside + #pragma BEGINDUMP / #pragma ENDDUMP and mark them as LOCAL ones + + * src/vm/hvm.c + ! removed my pseudo fix from 2023-01-30 15:18 UTC+0100 Przemyslaw Czerpak. + It was ugly hack which can work only with some linkers. + This modification fixes FILE() function used with C functions written + without own symbol table + + * src/rdd/dbf1.c + * minor code formatting + 2024-12-04 15:25 UTC+0100 Aleksander Czajczynski (hb fki.pl) * src/common/hbver.c ! added lacking VER_BUILDNUMBER definition that is missing diff --git a/contrib/hbzebra/code39.c b/contrib/hbzebra/code39.c index cc5ca3ccf0..f7d2d8039a 100644 --- a/contrib/hbzebra/code39.c +++ b/contrib/hbzebra/code39.c @@ -161,6 +161,8 @@ PHB_ZEBRA hb_zebra_create_code39( const char * szCode, HB_SIZE nLen, int iFlags int i, iLen = ( int ) nLen; int csum; + iLen = nLen > INT_MAX ? INT_MAX : ( int ) nLen; + pZebra = hb_zebra_create(); pZebra->iType = HB_ZEBRA_TYPE_CODE39; diff --git a/contrib/xhb/hbcompat.ch b/contrib/xhb/hbcompat.ch index 918171083c..bdb31e2a9d 100644 --- a/contrib/xhb/hbcompat.ch +++ b/contrib/xhb/hbcompat.ch @@ -513,7 +513,7 @@ RETURN a ; }:eval( ) #xtranslate HGetAACompatibility( ) => hb_HKeepOrder( ) #xtranslate HSetAACompatibility( [] ) => {| h | ;; - hb_HKeepOrder( h ) ;; + hb_HKeepOrder( h, .T. ) ;; RETURN .T. ; }:eval( ) /* inet*() functions */ diff --git a/include/hbcomp.h b/include/hbcomp.h index aa7c6d66dc..fd4d3804f3 100644 --- a/include/hbcomp.h +++ b/include/hbcomp.h @@ -120,8 +120,8 @@ extern void hb_compParserRun( HB_COMP_DECL ); #define HB_FUNF_ATTACHED 0x0200 /* function attached to function list */ extern void hb_compFunctionAdd( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */ +extern void hb_compFunctionSetScope( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cScope ); extern PHB_HINLINE hb_compInlineAdd( HB_COMP_DECL, const char * szFunName, int iLine ); -extern void hb_compFunctionMarkStatic( HB_COMP_DECL, const char * szFunName ); extern HB_EXPORT_INT const char * hb_compGetFuncID( const char * szFuncName, HB_FUNC_ID * pFunID, int * piFlags ); extern HB_BOOL hb_compFunCallCheck( HB_COMP_DECL, const char *, int ); diff --git a/src/compiler/genc.c b/src/compiler/genc.c index 0b765861d8..2b3261811c 100644 --- a/src/compiler/genc.c +++ b/src/compiler/genc.c @@ -58,8 +58,15 @@ static void hb_compDumpFindCFunc( HB_COMP_DECL ) { if( HB_ISFIRSTIDCHAR( ch ) ) { - if( ch == 'H' && strncmp( pszCCode, "B_FUNC_STATIC", 13 ) == 0 ) + if( ch == 'H' && strncmp( pszCCode, "B_FUNC", 6 ) == 0 ) { + HB_SYMBOLSCOPE scope = HB_FS_LOCAL; + pszCCode += 6; + if( strncmp( pszCCode, "_STATIC", 7 ) == 0 ) + { + pszCCode += 7; + scope |= HB_FS_STATIC; + } pszCCode += 13; while( HB_ISSPACE( *pszCCode ) ) ++pszCCode; @@ -80,7 +87,7 @@ static void hb_compDumpFindCFunc( HB_COMP_DECL ) if( *pszCCode == ')' ) { char * name = hb_strndup( pszName, len ); - hb_compFunctionMarkStatic( HB_COMP_PARAM, name ); + hb_compFunctionSetScope( HB_COMP_PARAM, name, scope ); hb_xfree( name ); } } diff --git a/src/compiler/hbmain.c b/src/compiler/hbmain.c index 91a18553d6..46e4ac1c8e 100644 --- a/src/compiler/hbmain.c +++ b/src/compiler/hbmain.c @@ -2296,14 +2296,14 @@ static void hb_compAnnounce( HB_COMP_DECL, const char * szFunName ) } } -void hb_compFunctionMarkStatic( HB_COMP_DECL, const char * szFunName ) +void hb_compFunctionSetScope( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cScope ) { PHB_HSYMBOL pSym = hb_compSymbolFind( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); if( pSym ) { if( ( pSym->cScope & ( HB_FS_DEFERRED | HB_FS_LOCAL ) ) == 0 ) - pSym->cScope |= HB_FS_STATIC | HB_FS_LOCAL; + pSym->cScope |= cScope; } } diff --git a/src/rdd/dbf1.c b/src/rdd/dbf1.c index b6d4335f71..fbe432544f 100644 --- a/src/rdd/dbf1.c +++ b/src/rdd/dbf1.c @@ -2197,10 +2197,12 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ], &nLen, pArea->area.cdPage, hb_vmCDP() ); hb_itemPutCLPtr( pItem, pszVal, nLen ); - break; } - pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ]; - hb_itemPutCL( pItem, pszVal, nLen ); + else + { + pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ]; + hb_itemPutCL( pItem, pszVal, nLen ); + } } break; diff --git a/src/vm/hvm.c b/src/vm/hvm.c index 143ab47f43..8214e6a37f 100644 --- a/src/vm/hvm.c +++ b/src/vm/hvm.c @@ -7553,8 +7553,7 @@ PHB_SYMB hb_vmGetRealFuncSym( PHB_SYMB pSym ) if( pSym && ! ( pSym->scope.value & HB_FS_LOCAL ) ) { pSym = pSym->pDynSym && - ( ( pSym->pDynSym->pSymbol->scope.value & HB_FS_LOCAL ) || - pSym->pDynSym->pSymbol->value.pFunPtr == pSym->value.pFunPtr ) ? + ( pSym->pDynSym->pSymbol->scope.value & HB_FS_LOCAL ) ? pSym->pDynSym->pSymbol : NULL; }