2009-08-14 16:59 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbwin/olecore.c
    ! added missing parenthesis
    + added support to translate 1 dimensional arrays of variants
      to HVM arrays
This commit is contained in:
Przemyslaw Czerpak
2009-08-14 15:00:17 +00:00
parent 32b6c86e1e
commit 6d6d08d276
2 changed files with 40 additions and 1 deletions

View File

@@ -17,6 +17,12 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-08-14 16:59 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/olecore.c
! added missing parenthesis
+ added support to translate 1 dimensional arrays of variants
to HVM arrays
2009-08-14 16:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* config/bsd/gcc.cf
* config/hpux/gcc.cf

View File

@@ -388,7 +388,7 @@ PHB_ITEM hb_oleItemPut( PHB_ITEM pItem, IDispatch* pDisp )
void hb_oleVariantToItem( PHB_ITEM pItem, VARIANT* pVariant )
{
if( pVariant->n1.n2.vt == VT_VARIANT | VT_BYREF )
if( pVariant->n1.n2.vt == ( VT_VARIANT | VT_BYREF ) )
pVariant = pVariant->n1.n2.n3.pvarVal;
switch( pVariant->n1.n2.vt )
@@ -624,6 +624,39 @@ void hb_oleVariantToItem( PHB_ITEM pItem, VARIANT* pVariant )
break;
#endif
case VT_VARIANT | VT_ARRAY:
case VT_VARIANT | VT_ARRAY | VT_BYREF:
{
SAFEARRAY * pSafeArray = pVariant->n1.n2.vt & VT_BYREF ?
*pVariant->n1.n2.n3.pparray :
pVariant->n1.n2.n3.parray;
if( pSafeArray && SafeArrayGetDim( pSafeArray ) == 1 )
{
long lFrom, lTo;
SafeArrayGetLBound( pSafeArray, 1, &lFrom );
SafeArrayGetUBound( pSafeArray, 1, &lTo );
if( lFrom >= lTo )
{
VARIANT vItem;
ULONG ul = 0;
hb_arrayNew( pItem, lTo - lFrom + 1 );
VariantInit( &vItem );
do
{
if( SUCCEEDED( SafeArrayGetElement( pSafeArray, &lFrom, &vItem ) ) )
{
hb_oleVariantToItem( hb_arrayGetItemPtr( pItem, ul++ ), &vItem );
VariantClear( &vItem );
}
}
while( ++lFrom <= lTo );
break;
}
}
}
default:
hb_itemClear( pItem );
}