1c6ed87c9SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c6ed87c9SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c6ed87c9SAndrew Rist * or more contributor license agreements. See the NOTICE file 5c6ed87c9SAndrew Rist * distributed with this work for additional information 6c6ed87c9SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c6ed87c9SAndrew Rist * to you under the Apache License, Version 2.0 (the 8c6ed87c9SAndrew Rist * "License"); you may not use this file except in compliance 9c6ed87c9SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11c6ed87c9SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13c6ed87c9SAndrew Rist * Unless required by applicable law or agreed to in writing, 14c6ed87c9SAndrew Rist * software distributed under the License is distributed on an 15c6ed87c9SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c6ed87c9SAndrew Rist * KIND, either express or implied. See the License for the 17c6ed87c9SAndrew Rist * specific language governing permissions and limitations 18c6ed87c9SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20c6ed87c9SAndrew Rist *************************************************************/ 21c6ed87c9SAndrew Rist 22c6ed87c9SAndrew Rist 23cdf0e10cSrcweir #ifndef DESTR_HXX 24cdf0e10cSrcweir #define DESTR_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "prim.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir namespace cppu 30cdf0e10cSrcweir { 31cdf0e10cSrcweir 32cdf0e10cSrcweir //################################################################################################## 33cdf0e10cSrcweir //#### destruction ################################################################################# 34cdf0e10cSrcweir //################################################################################################## 35cdf0e10cSrcweir 36cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 37cdf0e10cSrcweir inline void _destructUnion( 38cdf0e10cSrcweir void * pValue, 39cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr, 40cdf0e10cSrcweir uno_ReleaseFunc release ) 41cdf0e10cSrcweir SAL_THROW( () ) 42cdf0e10cSrcweir { 43cdf0e10cSrcweir typelib_TypeDescriptionReference * pType = _unionGetSetType( pValue, pTypeDescr ); 44cdf0e10cSrcweir ::uno_type_destructData( 45cdf0e10cSrcweir (char *)pValue + ((typelib_UnionTypeDescription *)pTypeDescr)->nValueOffset, 46cdf0e10cSrcweir pType, release ); 47cdf0e10cSrcweir ::typelib_typedescriptionreference_release( pType ); 48cdf0e10cSrcweir } 49cdf0e10cSrcweir //================================================================================================== 50cdf0e10cSrcweir void destructStruct( 51cdf0e10cSrcweir void * pValue, 52cdf0e10cSrcweir typelib_CompoundTypeDescription * pTypeDescr, 53cdf0e10cSrcweir uno_ReleaseFunc release ) 54cdf0e10cSrcweir SAL_THROW( () ); 55cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 56cdf0e10cSrcweir inline void _destructStruct( 57cdf0e10cSrcweir void * pValue, 58cdf0e10cSrcweir typelib_CompoundTypeDescription * pTypeDescr, 59cdf0e10cSrcweir uno_ReleaseFunc release ) 60cdf0e10cSrcweir SAL_THROW( () ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir if (pTypeDescr->pBaseTypeDescription) 63cdf0e10cSrcweir { 64cdf0e10cSrcweir destructStruct( pValue, pTypeDescr->pBaseTypeDescription, release ); 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs; 68cdf0e10cSrcweir sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets; 69cdf0e10cSrcweir sal_Int32 nDescr = pTypeDescr->nMembers; 70cdf0e10cSrcweir while (nDescr--) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir ::uno_type_destructData( 73cdf0e10cSrcweir (char *)pValue + pMemberOffsets[nDescr], 74cdf0e10cSrcweir ppTypeRefs[nDescr], release ); 75cdf0e10cSrcweir } 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 79cdf0e10cSrcweir inline void _destructArray( 80cdf0e10cSrcweir void * pValue, 81cdf0e10cSrcweir typelib_ArrayTypeDescription * pTypeDescr, 82cdf0e10cSrcweir uno_ReleaseFunc release ) 83cdf0e10cSrcweir throw () 84cdf0e10cSrcweir { 85cdf0e10cSrcweir typelib_TypeDescription * pElementType = NULL; 86cdf0e10cSrcweir TYPELIB_DANGER_GET( &pElementType, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType ); 87cdf0e10cSrcweir sal_Int32 nElementSize = pElementType->nSize; 88cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pElementType ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir sal_Int32 nTotalElements = pTypeDescr->nTotalElements; 91cdf0e10cSrcweir for(sal_Int32 i=0; i < nTotalElements; i++) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir ::uno_type_destructData( 94cdf0e10cSrcweir (sal_Char *)pValue + i * nElementSize, 95cdf0e10cSrcweir ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, release ); 96cdf0e10cSrcweir } 97cdf0e10cSrcweir 98cdf0e10cSrcweir typelib_typedescriptionreference_release(((typelib_IndirectTypeDescription *)pTypeDescr)->pType); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir //============================================================================== 102cdf0e10cSrcweir void destructSequence( 103cdf0e10cSrcweir uno_Sequence * pSequence, 104cdf0e10cSrcweir typelib_TypeDescriptionReference * pType, 105cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr, 106cdf0e10cSrcweir uno_ReleaseFunc release ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 109cdf0e10cSrcweir inline void _destructAny( 110cdf0e10cSrcweir uno_Any * pAny, 111cdf0e10cSrcweir uno_ReleaseFunc release ) 112cdf0e10cSrcweir SAL_THROW( () ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir typelib_TypeDescriptionReference * pType = pAny->pType; 115cdf0e10cSrcweir 116cdf0e10cSrcweir switch (pType->eTypeClass) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir case typelib_TypeClass_HYPER: 119cdf0e10cSrcweir case typelib_TypeClass_UNSIGNED_HYPER: 120cdf0e10cSrcweir if (sizeof(void *) < sizeof(sal_Int64)) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir break; 125cdf0e10cSrcweir case typelib_TypeClass_FLOAT: 126cdf0e10cSrcweir if (sizeof(void *) < sizeof(float)) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir break; 131cdf0e10cSrcweir case typelib_TypeClass_DOUBLE: 132cdf0e10cSrcweir if (sizeof(void *) < sizeof(double)) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir break; 137cdf0e10cSrcweir case typelib_TypeClass_STRING: 138cdf0e10cSrcweir ::rtl_uString_release( (rtl_uString *)pAny->pReserved ); 139cdf0e10cSrcweir break; 140cdf0e10cSrcweir case typelib_TypeClass_TYPE: 141cdf0e10cSrcweir ::typelib_typedescriptionreference_release( 142cdf0e10cSrcweir (typelib_TypeDescriptionReference *)pAny->pReserved ); 143cdf0e10cSrcweir break; 144cdf0e10cSrcweir case typelib_TypeClass_ANY: 145cdf0e10cSrcweir OSL_ENSURE( sal_False, "### unexpected nested any!" ); 146cdf0e10cSrcweir ::uno_any_destruct( (uno_Any *)pAny->pData, release ); 147cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 148cdf0e10cSrcweir break; 149cdf0e10cSrcweir case typelib_TypeClass_TYPEDEF: 150cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected typedef!" ); 151cdf0e10cSrcweir break; 152cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 153cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 154cdf0e10cSrcweir { 155cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr = 0; 156cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 157cdf0e10cSrcweir _destructStruct( pAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr, release ); 158cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 159cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 160cdf0e10cSrcweir break; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir case typelib_TypeClass_UNION: 163cdf0e10cSrcweir { 164cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr = 0; 165cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 166cdf0e10cSrcweir _destructUnion( pAny->pData, pTypeDescr, release ); 167cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 168cdf0e10cSrcweir ::rtl_freeMemory( pAny->pData ); 169cdf0e10cSrcweir break; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 172cdf0e10cSrcweir { 173cdf0e10cSrcweir destructSequence( 174*0618ff6bSPedro Giffuni *(uno_Sequence **) pAny->pData, pType, 0, release ); 175cdf0e10cSrcweir break; 176cdf0e10cSrcweir } 177cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 178cdf0e10cSrcweir _release( pAny->pReserved, release ); 179cdf0e10cSrcweir break; 180cdf0e10cSrcweir default: 181cdf0e10cSrcweir break; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 184cdf0e10cSrcweir pAny->pData = (void *)0xdeadbeef; 185cdf0e10cSrcweir #endif 186cdf0e10cSrcweir 187cdf0e10cSrcweir ::typelib_typedescriptionreference_release( pType ); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 190cdf0e10cSrcweir inline sal_Int32 idestructElements( 191cdf0e10cSrcweir void * pElements, typelib_TypeDescriptionReference * pElementType, 192cdf0e10cSrcweir sal_Int32 nStartIndex, sal_Int32 nStopIndex, 193cdf0e10cSrcweir uno_ReleaseFunc release ) 194cdf0e10cSrcweir SAL_THROW( () ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir switch (pElementType->eTypeClass) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir case typelib_TypeClass_CHAR: 199cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Unicode)); 200cdf0e10cSrcweir case typelib_TypeClass_BOOLEAN: 201cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Bool)); 202cdf0e10cSrcweir case typelib_TypeClass_BYTE: 203cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Int8)); 204cdf0e10cSrcweir case typelib_TypeClass_SHORT: 205cdf0e10cSrcweir case typelib_TypeClass_UNSIGNED_SHORT: 206cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Int16)); 207cdf0e10cSrcweir case typelib_TypeClass_LONG: 208cdf0e10cSrcweir case typelib_TypeClass_UNSIGNED_LONG: 209cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Int32)); 210cdf0e10cSrcweir case typelib_TypeClass_HYPER: 211cdf0e10cSrcweir case typelib_TypeClass_UNSIGNED_HYPER: 212cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Int64)); 213cdf0e10cSrcweir case typelib_TypeClass_FLOAT: 214cdf0e10cSrcweir return (sal_Int32)(sizeof(float)); 215cdf0e10cSrcweir case typelib_TypeClass_DOUBLE: 216cdf0e10cSrcweir return (sal_Int32)(sizeof(double)); 217cdf0e10cSrcweir 218cdf0e10cSrcweir case typelib_TypeClass_STRING: 219cdf0e10cSrcweir { 220cdf0e10cSrcweir rtl_uString ** pDest = (rtl_uString **)pElements; 221cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir ::rtl_uString_release( pDest[nPos] ); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir return (sal_Int32)(sizeof(rtl_uString *)); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir case typelib_TypeClass_TYPE: 228cdf0e10cSrcweir { 229cdf0e10cSrcweir typelib_TypeDescriptionReference ** pDest = (typelib_TypeDescriptionReference **)pElements; 230cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir ::typelib_typedescriptionreference_release( pDest[nPos] ); 233cdf0e10cSrcweir } 234cdf0e10cSrcweir return (sal_Int32)(sizeof(typelib_TypeDescriptionReference *)); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir case typelib_TypeClass_ANY: 237cdf0e10cSrcweir { 238cdf0e10cSrcweir uno_Any * pDest = (uno_Any *)pElements; 239cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir _destructAny( &pDest[nPos], release ); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir return (sal_Int32)(sizeof(uno_Any)); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir case typelib_TypeClass_ENUM: 246cdf0e10cSrcweir return (sal_Int32)(sizeof(sal_Int32)); 247cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 248cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 249cdf0e10cSrcweir { 250cdf0e10cSrcweir typelib_TypeDescription * pElementTypeDescr = 0; 251cdf0e10cSrcweir TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); 252cdf0e10cSrcweir sal_Int32 nElementSize = pElementTypeDescr->nSize; 253cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir _destructStruct( 256cdf0e10cSrcweir (char *)pElements + (nElementSize * nPos), 257cdf0e10cSrcweir (typelib_CompoundTypeDescription *)pElementTypeDescr, 258cdf0e10cSrcweir release ); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir sal_Int32 nSize = pElementTypeDescr->nSize; 261cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pElementTypeDescr ); 262cdf0e10cSrcweir return nSize; 263cdf0e10cSrcweir } 264cdf0e10cSrcweir case typelib_TypeClass_UNION: 265cdf0e10cSrcweir { 266cdf0e10cSrcweir typelib_TypeDescription * pElementTypeDescr = 0; 267cdf0e10cSrcweir TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); 268cdf0e10cSrcweir sal_Int32 nElementSize = pElementTypeDescr->nSize; 269cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir _destructUnion( 272cdf0e10cSrcweir (char *)pElements + (nElementSize * nPos), 273cdf0e10cSrcweir pElementTypeDescr, 274cdf0e10cSrcweir release ); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir sal_Int32 nSize = pElementTypeDescr->nSize; 277cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pElementTypeDescr ); 278cdf0e10cSrcweir return nSize; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 281cdf0e10cSrcweir { 282cdf0e10cSrcweir typelib_TypeDescription * pElementTypeDescr = 0; 283cdf0e10cSrcweir TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); 284cdf0e10cSrcweir uno_Sequence ** pDest = (uno_Sequence **)pElements; 285cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 286cdf0e10cSrcweir { 287cdf0e10cSrcweir destructSequence( 288cdf0e10cSrcweir pDest[nPos], 289cdf0e10cSrcweir pElementTypeDescr->pWeakRef, pElementTypeDescr, 290cdf0e10cSrcweir release ); 291cdf0e10cSrcweir } 292cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pElementTypeDescr ); 293cdf0e10cSrcweir return (sal_Int32)(sizeof(uno_Sequence *)); 294cdf0e10cSrcweir } 295cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 296cdf0e10cSrcweir { 297cdf0e10cSrcweir if (release) 298cdf0e10cSrcweir { 299cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir void * p = ((void **)pElements)[nPos]; 302cdf0e10cSrcweir if (p) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir (*release)( p ); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir } 307cdf0e10cSrcweir } 308cdf0e10cSrcweir else 309cdf0e10cSrcweir { 310cdf0e10cSrcweir for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir uno_Interface * p = ((uno_Interface **)pElements)[nPos]; 313cdf0e10cSrcweir if (p) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir (*p->release)( p ); 316cdf0e10cSrcweir } 317cdf0e10cSrcweir } 318cdf0e10cSrcweir } 319cdf0e10cSrcweir return (sal_Int32)(sizeof(void *)); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir default: 322cdf0e10cSrcweir OSL_ASSERT(false); 323cdf0e10cSrcweir return 0; 324cdf0e10cSrcweir } 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir //------------------------------------------------------------------------------ 328cdf0e10cSrcweir inline void idestructSequence( 329cdf0e10cSrcweir uno_Sequence * pSeq, 330cdf0e10cSrcweir typelib_TypeDescriptionReference * pType, 331cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr, 332cdf0e10cSrcweir uno_ReleaseFunc release ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir if (::osl_decrementInterlockedCount( &pSeq->nRefCount ) == 0) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir if (pSeq->nElements > 0) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir if (pTypeDescr) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir idestructElements( 341cdf0e10cSrcweir pSeq->elements, 342cdf0e10cSrcweir ((typelib_IndirectTypeDescription *) pTypeDescr)->pType, 0, 343cdf0e10cSrcweir pSeq->nElements, release ); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir else 346cdf0e10cSrcweir { 347cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 348cdf0e10cSrcweir idestructElements( 349cdf0e10cSrcweir pSeq->elements, 350cdf0e10cSrcweir ((typelib_IndirectTypeDescription *) pTypeDescr)->pType, 0, 351cdf0e10cSrcweir pSeq->nElements, release ); 352cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 353cdf0e10cSrcweir } 354cdf0e10cSrcweir } 355cdf0e10cSrcweir ::rtl_freeMemory( pSeq ); 356cdf0e10cSrcweir } 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------- 360cdf0e10cSrcweir inline void _destructData( 361cdf0e10cSrcweir void * pValue, 362cdf0e10cSrcweir typelib_TypeDescriptionReference * pType, 363cdf0e10cSrcweir typelib_TypeDescription * pTypeDescr, 364cdf0e10cSrcweir uno_ReleaseFunc release ) 365cdf0e10cSrcweir SAL_THROW( () ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir switch (pType->eTypeClass) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir case typelib_TypeClass_STRING: 370cdf0e10cSrcweir ::rtl_uString_release( *(rtl_uString **)pValue ); 371cdf0e10cSrcweir break; 372cdf0e10cSrcweir case typelib_TypeClass_TYPE: 373cdf0e10cSrcweir ::typelib_typedescriptionreference_release( *(typelib_TypeDescriptionReference **)pValue ); 374cdf0e10cSrcweir break; 375cdf0e10cSrcweir case typelib_TypeClass_ANY: 376cdf0e10cSrcweir _destructAny( (uno_Any *)pValue, release ); 377cdf0e10cSrcweir break; 378cdf0e10cSrcweir case typelib_TypeClass_TYPEDEF: 379cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected typedef!" ); 380cdf0e10cSrcweir break; 381cdf0e10cSrcweir case typelib_TypeClass_STRUCT: 382cdf0e10cSrcweir case typelib_TypeClass_EXCEPTION: 383cdf0e10cSrcweir if (pTypeDescr) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir _destructStruct( pValue, (typelib_CompoundTypeDescription *)pTypeDescr, release ); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir else 388cdf0e10cSrcweir { 389cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 390cdf0e10cSrcweir _destructStruct( pValue, (typelib_CompoundTypeDescription *)pTypeDescr, release ); 391cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir break; 394cdf0e10cSrcweir case typelib_TypeClass_ARRAY: 395cdf0e10cSrcweir if (pTypeDescr) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir _destructArray( pValue, (typelib_ArrayTypeDescription *)pTypeDescr, release ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir else 400cdf0e10cSrcweir { 401cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 402cdf0e10cSrcweir _destructArray( pValue, (typelib_ArrayTypeDescription *)pTypeDescr, release ); 403cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 404cdf0e10cSrcweir } 405cdf0e10cSrcweir break; 406cdf0e10cSrcweir case typelib_TypeClass_UNION: 407cdf0e10cSrcweir if (pTypeDescr) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir _destructUnion( pValue, pTypeDescr, release ); 410cdf0e10cSrcweir } 411cdf0e10cSrcweir else 412cdf0e10cSrcweir { 413cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTypeDescr, pType ); 414cdf0e10cSrcweir _destructUnion( pValue, pTypeDescr, release ); 415cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTypeDescr ); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir break; 418cdf0e10cSrcweir case typelib_TypeClass_SEQUENCE: 419cdf0e10cSrcweir { 420cdf0e10cSrcweir idestructSequence( 421cdf0e10cSrcweir *(uno_Sequence **)pValue, pType, pTypeDescr, release ); 422cdf0e10cSrcweir break; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir case typelib_TypeClass_INTERFACE: 425cdf0e10cSrcweir _release( *(void **)pValue, release ); 426cdf0e10cSrcweir break; 427cdf0e10cSrcweir default: 428cdf0e10cSrcweir break; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir } 433cdf0e10cSrcweir 434cdf0e10cSrcweir #endif 435