Skip to content

Commit

Permalink
2024-12-11 19:35 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
Browse files Browse the repository at this point in the history
  * 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
  • Loading branch information
druzus committed Dec 11, 2024
1 parent 3020495 commit 683b476
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 11 deletions.
26 changes: 26 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions contrib/hbzebra/code39.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion contrib/xhb/hbcompat.ch
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
RETURN a ; }:eval( <x> )
#xtranslate HGetAACompatibility( <x> ) => hb_HKeepOrder( <x> )
#xtranslate HSetAACompatibility( [<x,...>] ) => {| h | ;;
hb_HKeepOrder( h ) ;;
hb_HKeepOrder( h, .T. ) ;;
RETURN .T. ; }:eval( <x> )

/* inet*() functions */
Expand Down
2 changes: 1 addition & 1 deletion include/hbcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
11 changes: 9 additions & 2 deletions src/compiler/genc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/hbmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/rdd/dbf1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/vm/hvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 683b476

Please sign in to comment.