Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CPPU_SOURCE_UNO_COPY_HXX
20 : #define INCLUDED_CPPU_SOURCE_UNO_COPY_HXX
21 :
22 : #include "prim.hxx"
23 : #include "constr.hxx"
24 :
25 :
26 : namespace cppu
27 : {
28 :
29 :
30 : //#### copy construction ###########################################################################
31 :
32 :
33 :
34 1487262 : inline uno_Sequence * allocSeq(
35 : sal_Int32 nElementSize, sal_Int32 nElements )
36 : {
37 : OSL_ASSERT( nElements >= 0 && nElementSize >= 0 );
38 1487262 : uno_Sequence * pSeq = 0;
39 1487262 : sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements );
40 1487262 : if (nSize > 0)
41 : {
42 1487262 : pSeq = (uno_Sequence *) rtl_allocateMemory( nSize );
43 1487262 : if (pSeq != 0)
44 : {
45 : // header init
46 1487262 : pSeq->nRefCount = 1;
47 1487262 : pSeq->nElements = nElements;
48 : }
49 : }
50 1487262 : return pSeq;
51 : }
52 :
53 :
54 : void copyConstructStruct(
55 : void * pDest, void * pSource,
56 : typelib_CompoundTypeDescription * pTypeDescr,
57 : uno_AcquireFunc acquire, uno_Mapping * mapping );
58 :
59 11261344 : inline void _copyConstructStruct(
60 : void * pDest, void * pSource,
61 : typelib_CompoundTypeDescription * pTypeDescr,
62 : uno_AcquireFunc acquire, uno_Mapping * mapping )
63 : {
64 11261344 : if (pTypeDescr->pBaseTypeDescription)
65 : {
66 : // copy base value
67 1810501 : copyConstructStruct( pDest, pSource, pTypeDescr->pBaseTypeDescription, acquire, mapping );
68 : }
69 :
70 : // then copy members
71 11261344 : typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs;
72 11261344 : sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets;
73 11261344 : sal_Int32 nDescr = pTypeDescr->nMembers;
74 :
75 11261344 : if (mapping)
76 : {
77 2302252 : while (nDescr--)
78 : {
79 : ::uno_type_copyAndConvertData(
80 2549024 : (char *)pDest + pMemberOffsets[nDescr],
81 2549024 : (char *)pSource + pMemberOffsets[nDescr],
82 5098048 : ppTypeRefs[nDescr], mapping );
83 : }
84 : }
85 : else
86 : {
87 57200448 : while (nDescr--)
88 : {
89 : ::uno_type_copyData(
90 71411000 : (char *)pDest + pMemberOffsets[nDescr],
91 71411000 : (char *)pSource + pMemberOffsets[nDescr],
92 142822000 : ppTypeRefs[nDescr], acquire );
93 : }
94 : }
95 11261344 : }
96 :
97 :
98 : uno_Sequence * copyConstructSequence(
99 : uno_Sequence * pSource,
100 : typelib_TypeDescriptionReference * pElementType,
101 : uno_AcquireFunc acquire, uno_Mapping * mapping );
102 :
103 :
104 308740456 : inline void _copyConstructAnyFromData(
105 : uno_Any * pDestAny, void * pSource,
106 : typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
107 : uno_AcquireFunc acquire, uno_Mapping * mapping )
108 : {
109 308740456 : TYPE_ACQUIRE( pType );
110 308740456 : pDestAny->pType = pType;
111 :
112 308740456 : switch (pType->eTypeClass)
113 : {
114 : case typelib_TypeClass_CHAR:
115 456 : pDestAny->pData = &pDestAny->pReserved;
116 456 : *(sal_Unicode *)pDestAny->pData = *(sal_Unicode *)pSource;
117 456 : break;
118 : case typelib_TypeClass_BOOLEAN:
119 34382297 : pDestAny->pData = &pDestAny->pReserved;
120 34382297 : *(sal_Bool *)pDestAny->pData = (*(sal_Bool *)pSource != sal_False);
121 34382297 : break;
122 : case typelib_TypeClass_BYTE:
123 272392 : pDestAny->pData = &pDestAny->pReserved;
124 272392 : *(sal_Int8 *)pDestAny->pData = *(sal_Int8 *)pSource;
125 272392 : break;
126 : case typelib_TypeClass_SHORT:
127 : case typelib_TypeClass_UNSIGNED_SHORT:
128 11997229 : pDestAny->pData = &pDestAny->pReserved;
129 11997229 : *(sal_Int16 *)pDestAny->pData = *(sal_Int16 *)pSource;
130 11997229 : break;
131 : case typelib_TypeClass_LONG:
132 : case typelib_TypeClass_UNSIGNED_LONG:
133 24573505 : pDestAny->pData = &pDestAny->pReserved;
134 24573505 : *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource;
135 24573505 : break;
136 : case typelib_TypeClass_HYPER:
137 : case typelib_TypeClass_UNSIGNED_HYPER:
138 : if (sizeof(void *) >= sizeof(sal_Int64))
139 737397 : pDestAny->pData = &pDestAny->pReserved;
140 : else
141 : pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) );
142 737397 : *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource;
143 737397 : break;
144 : case typelib_TypeClass_FLOAT:
145 : if (sizeof(void *) >= sizeof(float))
146 1558983 : pDestAny->pData = &pDestAny->pReserved;
147 : else
148 : pDestAny->pData = ::rtl_allocateMemory( sizeof(float) );
149 1558983 : *(float *)pDestAny->pData = *(float *)pSource;
150 1558983 : break;
151 : case typelib_TypeClass_DOUBLE:
152 : if (sizeof(void *) >= sizeof(double))
153 6520879 : pDestAny->pData = &pDestAny->pReserved;
154 : else
155 : pDestAny->pData = ::rtl_allocateMemory( sizeof(double) );
156 6520879 : *(double *)pDestAny->pData = *(double *)pSource;
157 6520879 : break;
158 : case typelib_TypeClass_STRING:
159 78917458 : ::rtl_uString_acquire( *(rtl_uString **)pSource );
160 78917461 : pDestAny->pData = &pDestAny->pReserved;
161 78917461 : *(rtl_uString **)pDestAny->pData = *(rtl_uString **)pSource;
162 78917461 : break;
163 : case typelib_TypeClass_TYPE:
164 138043 : TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource );
165 138043 : pDestAny->pData = &pDestAny->pReserved;
166 138043 : *(typelib_TypeDescriptionReference **)pDestAny->pData = *(typelib_TypeDescriptionReference **)pSource;
167 138043 : break;
168 : case typelib_TypeClass_ANY:
169 : OSL_FAIL( "### unexpected nested any!" );
170 0 : break;
171 : case typelib_TypeClass_ENUM:
172 2864933 : pDestAny->pData = &pDestAny->pReserved;
173 : // enum is forced to 32bit long
174 2864933 : *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource;
175 2864933 : break;
176 : case typelib_TypeClass_STRUCT:
177 : case typelib_TypeClass_EXCEPTION:
178 8353895 : if (pTypeDescr)
179 : {
180 22245 : pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
181 : _copyConstructStruct(
182 : pDestAny->pData, pSource,
183 : (typelib_CompoundTypeDescription *)pTypeDescr,
184 22245 : acquire, mapping );
185 : }
186 : else
187 : {
188 8331650 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
189 8331650 : pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
190 : _copyConstructStruct(
191 : pDestAny->pData, pSource,
192 : (typelib_CompoundTypeDescription *)pTypeDescr,
193 8331651 : acquire, mapping );
194 8331650 : TYPELIB_DANGER_RELEASE( pTypeDescr );
195 : }
196 8353895 : break;
197 : case typelib_TypeClass_SEQUENCE:
198 20930837 : pDestAny->pData = &pDestAny->pReserved;
199 20930837 : if (pTypeDescr)
200 : {
201 : *(uno_Sequence **)pDestAny->pData = copyConstructSequence(
202 : *(uno_Sequence **)pSource,
203 : ((typelib_IndirectTypeDescription *)pTypeDescr)->pType,
204 30446 : acquire, mapping );
205 : }
206 : else
207 : {
208 20900391 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
209 : *(uno_Sequence **)pDestAny->pData = copyConstructSequence(
210 : *(uno_Sequence **)pSource,
211 : ((typelib_IndirectTypeDescription *)pTypeDescr)->pType,
212 20900391 : acquire, mapping );
213 20900392 : TYPELIB_DANGER_RELEASE( pTypeDescr );
214 : }
215 20930838 : break;
216 : case typelib_TypeClass_INTERFACE:
217 117492152 : pDestAny->pData = &pDestAny->pReserved;
218 117492152 : if (mapping)
219 : {
220 76674 : pDestAny->pReserved = _map( *(void **)pSource, pType, pTypeDescr, mapping );
221 : }
222 : else
223 : {
224 117415478 : _acquire( pDestAny->pReserved = *(void **)pSource, acquire );
225 : }
226 117492140 : break;
227 : default:
228 : OSL_ASSERT(false);
229 0 : break;
230 : }
231 308740448 : }
232 :
233 346133433 : inline void _copyConstructAny(
234 : uno_Any * pDestAny, void * pSource,
235 : typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
236 : uno_AcquireFunc acquire, uno_Mapping * mapping )
237 : {
238 346133433 : if (typelib_TypeClass_VOID == pType->eTypeClass)
239 : {
240 28754347 : CONSTRUCT_EMPTY_ANY( pDestAny );
241 : }
242 : else
243 : {
244 317379086 : if (typelib_TypeClass_ANY == pType->eTypeClass)
245 : {
246 10171270 : if (pSource)
247 : {
248 10171270 : pType = ((uno_Any *)pSource)->pType;
249 10171270 : if (typelib_TypeClass_VOID == pType->eTypeClass)
250 : {
251 8919403 : CONSTRUCT_EMPTY_ANY( pDestAny );
252 8919403 : return;
253 : }
254 1251867 : pTypeDescr = 0;
255 1251867 : pSource = ((uno_Any *)pSource)->pData;
256 : }
257 : else
258 : {
259 0 : CONSTRUCT_EMPTY_ANY( pDestAny );
260 0 : return;
261 : }
262 : }
263 308459683 : if (pSource)
264 : {
265 308339365 : _copyConstructAnyFromData( pDestAny, pSource, pType, pTypeDescr, acquire, mapping );
266 : }
267 : else // default construct
268 : {
269 120318 : TYPE_ACQUIRE( pType );
270 120318 : pDestAny->pType = pType;
271 120318 : switch (pType->eTypeClass)
272 : {
273 : case typelib_TypeClass_CHAR:
274 0 : pDestAny->pData = &pDestAny->pReserved;
275 0 : *(sal_Unicode *)pDestAny->pData = '\0';
276 0 : break;
277 : case typelib_TypeClass_BOOLEAN:
278 38 : pDestAny->pData = &pDestAny->pReserved;
279 38 : *(sal_Bool *)pDestAny->pData = sal_False;
280 38 : break;
281 : case typelib_TypeClass_BYTE:
282 0 : pDestAny->pData = &pDestAny->pReserved;
283 0 : *(sal_Int8 *)pDestAny->pData = 0;
284 0 : break;
285 : case typelib_TypeClass_SHORT:
286 : case typelib_TypeClass_UNSIGNED_SHORT:
287 22 : pDestAny->pData = &pDestAny->pReserved;
288 22 : *(sal_Int16 *)pDestAny->pData = 0;
289 22 : break;
290 : case typelib_TypeClass_LONG:
291 : case typelib_TypeClass_UNSIGNED_LONG:
292 7298 : pDestAny->pData = &pDestAny->pReserved;
293 7298 : *(sal_Int32 *)pDestAny->pData = 0;
294 7298 : break;
295 : case typelib_TypeClass_HYPER:
296 : case typelib_TypeClass_UNSIGNED_HYPER:
297 : if (sizeof(void *) >= sizeof(sal_Int64))
298 0 : pDestAny->pData = &pDestAny->pReserved;
299 : else
300 : pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) );
301 0 : *(sal_Int64 *)pDestAny->pData = 0;
302 0 : break;
303 : case typelib_TypeClass_FLOAT:
304 : if (sizeof(void *) >= sizeof(float))
305 0 : pDestAny->pData = &pDestAny->pReserved;
306 : else
307 : pDestAny->pData = ::rtl_allocateMemory( sizeof(float) );
308 0 : *(float *)pDestAny->pData = 0.0;
309 0 : break;
310 : case typelib_TypeClass_DOUBLE:
311 : if (sizeof(void *) >= sizeof(double))
312 0 : pDestAny->pData = &pDestAny->pReserved;
313 : else
314 : pDestAny->pData = ::rtl_allocateMemory( sizeof(double) );
315 0 : *(double *)pDestAny->pData = 0.0;
316 0 : break;
317 : case typelib_TypeClass_STRING:
318 4102 : pDestAny->pData = &pDestAny->pReserved;
319 4102 : *(rtl_uString **)pDestAny->pData = 0;
320 4102 : ::rtl_uString_new( (rtl_uString **)pDestAny->pData );
321 4102 : break;
322 : case typelib_TypeClass_TYPE:
323 0 : pDestAny->pData = &pDestAny->pReserved;
324 0 : *(typelib_TypeDescriptionReference **)pDestAny->pData = _getVoidType();
325 0 : break;
326 : case typelib_TypeClass_ENUM:
327 4 : pDestAny->pData = &pDestAny->pReserved;
328 4 : if (pTypeDescr)
329 : {
330 0 : *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue;
331 : }
332 : else
333 : {
334 4 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
335 4 : *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue;
336 4 : TYPELIB_DANGER_RELEASE( pTypeDescr );
337 : }
338 4 : break;
339 : case typelib_TypeClass_STRUCT:
340 : case typelib_TypeClass_EXCEPTION:
341 168 : if (pTypeDescr)
342 : {
343 168 : pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
344 : _defaultConstructStruct(
345 168 : pDestAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr );
346 : }
347 : else
348 : {
349 0 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
350 0 : pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
351 : _defaultConstructStruct(
352 0 : pDestAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr );
353 0 : TYPELIB_DANGER_RELEASE( pTypeDescr );
354 : }
355 168 : break;
356 : case typelib_TypeClass_SEQUENCE:
357 108340 : pDestAny->pData = &pDestAny->pReserved;
358 108340 : *(uno_Sequence **)pDestAny->pData = createEmptySequence();
359 108340 : break;
360 : case typelib_TypeClass_INTERFACE:
361 346 : pDestAny->pData = &pDestAny->pReserved;
362 346 : pDestAny->pReserved = 0; // either cpp or c-uno interface
363 346 : break;
364 : default:
365 : OSL_ASSERT(false);
366 0 : break;
367 : }
368 : }
369 : }
370 : }
371 :
372 31212174 : inline uno_Sequence * icopyConstructSequence(
373 : uno_Sequence * pSource,
374 : typelib_TypeDescriptionReference * pElementType,
375 : uno_AcquireFunc acquire, uno_Mapping * mapping )
376 : {
377 31212174 : typelib_TypeClass eTypeClass = pElementType->eTypeClass;
378 31306607 : if (!mapping ||
379 177720 : (eTypeClass <= typelib_TypeClass_ENUM &&
380 : eTypeClass != typelib_TypeClass_ANY))
381 : {
382 31121015 : osl_atomic_increment( &pSource->nRefCount );
383 31121015 : return pSource;
384 : }
385 : else // create new sequence
386 : {
387 : uno_Sequence * pDest;
388 91159 : sal_Int32 nElements = pSource->nElements;
389 91159 : if (nElements)
390 : {
391 88872 : switch (eTypeClass)
392 : {
393 : case typelib_TypeClass_ANY:
394 : {
395 79680 : pDest = allocSeq( sizeof (uno_Any), nElements );
396 79680 : if (pDest != 0)
397 : {
398 79680 : uno_Any * pDestElements = (uno_Any *)pDest->elements;
399 79680 : uno_Any * pSourceElements = (uno_Any *)pSource->elements;
400 566388 : for ( sal_Int32 nPos = nElements; nPos--; )
401 : {
402 : typelib_TypeDescriptionReference * pType =
403 407028 : pSourceElements[nPos].pType;
404 407028 : if (typelib_TypeClass_VOID == pType->eTypeClass)
405 : {
406 6555 : CONSTRUCT_EMPTY_ANY( &pDestElements[nPos] );
407 : }
408 : else
409 : {
410 : _copyConstructAnyFromData(
411 : &pDestElements[nPos],
412 400473 : pSourceElements[nPos].pData,
413 : pType, 0,
414 400473 : acquire, mapping );
415 : }
416 : }
417 : }
418 79680 : break;
419 : }
420 : case typelib_TypeClass_STRUCT:
421 : case typelib_TypeClass_EXCEPTION:
422 : {
423 8562 : typelib_TypeDescription * pElementTypeDescr = 0;
424 8562 : TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
425 8562 : sal_Int32 nElementSize = pElementTypeDescr->nSize;
426 8562 : char * pSourceElements = pSource->elements;
427 8562 : pDest = allocSeq( nElementSize, nElements );
428 8562 : if (pDest != 0)
429 : {
430 8562 : char * pElements = pDest->elements;
431 47306 : for ( sal_Int32 nPos = nElements; nPos--; )
432 : {
433 : _copyConstructStruct(
434 60364 : pElements + (nPos * nElementSize),
435 60364 : pSourceElements + (nPos * nElementSize),
436 : (typelib_CompoundTypeDescription *)
437 : pElementTypeDescr,
438 120728 : acquire, mapping );
439 : }
440 : }
441 8562 : TYPELIB_DANGER_RELEASE( pElementTypeDescr );
442 8562 : break;
443 : }
444 : case typelib_TypeClass_SEQUENCE: // sequence of sequence
445 : {
446 474 : pDest = allocSeq( sizeof (uno_Sequence *), nElements );
447 474 : if (pDest != 0)
448 : {
449 474 : typelib_TypeDescription * pElementTypeDescr = 0;
450 474 : TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
451 : typelib_TypeDescriptionReference * pSeqElementType =
452 : ((typelib_IndirectTypeDescription *)
453 474 : pElementTypeDescr)->pType;
454 :
455 : uno_Sequence ** pDestElements =
456 474 : (uno_Sequence **) pDest->elements;
457 : uno_Sequence ** pSourceElements =
458 474 : (uno_Sequence **) pSource->elements;
459 3084 : for ( sal_Int32 nPos = nElements; nPos--; )
460 : {
461 : uno_Sequence * pNew = copyConstructSequence(
462 2136 : pSourceElements[nPos],
463 : pSeqElementType,
464 2136 : acquire, mapping );
465 : OSL_ASSERT( pNew != 0 );
466 : // ought never be a memory allocation problem,
467 : // because of reference counted sequence handles
468 2136 : pDestElements[ nPos ] = pNew;
469 : }
470 :
471 474 : TYPELIB_DANGER_RELEASE( pElementTypeDescr );
472 : }
473 474 : break;
474 : }
475 : case typelib_TypeClass_INTERFACE:
476 : {
477 156 : pDest = allocSeq( sizeof (void *), nElements );
478 156 : if (pDest != 0)
479 : {
480 156 : char * pElements = pDest->elements;
481 156 : void ** pSourceElements = (void **)pSource->elements;
482 156 : typelib_TypeDescription * pElementTypeDescr = 0;
483 156 : TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
484 592 : for ( sal_Int32 nPos = nElements; nPos--; )
485 : {
486 280 : ((void **)pElements)[nPos] = 0;
487 280 : if (((void **)pSourceElements)[nPos])
488 : {
489 : (*mapping->mapInterface)(
490 : mapping, (void **)pElements + nPos,
491 254 : pSourceElements[nPos],
492 : (typelib_InterfaceTypeDescription *)
493 508 : pElementTypeDescr );
494 : }
495 : }
496 156 : TYPELIB_DANGER_RELEASE( pElementTypeDescr );
497 : }
498 156 : break;
499 : }
500 : default:
501 : OSL_FAIL( "### unexepcted sequence element type!" );
502 0 : pDest = 0;
503 0 : break;
504 : }
505 : }
506 : else // empty sequence
507 : {
508 2287 : pDest = allocSeq( 0, 0 );
509 : }
510 :
511 91159 : return pDest;
512 : }
513 : }
514 :
515 :
516 169824001 : inline void _copyConstructData(
517 : void * pDest, void * pSource,
518 : typelib_TypeDescriptionReference * pType, typelib_TypeDescription * pTypeDescr,
519 : uno_AcquireFunc acquire, uno_Mapping * mapping )
520 : {
521 169824001 : switch (pType->eTypeClass)
522 : {
523 : case typelib_TypeClass_CHAR:
524 766 : *(sal_Unicode *)pDest = *(sal_Unicode *)pSource;
525 766 : break;
526 : case typelib_TypeClass_BOOLEAN:
527 697356 : *(sal_Bool *)pDest = (*(sal_Bool *)pSource != sal_False);
528 697356 : break;
529 : case typelib_TypeClass_BYTE:
530 724 : *(sal_Int8 *)pDest = *(sal_Int8 *)pSource;
531 724 : break;
532 : case typelib_TypeClass_SHORT:
533 : case typelib_TypeClass_UNSIGNED_SHORT:
534 10717902 : *(sal_Int16 *)pDest = *(sal_Int16 *)pSource;
535 10717902 : break;
536 : case typelib_TypeClass_LONG:
537 : case typelib_TypeClass_UNSIGNED_LONG:
538 37324678 : *(sal_Int32 *)pDest = *(sal_Int32 *)pSource;
539 37324678 : break;
540 : case typelib_TypeClass_HYPER:
541 : case typelib_TypeClass_UNSIGNED_HYPER:
542 544 : *(sal_Int64 *)pDest = *(sal_Int64 *)pSource;
543 544 : break;
544 : case typelib_TypeClass_FLOAT:
545 356210 : *(float *)pDest = *(float *)pSource;
546 356210 : break;
547 : case typelib_TypeClass_DOUBLE:
548 694598 : *(double *)pDest = *(double *)pSource;
549 694598 : break;
550 : case typelib_TypeClass_STRING:
551 54034342 : ::rtl_uString_acquire( *(rtl_uString **)pSource );
552 54034342 : *(rtl_uString **)pDest = *(rtl_uString **)pSource;
553 54034342 : break;
554 : case typelib_TypeClass_TYPE:
555 3890451 : TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource );
556 3890451 : *(typelib_TypeDescriptionReference **)pDest = *(typelib_TypeDescriptionReference **)pSource;
557 3890451 : break;
558 : case typelib_TypeClass_ANY:
559 : _copyConstructAny(
560 : (uno_Any *)pDest, ((uno_Any *)pSource)->pData,
561 : ((uno_Any *)pSource)->pType, 0,
562 30095666 : acquire, mapping );
563 30095666 : break;
564 : case typelib_TypeClass_ENUM:
565 29477950 : *(sal_Int32 *)pDest = *(sal_Int32 *)pSource;
566 29477950 : break;
567 : case typelib_TypeClass_STRUCT:
568 : case typelib_TypeClass_EXCEPTION:
569 984478 : if (pTypeDescr)
570 : {
571 : _copyConstructStruct(
572 : pDest, pSource,
573 : (typelib_CompoundTypeDescription *)pTypeDescr,
574 41002 : acquire, mapping );
575 : }
576 : else
577 : {
578 943476 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
579 : _copyConstructStruct(
580 : pDest, pSource,
581 : (typelib_CompoundTypeDescription *)pTypeDescr,
582 943476 : acquire, mapping );
583 943476 : TYPELIB_DANGER_RELEASE( pTypeDescr );
584 : }
585 984478 : break;
586 : case typelib_TypeClass_SEQUENCE:
587 793877 : if (mapping)
588 : {
589 85264 : if (pTypeDescr)
590 : {
591 : *(uno_Sequence **)pDest = icopyConstructSequence(
592 : *(uno_Sequence **)pSource,
593 : ((typelib_IndirectTypeDescription *)pTypeDescr)->pType,
594 17570 : acquire, mapping );
595 : }
596 : else
597 : {
598 67694 : TYPELIB_DANGER_GET( &pTypeDescr, pType );
599 : *(uno_Sequence **)pDest = icopyConstructSequence(
600 : *(uno_Sequence **)pSource,
601 : ((typelib_IndirectTypeDescription *)pTypeDescr)->pType,
602 67694 : acquire, mapping );
603 67694 : TYPELIB_DANGER_RELEASE( pTypeDescr );
604 : }
605 : }
606 : else
607 : {
608 708613 : osl_atomic_increment( &(*(uno_Sequence **)pSource)->nRefCount );
609 708613 : *(uno_Sequence **)pDest = *(uno_Sequence **)pSource;
610 : }
611 793877 : break;
612 : case typelib_TypeClass_INTERFACE:
613 754265 : if (mapping)
614 205375 : *(void **)pDest = _map( *(void **)pSource, pType, pTypeDescr, mapping );
615 : else
616 548890 : _acquire( *(void **)pDest = *(void **)pSource, acquire );
617 754265 : break;
618 : default:
619 194 : break;
620 : }
621 169824001 : }
622 :
623 : }
624 :
625 : #endif
626 :
627 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|