LCOV - code coverage report
Current view: top level - libreoffice/cppu/source/uno - eq.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 128 284 45.1 %
Date: 2012-12-27 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10