1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
31 #include <rtl/memory.h>
40 //##################################################################################################
41 //#### equality ####################################################################################
42 //##################################################################################################
44 //--------------------------------------------------------------------------------------------------
45 inline sal_Bool
_equalObject(
46 void * pI1
, void * pI2
,
47 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
52 if ((0 == pI1
) || (0 == pI2
))
54 sal_Bool bRet
= sal_False
;
56 typelib_TypeDescriptionReference
* type_XInterface
=
57 * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE
);
58 if (0 == queryInterface
)
59 queryInterface
= binuno_queryInterface
;
60 pI1
= (*queryInterface
)( pI1
, type_XInterface
);
63 pI2
= (*queryInterface
)( pI2
, type_XInterface
);
67 _release( pI2
, release
);
69 _release( pI1
, release
);
74 //==================================================================================================
76 void * pDest
, void *pSource
,
77 typelib_CompoundTypeDescription
* pTypeDescr
,
78 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
80 //--------------------------------------------------------------------------------------------------
81 inline sal_Bool
_equalStruct(
82 void * pDest
, void *pSource
,
83 typelib_CompoundTypeDescription
* pTypeDescr
,
84 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
87 if (pTypeDescr
->pBaseTypeDescription
&&
88 !equalStruct( pDest
, pSource
, pTypeDescr
->pBaseTypeDescription
, queryInterface
, release
))
93 typelib_TypeDescriptionReference
** ppTypeRefs
= pTypeDescr
->ppTypeRefs
;
94 sal_Int32
* pMemberOffsets
= pTypeDescr
->pMemberOffsets
;
95 sal_Int32 nDescr
= pTypeDescr
->nMembers
;
99 sal_Int32 nOffset
= pMemberOffsets
[nDescr
];
100 if (! ::uno_type_equalData( (char *)pDest
+ nOffset
,
102 (char *)pSource
+ nOffset
,
104 queryInterface
, release
))
111 //==================================================================================================
112 sal_Bool
equalSequence(
113 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
114 typelib_TypeDescriptionReference
* pElementType
,
115 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
117 //--------------------------------------------------------------------------------------------------
118 inline sal_Bool
_equalSequence(
119 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
120 typelib_TypeDescriptionReference
* pElementType
,
121 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
124 if (pDest
== pSource
)
126 sal_Int32 nElements
= pDest
->nElements
;
127 if (nElements
!= pSource
->nElements
)
132 void * pDestElements
= pDest
->elements
;
133 void * pSourceElements
= pSource
->elements
;
135 switch (pElementType
->eTypeClass
)
137 case typelib_TypeClass_CHAR
:
138 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Unicode
) * nElements
));
139 case typelib_TypeClass_BOOLEAN
:
141 for ( sal_Int32 nPos
= nElements
; nPos
--; )
143 if ((((sal_Bool
*)pDestElements
)[nPos
] != sal_False
) !=
144 (((sal_Bool
*)pSourceElements
)[nPos
] != sal_False
))
151 case typelib_TypeClass_BYTE
:
152 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int8
) * nElements
));
153 case typelib_TypeClass_SHORT
:
154 case typelib_TypeClass_UNSIGNED_SHORT
:
155 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int16
) * nElements
));
156 case typelib_TypeClass_LONG
:
157 case typelib_TypeClass_UNSIGNED_LONG
:
158 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
159 case typelib_TypeClass_HYPER
:
160 case typelib_TypeClass_UNSIGNED_HYPER
:
161 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int64
) * nElements
));
162 case typelib_TypeClass_FLOAT
:
164 for ( sal_Int32 nPos
= nElements
; nPos
--; )
166 if (((float *)pDestElements
)[nPos
] != ((float *)pSourceElements
)[nPos
])
171 case typelib_TypeClass_DOUBLE
:
173 for ( sal_Int32 nPos
= nElements
; nPos
--; )
175 if (((double *)pDestElements
)[nPos
] != ((double *)pSourceElements
)[nPos
])
180 case typelib_TypeClass_STRING
:
182 for ( sal_Int32 nPos
= nElements
; nPos
--; )
184 if (! ((::rtl::OUString
*)pDestElements
+nPos
)->equals( ((const ::rtl::OUString
*)pSourceElements
)[nPos
] ))
189 case typelib_TypeClass_TYPE
:
191 for ( sal_Int32 nPos
= nElements
; nPos
--; )
193 if (! _type_equals( ((typelib_TypeDescriptionReference
**)pDestElements
)[nPos
],
194 ((typelib_TypeDescriptionReference
**)pSourceElements
)[nPos
] ))
201 case typelib_TypeClass_ANY
:
203 for ( sal_Int32 nPos
= nElements
; nPos
--; )
205 uno_Any
* pDest2
= (uno_Any
*)pDestElements
+ nPos
;
206 uno_Any
* pSource2
= (uno_Any
*)pSourceElements
+ nPos
;
207 if (! ::uno_type_equalData( pDest2
->pData
, pDest2
->pType
,
208 pSource2
->pData
, pSource2
->pType
,
209 queryInterface
, release
))
216 case typelib_TypeClass_ENUM
:
217 return (0 == ::rtl_compareMemory( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
218 case typelib_TypeClass_STRUCT
:
219 case typelib_TypeClass_EXCEPTION
:
221 typelib_TypeDescription
* pElementTypeDescr
= 0;
222 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
223 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
224 for ( sal_Int32 nPos
= nElements
; nPos
--; )
226 if (! _equalStruct( (char *)pDestElements
+ (nPos
* nElementSize
),
227 (char *)pSourceElements
+ (nPos
* nElementSize
),
228 (typelib_CompoundTypeDescription
*)pElementTypeDescr
,
229 queryInterface
, release
))
231 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
235 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
238 case typelib_TypeClass_UNION
:
240 typelib_TypeDescription
* pElementTypeDescr
= 0;
241 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
242 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
243 sal_Int32 nValueOffset
= ((typelib_UnionTypeDescription
*)pElementTypeDescr
)->nValueOffset
;
244 for ( sal_Int32 nPos
= nElements
; nPos
--; )
246 char * pDest2
= (char *)pDestElements
+ (nPos
* nElementSize
);
247 char * pSource2
= (char *)pSourceElements
+ (nPos
* nElementSize
);
248 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
249 pDest2
, pElementTypeDescr
);
250 sal_Bool bRet
= ::uno_type_equalData(
251 pDest2
+ nValueOffset
, pSetType
,
252 pSource2
+ nValueOffset
, pSetType
,
253 queryInterface
, release
);
254 ::typelib_typedescriptionreference_release( pSetType
);
257 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
261 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
264 case typelib_TypeClass_SEQUENCE
: // sequence of sequence
266 typelib_TypeDescription
* pElementTypeDescr
= 0;
267 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
268 typelib_TypeDescriptionReference
* pSeqElementType
=
269 ((typelib_IndirectTypeDescription
*)pElementTypeDescr
)->pType
;
270 for ( sal_Int32 nPos
= nElements
; nPos
--; )
272 if (! equalSequence( ((uno_Sequence
**)pDestElements
)[nPos
],
273 ((uno_Sequence
**)pSourceElements
)[nPos
],
274 pSeqElementType
, queryInterface
, release
))
276 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
280 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
283 case typelib_TypeClass_INTERFACE
:
285 for ( sal_Int32 nPos
= nElements
; nPos
--; )
287 if (! _equalObject( ((void **)pDestElements
)[nPos
], ((void **)pSourceElements
)[nPos
],
288 queryInterface
, release
))
300 //--------------------------------------------------------------------------------------------------
301 inline sal_Bool
_equalData(
303 typelib_TypeDescriptionReference
* pDestType
, typelib_TypeDescription
* pDestTypeDescr
,
305 typelib_TypeDescriptionReference
* pSourceType
, typelib_TypeDescription
* pSourceTypeDescr
,
306 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
309 typelib_TypeClass eSourceTypeClass
, eDestTypeClass
;
310 while (typelib_TypeClass_ANY
== (eDestTypeClass
= pDestType
->eTypeClass
))
313 pDestType
= ((uno_Any
*)pDest
)->pType
;
314 pDest
= ((uno_Any
*)pDest
)->pData
;
316 while (typelib_TypeClass_ANY
== (eSourceTypeClass
= pSourceType
->eTypeClass
))
318 pSourceTypeDescr
= 0;
319 pSourceType
= ((uno_Any
*)pSource
)->pType
;
320 pSource
= ((uno_Any
*)pSource
)->pData
;
323 switch (eDestTypeClass
)
325 case typelib_TypeClass_VOID
:
326 return eSourceTypeClass
== typelib_TypeClass_VOID
;
327 case typelib_TypeClass_CHAR
:
328 return eSourceTypeClass
== typelib_TypeClass_CHAR
329 && *(sal_Unicode
*)pDest
== *(sal_Unicode
*)pSource
;
330 case typelib_TypeClass_BOOLEAN
:
331 return eSourceTypeClass
== typelib_TypeClass_BOOLEAN
332 && ((*(sal_Bool
*)pDest
!= sal_False
)
333 == (*(sal_Bool
*)pSource
!= sal_False
));
334 case typelib_TypeClass_BYTE
:
335 switch (eSourceTypeClass
)
337 case typelib_TypeClass_BYTE
:
338 return (*(sal_Int8
*)pDest
== *(sal_Int8
*)pSource
);
339 case typelib_TypeClass_SHORT
:
340 return ((sal_Int16
)*(sal_Int8
*)pDest
== *(sal_Int16
*)pSource
);
341 case typelib_TypeClass_UNSIGNED_SHORT
:
342 return ((sal_Int32
)*(sal_Int8
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
343 case typelib_TypeClass_LONG
:
344 return ((sal_Int32
)*(sal_Int8
*)pDest
== *(sal_Int32
*)pSource
);
345 case typelib_TypeClass_UNSIGNED_LONG
:
346 return ((sal_Int64
)*(sal_Int8
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
347 case typelib_TypeClass_HYPER
:
348 return ((sal_Int64
)*(sal_Int8
*)pDest
== *(sal_Int64
*)pSource
);
349 case typelib_TypeClass_UNSIGNED_HYPER
:
350 return (*(sal_Int8
*)pDest
>= 0 &&
351 (sal_Int64
)*(sal_Int8
*)pDest
== *(sal_Int64
*)pSource
); // same size
352 case typelib_TypeClass_FLOAT
:
353 return ((float)*(sal_Int8
*)pDest
== *(float *)pSource
);
354 case typelib_TypeClass_DOUBLE
:
355 return ((double)*(sal_Int8
*)pDest
== *(double *)pSource
);
359 case typelib_TypeClass_SHORT
:
360 switch (eSourceTypeClass
)
362 case typelib_TypeClass_BYTE
:
363 return (*(sal_Int16
*)pDest
== (sal_Int16
)*(sal_Int8
*)pSource
);
364 case typelib_TypeClass_SHORT
:
365 return (*(sal_Int16
*)pDest
== *(sal_Int16
*)pSource
);
366 case typelib_TypeClass_UNSIGNED_SHORT
:
367 return ((sal_Int32
)*(sal_Int16
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
368 case typelib_TypeClass_LONG
:
369 return ((sal_Int32
)*(sal_Int16
*)pDest
== *(sal_Int32
*)pSource
);
370 case typelib_TypeClass_UNSIGNED_LONG
:
371 return ((sal_Int64
)*(sal_Int16
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
372 case typelib_TypeClass_HYPER
:
373 return ((sal_Int64
)*(sal_Int16
*)pDest
== *(sal_Int64
*)pSource
);
374 case typelib_TypeClass_UNSIGNED_HYPER
:
375 return (*(sal_Int16
*)pDest
>= 0 &&
376 (sal_Int64
)*(sal_Int16
*)pDest
== *(sal_Int64
*)pSource
); // same size
377 case typelib_TypeClass_FLOAT
:
378 return ((float)*(sal_Int16
*)pDest
== *(float *)pSource
);
379 case typelib_TypeClass_DOUBLE
:
380 return ((double)*(sal_Int16
*)pDest
== *(double *)pSource
);
384 case typelib_TypeClass_UNSIGNED_SHORT
:
385 switch (eSourceTypeClass
)
387 case typelib_TypeClass_BYTE
:
388 return ((sal_Int32
)*(sal_uInt16
*)pDest
== (sal_Int32
)*(sal_Int8
*)pSource
);
389 case typelib_TypeClass_SHORT
:
390 return ((sal_Int32
)*(sal_uInt16
*)pDest
== (sal_Int32
)*(sal_Int16
*)pSource
);
391 case typelib_TypeClass_UNSIGNED_SHORT
:
392 return (*(sal_uInt16
*)pDest
== *(sal_uInt16
*)pSource
);
393 case typelib_TypeClass_LONG
:
394 return ((sal_Int32
)*(sal_uInt16
*)pDest
== *(sal_Int32
*)pSource
);
395 case typelib_TypeClass_UNSIGNED_LONG
:
396 return ((sal_uInt32
)*(sal_uInt16
*)pDest
== *(sal_uInt32
*)pSource
);
397 case typelib_TypeClass_HYPER
:
398 return ((sal_Int64
)*(sal_uInt16
*)pDest
== *(sal_Int64
*)pSource
);
399 case typelib_TypeClass_UNSIGNED_HYPER
:
400 return ((sal_uInt64
)*(sal_uInt16
*)pDest
== *(sal_uInt64
*)pSource
);
401 case typelib_TypeClass_FLOAT
:
402 return ((float)*(sal_uInt16
*)pDest
== *(float *)pSource
);
403 case typelib_TypeClass_DOUBLE
:
404 return ((double)*(sal_uInt16
*)pDest
== *(double *)pSource
);
408 case typelib_TypeClass_LONG
:
409 switch (eSourceTypeClass
)
411 case typelib_TypeClass_BYTE
:
412 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_Int8
*)pSource
);
413 case typelib_TypeClass_SHORT
:
414 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_Int16
*)pSource
);
415 case typelib_TypeClass_UNSIGNED_SHORT
:
416 return (*(sal_Int32
*)pDest
== (sal_Int32
)*(sal_uInt16
*)pSource
);
417 case typelib_TypeClass_LONG
:
418 return (*(sal_Int32
*)pDest
== *(sal_Int32
*)pSource
);
419 case typelib_TypeClass_UNSIGNED_LONG
:
420 return ((sal_Int64
)*(sal_Int32
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
421 case typelib_TypeClass_HYPER
:
422 return ((sal_Int64
)*(sal_Int32
*)pDest
== *(sal_Int64
*)pSource
);
423 case typelib_TypeClass_UNSIGNED_HYPER
:
424 return (*(sal_Int32
*)pDest
>= 0 &&
425 (sal_Int64
)*(sal_Int32
*)pDest
== *(sal_Int64
*)pSource
); // same size
426 case typelib_TypeClass_FLOAT
:
427 return ((float)*(sal_Int32
*)pDest
== *(float *)pSource
);
428 case typelib_TypeClass_DOUBLE
:
429 return ((double)*(sal_Int32
*)pDest
== *(double *)pSource
);
433 case typelib_TypeClass_UNSIGNED_LONG
:
434 switch (eSourceTypeClass
)
436 case typelib_TypeClass_BYTE
:
437 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int8
*)pSource
);
438 case typelib_TypeClass_SHORT
:
439 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int16
*)pSource
);
440 case typelib_TypeClass_UNSIGNED_SHORT
:
441 return (*(sal_uInt32
*)pDest
== (sal_uInt32
)*(sal_uInt16
*)pSource
);
442 case typelib_TypeClass_LONG
:
443 return ((sal_Int64
)*(sal_uInt32
*)pDest
== (sal_Int64
)*(sal_Int32
*)pSource
);
444 case typelib_TypeClass_UNSIGNED_LONG
:
445 return (*(sal_uInt32
*)pDest
== *(sal_uInt32
*)pSource
);
446 case typelib_TypeClass_HYPER
:
447 return ((sal_Int64
)*(sal_uInt32
*)pDest
== *(sal_Int64
*)pSource
);
448 case typelib_TypeClass_UNSIGNED_HYPER
:
449 return ((sal_uInt64
)*(sal_uInt32
*)pDest
== *(sal_uInt64
*)pSource
);
450 case typelib_TypeClass_FLOAT
:
451 return ((float)*(sal_uInt32
*)pDest
== *(float *)pSource
);
452 case typelib_TypeClass_DOUBLE
:
453 return ((double)*(sal_uInt32
*)pDest
== *(double *)pSource
);
457 case typelib_TypeClass_HYPER
:
458 switch (eSourceTypeClass
)
460 case typelib_TypeClass_BYTE
:
461 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int8
*)pSource
);
462 case typelib_TypeClass_SHORT
:
463 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int16
*)pSource
);
464 case typelib_TypeClass_UNSIGNED_SHORT
:
465 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_uInt16
*)pSource
);
466 case typelib_TypeClass_LONG
:
467 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_Int32
*)pSource
);
468 case typelib_TypeClass_UNSIGNED_LONG
:
469 return (*(sal_Int64
*)pDest
== (sal_Int64
)*(sal_uInt32
*)pSource
);
470 case typelib_TypeClass_HYPER
:
471 return (*(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
);
472 case typelib_TypeClass_UNSIGNED_HYPER
:
473 return (*(sal_Int64
*)pDest
>= 0 &&
474 *(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
); // same size
475 case typelib_TypeClass_FLOAT
:
476 return ((float)*(sal_Int64
*)pDest
== *(float *)pSource
);
477 case typelib_TypeClass_DOUBLE
:
478 return ((double)*(sal_Int64
*)pDest
== *(double *)pSource
);
482 case typelib_TypeClass_UNSIGNED_HYPER
:
483 switch (eSourceTypeClass
)
485 case typelib_TypeClass_BYTE
:
486 return (*(sal_Int8
*)pSource
>= 0 &&
487 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int8
*)pSource
);
488 case typelib_TypeClass_SHORT
:
489 return (*(sal_Int16
*)pSource
>= 0 &&
490 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int16
*)pSource
);
491 case typelib_TypeClass_UNSIGNED_SHORT
:
492 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_uInt16
*)pSource
);
493 case typelib_TypeClass_LONG
:
494 return (*(sal_Int32
*)pSource
>= 0 &&
495 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int32
*)pSource
);
496 case typelib_TypeClass_UNSIGNED_LONG
:
497 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_uInt32
*)pSource
);
498 case typelib_TypeClass_HYPER
:
499 return (*(sal_Int64
*)pSource
>= 0 &&
500 *(sal_uInt64
*)pDest
== (sal_uInt64
)*(sal_Int64
*)pSource
);
501 case typelib_TypeClass_UNSIGNED_HYPER
:
502 return (*(sal_uInt64
*)pDest
== *(sal_uInt64
*)pSource
);
503 case typelib_TypeClass_FLOAT
:
504 if (::floor( *(float *)pSource
) != *(float *)pSource
|| *(float *)pSource
< 0)
506 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(float *)pSource
);
507 case typelib_TypeClass_DOUBLE
:
508 if (::floor( *(double *)pSource
) != *(double *)pSource
|| *(double *)pSource
< 0)
510 return (*(sal_uInt64
*)pDest
== (sal_uInt64
)*(double *)pSource
);
514 case typelib_TypeClass_FLOAT
:
515 switch (eSourceTypeClass
)
517 case typelib_TypeClass_BYTE
:
518 return (*(float *)pDest
== (float)*(sal_Int8
*)pSource
);
519 case typelib_TypeClass_SHORT
:
520 return (*(float *)pDest
== (float)*(sal_Int16
*)pSource
);
521 case typelib_TypeClass_UNSIGNED_SHORT
:
522 return (*(float *)pDest
== (float)*(sal_uInt16
*)pSource
);
523 case typelib_TypeClass_LONG
:
524 return (*(float *)pDest
== (float)*(sal_Int32
*)pSource
);
525 case typelib_TypeClass_UNSIGNED_LONG
:
526 return (*(float *)pDest
== (float)*(sal_uInt32
*)pSource
);
527 case typelib_TypeClass_HYPER
:
528 return (*(float *)pDest
== (float)*(sal_Int64
*)pSource
);
529 case typelib_TypeClass_UNSIGNED_HYPER
:
530 if (::floor( *(float *)pDest
) != *(float *)pDest
|| *(float *)pDest
< 0)
532 return ((sal_uInt64
)*(float *)pDest
== *(sal_uInt64
*)pSource
);
533 case typelib_TypeClass_FLOAT
:
534 return (*(float *)pDest
== *(float *)pSource
);
535 case typelib_TypeClass_DOUBLE
:
536 return ((double)*(float *)pDest
== *(double *)pSource
);
540 case typelib_TypeClass_DOUBLE
:
541 switch (eSourceTypeClass
)
543 case typelib_TypeClass_BYTE
:
544 return (*(double *)pDest
== (double)*(sal_Int8
*)pSource
);
545 case typelib_TypeClass_SHORT
:
546 return (*(double *)pDest
== (double)*(sal_Int16
*)pSource
);
547 case typelib_TypeClass_UNSIGNED_SHORT
:
548 return (*(double *)pDest
== (double)*(sal_uInt16
*)pSource
);
549 case typelib_TypeClass_LONG
:
550 return (*(double *)pDest
== (double)*(sal_Int32
*)pSource
);
551 case typelib_TypeClass_UNSIGNED_LONG
:
552 return (*(double *)pDest
== (double)*(sal_uInt32
*)pSource
);
553 case typelib_TypeClass_HYPER
:
554 return (*(double *)pDest
== (double)*(sal_Int64
*)pSource
);
555 case typelib_TypeClass_UNSIGNED_HYPER
:
556 if (::floor( *(double *)pDest
) != *(double *)pDest
|| *(double *)pDest
< 0)
558 return ((sal_uInt64
)*(double *)pDest
== *(sal_uInt64
*)pSource
);
559 case typelib_TypeClass_FLOAT
:
560 return (*(double *)pDest
== (double)*(float *)pSource
);
561 case typelib_TypeClass_DOUBLE
:
562 return (*(double *)pDest
== *(double *)pSource
);
566 case typelib_TypeClass_STRING
:
567 return eSourceTypeClass
== typelib_TypeClass_STRING
568 && ((::rtl::OUString
*)pDest
)->equals(
569 *(::rtl::OUString
const *)pSource
);
570 case typelib_TypeClass_TYPE
:
571 return eSourceTypeClass
== typelib_TypeClass_TYPE
573 *(typelib_TypeDescriptionReference
**)pDest
,
574 *(typelib_TypeDescriptionReference
**)pSource
);
575 case typelib_TypeClass_ENUM
:
576 return (_type_equals( pDestType
, pSourceType
) &&
577 *(sal_Int32
*)pDest
== *(sal_Int32
*)pSource
);
578 case typelib_TypeClass_STRUCT
:
579 case typelib_TypeClass_EXCEPTION
:
580 if (! _type_equals( pDestType
, pSourceType
))
586 (typelib_CompoundTypeDescription
*)pDestTypeDescr
,
587 queryInterface
, release
);
591 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
592 sal_Bool bRet
= _equalStruct(
594 (typelib_CompoundTypeDescription
*)pDestTypeDescr
,
595 queryInterface
, release
);
596 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
599 case typelib_TypeClass_UNION
:
600 if (_type_equals( pDestType
, pSourceType
) &&
601 *(sal_Int64
*)pDest
== *(sal_Int64
*)pSource
) // same discriminant
606 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
607 pDest
, pDestTypeDescr
);
608 bRet
= ::uno_type_equalData(
609 (char *)pDest
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
611 (char *)pSource
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
613 queryInterface
, release
);
614 typelib_typedescriptionreference_release( pSetType
);
618 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
619 typelib_TypeDescriptionReference
* pSetType
= _unionGetSetType(
620 pDest
, pDestTypeDescr
);
621 bRet
= ::uno_type_equalData(
622 (char *)pDest
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
624 (char *)pSource
+ ((typelib_UnionTypeDescription
*)pDestTypeDescr
)->nValueOffset
,
626 queryInterface
, release
);
627 typelib_typedescriptionreference_release( pSetType
);
628 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
633 case typelib_TypeClass_SEQUENCE
:
634 if (_type_equals( pDestType
, pSourceType
))
638 return _equalSequence(
639 *(uno_Sequence
**)pDest
, *(uno_Sequence
**)pSource
,
640 ((typelib_IndirectTypeDescription
*)pDestTypeDescr
)->pType
,
641 queryInterface
, release
);
645 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
646 sal_Bool bRet
= _equalSequence(
647 *(uno_Sequence
**)pDest
, *(uno_Sequence
**)pSource
,
648 ((typelib_IndirectTypeDescription
*)pDestTypeDescr
)->pType
,
649 queryInterface
, release
);
650 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
655 case typelib_TypeClass_INTERFACE
:
656 if (typelib_TypeClass_INTERFACE
== eSourceTypeClass
)
657 return _equalObject( *(void **)pDest
, *(void **)pSource
, queryInterface
, release
);