2017-05-10 07:50 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbwin/olecore.c
    * added additional protection to reduce hb_oleSafeArrayToString()
      functionality to arrays of VT_I1 and VT_UI1 items so other types
      which may also allocate 1 byte for each item are not converted.
This commit is contained in:
Przemysław Czerpak
2017-05-10 07:50:03 +02:00
parent fc9066234e
commit 568003e11f
2 changed files with 12 additions and 0 deletions

View File

@@ -10,6 +10,12 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2017-05-10 07:50 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/olecore.c
* added additional protection to reduce hb_oleSafeArrayToString()
functionality to arrays of VT_I1 and VT_UI1 items so other types
which may also allocate 1 byte for each item are not converted.
2017-05-09 17:04 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/olecore.c
% small optimization in hb_oleSafeArrayFromString()

View File

@@ -408,11 +408,15 @@ static SAFEARRAY * hb_oleSafeArrayFromString( PHB_ITEM pItem, VARTYPE vt )
return pSafeArray;
}
static HB_BOOL hb_oleSafeArrayToString( PHB_ITEM pItem, SAFEARRAY * pSafeArray )
{
long lFrom, lTo;
VARTYPE vt;
if( SafeArrayGetElemsize( pSafeArray ) == 1 &&
SafeArrayGetVartype( pSafeArray, &vt ) == S_OK &&
( vt == VT_I1 || vt == VT_UI1 ) &&
SafeArrayGetLBound( pSafeArray, 1, &lFrom ) == S_OK &&
SafeArrayGetUBound( pSafeArray, 1, &lTo ) == S_OK &&
lFrom <= lTo + 1 ) /* accept empty arrays */
@@ -427,6 +431,8 @@ static HB_BOOL hb_oleSafeArrayToString( PHB_ITEM pItem, SAFEARRAY * pSafeArray )
}
return HB_FALSE;
}
static VARIANT * hb_oleVariantParam( int iParam )
{
VARIANT * pVariant = ( VARIANT * ) hb_parptrGC( &s_gcVariantFuncs, iParam );