tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / cppu / source / uno / copy.hxx
blob10985a87a16f2fd74e5ff13dcba62b3115802a11
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include "prim.hxx"
22 #include "constr.hxx"
23 #include <cassert>
24 #include <cstddef>
25 #include <cstdlib>
26 #include <type_traits>
28 namespace cppu
32 //#### copy construction ###########################################################################
34 namespace {
36 // The non-dynamic prefix of sal_Sequence (aka uno_Sequence):
37 struct SequencePrefix {
38 sal_Int32 nRefCount;
39 sal_Int32 nElements;
41 static_assert(sizeof (SequencePrefix) < sizeof (uno_Sequence));
42 static_assert(offsetof(SequencePrefix, nRefCount) == offsetof(uno_Sequence, nRefCount));
43 static_assert(
44 std::is_same_v<decltype(SequencePrefix::nRefCount), decltype(uno_Sequence::nRefCount)>);
45 static_assert(offsetof(SequencePrefix, nElements) == offsetof(uno_Sequence, nElements));
46 static_assert(
47 std::is_same_v<decltype(SequencePrefix::nElements), decltype(uno_Sequence::nElements)>);
51 inline uno_Sequence * allocSeq(
52 sal_Int32 nElementSize, sal_Int32 nElements )
54 OSL_ASSERT( nElements >= 0 && nElementSize >= 0 );
55 uno_Sequence * pSeq = nullptr;
56 sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements );
57 if (nSize > 0)
59 pSeq = static_cast<uno_Sequence *>(std::malloc( nSize ));
60 if (pSeq != nullptr)
62 // header init, going via SequencePrefix to avoid UBSan insufficient-object-size
63 // warnings when `nElements == 0` and thus `nSize < sizeof (uno_Sequence)`:
64 auto const header = reinterpret_cast<SequencePrefix *>(pSeq);
65 header->nRefCount = 1;
66 header->nElements = nElements;
69 return pSeq;
73 void copyConstructStruct(
74 void * pDest, void * pSource,
75 typelib_CompoundTypeDescription * pTypeDescr,
76 uno_AcquireFunc acquire, uno_Mapping * mapping );
78 inline void _copyConstructStruct(
79 void * pDest, void * pSource,
80 typelib_CompoundTypeDescription * pTypeDescr,
81 uno_AcquireFunc acquire, uno_Mapping * mapping )
83 if (pTypeDescr->pBaseTypeDescription)
85 // copy base value
86 copyConstructStruct( pDest, pSource, pTypeDescr->pBaseTypeDescription, acquire, mapping );
89 // then copy members
90 typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs;
91 sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets;
92 sal_Int32 nDescr = pTypeDescr->nMembers;
94 if (mapping)
96 while (nDescr--)
98 ::uno_type_copyAndConvertData(
99 static_cast<char *>(pDest) + pMemberOffsets[nDescr],
100 static_cast<char *>(pSource) + pMemberOffsets[nDescr],
101 ppTypeRefs[nDescr], mapping );
104 else
106 while (nDescr--)
108 ::uno_type_copyData(
109 static_cast<char *>(pDest) + pMemberOffsets[nDescr],
110 static_cast<char *>(pSource) + pMemberOffsets[nDescr],
111 ppTypeRefs[nDescr], acquire );
117 uno_Sequence * copyConstructSequence(
118 uno_Sequence * pSource,
119 typelib_TypeDescriptionReference * pElementType,
120 uno_AcquireFunc acquire, uno_Mapping * mapping );
123 inline void _copyConstructAnyFromData(
124 uno_Any * pDestAny, void * pSource,
125 typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
126 uno_AcquireFunc acquire, uno_Mapping * mapping )
128 TYPE_ACQUIRE( pType );
129 pDestAny->pType = pType;
131 switch (pType->eTypeClass)
133 case typelib_TypeClass_CHAR:
134 pDestAny->pData = &pDestAny->pReserved;
135 *static_cast<sal_Unicode *>(pDestAny->pData) = *static_cast<sal_Unicode *>(pSource);
136 break;
137 case typelib_TypeClass_BOOLEAN:
138 pDestAny->pData = &pDestAny->pReserved;
139 *static_cast<sal_Bool *>(pDestAny->pData) = bool(*static_cast<sal_Bool *>(pSource));
140 break;
141 case typelib_TypeClass_BYTE:
142 pDestAny->pData = &pDestAny->pReserved;
143 *static_cast<sal_Int8 *>(pDestAny->pData) = *static_cast<sal_Int8 *>(pSource);
144 break;
145 case typelib_TypeClass_SHORT:
146 case typelib_TypeClass_UNSIGNED_SHORT:
147 pDestAny->pData = &pDestAny->pReserved;
148 *static_cast<sal_Int16 *>(pDestAny->pData) = *static_cast<sal_Int16 *>(pSource);
149 break;
150 case typelib_TypeClass_LONG:
151 case typelib_TypeClass_UNSIGNED_LONG:
152 case typelib_TypeClass_ENUM: // enum is forced to 32bit long
153 pDestAny->pData = &pDestAny->pReserved;
154 *static_cast<sal_Int32 *>(pDestAny->pData) = *static_cast<sal_Int32 *>(pSource);
155 break;
156 case typelib_TypeClass_HYPER:
157 case typelib_TypeClass_UNSIGNED_HYPER:
158 if (sizeof(void *) >= sizeof(sal_Int64))
159 pDestAny->pData = &pDestAny->pReserved;
160 else
161 pDestAny->pData = std::malloc( sizeof(sal_Int64) );
162 assert(pDestAny->pData);
163 *static_cast<sal_Int64 *>(pDestAny->pData) = *static_cast<sal_Int64 *>(pSource);
164 break;
165 case typelib_TypeClass_FLOAT:
166 if (sizeof(void *) >= sizeof(float))
167 pDestAny->pData = &pDestAny->pReserved;
168 else
169 pDestAny->pData = std::malloc( sizeof(float) );
170 assert(pDestAny->pData);
171 *static_cast<float *>(pDestAny->pData) = *static_cast<float *>(pSource);
172 break;
173 case typelib_TypeClass_DOUBLE:
174 if (sizeof(void *) >= sizeof(double))
175 pDestAny->pData = &pDestAny->pReserved;
176 else
177 pDestAny->pData = std::malloc( sizeof(double) );
178 assert(pDestAny->pData);
179 *static_cast<double *>(pDestAny->pData) = *static_cast<double *>(pSource);
180 break;
181 case typelib_TypeClass_STRING:
182 ::rtl_uString_acquire( *static_cast<rtl_uString **>(pSource) );
183 pDestAny->pData = &pDestAny->pReserved;
184 *static_cast<rtl_uString **>(pDestAny->pData) = *static_cast<rtl_uString **>(pSource);
185 break;
186 case typelib_TypeClass_TYPE:
187 TYPE_ACQUIRE( *static_cast<typelib_TypeDescriptionReference **>(pSource) );
188 pDestAny->pData = &pDestAny->pReserved;
189 *static_cast<typelib_TypeDescriptionReference **>(pDestAny->pData) = *static_cast<typelib_TypeDescriptionReference **>(pSource);
190 break;
191 case typelib_TypeClass_ANY:
192 OSL_FAIL( "### unexpected nested any!" );
193 break;
194 case typelib_TypeClass_STRUCT:
195 case typelib_TypeClass_EXCEPTION:
196 if (pTypeDescr)
198 pDestAny->pData = std::malloc( pTypeDescr->nSize );
199 _copyConstructStruct(
200 pDestAny->pData, pSource,
201 reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
202 acquire, mapping );
204 else
206 TYPELIB_DANGER_GET( &pTypeDescr, pType );
207 pDestAny->pData = std::malloc( pTypeDescr->nSize );
208 _copyConstructStruct(
209 pDestAny->pData, pSource,
210 reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
211 acquire, mapping );
212 TYPELIB_DANGER_RELEASE( pTypeDescr );
214 break;
215 case typelib_TypeClass_SEQUENCE:
216 pDestAny->pData = &pDestAny->pReserved;
217 if (pTypeDescr)
219 *static_cast<uno_Sequence **>(pDestAny->pData) = copyConstructSequence(
220 *static_cast<uno_Sequence **>(pSource),
221 reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType,
222 acquire, mapping );
224 else
226 TYPELIB_DANGER_GET( &pTypeDescr, pType );
227 *static_cast<uno_Sequence **>(pDestAny->pData) = copyConstructSequence(
228 *static_cast<uno_Sequence **>(pSource),
229 reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType,
230 acquire, mapping );
231 TYPELIB_DANGER_RELEASE( pTypeDescr );
233 break;
234 case typelib_TypeClass_INTERFACE:
235 pDestAny->pData = &pDestAny->pReserved;
236 if (mapping)
238 pDestAny->pReserved = _map( *static_cast<void **>(pSource), pType, pTypeDescr, mapping );
240 else
242 pDestAny->pReserved = *static_cast<void **>(pSource);
243 _acquire( pDestAny->pReserved, acquire );
245 break;
246 default:
247 OSL_ASSERT(false);
248 break;
252 inline void _copyConstructAny(
253 uno_Any * pDestAny, void * pSource,
254 typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
255 uno_AcquireFunc acquire, uno_Mapping * mapping )
257 if (typelib_TypeClass_VOID == pType->eTypeClass)
259 CONSTRUCT_EMPTY_ANY( pDestAny );
261 else
263 if (typelib_TypeClass_ANY == pType->eTypeClass)
265 if (pSource)
267 pType = static_cast<uno_Any *>(pSource)->pType;
268 if (typelib_TypeClass_VOID == pType->eTypeClass)
270 CONSTRUCT_EMPTY_ANY( pDestAny );
271 return;
273 pTypeDescr = nullptr;
274 pSource = static_cast<uno_Any *>(pSource)->pData;
276 else
278 CONSTRUCT_EMPTY_ANY( pDestAny );
279 return;
282 if (pSource)
284 _copyConstructAnyFromData( pDestAny, pSource, pType, pTypeDescr, acquire, mapping );
286 else // default construct
288 TYPE_ACQUIRE( pType );
289 pDestAny->pType = pType;
290 switch (pType->eTypeClass)
292 case typelib_TypeClass_CHAR:
293 pDestAny->pData = &pDestAny->pReserved;
294 *static_cast<sal_Unicode *>(pDestAny->pData) = '\0';
295 break;
296 case typelib_TypeClass_BOOLEAN:
297 pDestAny->pData = &pDestAny->pReserved;
298 *static_cast<sal_Bool *>(pDestAny->pData) = false;
299 break;
300 case typelib_TypeClass_BYTE:
301 pDestAny->pData = &pDestAny->pReserved;
302 *static_cast<sal_Int8 *>(pDestAny->pData) = 0;
303 break;
304 case typelib_TypeClass_SHORT:
305 case typelib_TypeClass_UNSIGNED_SHORT:
306 pDestAny->pData = &pDestAny->pReserved;
307 *static_cast<sal_Int16 *>(pDestAny->pData) = 0;
308 break;
309 case typelib_TypeClass_LONG:
310 case typelib_TypeClass_UNSIGNED_LONG:
311 pDestAny->pData = &pDestAny->pReserved;
312 *static_cast<sal_Int32 *>(pDestAny->pData) = 0;
313 break;
314 case typelib_TypeClass_HYPER:
315 case typelib_TypeClass_UNSIGNED_HYPER:
316 if (sizeof(void *) >= sizeof(sal_Int64))
317 pDestAny->pData = &pDestAny->pReserved;
318 else
319 pDestAny->pData = std::malloc( sizeof(sal_Int64) );
320 assert(pDestAny->pData);
321 *static_cast<sal_Int64 *>(pDestAny->pData) = 0;
322 break;
323 case typelib_TypeClass_FLOAT:
324 if (sizeof(void *) >= sizeof(float))
325 pDestAny->pData = &pDestAny->pReserved;
326 else
327 pDestAny->pData = std::malloc( sizeof(float) );
328 assert(pDestAny->pData);
329 *static_cast<float *>(pDestAny->pData) = 0.0;
330 break;
331 case typelib_TypeClass_DOUBLE:
332 if (sizeof(void *) >= sizeof(double))
333 pDestAny->pData = &pDestAny->pReserved;
334 else
335 pDestAny->pData = std::malloc( sizeof(double) );
336 assert(pDestAny->pData);
337 *static_cast<double *>(pDestAny->pData) = 0.0;
338 break;
339 case typelib_TypeClass_STRING:
340 pDestAny->pData = &pDestAny->pReserved;
341 *static_cast<rtl_uString **>(pDestAny->pData) = nullptr;
342 ::rtl_uString_new( static_cast<rtl_uString **>(pDestAny->pData) );
343 break;
344 case typelib_TypeClass_TYPE:
345 pDestAny->pData = &pDestAny->pReserved;
346 *static_cast<typelib_TypeDescriptionReference **>(pDestAny->pData) = _getVoidType();
347 break;
348 case typelib_TypeClass_ENUM:
349 pDestAny->pData = &pDestAny->pReserved;
350 if (pTypeDescr)
352 *static_cast<sal_Int32 *>(pDestAny->pData) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue;
354 else
356 TYPELIB_DANGER_GET( &pTypeDescr, pType );
357 *static_cast<sal_Int32 *>(pDestAny->pData) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue;
358 TYPELIB_DANGER_RELEASE( pTypeDescr );
360 break;
361 case typelib_TypeClass_STRUCT:
362 case typelib_TypeClass_EXCEPTION:
363 if (pTypeDescr)
365 pDestAny->pData = std::malloc( pTypeDescr->nSize );
366 _defaultConstructStruct(
367 pDestAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
369 else
371 TYPELIB_DANGER_GET( &pTypeDescr, pType );
372 pDestAny->pData = std::malloc( pTypeDescr->nSize );
373 _defaultConstructStruct(
374 pDestAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
375 TYPELIB_DANGER_RELEASE( pTypeDescr );
377 break;
378 case typelib_TypeClass_SEQUENCE:
379 pDestAny->pData = &pDestAny->pReserved;
380 *static_cast<uno_Sequence **>(pDestAny->pData) = createEmptySequence();
381 break;
382 case typelib_TypeClass_INTERFACE:
383 pDestAny->pData = &pDestAny->pReserved;
384 pDestAny->pReserved = nullptr; // either cpp or c-uno interface
385 break;
386 default:
387 OSL_ASSERT(false);
388 break;
394 inline uno_Sequence * icopyConstructSequence(
395 uno_Sequence * pSource,
396 typelib_TypeDescriptionReference * pElementType,
397 uno_AcquireFunc acquire, uno_Mapping * mapping )
399 typelib_TypeClass eTypeClass = pElementType->eTypeClass;
400 if (!mapping ||
401 (eTypeClass <= typelib_TypeClass_ENUM &&
402 eTypeClass != typelib_TypeClass_ANY))
404 osl_atomic_increment( &pSource->nRefCount );
405 return pSource;
407 else // create new sequence
409 uno_Sequence * pDest;
410 sal_Int32 nElements = pSource->nElements;
411 if (nElements)
413 switch (eTypeClass)
415 case typelib_TypeClass_ANY:
417 pDest = allocSeq( sizeof (uno_Any), nElements );
418 if (pDest != nullptr)
420 uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pDest->elements);
421 uno_Any * pSourceElements = reinterpret_cast<uno_Any *>(pSource->elements);
422 for ( sal_Int32 nPos = nElements; nPos--; )
424 typelib_TypeDescriptionReference * pType =
425 pSourceElements[nPos].pType;
426 if (typelib_TypeClass_VOID == pType->eTypeClass)
428 CONSTRUCT_EMPTY_ANY( &pDestElements[nPos] );
430 else
432 _copyConstructAnyFromData(
433 &pDestElements[nPos],
434 pSourceElements[nPos].pData,
435 pType, nullptr,
436 acquire, mapping );
440 break;
442 case typelib_TypeClass_STRUCT:
443 case typelib_TypeClass_EXCEPTION:
445 typelib_TypeDescription * pElementTypeDescr = nullptr;
446 TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
447 sal_Int32 nElementSize = pElementTypeDescr->nSize;
448 char * pSourceElements = pSource->elements;
449 pDest = allocSeq( nElementSize, nElements );
450 if (pDest != nullptr)
452 char * pElements = pDest->elements;
453 for ( sal_Int32 nPos = nElements; nPos--; )
455 _copyConstructStruct(
456 pElements + (nPos * nElementSize),
457 pSourceElements + (nPos * nElementSize),
458 reinterpret_cast<typelib_CompoundTypeDescription *>(
459 pElementTypeDescr),
460 acquire, mapping );
463 TYPELIB_DANGER_RELEASE( pElementTypeDescr );
464 break;
466 case typelib_TypeClass_SEQUENCE: // sequence of sequence
468 // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here
469 pDest = allocSeq( sizeof (uno_Sequence *), nElements );
470 if (pDest != nullptr)
472 typelib_TypeDescription * pElementTypeDescr = nullptr;
473 TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
474 typelib_TypeDescriptionReference * pSeqElementType =
475 reinterpret_cast<typelib_IndirectTypeDescription *>(
476 pElementTypeDescr)->pType;
478 uno_Sequence ** pDestElements =
479 reinterpret_cast<uno_Sequence **>(pDest->elements);
480 uno_Sequence ** pSourceElements =
481 reinterpret_cast<uno_Sequence **>(pSource->elements);
482 for ( sal_Int32 nPos = nElements; nPos--; )
484 uno_Sequence * pNew = copyConstructSequence(
485 pSourceElements[nPos],
486 pSeqElementType,
487 acquire, mapping );
488 OSL_ASSERT( pNew != nullptr );
489 // ought never be a memory allocation problem,
490 // because of reference counted sequence handles
491 pDestElements[ nPos ] = pNew;
494 TYPELIB_DANGER_RELEASE( pElementTypeDescr );
496 break;
498 case typelib_TypeClass_INTERFACE:
500 pDest = allocSeq( sizeof (void *), nElements );
501 if (pDest != nullptr)
503 char * pElements = pDest->elements;
504 void ** pSourceElements = reinterpret_cast<void **>(pSource->elements);
505 typelib_TypeDescription * pElementTypeDescr = nullptr;
506 TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
507 for ( sal_Int32 nPos = nElements; nPos--; )
509 reinterpret_cast<void **>(pElements)[nPos] = nullptr;
510 if (pSourceElements[nPos])
512 (*mapping->mapInterface)(
513 mapping, reinterpret_cast<void **>(pElements) + nPos,
514 pSourceElements[nPos],
515 reinterpret_cast<typelib_InterfaceTypeDescription *>(
516 pElementTypeDescr) );
519 TYPELIB_DANGER_RELEASE( pElementTypeDescr );
521 break;
523 default:
524 OSL_FAIL( "### unexpected sequence element type!" );
525 pDest = nullptr;
526 break;
529 else // empty sequence
531 pDest = allocSeq( 0, 0 );
534 return pDest;
539 inline void _copyConstructData(
540 void * pDest, void * pSource,
541 typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
542 uno_AcquireFunc acquire, uno_Mapping * mapping )
544 switch (pType->eTypeClass)
546 case typelib_TypeClass_CHAR:
547 *static_cast<sal_Unicode *>(pDest) = *static_cast<sal_Unicode *>(pSource);
548 break;
549 case typelib_TypeClass_BOOLEAN:
550 *static_cast<sal_Bool *>(pDest) = bool(*static_cast<sal_Bool *>(pSource));
551 break;
552 case typelib_TypeClass_BYTE:
553 *static_cast<sal_Int8 *>(pDest) = *static_cast<sal_Int8 *>(pSource);
554 break;
555 case typelib_TypeClass_SHORT:
556 case typelib_TypeClass_UNSIGNED_SHORT:
557 *static_cast<sal_Int16 *>(pDest) = *static_cast<sal_Int16 *>(pSource);
558 break;
559 case typelib_TypeClass_LONG:
560 case typelib_TypeClass_UNSIGNED_LONG:
561 case typelib_TypeClass_ENUM:
562 *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int32 *>(pSource);
563 break;
564 case typelib_TypeClass_HYPER:
565 case typelib_TypeClass_UNSIGNED_HYPER:
566 *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int64 *>(pSource);
567 break;
568 case typelib_TypeClass_FLOAT:
569 *static_cast<float *>(pDest) = *static_cast<float *>(pSource);
570 break;
571 case typelib_TypeClass_DOUBLE:
572 *static_cast<double *>(pDest) = *static_cast<double *>(pSource);
573 break;
574 case typelib_TypeClass_STRING:
575 ::rtl_uString_acquire( *static_cast<rtl_uString **>(pSource) );
576 *static_cast<rtl_uString **>(pDest) = *static_cast<rtl_uString **>(pSource);
577 break;
578 case typelib_TypeClass_TYPE:
579 TYPE_ACQUIRE( *static_cast<typelib_TypeDescriptionReference **>(pSource) );
580 *static_cast<typelib_TypeDescriptionReference **>(pDest) = *static_cast<typelib_TypeDescriptionReference **>(pSource);
581 break;
582 case typelib_TypeClass_ANY:
583 _copyConstructAny(
584 static_cast<uno_Any *>(pDest), static_cast<uno_Any *>(pSource)->pData,
585 static_cast<uno_Any *>(pSource)->pType, nullptr,
586 acquire, mapping );
587 break;
588 case typelib_TypeClass_STRUCT:
589 case typelib_TypeClass_EXCEPTION:
590 if (pTypeDescr)
592 _copyConstructStruct(
593 pDest, pSource,
594 reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
595 acquire, mapping );
597 else
599 TYPELIB_DANGER_GET( &pTypeDescr, pType );
600 _copyConstructStruct(
601 pDest, pSource,
602 reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
603 acquire, mapping );
604 TYPELIB_DANGER_RELEASE( pTypeDescr );
606 break;
607 case typelib_TypeClass_SEQUENCE:
608 if (mapping)
610 if (pTypeDescr)
612 *static_cast<uno_Sequence **>(pDest) = icopyConstructSequence(
613 *static_cast<uno_Sequence **>(pSource),
614 reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType,
615 acquire, mapping );
617 else
619 TYPELIB_DANGER_GET( &pTypeDescr, pType );
620 *static_cast<uno_Sequence **>(pDest) = icopyConstructSequence(
621 *static_cast<uno_Sequence **>(pSource),
622 reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType,
623 acquire, mapping );
624 TYPELIB_DANGER_RELEASE( pTypeDescr );
627 else
629 osl_atomic_increment( &(*static_cast<uno_Sequence **>(pSource))->nRefCount );
630 *static_cast<uno_Sequence **>(pDest) = *static_cast<uno_Sequence **>(pSource);
632 break;
633 case typelib_TypeClass_INTERFACE:
634 if (mapping)
635 *static_cast<void **>(pDest) = _map( *static_cast<void **>(pSource), pType, pTypeDescr, mapping );
636 else
638 *static_cast<void **>(pDest) = *static_cast<void **>(pSource);
639 _acquire( *static_cast<void **>(pDest), acquire );
641 break;
642 default:
643 break;
649 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */