1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <rtl/memory.h>
43 //##################################################################################################
44 //#### equality ####################################################################################
45 //##################################################################################################
47 //--------------------------------------------------------------------------------------------------
48 inline sal_Bool
_equalObject(
49 void * pI1
, void * pI2
,
50 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
55 if ((0 == pI1
) || (0 == pI2
))
57 sal_Bool bRet
= sal_False
;
59 typelib_TypeDescriptionReference
* type_XInterface
=
60 * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE
);
61 if (0 == queryInterface
)
62 queryInterface
= binuno_queryInterface
;
63 pI1
= (*queryInterface
)( pI1
, type_XInterface
);
66 pI2
= (*queryInterface
)( pI2
, type_XInterface
);
70 _release( pI2
, release
);
72 _release( pI1
, release
);
77 //==================================================================================================
79 void * pDest
, void *pSource
,
80 typelib_CompoundTypeDescription
* pTypeDescr
,
81 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
83 //--------------------------------------------------------------------------------------------------
84 inline sal_Bool
_equalStruct(
85 void * pDest
, void *pSource
,
86 typelib_CompoundTypeDescription
* pTypeDescr
,
87 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
90 if (pTypeDescr
->pBaseTypeDescription
&&
91 !equalStruct( pDest
, pSource
, pTypeDescr
->pBaseTypeDescription
, queryInterface
, release
))
96 typelib_TypeDescriptionReference
** ppTypeRefs
= pTypeDescr
->ppTypeRefs
;
97 sal_Int32
* pMemberOffsets
= pTypeDescr
->pMemberOffsets
;
98 sal_Int32 nDescr
= pTypeDescr
->nMembers
;
102 sal_Int32 nOffset
= pMemberOffsets
[nDescr
];
103 if (! ::uno_type_equalData( (char *)pDest
+ nOffset
,
105 (char *)pSource
+ nOffset
,
107 queryInterface
, release
))
114 //==================================================================================================
115 sal_Bool
equalSequence(
116 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
117 typelib_TypeDescriptionReference
* pElementType
,
118 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
120 //--------------------------------------------------------------------------------------------------
121 inline sal_Bool
_equalSequence(
122 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
123 typelib_TypeDescriptionReference
* pElementType
,
124 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
127 if (pDest
== pSource
)
129 sal_Int32 nElements
= pDest
->nElements
;
130 if (nElements
!= pSource
->nElements
)
135 void * pDestElements
= pDest
->elements
;
136 void * pSourceElements
= pSource
->elements
;
138 switch (pElementType
->eTypeClass
)
140 case typelib_TypeClass_CHAR
:
141 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Unicode
) * nElements
));
142 case typelib_TypeClass_BOOLEAN
:
144 for ( sal_Int32 nPos
= nElements
; nPos
--; )
146 if ((((sal_Bool
*)pDestElements
)[nPos
] != sal_False
) !=
147 (((sal_Bool
*)pSourceElements
)[nPos
] != sal_False
))
154 case typelib_TypeClass_BYTE
:
155 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int8
) * nElements
));
156 case typelib_TypeClass_SHORT
:
157 case typelib_TypeClass_UNSIGNED_SHORT
:
158 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int16
) * nElements
));
159 case typelib_TypeClass_LONG
:
160 case typelib_TypeClass_UNSIGNED_LONG
:
161 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
162 case typelib_TypeClass_HYPER
:
163 case typelib_TypeClass_UNSIGNED_HYPER
:
164 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int64
) * nElements
));
165 case typelib_TypeClass_FLOAT
:
167 for ( sal_Int32 nPos
= nElements
; nPos
--; )
169 if (((float *)pDestElements
)[nPos
] != ((float *)pSourceElements
)[nPos
])
174 case typelib_TypeClass_DOUBLE
:
176 for ( sal_Int32 nPos
= nElements
; nPos
--; )
178 if (((double *)pDestElements
)[nPos
] != ((double *)pSourceElements
)[nPos
])
183 case typelib_TypeClass_STRING
:
185 for ( sal_Int32 nPos
= nElements
; nPos
--; )
187 if (! ((::rtl::OUString
*)pDestElements
+nPos
)->equals( ((const ::rtl::OUString
*)pSourceElements
)[nPos
] ))
192 case typelib_TypeClass_TYPE
:
194 for ( sal_Int32 nPos
= nElements
; nPos
--; )
196 if (! _type_equals( ((typelib_TypeDescriptionReference
**)pDestElements
)[nPos
],
197 ((typelib_TypeDescriptionReference
**)pSourceElements
)[nPos
] ))
204 case typelib_TypeClass_ANY
:
206 for ( sal_Int32 nPos
= nElements
; nPos
--; )
208 uno_Any
* pDest2
= (uno_Any
*)pDestElements
+ nPos
;
209 uno_Any
* pSource2
= (uno_Any
*)pSourceElements
+ nPos
;
210 if (! ::uno_type_equalData( pDest2
->pData
, pDest2
->pType
,
211 pSource2
->pData
, pSource2
->pType
,
212 queryInterface
, release
))
219 case typelib_TypeClass_ENUM
:
220 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
221 case typelib_TypeClass_STRUCT
:
222 case typelib_TypeClass_EXCEPTION
:
224 typelib_TypeDescription
* pElementTypeDescr
= 0;
225 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
226 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
227 for ( sal_Int32 nPos
= nElements
; nPos
--; )
229 if (! _equalStruct( (char *)pDestElements
+ (nPos
* nElementSize
),
230 (char *)pSourceElements
+ (nPos
* nElementSize
),
231 (typelib_CompoundTypeDescription
*)pElementTypeDescr
,
232 queryInterface
, release
))
234 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
238 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
241 case typelib_TypeClass_UNION
:
243 typelib_TypeDescription
* pElementTypeDescr
= 0;
244 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
245 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
246 sal_Int32 nValueOffset
= ((typelib_UnionTypeDescription
*)pElementTypeDescr
)->nValueOffset
;
247 for ( sal_Int32 nPos
= nElements
; nPos
--; )
249 char * pDest2
= (char *)pDestElements
+ (nPos
* nElementSize
);
250 char * pSource2
= (char *)pSourceElements
+ (nPos
* nElementSize
);
251 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
252 pDest2
, pElementTypeDescr
);
253 sal_Bool bRet
= ::uno_type_equalData(
254 pDest2
+ nValueOffset
, pSetType
,
255 pSource2
+ nValueOffset
, pSetType
,
256 queryInterface
, release
);
257 ::typelib_typedescriptionreference_release( pSetType
);
260 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
264 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
267 case typelib_TypeClass_SEQUENCE
: // sequence of sequence
269 typelib_TypeDescription
* pElementTypeDescr
= 0;
270 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
271 typelib_TypeDescriptionReference
* pSeqElementType
=
272 ((typelib_IndirectTypeDescription
*)pElementTypeDescr
)->pType
;
273 for ( sal_Int32 nPos
= nElements
; nPos
--; )
275 if (! equalSequence( ((uno_Sequence
**)pDestElements
)[nPos
],
276 ((uno_Sequence
**)pSourceElements
)[nPos
],
277 pSeqElementType
, queryInterface
, release
))
279 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
283 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
286 case typelib_TypeClass_INTERFACE
:
288 for ( sal_Int32 nPos
= nElements
; nPos
--; )
290 if (! _equalObject( ((void **)pDestElements
)[nPos
], ((void **)pSourceElements
)[nPos
],
291 queryInterface
, release
))
303 //--------------------------------------------------------------------------------------------------
304 inline sal_Bool
_equalData(
306 typelib_TypeDescriptionReference
* pDestType
, typelib_TypeDescription
* pDestTypeDescr
,
308 typelib_TypeDescriptionReference
* pSourceType
, typelib_TypeDescription
* pSourceTypeDescr
,
309 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
312 typelib_TypeClass eSourceTypeClass
, eDestTypeClass
;
313 while (typelib_TypeClass_ANY
== (eDestTypeClass
= pDestType
->eTypeClass
))
316 pDestType
= ((uno_Any
*)pDest
)->pType
;
317 pDest
= ((uno_Any
*)pDest
)->pData
;
319 while (typelib_TypeClass_ANY
== (eSourceTypeClass
= pSourceType
->eTypeClass
))
321 pSourceTypeDescr
= 0;
322 pSourceType
= ((uno_Any
*)pSource
)->pType
;
323 pSource
= ((uno_Any
*)pSource
)->pData
;
326 switch (eDestTypeClass
)
328 case typelib_TypeClass_VOID
:
329 return eSourceTypeClass
== typelib_TypeClass_VOID
;
330 case typelib_TypeClass_CHAR
:
331 return eSourceTypeClass
== typelib_TypeClass_CHAR
332 && *(sal_Unicode
*)pDest
== *(sal_Unicode
*)pSource
;
333 case typelib_TypeClass_BOOLEAN
:
334 return eSourceTypeClass
== typelib_TypeClass_BOOLEAN
335 && ((*(sal_Bool
*)pDest
!= sal_False
)
336 == (*(sal_Bool
*)pSource
!= sal_False
));
337 case typelib_TypeClass_BYTE
:
338 switch (eSourceTypeClass
)
340 case typelib_TypeClass_BYTE
:
341 return (*(sal_Int8
*)pDest
== *(sal_Int8
*)pSource
);
342 case typelib_TypeClass_SHORT
:
343 return ((sal_Int16
)*(sal_Int8
*)pDest
== *(sal_Int16
*)pSource
);
344 case typelib_TypeClass_UNSIGNED_SHORT
:
345 return ((sal_Int32
)*(sal_Int8
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
346 case typelib_TypeClass_LONG
:
347 return ((sal_Int32
)*(sal_Int8
*)pDest
== *(sal_Int32
*)pSource
);
348 case typelib_TypeClass_UNSIGNED_LONG
:
349 return ((sal_Int64
)*(sal_Int8
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
350 case typelib_TypeClass_HYPER
:
351 return ((sal_Int64
)*(sal_Int8
*)pDest
== *(sal_Int64
*)pSource
);
352 case typelib_TypeClass_UNSIGNED_HYPER
:
353 return (*(sal_Int8
*)pDest
>= 0 &&
354 (sal_Int64
)*(sal_Int8
*)pDest
== *(sal_Int64
*)pSource
); // same size
355 case typelib_TypeClass_FLOAT
:
356 return ((float)*(sal_Int8
*)pDest
== *(float *)pSource
);
357 case typelib_TypeClass_DOUBLE
:
358 return ((double)*(sal_Int8
*)pDest
== *(double *)pSource
);
362 case typelib_TypeClass_SHORT
:
363 switch (eSourceTypeClass
)
365 case typelib_TypeClass_BYTE
:
366 return (*(sal_Int16
*)pDest
== (sal_Int16
)*(sal_Int8
*)pSource
);
367 case typelib_TypeClass_SHORT
:
368 return (*(sal_Int16
*)pDest
== *(sal_Int16
*)pSource
);
369 case typelib_TypeClass_UNSIGNED_SHORT
:
370 return ((sal_Int32
)*(sal_Int16
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
371 case typelib_TypeClass_LONG
:
372 return ((sal_Int32
)*(sal_Int16
*)pDest
== *(sal_Int32
*)pSource
);
373 case typelib_TypeClass_UNSIGNED_LONG
:
374 return ((sal_Int64
)*(sal_Int16
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
375 case typelib_TypeClass_HYPER
:
376 return ((sal_Int64
)*(sal_Int16
*)pDest
== *(sal_Int64
*)pSource
);
377 case typelib_TypeClass_UNSIGNED_HYPER
:
378 return (*(sal_Int16
*)pDest
>= 0 &&
379 (sal_Int64
)*(sal_Int16
*)pDest
== *(sal_Int64
*)pSource
); // same size
380 case typelib_TypeClass_FLOAT
:
381 return ((float)*(sal_Int16
*)pDest
== *(float *)pSource
);
382 case typelib_TypeClass_DOUBLE
:
383 return ((double)*(sal_Int16
*)pDest
== *(double *)pSource
);
387 case typelib_TypeClass_UNSIGNED_SHORT
:
388 switch (eSourceTypeClass
)
390 case typelib_TypeClass_BYTE
:
391 return ((sal_Int32
)*(sal_uInt16
*)pDest
== (sal_Int32
)*(sal_Int8
*)pSource
);
392 case typelib_TypeClass_SHORT
:
393 return ((sal_Int32
)*(sal_uInt16
*)pDest
== (sal_Int32
)*(sal_Int16
*)pSource
);
394 case typelib_TypeClass_UNSIGNED_SHORT
:
395 return (*(sal_uInt16
*)pDest
== *(sal_uInt16
*)pSource
);
396 case typelib_TypeClass_LONG
:
397 return ((sal_Int32
)*(sal_uInt16
*)pDest
== *(sal_Int32
*)pSource
);
398 case typelib_TypeClass_UNSIGNED_LONG
:
399 return ((sal_uInt32
)*(sal_uInt16
*)pDest
== *(sal_uInt32
*)pSource
);
400 case typelib_TypeClass_HYPER
:
401 return ((sal_Int64
)*(sal_uInt16
*)pDest
== *(sal_Int64
*)pSource
);
402 case typelib_TypeClass_UNSIGNED_HYPER
:
403 return ((sal_uInt64
)*(sal_uInt16
*)pDest
== *(sal_uInt64
*)pSource
);
404 case typelib_TypeClass_FLOAT
:
405 return ((float)*(sal_uInt16
*)pDest
== *(float *)pSource
);
406 case typelib_TypeClass_DOUBLE
:
407 return ((double)*(sal_uInt16
*)pDest
== *(double *)pSource
);
411 case typelib_TypeClass_LONG
:
412 switch (eSourceTypeClass
)
414 case typelib_TypeClass_BYTE
:
415 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_Int8
*)pSource
);
416 case typelib_TypeClass_SHORT
:
417 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_Int16
*)pSource
);
418 case typelib_TypeClass_UNSIGNED_SHORT
:
419 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
420 case typelib_TypeClass_LONG
:
421 return (*(sal_Int32
*)pDest
== *(sal_Int32
*)pSource
);
422 case typelib_TypeClass_UNSIGNED_LONG
:
423 return ((sal_Int64
)*(sal_Int32
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
424 case typelib_TypeClass_HYPER
:
425 return ((sal_Int64
)*(sal_Int32
*)pDest
== *(sal_Int64
*)pSource
);
426 case typelib_TypeClass_UNSIGNED_HYPER
:
427 return (*(sal_Int32
*)pDest
>= 0 &&
428 (sal_Int64
)*(sal_Int32
*)pDest
== *(sal_Int64
*)pSource
); // same size
429 case typelib_TypeClass_FLOAT
:
430 return ((float)*(sal_Int32
*)pDest
== *(float *)pSource
);
431 case typelib_TypeClass_DOUBLE
:
432 return ((double)*(sal_Int32
*)pDest
== *(double *)pSource
);
436 case typelib_TypeClass_UNSIGNED_LONG
:
437 switch (eSourceTypeClass
)
439 case typelib_TypeClass_BYTE
:
440 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int8
*)pSource
);
441 case typelib_TypeClass_SHORT
:
442 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int16
*)pSource
);
443 case typelib_TypeClass_UNSIGNED_SHORT
:
444 return (*(sal_uInt32
*)pDest
== (sal_uInt32
)*(sal_uInt16
*)pSource
);
445 case typelib_TypeClass_LONG
:
446 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int32
*)pSource
);
447 case typelib_TypeClass_UNSIGNED_LONG
:
448 return (*(sal_uInt32
*)pDest
== *(sal_uInt32
*)pSource
);
449 case typelib_TypeClass_HYPER
:
450 return ((sal_Int64
)*(sal_uInt32
*)pDest
== *(sal_Int64
*)pSource
);
451 case typelib_TypeClass_UNSIGNED_HYPER
:
452 return ((sal_uInt64
)*(sal_uInt32
*)pDest
== *(sal_uInt64
*)pSource
);
453 case typelib_TypeClass_FLOAT
:
454 return ((float)*(sal_uInt32
*)pDest
== *(float *)pSource
);
455 case typelib_TypeClass_DOUBLE
:
456 return ((double)*(sal_uInt32
*)pDest
== *(double *)pSource
);
460 case typelib_TypeClass_HYPER
:
461 switch (eSourceTypeClass
)
463 case typelib_TypeClass_BYTE
:
464 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int8
*)pSource
);
465 case typelib_TypeClass_SHORT
:
466 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int16
*)pSource
);
467 case typelib_TypeClass_UNSIGNED_SHORT
:
468 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_uInt16
*)pSource
);
469 case typelib_TypeClass_LONG
:
470 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int32
*)pSource
);
471 case typelib_TypeClass_UNSIGNED_LONG
:
472 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
473 case typelib_TypeClass_HYPER
:
474 return (*(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
);
475 case typelib_TypeClass_UNSIGNED_HYPER
:
476 return (*(sal_Int64
*)pDest
>= 0 &&
477 *(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
); // same size
478 case typelib_TypeClass_FLOAT
:
479 return ((float)*(sal_Int64
*)pDest
== *(float *)pSource
);
480 case typelib_TypeClass_DOUBLE
:
481 return ((double)*(sal_Int64
*)pDest
== *(double *)pSource
);
485 case typelib_TypeClass_UNSIGNED_HYPER
:
486 switch (eSourceTypeClass
)
488 case typelib_TypeClass_BYTE
:
489 return (*(sal_Int8
*)pSource
>= 0 &&
490 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int8
*)pSource
);
491 case typelib_TypeClass_SHORT
:
492 return (*(sal_Int16
*)pSource
>= 0 &&
493 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int16
*)pSource
);
494 case typelib_TypeClass_UNSIGNED_SHORT
:
495 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_uInt16
*)pSource
);
496 case typelib_TypeClass_LONG
:
497 return (*(sal_Int32
*)pSource
>= 0 &&
498 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int32
*)pSource
);
499 case typelib_TypeClass_UNSIGNED_LONG
:
500 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_uInt32
*)pSource
);
501 case typelib_TypeClass_HYPER
:
502 return (*(sal_Int64
*)pSource
>= 0 &&
503 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int64
*)pSource
);
504 case typelib_TypeClass_UNSIGNED_HYPER
:
505 return (*(sal_uInt64
*)pDest
== *(sal_uInt64
*)pSource
);
506 case typelib_TypeClass_FLOAT
:
507 if (::floor( *(float *)pSource
) != *(float *)pSource
|| *(float *)pSource
< 0)
509 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(float *)pSource
);
510 case typelib_TypeClass_DOUBLE
:
511 if (::floor( *(double *)pSource
) != *(double *)pSource
|| *(double *)pSource
< 0)
513 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(double *)pSource
);
517 case typelib_TypeClass_FLOAT
:
518 switch (eSourceTypeClass
)
520 case typelib_TypeClass_BYTE
:
521 return (*(float *)pDest
== (float)*(sal_Int8
*)pSource
);
522 case typelib_TypeClass_SHORT
:
523 return (*(float *)pDest
== (float)*(sal_Int16
*)pSource
);
524 case typelib_TypeClass_UNSIGNED_SHORT
:
525 return (*(float *)pDest
== (float)*(sal_uInt16
*)pSource
);
526 case typelib_TypeClass_LONG
:
527 return (*(float *)pDest
== (float)*(sal_Int32
*)pSource
);
528 case typelib_TypeClass_UNSIGNED_LONG
:
529 return (*(float *)pDest
== (float)*(sal_uInt32
*)pSource
);
530 case typelib_TypeClass_HYPER
:
531 return (*(float *)pDest
== (float)*(sal_Int64
*)pSource
);
532 case typelib_TypeClass_UNSIGNED_HYPER
:
533 if (::floor( *(float *)pDest
) != *(float *)pDest
|| *(float *)pDest
< 0)
535 return ((sal_uInt64
)*(float *)pDest
== *(sal_uInt64
*)pSource
);
536 case typelib_TypeClass_FLOAT
:
537 return (*(float *)pDest
== *(float *)pSource
);
538 case typelib_TypeClass_DOUBLE
:
539 return ((double)*(float *)pDest
== *(double *)pSource
);
543 case typelib_TypeClass_DOUBLE
:
544 switch (eSourceTypeClass
)
546 case typelib_TypeClass_BYTE
:
547 return (*(double *)pDest
== (double)*(sal_Int8
*)pSource
);
548 case typelib_TypeClass_SHORT
:
549 return (*(double *)pDest
== (double)*(sal_Int16
*)pSource
);
550 case typelib_TypeClass_UNSIGNED_SHORT
:
551 return (*(double *)pDest
== (double)*(sal_uInt16
*)pSource
);
552 case typelib_TypeClass_LONG
:
553 return (*(double *)pDest
== (double)*(sal_Int32
*)pSource
);
554 case typelib_TypeClass_UNSIGNED_LONG
:
555 return (*(double *)pDest
== (double)*(sal_uInt32
*)pSource
);
556 case typelib_TypeClass_HYPER
:
557 return (*(double *)pDest
== (double)*(sal_Int64
*)pSource
);
558 case typelib_TypeClass_UNSIGNED_HYPER
:
559 if (::floor( *(double *)pDest
) != *(double *)pDest
|| *(double *)pDest
< 0)
561 return ((sal_uInt64
)*(double *)pDest
== *(sal_uInt64
*)pSource
);
562 case typelib_TypeClass_FLOAT
:
563 return (*(double *)pDest
== (double)*(float *)pSource
);
564 case typelib_TypeClass_DOUBLE
:
565 return (*(double *)pDest
== *(double *)pSource
);
569 case typelib_TypeClass_STRING
:
570 return eSourceTypeClass
== typelib_TypeClass_STRING
571 && ((::rtl::OUString
*)pDest
)->equals(
572 *(::rtl::OUString
const *)pSource
);
573 case typelib_TypeClass_TYPE
:
574 return eSourceTypeClass
== typelib_TypeClass_TYPE
576 *(typelib_TypeDescriptionReference
**)pDest
,
577 *(typelib_TypeDescriptionReference
**)pSource
);
578 case typelib_TypeClass_ENUM
:
579 return (_type_equals( pDestType
, pSourceType
) &&
580 *(sal_Int32
*)pDest
== *(sal_Int32
*)pSource
);
581 case typelib_TypeClass_STRUCT
:
582 case typelib_TypeClass_EXCEPTION
:
583 if (! _type_equals( pDestType
, pSourceType
))
589 (typelib_CompoundTypeDescription
*)pDestTypeDescr
,
590 queryInterface
, release
);
594 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
595 sal_Bool bRet
= _equalStruct(
597 (typelib_CompoundTypeDescription
*)pDestTypeDescr
,
598 queryInterface
, release
);
599 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
602 case typelib_TypeClass_UNION
:
603 if (_type_equals( pDestType
, pSourceType
) &&
604 *(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
) // same discriminant
609 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
610 pDest
, pDestTypeDescr
);
611 bRet
= ::uno_type_equalData(
612 (char *)pDest
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
614 (char *)pSource
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
616 queryInterface
, release
);
617 typelib_typedescriptionreference_release( pSetType
);
621 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
622 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
623 pDest
, pDestTypeDescr
);
624 bRet
= ::uno_type_equalData(
625 (char *)pDest
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
627 (char *)pSource
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
629 queryInterface
, release
);
630 typelib_typedescriptionreference_release( pSetType
);
631 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
636 case typelib_TypeClass_SEQUENCE
:
637 if (_type_equals( pDestType
, pSourceType
))
641 return _equalSequence(
642 *(uno_Sequence
**)pDest
, *(uno_Sequence
**)pSource
,
643 ((typelib_IndirectTypeDescription
*)pDestTypeDescr
)->pType
,
644 queryInterface
, release
);
648 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
649 sal_Bool bRet
= _equalSequence(
650 *(uno_Sequence
**)pDest
, *(uno_Sequence
**)pSource
,
651 ((typelib_IndirectTypeDescription
*)pDestTypeDescr
)->pType
,
652 queryInterface
, release
);
653 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
658 case typelib_TypeClass_INTERFACE
:
659 if (typelib_TypeClass_INTERFACE
== eSourceTypeClass
)
660 return _equalObject( *(void **)pDest
, *(void **)pSource
, queryInterface
, release
);