diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-31 10:18:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-31 10:18:17 +0100 |
commit | a2c464868aca4bb38aa8afff635da56942b597ac (patch) | |
tree | f6eba943ea933e250d98b37986e0d86773bead09 | |
parent | 9e77c2fb7cadfd477fb1b971b011d43f30781660 (diff) |
[API CHANGE] Remove UNOIDL "array" and "union" vaporware remnants from cppu
This leaves only aborting stubs (for SONAME stability) for
typelib_static_array_type_init
typelib_typedescription_newArray
typelib_typedescription_newUnion
and completely removes corresponding
typelib_ArrayTypeDescription
typelib_UnionTypeDescription
structs and C++ inline
getCppuArrayType*
functions. None of this should ever have been called by client code anyway, so
while technically an API change it should not matter for practical purposes.
Change-Id: I23769d104d545533bf578762b79994e269d78c22
-rw-r--r-- | cppu/Library_cppu.mk | 1 | ||||
-rw-r--r-- | cppu/source/cppu/compat.cxx | 47 | ||||
-rw-r--r-- | cppu/source/typelib/static_types.cxx | 65 | ||||
-rw-r--r-- | cppu/source/typelib/typelib.cxx | 201 | ||||
-rw-r--r-- | cppu/source/uno/assign.hxx | 163 | ||||
-rw-r--r-- | cppu/source/uno/constr.hxx | 116 | ||||
-rw-r--r-- | cppu/source/uno/copy.hxx | 207 | ||||
-rw-r--r-- | cppu/source/uno/destr.hxx | 85 | ||||
-rw-r--r-- | cppu/source/uno/eq.hxx | 60 | ||||
-rw-r--r-- | cppu/source/uno/prim.hxx | 26 | ||||
-rw-r--r-- | cppu/source/uno/sequence.cxx | 95 | ||||
-rw-r--r-- | include/com/sun/star/uno/Type.h | 43 | ||||
-rw-r--r-- | include/com/sun/star/uno/Type.hxx | 117 | ||||
-rw-r--r-- | include/typelib/typedescription.h | 128 |
14 files changed, 55 insertions, 1299 deletions
diff --git a/cppu/Library_cppu.mk b/cppu/Library_cppu.mk index c00fd8e5efe0..820e88f58651 100644 --- a/cppu/Library_cppu.mk +++ b/cppu/Library_cppu.mk @@ -31,6 +31,7 @@ $(eval $(call gb_Library_add_cobjects,cppu,\ )) $(eval $(call gb_Library_add_exception_objects,cppu,\ + cppu/source/cppu/compat \ cppu/source/cppu/cppu_opt \ cppu/source/threadpool/current \ cppu/source/threadpool/jobqueue \ diff --git a/cppu/source/cppu/compat.cxx b/cppu/source/cppu/compat.cxx new file mode 100644 index 000000000000..06181e6efa11 --- /dev/null +++ b/cppu/source/cppu/compat.cxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <cstdlib> + +#include <typelib/typedescription.h> +#include <rtl/ustring.h> +#include <sal/types.h> + +// Stubs for removed functionality, to be killed when we bump sal SONAME + +extern "C" { + +SAL_DLLPUBLIC_EXPORT void SAL_CALL typelib_static_array_type_init( + typelib_TypeDescriptionReference **, typelib_TypeDescriptionReference *, + sal_Int32, ...) SAL_THROW_EXTERN_C() +{ + std::abort(); +} + +SAL_DLLPUBLIC_EXPORT void SAL_CALL typelib_typedescription_newArray( + typelib_TypeDescription **, typelib_TypeDescriptionReference *, + sal_Int32, sal_Int32 *) SAL_THROW_EXTERN_C() +{ + std::abort(); +} + +SAL_DLLPUBLIC_EXPORT void SAL_CALL typelib_typedescription_newUnion( + typelib_TypeDescription **, rtl_uString *, + typelib_TypeDescriptionReference *, sal_Int64, + typelib_TypeDescriptionReference *, sal_Int32, void *) + SAL_THROW_EXTERN_C() +{ + std::abort(); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 83f52abfb369..fb146038ea91 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -573,71 +573,6 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_static_enum_type_init( } } -//################################################################################################## -CPPU_DLLPUBLIC void SAL_CALL typelib_static_array_type_init( - typelib_TypeDescriptionReference ** ppRef, - typelib_TypeDescriptionReference * pElementTypeRef, - sal_Int32 nDimensions, ... ) - SAL_THROW_EXTERN_C() -{ - if (! *ppRef) - { - MutexGuard aGuard( typelib_StaticInitMutex::get() ); - if (! *ppRef) - { - OUStringBuffer aBuf( 32 ); - aBuf.append( pElementTypeRef->pTypeName ); - - va_list dimArgs; - va_start( dimArgs, nDimensions ); - sal_Int32 dim = 0; - sal_Int32 nElements = 1; - sal_Int32* pDimensions = new sal_Int32[nDimensions]; - for (sal_Int32 i=0; i < nDimensions; i++) - { - dim = va_arg( dimArgs, int); - pDimensions[i] = dim; - aBuf.appendAscii("["); - aBuf.append(dim); - aBuf.appendAscii("]"); - nElements *= dim; - } - va_end( dimArgs ); - OUString aTypeName( aBuf.makeStringAndClear() ); - - assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ARRAY) ); - *ppRef = igetTypeByName( aTypeName.pData ); - if (!*ppRef) - { - typelib_TypeDescription * pReg = 0; - ::typelib_typedescription_newEmpty( - &pReg, typelib_TypeClass_ARRAY, aTypeName.pData ); - typelib_ArrayTypeDescription * pArray = (typelib_ArrayTypeDescription *)pReg; - - pArray->nDimensions = nDimensions; - pArray->nTotalElements = nElements; - pArray->pDimensions = pDimensions; - - typelib_typedescriptionreference_acquire(pElementTypeRef); - ((typelib_IndirectTypeDescription*)pArray)->pType = pElementTypeRef; - - pReg->pWeakRef = (typelib_TypeDescriptionReference *)pReg; - // sizeof( void ) not allowed - pReg->nSize = ::typelib_typedescription_getAlignedUnoSize( pReg, 0, pReg->nAlignment ); - pReg->nAlignment = ::adjustAlignment( pReg->nAlignment ); - pReg->bComplete = sal_True; - - ::typelib_typedescription_register( &pReg ); - *ppRef = (typelib_TypeDescriptionReference *)pReg; - assert( *ppRef == pReg->pWeakRef ); - } else - delete [] pDimensions; - // another static ref: - ++((*ppRef)->nStaticRefCount); - } - } -} - } // extern "C" } diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 585b6c5c8ec4..4afb43821e45 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -116,18 +116,10 @@ static inline sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass ) // the new description switch( eTypeClass ) { - case typelib_TypeClass_ARRAY: - nSize = (sal_Int32)sizeof( typelib_ArrayTypeDescription ); - break; - case typelib_TypeClass_SEQUENCE: nSize = (sal_Int32)sizeof( typelib_IndirectTypeDescription ); break; - case typelib_TypeClass_UNION: - nSize = (sal_Int32)sizeof( typelib_UnionTypeDescription ); - break; - case typelib_TypeClass_STRUCT: nSize = (sal_Int32)sizeof( typelib_StructTypeDescription ); break; @@ -211,9 +203,7 @@ struct TypeDescriptor_Init_Impl // only for debugging sal_Int32 nTypeDescriptionCount; sal_Int32 nCompoundTypeDescriptionCount; - sal_Int32 nUnionTypeDescriptionCount; sal_Int32 nIndirectTypeDescriptionCount; - sal_Int32 nArrayTypeDescriptionCount; sal_Int32 nEnumTypeDescriptionCount; sal_Int32 nInterfaceMethodTypeDescriptionCount; sal_Int32 nInterfaceAttributeTypeDescriptionCount; @@ -225,8 +215,8 @@ struct TypeDescriptor_Init_Impl pWeakMap(0), pCallbacks(0), pCache(0), pMutex(0) #if OSL_DEBUG_LEVEL > 1 , nTypeDescriptionCount(0), nCompoundTypeDescriptionCount(0), - nUnionTypeDescriptionCount(0), nIndirectTypeDescriptionCount(0), - nArrayTypeDescriptionCount(0), nEnumTypeDescriptionCount(0), + nIndirectTypeDescriptionCount(0), + nEnumTypeDescriptionCount(0), nInterfaceMethodTypeDescriptionCount(0), nInterfaceAttributeTypeDescriptionCount(0), nInterfaceTypeDescriptionCount(0), nTypeDescriptionReferenceCount(0) @@ -335,9 +325,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW(()) #if OSL_DEBUG_LEVEL > 1 OSL_ENSURE( !nTypeDescriptionCount, "### nTypeDescriptionCount is not zero" ); OSL_ENSURE( !nCompoundTypeDescriptionCount, "### nCompoundTypeDescriptionCount is not zero" ); - OSL_ENSURE( !nUnionTypeDescriptionCount, "### nUnionTypeDescriptionCount is not zero" ); OSL_ENSURE( !nIndirectTypeDescriptionCount, "### nIndirectTypeDescriptionCount is not zero" ); - OSL_ENSURE( !nArrayTypeDescriptionCount, "### nArrayTypeDescriptionCount is not zero" ); OSL_ENSURE( !nEnumTypeDescriptionCount, "### nEnumTypeDescriptionCount is not zero" ); OSL_ENSURE( !nInterfaceMethodTypeDescriptionCount, "### nInterfaceMethodTypeDescriptionCount is not zero" ); OSL_ENSURE( !nInterfaceAttributeTypeDescriptionCount, "### nInterfaceAttributeTypeDescriptionCount is not zero" ); @@ -491,7 +479,6 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { { OSL_ASSERT( (typelib_TypeClass_STRUCT == (*ppTypeDescr)->eTypeClass || typelib_TypeClass_EXCEPTION == (*ppTypeDescr)->eTypeClass || - typelib_TypeClass_UNION == (*ppTypeDescr)->eTypeClass || typelib_TypeClass_ENUM == (*ppTypeDescr)->eTypeClass || typelib_TypeClass_INTERFACE == (*ppTypeDescr)->eTypeClass) && !reallyWeak( (*ppTypeDescr)->eTypeClass ) ); @@ -593,21 +580,6 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( typelib_TypeDescription * pRet; switch( eTypeClass ) { - case typelib_TypeClass_ARRAY: - { - typelib_ArrayTypeDescription * pTmp = new typelib_ArrayTypeDescription(); - typelib_IndirectTypeDescription * pIndirect = (typelib_IndirectTypeDescription *)pTmp; - pRet = (typelib_TypeDescription *)pTmp; -#if OSL_DEBUG_LEVEL > 1 - osl_atomic_increment( &Init::get().nArrayTypeDescriptionCount ); -#endif - pIndirect->pType = 0; - pTmp->nDimensions = 0; - pTmp->nTotalElements = 0; - pTmp->pDimensions = 0; - } - break; - case typelib_TypeClass_SEQUENCE: { typelib_IndirectTypeDescription * pTmp = new typelib_IndirectTypeDescription(); @@ -619,23 +591,6 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( } break; - case typelib_TypeClass_UNION: - { - typelib_UnionTypeDescription * pTmp; - pTmp = new typelib_UnionTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; -#if OSL_DEBUG_LEVEL > 1 - osl_atomic_increment( &Init::get().nUnionTypeDescriptionCount ); -#endif - pTmp->nMembers = 0; - pTmp->pDiscriminantTypeRef = 0; - pTmp->pDiscriminants = 0; - pTmp->ppTypeRefs = 0; - pTmp->ppMemberNames = 0; - pTmp->pDefaultTypeRef = 0; - } - break; - case typelib_TypeClass_STRUCT: { // FEATURE_EMPTYCLASS @@ -920,59 +875,6 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newStruct( } //------------------------------------------------------------------------ -extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newUnion( - typelib_TypeDescription ** ppRet, - rtl_uString * pTypeName, - typelib_TypeDescriptionReference * pDiscriminantTypeRef, - sal_Int64 nDefaultDiscriminant, - typelib_TypeDescriptionReference * pDefaultTypeRef, - sal_Int32 nMembers, - typelib_Union_Init * pMembers ) - SAL_THROW_EXTERN_C() -{ - typelib_typedescription_newEmpty( ppRet, typelib_TypeClass_UNION, pTypeName ); - // discriminant type - typelib_UnionTypeDescription * pTmp = (typelib_UnionTypeDescription *)*ppRet; - typelib_typedescriptionreference_acquire( pTmp->pDiscriminantTypeRef = pDiscriminantTypeRef ); - - sal_Int32 nPos; - - pTmp->nMembers = nMembers; - // default discriminant - if (nMembers) - { - pTmp->pDiscriminants = new sal_Int64[ nMembers ]; - for ( nPos = nMembers; nPos--; ) - { - pTmp->pDiscriminants[nPos] = pMembers[nPos].nDiscriminant; - } - } - // default default discriminant - pTmp->nDefaultDiscriminant = nDefaultDiscriminant; - - // union member types - pTmp->ppTypeRefs = new typelib_TypeDescriptionReference *[ nMembers ]; - for ( nPos = nMembers; nPos--; ) - { - typelib_typedescriptionreference_acquire( pTmp->ppTypeRefs[nPos] = pMembers[nPos].pTypeRef ); - } - // union member names - pTmp->ppMemberNames = new rtl_uString *[ nMembers ]; - for ( nPos = nMembers; nPos--; ) - { - rtl_uString_acquire( pTmp->ppMemberNames[nPos] = pMembers[nPos].pMemberName ); - } - - // default union type - typelib_typedescriptionreference_acquire( pTmp->pDefaultTypeRef = pDefaultTypeRef ); - - if (! reallyWeak( typelib_TypeClass_UNION )) - (*ppRet)->pWeakRef = (typelib_TypeDescriptionReference *)*ppRet; - (*ppRet)->nSize = typelib_typedescription_getAlignedUnoSize( (*ppRet), 0, (*ppRet)->nAlignment ); - (*ppRet)->nAlignment = adjustAlignment( (*ppRet)->nAlignment ); -} - -//------------------------------------------------------------------------ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newEnum( typelib_TypeDescription ** ppRet, rtl_uString * pTypeName, @@ -1002,44 +904,6 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newEnum( } //------------------------------------------------------------------------ -extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newArray( - typelib_TypeDescription ** ppRet, - typelib_TypeDescriptionReference * pElementTypeRef, - sal_Int32 nDimensions, - sal_Int32 * pDimensions ) - SAL_THROW_EXTERN_C () -{ - OUStringBuffer aBuf( 32 ); - aBuf.append( pElementTypeRef->pTypeName ); - sal_Int32 nElements = 1; - for (sal_Int32 i=0; i < nDimensions; i++) - { - aBuf.appendAscii("["); - aBuf.append(pDimensions[i]); - aBuf.appendAscii("]"); - nElements *= pDimensions[i]; - } - OUString aTypeName( aBuf.makeStringAndClear() ); - - - typelib_typedescription_newEmpty( ppRet, typelib_TypeClass_ARRAY, aTypeName.pData ); - typelib_ArrayTypeDescription * pArray = (typelib_ArrayTypeDescription *)*ppRet; - - pArray->nDimensions = nDimensions; - pArray->nTotalElements = nElements; - pArray->pDimensions = new sal_Int32[ nDimensions ]; - ::memcpy( pArray->pDimensions, pDimensions, nDimensions * sizeof(sal_Int32) ); - - typelib_typedescriptionreference_acquire(pElementTypeRef); - ((typelib_IndirectTypeDescription*)pArray)->pType = pElementTypeRef; - - (*ppRet)->pWeakRef = (typelib_TypeDescriptionReference *)*ppRet; - // sizeof( void ) not allowed - (*ppRet)->nSize = typelib_typedescription_getAlignedUnoSize( *ppRet, 0, (*ppRet)->nAlignment ); - (*ppRet)->nAlignment = adjustAlignment( (*ppRet)->nAlignment ); -} - -//------------------------------------------------------------------------ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newInterface( typelib_InterfaceTypeDescription ** ppRet, rtl_uString * pTypeName, @@ -1449,38 +1313,10 @@ static inline void typelib_typedescription_destructExtendedMembers( switch( pTD->eTypeClass ) { - case typelib_TypeClass_ARRAY: - if( ((typelib_IndirectTypeDescription*)pTD)->pType ) - typelib_typedescriptionreference_release( ((typelib_IndirectTypeDescription*)pTD)->pType ); - delete [] ((typelib_ArrayTypeDescription *)pTD)->pDimensions; - break; case typelib_TypeClass_SEQUENCE: if( ((typelib_IndirectTypeDescription*)pTD)->pType ) typelib_typedescriptionreference_release( ((typelib_IndirectTypeDescription*)pTD)->pType ); break; - case typelib_TypeClass_UNION: - { - typelib_UnionTypeDescription * pUnionTD = (typelib_UnionTypeDescription *)pTD; - typelib_typedescriptionreference_release( pUnionTD->pDiscriminantTypeRef ); - typelib_typedescriptionreference_release( pUnionTD->pDefaultTypeRef ); - - sal_Int32 nPos; - typelib_TypeDescriptionReference ** ppTypeRefs = pUnionTD->ppTypeRefs; - for ( nPos = pUnionTD->nMembers; nPos--; ) - { - typelib_typedescriptionreference_release( ppTypeRefs[nPos] ); - } - - rtl_uString ** ppMemberNames = pUnionTD->ppMemberNames; - for ( nPos = pUnionTD->nMembers; nPos--; ) - { - rtl_uString_release( ppMemberNames[nPos] ); - } - delete [] pUnionTD->ppMemberNames; - delete [] pUnionTD->pDiscriminants; - delete [] pUnionTD->ppTypeRefs; - } - break; case typelib_TypeClass_STRUCT: delete[] reinterpret_cast< typelib_StructTypeDescription * >(pTD)-> pParameterizedTypes; @@ -1618,15 +1454,9 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_release( #if OSL_DEBUG_LEVEL > 1 switch( pTD->eTypeClass ) { - case typelib_TypeClass_ARRAY: - osl_atomic_decrement( &rInit.nArrayTypeDescriptionCount ); - break; case typelib_TypeClass_SEQUENCE: osl_atomic_decrement( &rInit.nIndirectTypeDescriptionCount ); break; - case typelib_TypeClass_UNION: - osl_atomic_decrement( &rInit.nUnionTypeDescriptionCount ); - break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: osl_atomic_decrement( &rInit.nCompoundTypeDescriptionCount ); @@ -1830,24 +1660,6 @@ extern "C" sal_Int32 SAL_CALL typelib_typedescription_getAlignedUnoSize( // FEATURE_INTERFACE nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( void * )); break; - case typelib_TypeClass_UNION: - { - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof(sal_Int64)); - for ( sal_Int32 nPos = ((typelib_UnionTypeDescription *)pTypeDescription)->nMembers; nPos--; ) - { - typelib_TypeDescription * pTD = 0; - TYPELIB_DANGER_GET( &pTD, ((typelib_UnionTypeDescription *)pTypeDescription)->ppTypeRefs[nPos] ); - sal_Int32 nMaxIntegralTypeSize; - sal_Int32 nMemberSize = typelib_typedescription_getAlignedUnoSize( pTD, (sal_Int32)(sizeof(sal_Int64)), nMaxIntegralTypeSize ); - TYPELIB_DANGER_RELEASE( pTD ); - if (nSize < nMemberSize) - nSize = nMemberSize; - if (rMaxIntegralTypeSize < nMaxIntegralTypeSize) - rMaxIntegralTypeSize = nMaxIntegralTypeSize; - } - ((typelib_UnionTypeDescription *)pTypeDescription)->nValueOffset = rMaxIntegralTypeSize; - } - break; case typelib_TypeClass_ENUM: nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( typelib_TypeClass )); break; @@ -1900,15 +1712,6 @@ extern "C" sal_Int32 SAL_CALL typelib_typedescription_getAlignedUnoSize( nSize += nStructSize; } break; - case typelib_TypeClass_ARRAY: - { - typelib_TypeDescription * pTD = 0; - TYPELIB_DANGER_GET( &pTD, ((typelib_IndirectTypeDescription *)pTypeDescription)->pType ); - rMaxIntegralTypeSize = pTD->nSize; - TYPELIB_DANGER_RELEASE( pTD ); - nSize = ((typelib_ArrayTypeDescription *)pTypeDescription)->nTotalElements * rMaxIntegralTypeSize; - } - break; case typelib_TypeClass_SEQUENCE: nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( void * )); break; diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx index 66b065cb834b..655fe4c6d2e4 100644 --- a/cppu/source/uno/assign.hxx +++ b/cppu/source/uno/assign.hxx @@ -101,128 +101,6 @@ inline sal_Bool _assignStruct( return sal_True; } //-------------------------------------------------------------------------------------------------- -inline sal_Bool _assignArray( - void * pDest, void * pSource, - typelib_ArrayTypeDescription * pTypeDescr, - uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release ) -{ - typelib_TypeDescriptionReference * pElementTypeRef = - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; - typelib_TypeDescription * pElementTypeDescr = NULL; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementTypeRef ); - sal_Int32 nTotalElements = pTypeDescr->nTotalElements; - sal_Int32 nElementSize = pElementTypeDescr->nSize; - sal_Int32 i; - sal_Bool bRet = sal_False; - - switch ( pElementTypeRef->eTypeClass ) - { - case typelib_TypeClass_CHAR: - case typelib_TypeClass_BOOLEAN: - case typelib_TypeClass_BYTE: - case typelib_TypeClass_SHORT: - case typelib_TypeClass_UNSIGNED_SHORT: - case typelib_TypeClass_LONG: - case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_HYPER: - case typelib_TypeClass_UNSIGNED_HYPER: - case typelib_TypeClass_FLOAT: - case typelib_TypeClass_DOUBLE: - for (i=0; i < nTotalElements; i++) - { - memcpy((sal_Char *)pDest + i * nElementSize, - (sal_Char *)pSource + i * nElementSize, - nElementSize); - } - bRet = sal_True; - break; - case typelib_TypeClass_STRING: - for (i=0; i < nTotalElements; i++) - { - ::rtl_uString_assign( (rtl_uString **)pDest + i, - ((rtl_uString **)pSource)[i] ); - } - bRet = sal_True; - break; - case typelib_TypeClass_TYPE: - for (i=0; i < nTotalElements; i++) - { - typelib_TypeDescriptionReference ** pp = (typelib_TypeDescriptionReference **)pDest + i; - ::typelib_typedescriptionreference_release( *pp ); - *pp = *((typelib_TypeDescriptionReference **)pSource + i); - TYPE_ACQUIRE( *pp ); - } - bRet = sal_True; - break; - case typelib_TypeClass_ANY: - for (i=0; i < nTotalElements; i++) - { - _destructAny( (uno_Any *)pDest + i, release ); - _copyConstructAny( (uno_Any *)pDest + i, (uno_Any *)pSource + i, - pElementTypeRef, pElementTypeDescr, acquire, 0 ); - } - bRet = sal_True; - break; - case typelib_TypeClass_ENUM: - for (i=0; i < nTotalElements; i++) - { - *((sal_Int32 *)pDest + i) = *((sal_Int32 *)pSource + i); - } - bRet = sal_True; - break; - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - for (i=0; i < nTotalElements; i++) - { - bRet = _assignStruct( (sal_Char *)pDest + i * nElementSize, - (sal_Char *)pSource + i * nElementSize, - (typelib_CompoundTypeDescription *)pElementTypeDescr, - queryInterface, acquire, release ); - if (! bRet) - break; - } - bRet = sal_True; - break; - case typelib_TypeClass_UNION: - for (i=0; i < nTotalElements; i++) - { - _destructUnion( (sal_Char*)pDest + i * nElementSize, pElementTypeDescr, release ); - _copyConstructUnion( (sal_Char*)pDest + i * nElementSize, - (sal_Char*)pSource + i * nElementSize, - pElementTypeDescr, acquire, 0 ); - } - bRet = sal_True; - break; - case typelib_TypeClass_SEQUENCE: - for (i=0; i < nTotalElements; i++) - { - osl_atomic_increment( &(*((uno_Sequence **)pSource + i))->nRefCount ); - idestructSequence( - *((uno_Sequence **)pDest + i), - pElementTypeRef, pElementTypeDescr, release ); - *((uno_Sequence **)pDest + i) = *((uno_Sequence **)pSource + i); - } - bRet = sal_True; - break; - case typelib_TypeClass_INTERFACE: - for (i=0; i < nTotalElements; i++) - { - _assignInterface( - (void **)((sal_Char*)pDest + i * nElementSize), - *(void **)((sal_Char*)pSource + i * nElementSize), - acquire, release ); - } - bRet = sal_True; - break; - default: - OSL_ASSERT(false); - break; - } - - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - return bRet; -} -//-------------------------------------------------------------------------------------------------- inline sal_Bool _assignData( void * pDest, typelib_TypeDescriptionReference * pDestType, typelib_TypeDescription * pDestTypeDescr, @@ -516,47 +394,6 @@ inline sal_Bool _assignData( return bRet; } return sal_False; - case typelib_TypeClass_ARRAY: - { - sal_Bool bRet = sal_False; - if (pSourceTypeDescr) - { - typelib_ArrayTypeDescription * pTypeDescr = - (typelib_ArrayTypeDescription *)pSourceTypeDescr; - bRet = _assignArray( pDest, pSource, pTypeDescr, queryInterface, acquire, release ); - } - else - { - TYPELIB_DANGER_GET( &pSourceTypeDescr, pSourceType ); - typelib_ArrayTypeDescription * pTypeDescr = - (typelib_ArrayTypeDescription *)pSourceTypeDescr; - if ( pTypeDescr ) - { - bRet = _assignArray( - pDest, pSource, pTypeDescr, queryInterface, acquire, release ); - } - TYPELIB_DANGER_RELEASE( pSourceTypeDescr ); - } - return bRet; - } - case typelib_TypeClass_UNION: - if (_type_equals( pDestType, pSourceType )) - { - if (pDestTypeDescr) - { - _destructUnion( pDest, pDestTypeDescr, release ); - _copyConstructUnion( pDest, pSource, pDestTypeDescr, acquire, 0 ); - } - else - { - TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType ); - _destructUnion( pDest, pDestTypeDescr, release ); - _copyConstructUnion( pDest, pSource, pDestTypeDescr, acquire, 0 ); - TYPELIB_DANGER_RELEASE( pDestTypeDescr ); - } - return sal_True; - } - return sal_False; case typelib_TypeClass_SEQUENCE: if (typelib_TypeClass_SEQUENCE != pSourceType->eTypeClass) return sal_False; diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx index dd0343a5247f..186520749d11 100644 --- a/cppu/source/uno/constr.hxx +++ b/cppu/source/uno/constr.hxx @@ -29,17 +29,6 @@ namespace cppu //#### construction ################################################################################ //################################################################################################## -//-------------------------------------------------------------------------------------------------- -inline void _defaultConstructUnion( - void * pMem, - typelib_TypeDescription * pTypeDescr ) - SAL_THROW(()) -{ - ::uno_type_constructData( - (char *)pMem + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - ((typelib_UnionTypeDescription *)pTypeDescr)->pDefaultTypeRef ); - *(sal_Int64 *)pMem = ((typelib_UnionTypeDescription *)pTypeDescr)->nDefaultDiscriminant; -} //================================================================================================== void defaultConstructStruct( void * pMem, @@ -67,87 +56,6 @@ inline void _defaultConstructStruct( } //-------------------------------------------------------------------------------------------------- -inline void _defaultConstructArray( - void * pMem, - typelib_ArrayTypeDescription * pTypeDescr ) -{ - typelib_TypeDescription * pElementType = NULL; - TYPELIB_DANGER_GET( &pElementType, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType ); - sal_Int32 nTotalElements = pTypeDescr->nTotalElements; - sal_Int32 nElementSize = pElementType->nSize; - sal_Int32 i; - switch ( pElementType->eTypeClass ) - { - case typelib_TypeClass_CHAR: - case typelib_TypeClass_BOOLEAN: - case typelib_TypeClass_BYTE: - case typelib_TypeClass_SHORT: - case typelib_TypeClass_UNSIGNED_SHORT: - case typelib_TypeClass_LONG: - case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_HYPER: - case typelib_TypeClass_UNSIGNED_HYPER: - case typelib_TypeClass_FLOAT: - case typelib_TypeClass_DOUBLE: - case typelib_TypeClass_INTERFACE: - memset(pMem, 0, nElementSize * nTotalElements); - break; - - case typelib_TypeClass_STRING: - for (i=0; i < nTotalElements; i++) - { - rtl_uString** ppElement = (rtl_uString **)pMem + i; - *ppElement = 0; - rtl_uString_new( ppElement); - } - break; - case typelib_TypeClass_TYPE: - for (i=0; i < nTotalElements; i++) - { - typelib_TypeDescriptionReference** ppElement = (typelib_TypeDescriptionReference **)pMem + i; - *ppElement = _getVoidType(); - } - break; - case typelib_TypeClass_ANY: - for (i=0; i < nTotalElements; i++) - { - CONSTRUCT_EMPTY_ANY( (uno_Any *)pMem + i ); - } - break; - case typelib_TypeClass_ENUM: - for (i=0; i < nTotalElements; i++) - { - *((sal_Int32 *)pMem + i) = ((typelib_EnumTypeDescription *)pElementType)->nDefaultEnumValue; - } - break; - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - for (i=0; i < nTotalElements; i++) - { - _defaultConstructStruct( (sal_Char*)pMem + i * nElementSize, (typelib_CompoundTypeDescription *)pElementType ); - } - break; - case typelib_TypeClass_UNION: - for (i=0; i < nTotalElements; i++) - { - _defaultConstructUnion( (sal_Char*)pMem + i * nElementSize, pElementType ); - } - break; - case typelib_TypeClass_SEQUENCE: - for (i=0; i < nTotalElements; i++) - { - uno_Sequence** ppElement = (uno_Sequence **)pMem + i; - *ppElement = createEmptySequence(); - } - break; - default: - OSL_ASSERT(false); - break; - } - TYPELIB_DANGER_RELEASE( pElementType ); -} - -//-------------------------------------------------------------------------------------------------- inline void _defaultConstructData( void * pMem, typelib_TypeDescriptionReference * pType, @@ -218,30 +126,6 @@ inline void _defaultConstructData( TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; - case typelib_TypeClass_ARRAY: - if (pTypeDescr) - { - _defaultConstructArray( pMem, (typelib_ArrayTypeDescription *)pTypeDescr ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _defaultConstructArray( pMem, (typelib_ArrayTypeDescription *)pTypeDescr ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; - case typelib_TypeClass_UNION: - if (pTypeDescr) - { - _defaultConstructUnion( pMem, pTypeDescr ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _defaultConstructUnion( pMem, pTypeDescr ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; case typelib_TypeClass_SEQUENCE: *(uno_Sequence **)pMem = createEmptySequence(); break; diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index fb9adb3c2452..b3b536e03f48 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -95,65 +95,6 @@ inline void _copyConstructStruct( } } } -//-------------------------------------------------------------------------------------------------- -inline void _copyConstructArray( - void * pDest, void * pSource, - typelib_ArrayTypeDescription * pTypeDescr, - uno_AcquireFunc acquire, uno_Mapping * mapping ) -{ - typelib_TypeDescriptionReference * pElementTypeRef = ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; - typelib_TypeDescription * pElementTypeDescr = NULL; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementTypeRef ); - sal_Int32 nElementSize = ((typelib_TypeDescription*)pElementTypeDescr)->nSize; - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - sal_Int32 nTotalElements = pTypeDescr->nTotalElements; - - if (mapping) - { - for(sal_Int32 i = 0; i < nTotalElements; i++) - { - ::uno_type_copyAndConvertData( - (sal_Char *)pDest + i * nElementSize, - (sal_Char *)pSource + i * nElementSize, - pElementTypeRef, mapping ); - } - } - else - { - for(sal_Int32 i = 0; i < nTotalElements; i++) - { - ::uno_type_copyData( - (sal_Char *)pDest + (i * nElementSize), - (sal_Char *)pSource + (i * nElementSize), - pElementTypeRef, acquire ); - } - } -} -//-------------------------------------------------------------------------------------------------- -inline void _copyConstructUnion( - void * pDest, void * pSource, - typelib_TypeDescription * pTypeDescr, - uno_AcquireFunc acquire, uno_Mapping * mapping ) - SAL_THROW (()) -{ - typelib_TypeDescriptionReference * pSetType = _unionGetSetType( pSource, pTypeDescr ); - if (mapping) - { - ::uno_type_copyAndConvertData( - (char *)pDest + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - (char *)pSource + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - pSetType, mapping ); - } - else - { - ::uno_type_copyData( - (char *)pDest + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - (char *)pSource + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - pSetType, acquire ); - } - *(sal_Int64 *)pDest = *(sal_Int64 *)pSource; - typelib_typedescriptionreference_release( pSetType ); -} //------------------------------------------------------------------------------ uno_Sequence * copyConstructSequence( @@ -256,40 +197,6 @@ inline void _copyConstructAnyFromData( TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; - case typelib_TypeClass_ARRAY: - if (pTypeDescr) - { - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _copyConstructArray( - pDestAny->pData, pSource, - (typelib_ArrayTypeDescription *)pTypeDescr, - acquire, mapping ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _copyConstructArray( - pDestAny->pData, pSource, - (typelib_ArrayTypeDescription *)pTypeDescr, - acquire, mapping ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; - case typelib_TypeClass_UNION: - if (pTypeDescr) - { - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _copyConstructUnion( pDestAny->pData, pSource, pTypeDescr, acquire, mapping ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _copyConstructUnion( pDestAny->pData, pSource, pTypeDescr, acquire, mapping ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; case typelib_TypeClass_SEQUENCE: pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) @@ -450,36 +357,6 @@ inline void _copyConstructAny( TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; - case typelib_TypeClass_ARRAY: - if (pTypeDescr) - { - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _defaultConstructArray( - pDestAny->pData, (typelib_ArrayTypeDescription *)pTypeDescr ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _defaultConstructArray( - pDestAny->pData, (typelib_ArrayTypeDescription *)pTypeDescr ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; - case typelib_TypeClass_UNION: - if (pTypeDescr) - { - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _defaultConstructUnion( pDestAny->pData, pTypeDescr ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); - _defaultConstructUnion( pDestAny->pData, pTypeDescr ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; case typelib_TypeClass_SEQUENCE: pDestAny->pData = &pDestAny->pReserved; *(uno_Sequence **)pDestAny->pData = createEmptySequence(); @@ -568,60 +445,6 @@ inline uno_Sequence * icopyConstructSequence( TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } - case typelib_TypeClass_ARRAY: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - char * pSourceElements = pSource->elements; - pDest = allocSeq( nElementSize, nElements ); - if (pDest != 0) - { - char * pElements = pDest->elements; - for ( sal_Int32 nPos = nElements; nPos--; ) - { - _copyConstructArray( - pElements + (nPos * nElementSize), - pSourceElements + (nPos * nElementSize), - (typelib_ArrayTypeDescription *)pElementTypeDescr, - acquire, mapping ); - } - } - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - break; - } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - sal_Int32 nValueOffset = - ((typelib_UnionTypeDescription *) - pElementTypeDescr)->nValueOffset; - pDest = allocSeq( nElementSize, nElements ); - if (pDest != 0) - { - char * pElements = pDest->elements; - char * pSourceElements = pSource->elements; - for ( sal_Int32 nPos = nElements; nPos--; ) - { - char * pDest2 = - pElements + (nPos * nElementSize); - char * pSource2 = - pSourceElements + (nPos * nElementSize); - - typelib_TypeDescriptionReference * pSetType = - _unionGetSetType( pSource2, pElementTypeDescr ); - ::uno_type_copyAndConvertData( - pDest2 + nValueOffset, pSource2 + nValueOffset, - pSetType, mapping ); - *(sal_Int64 *)pDest2 = *(sal_Int64 *)pSource2; - ::typelib_typedescriptionreference_release( pSetType ); - } - } - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - break; - } case typelib_TypeClass_SEQUENCE: // sequence of sequence { pDest = allocSeq( sizeof (uno_Sequence *), nElements ); @@ -765,36 +588,6 @@ inline void _copyConstructData( TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; - case typelib_TypeClass_ARRAY: - if (pTypeDescr) - { - _copyConstructArray( - pDest, pSource, - (typelib_ArrayTypeDescription *)pTypeDescr, - acquire, mapping ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _copyConstructArray( - pDest, pSource, - (typelib_ArrayTypeDescription *)pTypeDescr, - acquire, mapping ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; - case typelib_TypeClass_UNION: - if (pTypeDescr) - { - _copyConstructUnion( pDest, pSource, pTypeDescr, acquire, mapping ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _copyConstructUnion( pDest, pSource, pTypeDescr, acquire, mapping ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; case typelib_TypeClass_SEQUENCE: if (mapping) { diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index f3bc26ff3927..c02e7cf7a267 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -29,19 +29,6 @@ namespace cppu //#### destruction ################################################################################# //################################################################################################## -//-------------------------------------------------------------------------------------------------- -inline void _destructUnion( - void * pValue, - typelib_TypeDescription * pTypeDescr, - uno_ReleaseFunc release ) - SAL_THROW(()) -{ - typelib_TypeDescriptionReference * pType = _unionGetSetType( pValue, pTypeDescr ); - ::uno_type_destructData( - (char *)pValue + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, - pType, release ); - ::typelib_typedescriptionreference_release( pType ); -} //================================================================================================== void destructStruct( void * pValue, @@ -71,29 +58,6 @@ inline void _destructStruct( } } -//-------------------------------------------------------------------------------------------------- -inline void _destructArray( - void * pValue, - typelib_ArrayTypeDescription * pTypeDescr, - uno_ReleaseFunc release ) - throw () -{ - typelib_TypeDescription * pElementType = NULL; - TYPELIB_DANGER_GET( &pElementType, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType ); - sal_Int32 nElementSize = pElementType->nSize; - TYPELIB_DANGER_RELEASE( pElementType ); - - sal_Int32 nTotalElements = pTypeDescr->nTotalElements; - for(sal_Int32 i=0; i < nTotalElements; i++) - { - ::uno_type_destructData( - (sal_Char *)pValue + i * nElementSize, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, release ); - } - - typelib_typedescriptionreference_release(((typelib_IndirectTypeDescription *)pTypeDescr)->pType); -} - //============================================================================== void destructSequence( uno_Sequence * pSequence, @@ -155,15 +119,6 @@ inline void _destructAny( ::rtl_freeMemory( pAny->pData ); break; } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pTypeDescr = 0; - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _destructUnion( pAny->pData, pTypeDescr, release ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - ::rtl_freeMemory( pAny->pData ); - break; - } case typelib_TypeClass_SEQUENCE: { destructSequence( @@ -257,22 +212,6 @@ inline sal_Int32 idestructElements( TYPELIB_DANGER_RELEASE( pElementTypeDescr ); return nSize; } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) - { - _destructUnion( - (char *)pElements + (nElementSize * nPos), - pElementTypeDescr, - release ); - } - sal_Int32 nSize = pElementTypeDescr->nSize; - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - return nSize; - } case typelib_TypeClass_SEQUENCE: { typelib_TypeDescription * pElementTypeDescr = 0; @@ -387,30 +326,6 @@ inline void _destructData( TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; - case typelib_TypeClass_ARRAY: - if (pTypeDescr) - { - _destructArray( pValue, (typelib_ArrayTypeDescription *)pTypeDescr, release ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _destructArray( pValue, (typelib_ArrayTypeDescription *)pTypeDescr, release ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; - case typelib_TypeClass_UNION: - if (pTypeDescr) - { - _destructUnion( pValue, pTypeDescr, release ); - } - else - { - TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _destructUnion( pValue, pTypeDescr, release ); - TYPELIB_DANGER_RELEASE( pTypeDescr ); - } - break; case typelib_TypeClass_SEQUENCE: { idestructSequence( diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index a3a26bf08ba9..c1496cb77900 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -226,32 +226,6 @@ inline sal_Bool _equalSequence( TYPELIB_DANGER_RELEASE( pElementTypeDescr ); return sal_True; } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - sal_Int32 nValueOffset = ((typelib_UnionTypeDescription *)pElementTypeDescr)->nValueOffset; - for ( sal_Int32 nPos = nElements; nPos--; ) - { - char * pDest2 = (char *)pDestElements + (nPos * nElementSize); - char * pSource2 = (char *)pSourceElements + (nPos * nElementSize); - typelib_TypeDescriptionReference * pSetType = _unionGetSetType( - pDest2, pElementTypeDescr ); - sal_Bool bRet = ::uno_type_equalData( - pDest2 + nValueOffset, pSetType, - pSource2 + nValueOffset, pSetType, - queryInterface, release ); - ::typelib_typedescriptionreference_release( pSetType ); - if (! bRet) - { - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - return sal_False; - } - } - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - return sal_True; - } case typelib_TypeClass_SEQUENCE: // sequence of sequence { typelib_TypeDescription * pElementTypeDescr = 0; @@ -586,40 +560,6 @@ inline sal_Bool _equalData( TYPELIB_DANGER_RELEASE( pDestTypeDescr ); return bRet; } - case typelib_TypeClass_UNION: - if (_type_equals( pDestType, pSourceType ) && - *(sal_Int64 *)pDest == *(sal_Int64 *)pSource) // same discriminant - { - sal_Bool bRet; - if (pDestTypeDescr) - { - typelib_TypeDescriptionReference * pSetType = _unionGetSetType( - pDest, pDestTypeDescr ); - bRet = ::uno_type_equalData( - (char *)pDest + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset, - pSetType, - (char *)pSource + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset, - pSetType, - queryInterface, release ); - typelib_typedescriptionreference_release( pSetType ); - } - else - { - TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType ); - typelib_TypeDescriptionReference * pSetType = _unionGetSetType( - pDest, pDestTypeDescr ); - bRet = ::uno_type_equalData( - (char *)pDest + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset, - pSetType, - (char *)pSource + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset, - pSetType, - queryInterface, release ); - typelib_typedescriptionreference_release( pSetType ); - TYPELIB_DANGER_RELEASE( pDestTypeDescr ); - } - return bRet; - } - return sal_False; case typelib_TypeClass_SEQUENCE: if (_type_equals( pDestType, pSourceType )) { diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index b40dac398eb3..5be342a6ca25 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -151,32 +151,6 @@ extern "C" void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * pDestType ); //-------------------------------------------------------------------------------------------------- -inline typelib_TypeDescriptionReference * _unionGetSetType( - void * pUnion, typelib_TypeDescription * pTD ) - SAL_THROW(()) -{ - typelib_TypeDescriptionReference * pRet = 0; - sal_Int32 nPos; - - sal_Int64 * pDiscr = ((typelib_UnionTypeDescription *)pTD)->pDiscriminants; - sal_Int64 nDiscr = *(sal_Int64 *)pUnion; - for ( nPos = ((typelib_UnionTypeDescription *)pTD)->nMembers; nPos--; ) - { - if (pDiscr[nPos] == nDiscr) - { - pRet = ((typelib_UnionTypeDescription *)pTD)->ppTypeRefs[nPos]; - break; - } - } - if (nPos >= 0) - { - // default - pRet = ((typelib_UnionTypeDescription *)pTD)->pDefaultTypeRef; - } - typelib_typedescriptionreference_acquire( pRet ); - return pRet; -} -//-------------------------------------------------------------------------------------------------- inline sal_Bool _type_equals( typelib_TypeDescriptionReference * pType1, typelib_TypeDescriptionReference * pType2 ) SAL_THROW(()) diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index d570461f9297..03198c175353 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -265,65 +265,6 @@ static inline bool idefaultConstructElements( TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } - case typelib_TypeClass_ARRAY: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - - if (nAlloc >= 0) - pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) - { - char * pElements = pSeq->elements; - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) - { - _defaultConstructArray( - pElements + (nElementSize * nPos), - (typelib_ArrayTypeDescription *)pElementTypeDescr ); - } - } - - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - break; - } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - - if (nAlloc >= 0) - pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) - { - sal_Int32 nValueOffset = - ((typelib_UnionTypeDescription *) - pElementTypeDescr)->nValueOffset; - sal_Int64 nDefaultDiscr = - ((typelib_UnionTypeDescription *) - pElementTypeDescr)->nDefaultDiscriminant; - - typelib_TypeDescription * pDefaultTypeDescr = 0; - TYPELIB_DANGER_GET( - &pDefaultTypeDescr, - ((typelib_UnionTypeDescription *) - pElementTypeDescr)->pDefaultTypeRef ); - - char * pElements = pSeq->elements; - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) - { - char * pMem = pElements + (nElementSize * nPos); - ::uno_constructData( - (char *)pMem + nValueOffset, pDefaultTypeDescr ); - *(sal_Int64 *)pMem = nDefaultDiscr; - } - TYPELIB_DANGER_RELEASE( pDefaultTypeDescr ); - } - - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - break; - } case typelib_TypeClass_SEQUENCE: { if (nAlloc >= 0) @@ -588,42 +529,6 @@ static inline bool icopyConstructFromElements( TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } - case typelib_TypeClass_UNION: - { - typelib_TypeDescription * pElementTypeDescr = 0; - TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); - sal_Int32 nElementSize = pElementTypeDescr->nSize; - - if (nAlloc >= 0) - pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) - { - char * pDestElements = pSeq->elements; - - sal_Int32 nValueOffset = - ((typelib_UnionTypeDescription *) - pElementTypeDescr)->nValueOffset; - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) - { - char * pDest = - pDestElements + (nElementSize * nPos); - char * pSource = - (char *)pSourceElements + (nElementSize * nPos); - - typelib_TypeDescriptionReference * pSetType = _unionGetSetType( - pSource, pElementTypeDescr ); - ::uno_type_copyData( - pDest + nValueOffset, - pSource + nValueOffset, - pSetType, acquire ); - *(sal_Int64 *)pDest = *(sal_Int64 *)pSource; - typelib_typedescriptionreference_release( pSetType ); - } - } - - TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - break; - } case typelib_TypeClass_SEQUENCE: // sequence of sequence { if (nAlloc >= 0) diff --git a/include/com/sun/star/uno/Type.h b/include/com/sun/star/uno/Type.h index 0a6a21b83b6d..1b3775f259fb 100644 --- a/include/com/sun/star/uno/Type.h +++ b/include/com/sun/star/uno/Type.h @@ -377,49 +377,6 @@ inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * ) */ inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * ) SAL_THROW(()); -/** Array template function to get meta type for one-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW(()); -/** Array template function to get meta type for two-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW(()); -/** Array template function to get meta type for three-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW(()); -/** Array template function to get meta type for four-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW(()); -/** Array template function to get meta type for five-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW(()); -/** Array template function to get meta type for six-dimensional arrays. - - @param pT array pointer - @return type of array -*/ -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW(()); - /** Gets the meta type of an IDL type. The difference between this function template (with a type parameter) and diff --git a/include/com/sun/star/uno/Type.hxx b/include/com/sun/star/uno/Type.hxx index 7838c581ad22..e32a64594bdc 100644 --- a/include/com/sun/star/uno/Type.hxx +++ b/include/com/sun/star/uno/Type.hxx @@ -186,123 +186,6 @@ inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARA return ::cppu::UnoType< double >::get(); } -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( *pT ); - sal_Int32 size = sizeof( **pT ); - sal_Int32 dim1 = sizeof( *pT ) / size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 1, dim1 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( **pT ); - sal_Int32 size = sizeof( ***pT ); - sal_Int32 dim2 = sizeof( **pT ) / size; - sal_Int32 dim1 = sizeof( *pT ) / dim2 / size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 2, dim1, dim2 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( ***pT ); - sal_Int32 size = sizeof( ****pT ); - sal_Int32 dim3 = sizeof( ***pT ) / size; - sal_Int32 dim2 = sizeof( **pT ) / dim3 / size; - sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3)/ size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 3, dim1, dim2, dim3 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( ****pT ); - sal_Int32 size = sizeof( *****pT ); - sal_Int32 dim4 = sizeof( ****pT ) / size; - sal_Int32 dim3 = sizeof( ***pT ) / dim4 / size; - sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4) / size; - sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4) / size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 4, dim1, dim2, dim3, dim4 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( *****pT ); - sal_Int32 size = sizeof( ******pT ); - sal_Int32 dim5 = sizeof( *****pT ) / size; - sal_Int32 dim4 = sizeof( ****pT ) / dim5 / size; - sal_Int32 dim3 = sizeof( ***pT ) / (dim4 * dim5) / size; - sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5) / size; - sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5) / size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 5, dim1, dim2, dim3, dim4, dim5 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - -template< class T > -inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW(()) -{ - if (! ::com::sun::star::uno::Array< T >::s_pType) - { - const ::com::sun::star::uno::Type & rElementType = - ::cppu::getTypeFavourUnsigned( ******pT ); - sal_Int32 size = sizeof( *******pT ); - sal_Int32 dim6 = sizeof( ******pT ) / size; - sal_Int32 dim5 = sizeof( *****pT ) / dim6 / size; - sal_Int32 dim4 = sizeof( ****pT ) / (dim5 * dim6) / size; - sal_Int32 dim3 = sizeof( ***pT ) / (dim4 * dim5 * dim6) / size; - sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5 * dim6) / size; - sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5 * dim6) / size; - ::typelib_static_array_type_init( - & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(), - 6, dim1, dim2, dim3, dim4, dim5, dim6 ); - } - return * reinterpret_cast< const ::com::sun::star::uno::Type * >( - & ::com::sun::star::uno::Array< T >::s_pType ); -} - template< typename T > inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType() SAL_THROW(()) { diff --git a/include/typelib/typedescription.h b/include/typelib/typedescription.h index a7b06eca56f6..2b7314f20b6f 100644 --- a/include/typelib/typedescription.h +++ b/include/typelib/typedescription.h @@ -95,7 +95,7 @@ typedef struct _typelib_TypeDescription void * pReserved; /** flag to determine whether the description is complete: - compound and union types lack of member names, enums lack of member types and names, + compound types lack of member names, enums lack of member types and names, interfaces lack of members and table init. Call typelib_typedescription_complete() if false. */ @@ -165,42 +165,7 @@ typedef struct _typelib_StructTypeDescription sal_Bool * pParameterizedTypes; } typelib_StructTypeDescription; -/** Type description of a union. The type class of this description is typelib_TypeClass_UNION. -*/ -typedef struct _typelib_UnionTypeDescription -{ - /** inherits all members of typelib_TypeDescription - */ - typelib_TypeDescription aBase; - - /** type of the discriminant - */ - typelib_TypeDescriptionReference * pDiscriminantTypeRef; - - /** union default descriminant - */ - sal_Int64 nDefaultDiscriminant; - /** union default member type (may be 0) - */ - typelib_TypeDescriptionReference * pDefaultTypeRef; - /** number of union member types - */ - sal_Int32 nMembers; - /** union member discriminant values (same order as idl declaration) - */ - sal_Int64 * pDiscriminants; - /** union member value types (same order as idl declaration) - */ - typelib_TypeDescriptionReference ** ppTypeRefs; - /** union member value names (same order as idl declaration) - */ - rtl_uString ** ppMemberNames; - /** union value offset for data access - */ - sal_Int32 nValueOffset; -} typelib_UnionTypeDescription; - -/** Type description of an array or sequence. +/** Type description of a sequence. */ typedef struct _typelib_IndirectTypeDescription { @@ -208,30 +173,11 @@ typedef struct _typelib_IndirectTypeDescription */ typelib_TypeDescription aBase; - /** array, sequence: pointer to element type + /** pointer to element type */ typelib_TypeDescriptionReference * pType; } typelib_IndirectTypeDescription; -/** Type description of an array. -*/ -typedef struct _typelib_ArrayTypeDescription -{ - /** inherits all members of typelib_IndirectTypeDescription - */ - typelib_IndirectTypeDescription aBase; - - /** number of dimensions - */ - sal_Int32 nDimensions; - /** number of total array elements - */ - sal_Int32 nTotalElements; - /** array of dimensions - */ - sal_Int32 * pDimensions; -} typelib_ArrayTypeDescription; - /** Type description of an enum. The type class of this description is typelib_TypeClass_ENUM. */ typedef struct _typelib_EnumTypeDescription @@ -531,47 +477,10 @@ typedef struct _typelib_Parameter_Init sal_Bool bOut; } typelib_Parameter_Init; -/** Init struct of union types for typelib_typedescription_newUnion(). -*/ -typedef struct _typelib_Union_Init -{ - /** union member discriminant - */ - sal_Int64 nDiscriminant; - /** union member name - */ - rtl_uString * pMemberName; - /** union member type - */ - typelib_TypeDescriptionReference* pTypeRef; -} typelib_Union_Init; - #if defined( SAL_W32) #pragma pack(pop) #endif - -/** Creates a union type description. All discriminants are handled as int64 values. - The pDiscriminantTypeRef must be of type byte, short, ..., up to hyper. - - @param ppRet inout union type description - @param pTypeName name of union type - @param pDiscriminantTypeRef discriminant type - @param nDefaultDiscriminant default discriminant - @param pDefaultTypeRef default value type of union - @param nMembers number of union members - @param pMembers init members -*/ -CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newUnion( - typelib_TypeDescription ** ppRet, - rtl_uString * pTypeName, - typelib_TypeDescriptionReference * pDiscriminantTypeRef, - sal_Int64 nDefaultDiscriminant, - typelib_TypeDescriptionReference * pDefaultTypeRef, - sal_Int32 nMembers, - typelib_Union_Init * pMembers ) - SAL_THROW_EXTERN_C(); - /** Creates an enum type description. @param ppRet inout enum type description @@ -590,20 +499,6 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newEnum( sal_Int32 * pEnumValues ) SAL_THROW_EXTERN_C(); -/** Creates an array type description. - - @param ppRet inout enum type description - @param pElementTypeRef element type - @param nDimensions number of dimensions - @param pDimensions dimensions -*/ -CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newArray( - typelib_TypeDescription ** ppRet, - typelib_TypeDescriptionReference * pElementTypeRef, - sal_Int32 nDimensions, - sal_Int32 * pDimensions ) - SAL_THROW_EXTERN_C (); - /** Creates a new type description. Since this function can only be used to create type descriptions for plain @@ -614,7 +509,7 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_newArray( @param ppRet inout type description @param eTypeClass type class @param pTypeName name of type - @param pType sequence, array: element type; + @param pType sequence: element type; struct, Exception: base type; @param nMembers number of members if struct, exception @param pMembers array of members if struct, exception @@ -988,19 +883,6 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_static_sequence_type_init( typelib_TypeDescriptionReference * pElementType ) SAL_THROW_EXTERN_C (); -/** Inits static array type reference. Thread synchronizes on typelib init mutex. - - @param ppRef pointer to type reference pointer - @param pElementType element type of sequence - @param nDimensions number of dimensions - @param ... additional sal_Int32 parameter for each dimension -*/ -CPPU_DLLPUBLIC void SAL_CALL typelib_static_array_type_init( - typelib_TypeDescriptionReference ** ppRef, - typelib_TypeDescriptionReference * pElementType, - sal_Int32 nDimensions, ... ) - SAL_THROW_EXTERN_C (); - /** Inits incomplete static compound type reference. Thread synchronizes on typelib init mutex. Since this function can only be used to create type descriptions for plain @@ -1084,7 +966,7 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_static_enum_type_init( sal_Int32 nDefaultValue ) SAL_THROW_EXTERN_C(); -/** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND, UNION, +/** Completes a typedescription to be used for, e.g., marshalling values. COMPOUND, INTERFACE and ENUM type descriptions may be partly initialized (see typelib_static_...(), typelib_TypeDescription::bComplete). For interface type descriptions, this will also init index tables. |