diff options
author | Joachim Lingner <jl@openoffice.org> | 2012-02-23 12:38:36 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-02-23 14:57:12 +0000 |
commit | a6ff118c4fdb3af7702c463d995df38742da3464 (patch) | |
tree | ace156145c90a0881e4da7a560663287a7afaa1f /extensions | |
parent | Revert "fix handling of SAFEARRAY(s) returned as variant in olebridge (fdo#38... (diff) | |
download | core-a6ff118c4fdb3af7702c463d995df38742da3464.tar.gz core-a6ff118c4fdb3af7702c463d995df38742da3464.zip |
default conversion of sequences is now again SAFEARRAY of VARIANTs #fdo46165
cws jl166 patch: #i117010# default conversion of sequences is now again SAFEARRAY of VARIANTs
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 7cdcea0c700e..97782cca32ba 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1318,47 +1318,32 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) typelib_TypeDescription* pSeqElementDesc= NULL; TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); + sal_Int32 nElementSize= pSeqElementDesc->nSize; + n= punoSeq->nElements; - // 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 ) ); + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = n; + VARIANT oleElement; + long safeI[1]; - if ( eTargetElementType != VT_EMPTY ) - pArray = createUnoSequenceWrapper( rSeq, eTargetElementType ); + pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - if ( !pArray ) - { - sal_Int32 nElementSize= pSeqElementDesc->nSize; - n= punoSeq->nElements; - - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].lLbound = 0; - rgsabound[0].cElements = n; - VARIANT oleElement; - long safeI[1]; - - pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - - Any unoElement; - // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; - sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; + Any unoElement; + sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - for (sal_uInt32 i = 0; i < n; i++) - { - unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); - VariantInit(&oleElement); + for (sal_uInt32 i = 0; i < n; i++) + { + unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); + VariantInit(&oleElement); - anyToVariant(&oleElement, unoElement); + anyToVariant(&oleElement, unoElement); - safeI[0] = i; - SafeArrayPutElement(pArray, safeI, &oleElement); + safeI[0] = i; + SafeArrayPutElement(pArray, safeI, &oleElement); - VariantClear(&oleElement); - } + VariantClear(&oleElement); } - TYPELIB_DANGER_RELEASE( pSeqElementDesc); return pArray; |