2001-07-18 09:06 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

* source/rtl/tbrowse.prg
     + activated scoping
   * include/hbapierr.h
     include/hbapiitm.h
     include/hbvm.h
     source/rtl/errorapi.c
     source/vm/hvm.c
     source/vm/itemapi.c
     ! fixed va_start() use or, better, changed it to be compatible with OS/2 EMX GCC
       compiler which REQUIRES that va_start() calls use a type which cannot be promoted
       to something bigger. That is, this call is correct:
       va_start(valist, ulUnsignedLongType)
       while this one is not:
       va_start(valist, usUnsignedShortType)
       Using a type which can be promoted to a bigger one leads to memory corruption.
       I think this requirement could exist even on other ANSI C compilers.
     ! Removed workaround inside hb_itemDo() and hb_itemDoC() to prevent this corruption.
This commit is contained in:
Maurilio Longo
2001-07-18 07:21:03 +00:00
parent 8abc351c51
commit bd80e8d997
8 changed files with 93 additions and 79 deletions

View File

@@ -3277,28 +3277,28 @@ HB_ITEM_PTR hb_vmEvalBlock( HB_ITEM_PTR pBlock )
/* Evaluates a codeblock item using passed additional arguments
* pBlock = an item of codeblock type to evaluate
* uiArgCount = number of arguments passed to a codeblock
* ulArgCount = number of arguments passed to a codeblock
* ... = the list of arguments of type PHB_ITEM
*
*for example:
* retVal = hb_vmEvalBlockV( pBlock, 2, pParam1, pParam2 );
*/
HB_ITEM_PTR hb_vmEvalBlockV( HB_ITEM_PTR pBlock, USHORT uiArgCount, ... )
HB_ITEM_PTR hb_vmEvalBlockV( HB_ITEM_PTR pBlock, ULONG ulArgCount, ... )
{
va_list va;
USHORT i;
ULONG i;
HB_TRACE(HB_TR_DEBUG, ("hb_vmEvalBlockV(%p, %hu, ...)", pBlock, uiArgCount));
HB_TRACE(HB_TR_DEBUG, ("hb_vmEvalBlockV(%p, %hu, ...)", pBlock, ulArgCount));
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pBlock );
va_start( va, uiArgCount );
for( i = 1; i <= uiArgCount; i++ )
va_start( va, ulArgCount );
for( i = 1; i <= ulArgCount; i++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
va_end( va );
hb_vmDo( uiArgCount );
hb_vmDo( ulArgCount );
return &hb_stack.Return;
}

View File

@@ -215,14 +215,13 @@ BOOL hb_evalRelease( PEVALINFO pEvalInfo )
NOTE: When calling hb_itemDo() with no arguments for the Harbour item being
evaluated, you must use '(PHB_ITEM *) 0' as the third parameter.
*/
NOTE: pItemArg1 is needed to workaround a bug in OS2/GCC. */
PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
PHB_ITEM hb_itemDo( PHB_ITEM pItem, ULONG ulPCount, ... )
{
PHB_ITEM pResult;
HB_TRACE(HB_TR_DEBUG, ("hb_itemDo(%p, %hu, %p, ...)", pItem, uiPCount, pItemArg1));
HB_TRACE(HB_TR_DEBUG, ("hb_itemDo(%p, %hu, ...)", pItem, ulPCount));
if( pItem )
{
@@ -232,16 +231,15 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
if( pDynSym )
{
USHORT uiParam;
ULONG ulParam;
va_list va;
va_start( va, pItemArg1 );
va_start( va, ulPCount );
hb_vmPushSymbol( pDynSym->pSymbol );
hb_vmPushNil();
if( uiPCount >= 1 ) hb_vmPush( pItemArg1 );
for( uiParam = 2; uiParam <= uiPCount; uiParam++ )
for( ulParam = 1; ulParam <= ulPCount; ulParam++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
hb_vmDo( uiPCount );
hb_vmDo( ulPCount );
va_end( va );
pResult = hb_itemNew( NULL );
@@ -252,16 +250,15 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
}
else if( HB_IS_BLOCK( pItem ) )
{
USHORT uiParam;
ULONG ulParam;
va_list va;
va_start( va, pItemArg1 );
va_start( va, ulPCount );
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pItem );
if( uiPCount >= 1 ) hb_vmPush( pItemArg1 );
for( uiParam = 2; uiParam <= uiPCount; uiParam++ )
for( ulParam = 1; ulParam <= ulPCount; ulParam++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
hb_vmDo( uiPCount );
hb_vmDo( ulPCount );
va_end( va );
pResult = hb_itemNew( NULL );
@@ -269,16 +266,15 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
}
else if( HB_IS_SYMBOL( pItem ) )
{
USHORT uiParam;
ULONG ulParam;
va_list va;
va_start( va, pItemArg1 );
va_start( va, ulPCount );
hb_vmPushSymbol( pItem->item.asSymbol.value );
hb_vmPushNil();
if( uiPCount >= 1 ) hb_vmPush( pItemArg1 );
for( uiParam = 2; uiParam <= uiPCount; uiParam++ )
for( ulParam = 1; ulParam <= ulPCount; ulParam++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
hb_vmDo( uiPCount );
hb_vmDo( ulPCount );
va_end( va );
pResult = hb_itemNew( NULL );
@@ -298,14 +294,13 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
NOTE: When calling hb_itemDoC() with no arguments for the Harbour function
being called, you must use '(PHB_ITEM *) 0' as the third parameter.
*/
NOTE: pItemArg1 is needed to workaround a bug in OS2/GCC. */
PHB_ITEM hb_itemDoC( char * szFunc, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
PHB_ITEM hb_itemDoC( char * szFunc, ULONG ulPCount, ... )
{
PHB_ITEM pResult;
HB_TRACE(HB_TR_DEBUG, ("hb_itemDoC(%s, %hu, %p, ...)", szFunc, uiPCount, pItemArg1));
HB_TRACE(HB_TR_DEBUG, ("hb_itemDoC(%s, %hu, ...)", szFunc, ulPCount));
if( szFunc )
{
@@ -313,16 +308,15 @@ PHB_ITEM hb_itemDoC( char * szFunc, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
if( pDynSym )
{
USHORT uiParam;
ULONG ulParam;
va_list va;
va_start( va, pItemArg1 );
va_start( va, ulPCount );
hb_vmPushSymbol( pDynSym->pSymbol );
hb_vmPushNil();
if( uiPCount >= 1 ) hb_vmPush( pItemArg1 );
for( uiParam = 2; uiParam <= uiPCount; uiParam++ )
for( ulParam = 1; ulParam <= ulPCount; ulParam++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
hb_vmDo( uiPCount );
hb_vmDo( ulPCount );
va_end( va );
pResult = hb_itemNew( NULL );