xref: /AOO41X/main/cppu/source/uno/eq.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef EQ_HXX
28*cdf0e10cSrcweir #define EQ_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <math.h>
31*cdf0e10cSrcweir #include <rtl/memory.h>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "prim.hxx"
34*cdf0e10cSrcweir #include "destr.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir namespace cppu
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir //##################################################################################################
41*cdf0e10cSrcweir //#### equality ####################################################################################
42*cdf0e10cSrcweir //##################################################################################################
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
45*cdf0e10cSrcweir inline sal_Bool _equalObject(
46*cdf0e10cSrcweir 	void * pI1, void * pI2,
47*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
48*cdf0e10cSrcweir 	SAL_THROW( () )
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 	if (pI1 == pI2)
51*cdf0e10cSrcweir 		return sal_True;
52*cdf0e10cSrcweir 	if ((0 == pI1) || (0 == pI2))
53*cdf0e10cSrcweir 		return sal_False;
54*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     typelib_TypeDescriptionReference * type_XInterface =
57*cdf0e10cSrcweir         * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE );
58*cdf0e10cSrcweir 	if (0 == queryInterface)
59*cdf0e10cSrcweir         queryInterface = binuno_queryInterface;
60*cdf0e10cSrcweir     pI1 = (*queryInterface)( pI1, type_XInterface );
61*cdf0e10cSrcweir     if (0 != pI1)
62*cdf0e10cSrcweir     {
63*cdf0e10cSrcweir         pI2 = (*queryInterface)( pI2, type_XInterface );
64*cdf0e10cSrcweir         if (0 != pI2)
65*cdf0e10cSrcweir         {
66*cdf0e10cSrcweir             bRet = (pI1 == pI2);
67*cdf0e10cSrcweir             _release( pI2, release );
68*cdf0e10cSrcweir         }
69*cdf0e10cSrcweir         _release( pI1, release );
70*cdf0e10cSrcweir     }
71*cdf0e10cSrcweir     return bRet;
72*cdf0e10cSrcweir }
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir //==================================================================================================
75*cdf0e10cSrcweir sal_Bool equalStruct(
76*cdf0e10cSrcweir 	void * pDest, void *pSource,
77*cdf0e10cSrcweir 	typelib_CompoundTypeDescription * pTypeDescr,
78*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
79*cdf0e10cSrcweir 	SAL_THROW( () );
80*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
81*cdf0e10cSrcweir inline sal_Bool _equalStruct(
82*cdf0e10cSrcweir 	void * pDest, void *pSource,
83*cdf0e10cSrcweir 	typelib_CompoundTypeDescription * pTypeDescr,
84*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
85*cdf0e10cSrcweir 	SAL_THROW( () )
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir 	if (pTypeDescr->pBaseTypeDescription &&
88*cdf0e10cSrcweir 		!equalStruct( pDest, pSource, pTypeDescr->pBaseTypeDescription, queryInterface, release ))
89*cdf0e10cSrcweir 	{
90*cdf0e10cSrcweir 		return sal_False;
91*cdf0e10cSrcweir 	}
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs;
94*cdf0e10cSrcweir 	sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets;
95*cdf0e10cSrcweir 	sal_Int32 nDescr = pTypeDescr->nMembers;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	while (nDescr--)
98*cdf0e10cSrcweir 	{
99*cdf0e10cSrcweir 		sal_Int32 nOffset = pMemberOffsets[nDescr];
100*cdf0e10cSrcweir 		if (! ::uno_type_equalData( (char *)pDest + nOffset,
101*cdf0e10cSrcweir                                     ppTypeRefs[nDescr],
102*cdf0e10cSrcweir                                     (char *)pSource + nOffset,
103*cdf0e10cSrcweir                                     ppTypeRefs[nDescr],
104*cdf0e10cSrcweir                                     queryInterface, release ))
105*cdf0e10cSrcweir 		{
106*cdf0e10cSrcweir 			return sal_False;
107*cdf0e10cSrcweir 		}
108*cdf0e10cSrcweir 	}
109*cdf0e10cSrcweir 	return sal_True;
110*cdf0e10cSrcweir }
111*cdf0e10cSrcweir //==================================================================================================
112*cdf0e10cSrcweir sal_Bool equalSequence(
113*cdf0e10cSrcweir 	uno_Sequence * pDest, uno_Sequence * pSource,
114*cdf0e10cSrcweir 	typelib_TypeDescriptionReference * pElementType,
115*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
116*cdf0e10cSrcweir 	SAL_THROW( () );
117*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
118*cdf0e10cSrcweir inline sal_Bool _equalSequence(
119*cdf0e10cSrcweir 	uno_Sequence * pDest, uno_Sequence * pSource,
120*cdf0e10cSrcweir 	typelib_TypeDescriptionReference * pElementType,
121*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
122*cdf0e10cSrcweir 	SAL_THROW( () )
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir 	if (pDest == pSource)
125*cdf0e10cSrcweir 		return sal_True;
126*cdf0e10cSrcweir 	sal_Int32 nElements = pDest->nElements;
127*cdf0e10cSrcweir 	if (nElements != pSource->nElements)
128*cdf0e10cSrcweir 		return sal_False;
129*cdf0e10cSrcweir 	if (! nElements)
130*cdf0e10cSrcweir 		return sal_True;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	void * pDestElements = pDest->elements;
133*cdf0e10cSrcweir 	void * pSourceElements = pSource->elements;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	switch (pElementType->eTypeClass)
136*cdf0e10cSrcweir 	{
137*cdf0e10cSrcweir 	case typelib_TypeClass_CHAR:
138*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Unicode) * nElements ));
139*cdf0e10cSrcweir 	case typelib_TypeClass_BOOLEAN:
140*cdf0e10cSrcweir 	{
141*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
142*cdf0e10cSrcweir 		{
143*cdf0e10cSrcweir 			if ((((sal_Bool *)pDestElements)[nPos] != sal_False) !=
144*cdf0e10cSrcweir 				(((sal_Bool *)pSourceElements)[nPos] != sal_False))
145*cdf0e10cSrcweir 			{
146*cdf0e10cSrcweir 				return sal_False;
147*cdf0e10cSrcweir 			}
148*cdf0e10cSrcweir 		}
149*cdf0e10cSrcweir 		return sal_True;
150*cdf0e10cSrcweir 	}
151*cdf0e10cSrcweir 	case typelib_TypeClass_BYTE:
152*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int8) * nElements ));
153*cdf0e10cSrcweir 	case typelib_TypeClass_SHORT:
154*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_SHORT:
155*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int16) * nElements ));
156*cdf0e10cSrcweir 	case typelib_TypeClass_LONG:
157*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_LONG:
158*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
159*cdf0e10cSrcweir 	case typelib_TypeClass_HYPER:
160*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_HYPER:
161*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int64) * nElements ));
162*cdf0e10cSrcweir 	case typelib_TypeClass_FLOAT:
163*cdf0e10cSrcweir 	{
164*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
165*cdf0e10cSrcweir 		{
166*cdf0e10cSrcweir 			if (((float *)pDestElements)[nPos] != ((float *)pSourceElements)[nPos])
167*cdf0e10cSrcweir 				return sal_False;
168*cdf0e10cSrcweir 		}
169*cdf0e10cSrcweir 		return sal_True;
170*cdf0e10cSrcweir 	}
171*cdf0e10cSrcweir 	case typelib_TypeClass_DOUBLE:
172*cdf0e10cSrcweir 	{
173*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
174*cdf0e10cSrcweir 		{
175*cdf0e10cSrcweir 			if (((double *)pDestElements)[nPos] != ((double *)pSourceElements)[nPos])
176*cdf0e10cSrcweir 				return sal_False;
177*cdf0e10cSrcweir 		}
178*cdf0e10cSrcweir 		return sal_True;
179*cdf0e10cSrcweir 	}
180*cdf0e10cSrcweir 	case typelib_TypeClass_STRING:
181*cdf0e10cSrcweir 	{
182*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
183*cdf0e10cSrcweir 		{
184*cdf0e10cSrcweir 			if (! ((::rtl::OUString *)pDestElements +nPos)->equals( ((const ::rtl::OUString *)pSourceElements)[nPos] ))
185*cdf0e10cSrcweir 				return sal_False;
186*cdf0e10cSrcweir 		}
187*cdf0e10cSrcweir 		return sal_True;
188*cdf0e10cSrcweir 	}
189*cdf0e10cSrcweir 	case typelib_TypeClass_TYPE:
190*cdf0e10cSrcweir 	{
191*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
192*cdf0e10cSrcweir 		{
193*cdf0e10cSrcweir 			if (! _type_equals( ((typelib_TypeDescriptionReference **)pDestElements)[nPos],
194*cdf0e10cSrcweir                                 ((typelib_TypeDescriptionReference **)pSourceElements)[nPos] ))
195*cdf0e10cSrcweir 			{
196*cdf0e10cSrcweir 				return sal_False;
197*cdf0e10cSrcweir 			}
198*cdf0e10cSrcweir 		}
199*cdf0e10cSrcweir 		return sal_True;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir 	case typelib_TypeClass_ANY:
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
204*cdf0e10cSrcweir 		{
205*cdf0e10cSrcweir 			uno_Any * pDest2 = (uno_Any *)pDestElements + nPos;
206*cdf0e10cSrcweir 			uno_Any * pSource2 = (uno_Any *)pSourceElements + nPos;
207*cdf0e10cSrcweir 			if (! ::uno_type_equalData( pDest2->pData, pDest2->pType,
208*cdf0e10cSrcweir 										pSource2->pData, pSource2->pType,
209*cdf0e10cSrcweir 										queryInterface, release ))
210*cdf0e10cSrcweir 			{
211*cdf0e10cSrcweir 				return sal_False;
212*cdf0e10cSrcweir 			}
213*cdf0e10cSrcweir 		}
214*cdf0e10cSrcweir 		return sal_True;
215*cdf0e10cSrcweir 	}
216*cdf0e10cSrcweir 	case typelib_TypeClass_ENUM:
217*cdf0e10cSrcweir 		return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
218*cdf0e10cSrcweir 	case typelib_TypeClass_STRUCT:
219*cdf0e10cSrcweir 	case typelib_TypeClass_EXCEPTION:
220*cdf0e10cSrcweir 	{
221*cdf0e10cSrcweir 		typelib_TypeDescription * pElementTypeDescr = 0;
222*cdf0e10cSrcweir 		TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
223*cdf0e10cSrcweir 		sal_Int32 nElementSize = pElementTypeDescr->nSize;
224*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
225*cdf0e10cSrcweir 		{
226*cdf0e10cSrcweir 			if (! _equalStruct( (char *)pDestElements + (nPos * nElementSize),
227*cdf0e10cSrcweir                                 (char *)pSourceElements + (nPos * nElementSize),
228*cdf0e10cSrcweir                                 (typelib_CompoundTypeDescription *)pElementTypeDescr,
229*cdf0e10cSrcweir                                 queryInterface, release ))
230*cdf0e10cSrcweir 			{
231*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( pElementTypeDescr );
232*cdf0e10cSrcweir 				return sal_False;
233*cdf0e10cSrcweir 			}
234*cdf0e10cSrcweir 		}
235*cdf0e10cSrcweir 		TYPELIB_DANGER_RELEASE( pElementTypeDescr );
236*cdf0e10cSrcweir 		return sal_True;
237*cdf0e10cSrcweir 	}
238*cdf0e10cSrcweir 	case typelib_TypeClass_UNION:
239*cdf0e10cSrcweir 	{
240*cdf0e10cSrcweir 		typelib_TypeDescription * pElementTypeDescr = 0;
241*cdf0e10cSrcweir 		TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
242*cdf0e10cSrcweir 		sal_Int32 nElementSize = pElementTypeDescr->nSize;
243*cdf0e10cSrcweir 		sal_Int32 nValueOffset = ((typelib_UnionTypeDescription *)pElementTypeDescr)->nValueOffset;
244*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
245*cdf0e10cSrcweir 		{
246*cdf0e10cSrcweir 			char * pDest2 = (char *)pDestElements + (nPos * nElementSize);
247*cdf0e10cSrcweir 			char * pSource2 = (char *)pSourceElements + (nPos * nElementSize);
248*cdf0e10cSrcweir 			typelib_TypeDescriptionReference * pSetType = _unionGetSetType(
249*cdf0e10cSrcweir                 pDest2, pElementTypeDescr );
250*cdf0e10cSrcweir 			sal_Bool bRet = ::uno_type_equalData(
251*cdf0e10cSrcweir                 pDest2 + nValueOffset, pSetType,
252*cdf0e10cSrcweir                 pSource2 + nValueOffset, pSetType,
253*cdf0e10cSrcweir                 queryInterface, release );
254*cdf0e10cSrcweir 			::typelib_typedescriptionreference_release( pSetType );
255*cdf0e10cSrcweir 			if (! bRet)
256*cdf0e10cSrcweir 			{
257*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( pElementTypeDescr );
258*cdf0e10cSrcweir 				return sal_False;
259*cdf0e10cSrcweir 			}
260*cdf0e10cSrcweir 		}
261*cdf0e10cSrcweir 		TYPELIB_DANGER_RELEASE( pElementTypeDescr );
262*cdf0e10cSrcweir 		return sal_True;
263*cdf0e10cSrcweir 	}
264*cdf0e10cSrcweir 	case typelib_TypeClass_SEQUENCE: // sequence of sequence
265*cdf0e10cSrcweir 	{
266*cdf0e10cSrcweir 		typelib_TypeDescription * pElementTypeDescr = 0;
267*cdf0e10cSrcweir 		TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
268*cdf0e10cSrcweir 		typelib_TypeDescriptionReference * pSeqElementType =
269*cdf0e10cSrcweir 			((typelib_IndirectTypeDescription *)pElementTypeDescr)->pType;
270*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
271*cdf0e10cSrcweir 		{
272*cdf0e10cSrcweir 			if (! equalSequence( ((uno_Sequence **)pDestElements)[nPos],
273*cdf0e10cSrcweir 								 ((uno_Sequence **)pSourceElements)[nPos],
274*cdf0e10cSrcweir 								 pSeqElementType, queryInterface, release ))
275*cdf0e10cSrcweir 			{
276*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( pElementTypeDescr );
277*cdf0e10cSrcweir 				return sal_False;
278*cdf0e10cSrcweir 			}
279*cdf0e10cSrcweir 		}
280*cdf0e10cSrcweir 		TYPELIB_DANGER_RELEASE( pElementTypeDescr );
281*cdf0e10cSrcweir 		return sal_True;
282*cdf0e10cSrcweir 	}
283*cdf0e10cSrcweir 	case typelib_TypeClass_INTERFACE:
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir 		for ( sal_Int32 nPos = nElements; nPos--; )
286*cdf0e10cSrcweir 		{
287*cdf0e10cSrcweir 			if (! _equalObject( ((void **)pDestElements)[nPos], ((void **)pSourceElements)[nPos],
288*cdf0e10cSrcweir                                 queryInterface, release ))
289*cdf0e10cSrcweir 			{
290*cdf0e10cSrcweir 				return sal_False;
291*cdf0e10cSrcweir 			}
292*cdf0e10cSrcweir 		}
293*cdf0e10cSrcweir 		return sal_True;
294*cdf0e10cSrcweir 	}
295*cdf0e10cSrcweir     default:
296*cdf0e10cSrcweir         OSL_ASSERT(false);
297*cdf0e10cSrcweir         return sal_False;
298*cdf0e10cSrcweir 	}
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
301*cdf0e10cSrcweir inline sal_Bool _equalData(
302*cdf0e10cSrcweir 	void * pDest,
303*cdf0e10cSrcweir 	typelib_TypeDescriptionReference * pDestType, typelib_TypeDescription * pDestTypeDescr,
304*cdf0e10cSrcweir 	void * pSource,
305*cdf0e10cSrcweir 	typelib_TypeDescriptionReference * pSourceType, typelib_TypeDescription * pSourceTypeDescr,
306*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
307*cdf0e10cSrcweir 	SAL_THROW( () )
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	typelib_TypeClass eSourceTypeClass, eDestTypeClass;
310*cdf0e10cSrcweir 	while (typelib_TypeClass_ANY == (eDestTypeClass = pDestType->eTypeClass))
311*cdf0e10cSrcweir 	{
312*cdf0e10cSrcweir 		pDestTypeDescr = 0;
313*cdf0e10cSrcweir 		pDestType = ((uno_Any *)pDest)->pType;
314*cdf0e10cSrcweir 		pDest = ((uno_Any *)pDest)->pData;
315*cdf0e10cSrcweir 	}
316*cdf0e10cSrcweir 	while (typelib_TypeClass_ANY == (eSourceTypeClass = pSourceType->eTypeClass))
317*cdf0e10cSrcweir 	{
318*cdf0e10cSrcweir 		pSourceTypeDescr = 0;
319*cdf0e10cSrcweir 		pSourceType = ((uno_Any *)pSource)->pType;
320*cdf0e10cSrcweir 		pSource = ((uno_Any *)pSource)->pData;
321*cdf0e10cSrcweir 	}
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 	switch (eDestTypeClass)
324*cdf0e10cSrcweir 	{
325*cdf0e10cSrcweir 	case typelib_TypeClass_VOID:
326*cdf0e10cSrcweir 		return eSourceTypeClass == typelib_TypeClass_VOID;
327*cdf0e10cSrcweir 	case typelib_TypeClass_CHAR:
328*cdf0e10cSrcweir 		return eSourceTypeClass == typelib_TypeClass_CHAR
329*cdf0e10cSrcweir 			&& *(sal_Unicode *)pDest == *(sal_Unicode *)pSource;
330*cdf0e10cSrcweir 	case typelib_TypeClass_BOOLEAN:
331*cdf0e10cSrcweir 		return eSourceTypeClass == typelib_TypeClass_BOOLEAN
332*cdf0e10cSrcweir 			&& ((*(sal_Bool *)pDest != sal_False)
333*cdf0e10cSrcweir                 == (*(sal_Bool *)pSource != sal_False));
334*cdf0e10cSrcweir 	case typelib_TypeClass_BYTE:
335*cdf0e10cSrcweir 		switch (eSourceTypeClass)
336*cdf0e10cSrcweir 		{
337*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
338*cdf0e10cSrcweir 			return (*(sal_Int8 *)pDest == *(sal_Int8 *)pSource);
339*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
340*cdf0e10cSrcweir 			return ((sal_Int16)*(sal_Int8 *)pDest == *(sal_Int16 *)pSource);
341*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
342*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_Int8 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
343*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
344*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_Int8 *)pDest == *(sal_Int32 *)pSource);
345*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
346*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int8 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
347*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
348*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource);
349*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
350*cdf0e10cSrcweir 			return (*(sal_Int8 *)pDest >= 0 &&
351*cdf0e10cSrcweir 					(sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource); // same size
352*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
353*cdf0e10cSrcweir 			return ((float)*(sal_Int8 *)pDest == *(float *)pSource);
354*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
355*cdf0e10cSrcweir 			return ((double)*(sal_Int8 *)pDest == *(double *)pSource);
356*cdf0e10cSrcweir         default:
357*cdf0e10cSrcweir             return sal_False;
358*cdf0e10cSrcweir 		}
359*cdf0e10cSrcweir 	case typelib_TypeClass_SHORT:
360*cdf0e10cSrcweir 		switch (eSourceTypeClass)
361*cdf0e10cSrcweir 		{
362*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
363*cdf0e10cSrcweir 			return (*(sal_Int16 *)pDest == (sal_Int16)*(sal_Int8 *)pSource);
364*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
365*cdf0e10cSrcweir 			return (*(sal_Int16 *)pDest == *(sal_Int16 *)pSource);
366*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
367*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_Int16 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
368*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
369*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_Int16 *)pDest == *(sal_Int32 *)pSource);
370*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
371*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int16 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
372*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
373*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource);
374*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
375*cdf0e10cSrcweir 			return (*(sal_Int16 *)pDest >= 0 &&
376*cdf0e10cSrcweir 					(sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource); // same size
377*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
378*cdf0e10cSrcweir 			return ((float)*(sal_Int16 *)pDest == *(float *)pSource);
379*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
380*cdf0e10cSrcweir 			return ((double)*(sal_Int16 *)pDest == *(double *)pSource);
381*cdf0e10cSrcweir         default:
382*cdf0e10cSrcweir             return sal_False;
383*cdf0e10cSrcweir 		}
384*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_SHORT:
385*cdf0e10cSrcweir 		switch (eSourceTypeClass)
386*cdf0e10cSrcweir 		{
387*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
388*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int8 *)pSource);
389*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
390*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int16 *)pSource);
391*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
392*cdf0e10cSrcweir 			return (*(sal_uInt16 *)pDest == *(sal_uInt16 *)pSource);
393*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
394*cdf0e10cSrcweir 			return ((sal_Int32)*(sal_uInt16 *)pDest == *(sal_Int32 *)pSource);
395*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
396*cdf0e10cSrcweir 			return ((sal_uInt32)*(sal_uInt16 *)pDest == *(sal_uInt32 *)pSource);
397*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
398*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_uInt16 *)pDest == *(sal_Int64 *)pSource);
399*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
400*cdf0e10cSrcweir 			return ((sal_uInt64)*(sal_uInt16 *)pDest == *(sal_uInt64 *)pSource);
401*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
402*cdf0e10cSrcweir 			return ((float)*(sal_uInt16 *)pDest == *(float *)pSource);
403*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
404*cdf0e10cSrcweir 			return ((double)*(sal_uInt16 *)pDest == *(double *)pSource);
405*cdf0e10cSrcweir         default:
406*cdf0e10cSrcweir             return sal_False;
407*cdf0e10cSrcweir 		}
408*cdf0e10cSrcweir 	case typelib_TypeClass_LONG:
409*cdf0e10cSrcweir 		switch (eSourceTypeClass)
410*cdf0e10cSrcweir 		{
411*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
412*cdf0e10cSrcweir 			return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int8 *)pSource);
413*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
414*cdf0e10cSrcweir 			return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int16 *)pSource);
415*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
416*cdf0e10cSrcweir 			return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
417*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
418*cdf0e10cSrcweir 			return (*(sal_Int32 *)pDest == *(sal_Int32 *)pSource);
419*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
420*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int32 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
421*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
422*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource);
423*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
424*cdf0e10cSrcweir 			return (*(sal_Int32 *)pDest >= 0 &&
425*cdf0e10cSrcweir 					(sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource); // same size
426*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
427*cdf0e10cSrcweir 			return ((float)*(sal_Int32 *)pDest == *(float *)pSource);
428*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
429*cdf0e10cSrcweir 			return ((double)*(sal_Int32 *)pDest == *(double *)pSource);
430*cdf0e10cSrcweir         default:
431*cdf0e10cSrcweir             return sal_False;
432*cdf0e10cSrcweir 		}
433*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_LONG:
434*cdf0e10cSrcweir 		switch (eSourceTypeClass)
435*cdf0e10cSrcweir 		{
436*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
437*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int8 *)pSource);
438*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
439*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int16 *)pSource);
440*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
441*cdf0e10cSrcweir 			return (*(sal_uInt32 *)pDest == (sal_uInt32)*(sal_uInt16 *)pSource);
442*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
443*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int32 *)pSource);
444*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
445*cdf0e10cSrcweir 			return (*(sal_uInt32 *)pDest == *(sal_uInt32 *)pSource);
446*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
447*cdf0e10cSrcweir 			return ((sal_Int64)*(sal_uInt32 *)pDest == *(sal_Int64 *)pSource);
448*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
449*cdf0e10cSrcweir 			return ((sal_uInt64)*(sal_uInt32 *)pDest == *(sal_uInt64 *)pSource);
450*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
451*cdf0e10cSrcweir 			return ((float)*(sal_uInt32 *)pDest == *(float *)pSource);
452*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
453*cdf0e10cSrcweir 			return ((double)*(sal_uInt32 *)pDest == *(double *)pSource);
454*cdf0e10cSrcweir         default:
455*cdf0e10cSrcweir             return sal_False;
456*cdf0e10cSrcweir 		}
457*cdf0e10cSrcweir 	case typelib_TypeClass_HYPER:
458*cdf0e10cSrcweir 		switch (eSourceTypeClass)
459*cdf0e10cSrcweir 		{
460*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
461*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int8 *)pSource);
462*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
463*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int16 *)pSource);
464*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
465*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt16 *)pSource);
466*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
467*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int32 *)pSource);
468*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
469*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
470*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
471*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest == *(sal_Int64 *)pSource);
472*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
473*cdf0e10cSrcweir 			return (*(sal_Int64 *)pDest >= 0 &&
474*cdf0e10cSrcweir 					*(sal_Int64 *)pDest == *(sal_Int64 *)pSource); // same size
475*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
476*cdf0e10cSrcweir 			return ((float)*(sal_Int64 *)pDest == *(float *)pSource);
477*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
478*cdf0e10cSrcweir 			return ((double)*(sal_Int64 *)pDest == *(double *)pSource);
479*cdf0e10cSrcweir         default:
480*cdf0e10cSrcweir             return sal_False;
481*cdf0e10cSrcweir 		}
482*cdf0e10cSrcweir 	case typelib_TypeClass_UNSIGNED_HYPER:
483*cdf0e10cSrcweir 		switch (eSourceTypeClass)
484*cdf0e10cSrcweir 		{
485*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
486*cdf0e10cSrcweir 			return (*(sal_Int8 *)pSource >= 0 &&
487*cdf0e10cSrcweir 					*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int8 *)pSource);
488*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
489*cdf0e10cSrcweir 			return (*(sal_Int16 *)pSource >= 0 &&
490*cdf0e10cSrcweir 					*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int16 *)pSource);
491*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
492*cdf0e10cSrcweir 			return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt16 *)pSource);
493*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
494*cdf0e10cSrcweir 			return (*(sal_Int32 *)pSource >= 0 &&
495*cdf0e10cSrcweir 					*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int32 *)pSource);
496*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
497*cdf0e10cSrcweir 			return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt32 *)pSource);
498*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
499*cdf0e10cSrcweir 			return (*(sal_Int64 *)pSource >= 0 &&
500*cdf0e10cSrcweir 					*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int64 *)pSource);
501*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
502*cdf0e10cSrcweir 			return (*(sal_uInt64 *)pDest == *(sal_uInt64 *)pSource);
503*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
504*cdf0e10cSrcweir 			if (::floor( *(float *)pSource ) != *(float *)pSource || *(float *)pSource < 0)
505*cdf0e10cSrcweir 				return sal_False;
506*cdf0e10cSrcweir 			return (*(sal_uInt64 *)pDest == (sal_uInt64)*(float *)pSource);
507*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
508*cdf0e10cSrcweir 			if (::floor( *(double *)pSource ) != *(double *)pSource || *(double *)pSource < 0)
509*cdf0e10cSrcweir 				return sal_False;
510*cdf0e10cSrcweir 			return (*(sal_uInt64 *)pDest == (sal_uInt64)*(double *)pSource);
511*cdf0e10cSrcweir         default:
512*cdf0e10cSrcweir             return sal_False;
513*cdf0e10cSrcweir 		}
514*cdf0e10cSrcweir 	case typelib_TypeClass_FLOAT:
515*cdf0e10cSrcweir 		switch (eSourceTypeClass)
516*cdf0e10cSrcweir 		{
517*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
518*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_Int8 *)pSource);
519*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
520*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_Int16 *)pSource);
521*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
522*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_uInt16 *)pSource);
523*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
524*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_Int32 *)pSource);
525*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
526*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_uInt32 *)pSource);
527*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
528*cdf0e10cSrcweir 			return (*(float *)pDest == (float)*(sal_Int64 *)pSource);
529*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
530*cdf0e10cSrcweir 			if (::floor( *(float *)pDest ) != *(float *)pDest || *(float *)pDest < 0)
531*cdf0e10cSrcweir 				return sal_False;
532*cdf0e10cSrcweir 			return ((sal_uInt64)*(float *)pDest == *(sal_uInt64 *)pSource);
533*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
534*cdf0e10cSrcweir 			return (*(float *)pDest == *(float *)pSource);
535*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
536*cdf0e10cSrcweir 			return ((double)*(float *)pDest == *(double *)pSource);
537*cdf0e10cSrcweir         default:
538*cdf0e10cSrcweir             return sal_False;
539*cdf0e10cSrcweir 		}
540*cdf0e10cSrcweir 	case typelib_TypeClass_DOUBLE:
541*cdf0e10cSrcweir 		switch (eSourceTypeClass)
542*cdf0e10cSrcweir 		{
543*cdf0e10cSrcweir 		case typelib_TypeClass_BYTE:
544*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_Int8 *)pSource);
545*cdf0e10cSrcweir 		case typelib_TypeClass_SHORT:
546*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_Int16 *)pSource);
547*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_SHORT:
548*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_uInt16 *)pSource);
549*cdf0e10cSrcweir 		case typelib_TypeClass_LONG:
550*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_Int32 *)pSource);
551*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_LONG:
552*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_uInt32 *)pSource);
553*cdf0e10cSrcweir 		case typelib_TypeClass_HYPER:
554*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(sal_Int64 *)pSource);
555*cdf0e10cSrcweir 		case typelib_TypeClass_UNSIGNED_HYPER:
556*cdf0e10cSrcweir 			if (::floor( *(double *)pDest ) != *(double *)pDest || *(double *)pDest < 0)
557*cdf0e10cSrcweir 				return sal_False;
558*cdf0e10cSrcweir 			return ((sal_uInt64)*(double *)pDest == *(sal_uInt64 *)pSource);
559*cdf0e10cSrcweir 		case typelib_TypeClass_FLOAT:
560*cdf0e10cSrcweir 			return (*(double *)pDest == (double)*(float *)pSource);
561*cdf0e10cSrcweir 		case typelib_TypeClass_DOUBLE:
562*cdf0e10cSrcweir 			return (*(double *)pDest == *(double *)pSource);
563*cdf0e10cSrcweir         default:
564*cdf0e10cSrcweir             return sal_False;
565*cdf0e10cSrcweir 		}
566*cdf0e10cSrcweir 	case typelib_TypeClass_STRING:
567*cdf0e10cSrcweir         return eSourceTypeClass == typelib_TypeClass_STRING
568*cdf0e10cSrcweir             && ((::rtl::OUString *)pDest)->equals(
569*cdf0e10cSrcweir                 *(::rtl::OUString const *)pSource );
570*cdf0e10cSrcweir 	case typelib_TypeClass_TYPE:
571*cdf0e10cSrcweir         return eSourceTypeClass == typelib_TypeClass_TYPE
572*cdf0e10cSrcweir             && _type_equals(
573*cdf0e10cSrcweir                 *(typelib_TypeDescriptionReference **)pDest,
574*cdf0e10cSrcweir                 *(typelib_TypeDescriptionReference **)pSource );
575*cdf0e10cSrcweir 	case typelib_TypeClass_ENUM:
576*cdf0e10cSrcweir 		return (_type_equals( pDestType, pSourceType ) &&
577*cdf0e10cSrcweir 				*(sal_Int32 *)pDest == *(sal_Int32 *)pSource);
578*cdf0e10cSrcweir 	case typelib_TypeClass_STRUCT:
579*cdf0e10cSrcweir 	case typelib_TypeClass_EXCEPTION:
580*cdf0e10cSrcweir 		if (! _type_equals( pDestType, pSourceType ))
581*cdf0e10cSrcweir 			return sal_False;
582*cdf0e10cSrcweir 		if (pDestTypeDescr)
583*cdf0e10cSrcweir 		{
584*cdf0e10cSrcweir 			return _equalStruct(
585*cdf0e10cSrcweir 				pDest, pSource,
586*cdf0e10cSrcweir 				(typelib_CompoundTypeDescription *)pDestTypeDescr,
587*cdf0e10cSrcweir 				queryInterface, release );
588*cdf0e10cSrcweir 		}
589*cdf0e10cSrcweir 		else
590*cdf0e10cSrcweir 		{
591*cdf0e10cSrcweir 			TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType );
592*cdf0e10cSrcweir 			sal_Bool bRet = _equalStruct(
593*cdf0e10cSrcweir 				pDest, pSource,
594*cdf0e10cSrcweir 				(typelib_CompoundTypeDescription *)pDestTypeDescr,
595*cdf0e10cSrcweir 				queryInterface, release );
596*cdf0e10cSrcweir 			TYPELIB_DANGER_RELEASE( pDestTypeDescr );
597*cdf0e10cSrcweir 			return bRet;
598*cdf0e10cSrcweir 		}
599*cdf0e10cSrcweir 	case typelib_TypeClass_UNION:
600*cdf0e10cSrcweir 		if (_type_equals( pDestType, pSourceType ) &&
601*cdf0e10cSrcweir 			*(sal_Int64 *)pDest == *(sal_Int64 *)pSource) // same discriminant
602*cdf0e10cSrcweir 		{
603*cdf0e10cSrcweir 			sal_Bool bRet;
604*cdf0e10cSrcweir 			if (pDestTypeDescr)
605*cdf0e10cSrcweir 			{
606*cdf0e10cSrcweir 				typelib_TypeDescriptionReference * pSetType = _unionGetSetType(
607*cdf0e10cSrcweir                     pDest, pDestTypeDescr );
608*cdf0e10cSrcweir 				bRet = ::uno_type_equalData(
609*cdf0e10cSrcweir 					(char *)pDest + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset,
610*cdf0e10cSrcweir                     pSetType,
611*cdf0e10cSrcweir 					(char *)pSource + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset,
612*cdf0e10cSrcweir                     pSetType,
613*cdf0e10cSrcweir 					queryInterface, release );
614*cdf0e10cSrcweir 				typelib_typedescriptionreference_release( pSetType );
615*cdf0e10cSrcweir 			}
616*cdf0e10cSrcweir 			else
617*cdf0e10cSrcweir 			{
618*cdf0e10cSrcweir 				TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType );
619*cdf0e10cSrcweir 				typelib_TypeDescriptionReference * pSetType = _unionGetSetType(
620*cdf0e10cSrcweir                     pDest, pDestTypeDescr );
621*cdf0e10cSrcweir 				bRet = ::uno_type_equalData(
622*cdf0e10cSrcweir 					(char *)pDest + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset,
623*cdf0e10cSrcweir                     pSetType,
624*cdf0e10cSrcweir 					(char *)pSource + ((typelib_UnionTypeDescription *)pDestTypeDescr)->nValueOffset,
625*cdf0e10cSrcweir                     pSetType,
626*cdf0e10cSrcweir 					queryInterface, release );
627*cdf0e10cSrcweir 				typelib_typedescriptionreference_release( pSetType );
628*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( pDestTypeDescr );
629*cdf0e10cSrcweir 			}
630*cdf0e10cSrcweir 			return bRet;
631*cdf0e10cSrcweir 		}
632*cdf0e10cSrcweir 		return sal_False;
633*cdf0e10cSrcweir 	case typelib_TypeClass_SEQUENCE:
634*cdf0e10cSrcweir 		if (_type_equals( pDestType, pSourceType ))
635*cdf0e10cSrcweir 		{
636*cdf0e10cSrcweir 			if (pDestTypeDescr)
637*cdf0e10cSrcweir 			{
638*cdf0e10cSrcweir 				return _equalSequence(
639*cdf0e10cSrcweir 					*(uno_Sequence **)pDest, *(uno_Sequence **)pSource,
640*cdf0e10cSrcweir 					((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType,
641*cdf0e10cSrcweir 					queryInterface, release );
642*cdf0e10cSrcweir 			}
643*cdf0e10cSrcweir 			else
644*cdf0e10cSrcweir 			{
645*cdf0e10cSrcweir 				TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType );
646*cdf0e10cSrcweir 				sal_Bool bRet = _equalSequence(
647*cdf0e10cSrcweir 					*(uno_Sequence **)pDest, *(uno_Sequence **)pSource,
648*cdf0e10cSrcweir 					((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType,
649*cdf0e10cSrcweir 					queryInterface, release );
650*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( pDestTypeDescr );
651*cdf0e10cSrcweir 				return bRet;
652*cdf0e10cSrcweir 			}
653*cdf0e10cSrcweir 		}
654*cdf0e10cSrcweir 		return sal_False;
655*cdf0e10cSrcweir 	case typelib_TypeClass_INTERFACE:
656*cdf0e10cSrcweir 		if (typelib_TypeClass_INTERFACE == eSourceTypeClass)
657*cdf0e10cSrcweir 			return _equalObject( *(void **)pDest, *(void **)pSource, queryInterface, release );
658*cdf0e10cSrcweir         break;
659*cdf0e10cSrcweir     default:
660*cdf0e10cSrcweir         OSL_ASSERT(false);
661*cdf0e10cSrcweir         break;
662*cdf0e10cSrcweir 	}
663*cdf0e10cSrcweir 	return sal_False;
664*cdf0e10cSrcweir }
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir }
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir #endif
669