Author: arielch Date: Mon Jan 9 21:46:55 2012 New Revision: 1229372 URL: http://svn.apache.org/viewvc?rev=1229372&view=rev Log: i117010 - default conversion of sequences is now again SAFEARRAY of VARIANTs
Original author Joachim Lingner <[email protected]> Tue Mar 15 14:24:01 2011 changeset 275627 00bf0ef35ffa parent 275626 0b716817fec5 child 275628 795ebf68a524 Modified: incubator/ooo/trunk/main/extensions/source/ole/unoconversionutilities.hxx Modified: incubator/ooo/trunk/main/extensions/source/ole/unoconversionutilities.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/extensions/source/ole/unoconversionutilities.hxx?rev=1229372&r1=1229371&r2=1229372&view=diff ============================================================================== --- incubator/ooo/trunk/main/extensions/source/ole/unoconversionutilities.hxx (original) +++ incubator/ooo/trunk/main/extensions/source/ole/unoconversionutilities.hxx Mon Jan 9 21:46:55 2012 @@ -1320,47 +1320,32 @@ SAFEARRAY* UnoConversionUtilities<T>::c typelib_TypeDescription* pSeqElementDesc= NULL; TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); + sal_Int32 nElementSize= pSeqElementDesc->nSize; + n= punoSeq->nElements; + + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = n; + VARIANT oleElement; + long safeI[1]; - // try to find VARIANT type that is related to the UNO type of the sequence elements - // the sequence as a sequence element should be handled in a special way - VARTYPE eTargetElementType = VT_EMPTY; - if ( pSeqElementDesc->eTypeClass != TypeClass_SEQUENCE ) - eTargetElementType = mapTypeClassToVartype( static_cast< TypeClass >( pSeqElementDesc->eTypeClass ) ); + pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - if ( eTargetElementType != VT_EMPTY ) - pArray = createUnoSequenceWrapper( rSeq, eTargetElementType ); + Any unoElement; + sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - if ( !pArray ) + for (sal_uInt32 i = 0; i < n; i++) { - sal_Int32 nElementSize= pSeqElementDesc->nSize; - n= punoSeq->nElements; - - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].lLbound = 0; - rgsabound[0].cElements = n; - VARIANT oleElement; - long safeI[1]; + unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); + VariantInit(&oleElement); - pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); + anyToVariant(&oleElement, unoElement); - Any unoElement; - // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; - sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; + safeI[0] = i; + SafeArrayPutElement(pArray, safeI, &oleElement); - for (sal_uInt32 i = 0; i < n; i++) - { - unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); - VariantInit(&oleElement); - - anyToVariant(&oleElement, unoElement); - - safeI[0] = i; - SafeArrayPutElement(pArray, safeI, &oleElement); - - VariantClear(&oleElement); - } + VariantClear(&oleElement); } - TYPELIB_DANGER_RELEASE( pSeqElementDesc); return pArray;
