From e9cb7ffa2f7a2354ba68a0a66181fe123180a415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Thu, 11 May 2017 18:05:43 +0200 Subject: [PATCH] 2017-05-11 18:05 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbwin/olecore.c * create resizable array instead of fixed size array when empty OLE array is created by __oleVariantNew() --- ChangeLog.txt | 5 +++++ contrib/hbwin/olecore.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 93213a791a..f237a81e9d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,11 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2017-05-11 18:05 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbwin/olecore.c + * create resizable array instead of fixed size array when empty OLE + array is created by __oleVariantNew() + 2017-05-10 17:21 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbwin/olecore.c + added functions which changes default method of NIL conversion to diff --git a/contrib/hbwin/olecore.c b/contrib/hbwin/olecore.c index 018788e2ba..aa4764a461 100644 --- a/contrib/hbwin/olecore.c +++ b/contrib/hbwin/olecore.c @@ -490,7 +490,16 @@ static SAFEARRAY * hb_oleSafeArrayFromItem( PHB_ITEM pItem, VARTYPE vt ) return NULL; } - pSafeArray = SafeArrayCreateVector( vt, 0, cElements ); + if( cElements == 0 ) + { + SAFEARRAYBOUND sabound[ 1 ]; + + sabound[ 0 ].lLbound = 0; + sabound[ 0 ].cElements = 0; + pSafeArray = SafeArrayCreate( vt, 1, sabound ); + } + else + pSafeArray = SafeArrayCreateVector( vt, 0, cElements ); if( pSafeArray && cElements > 0 ) {