LCOV - code coverage report
Current view: top level - cppu/source/uno - eq.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 262 0.0 %
Date: 2014-04-14 Functions: 0 4 0.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           0 : inline bool _equalObject(
      37             :     void * pI1, void * pI2,
      38             :     uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
      39             :     SAL_THROW(())
      40             : {
      41           0 :     if (pI1 == pI2)
      42           0 :         return true;
      43           0 :     if ((0 == pI1) || (0 == pI2))
      44           0 :         return false;
      45           0 :     bool bRet = 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             : bool equalStruct(
      67             :     void * pDest, void *pSource,
      68             :     typelib_CompoundTypeDescription * pTypeDescr,
      69             :     uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
      70             :     SAL_THROW(());
      71             : 
      72           0 : inline bool _equalStruct(
      73             :     void * pDest, void *pSource,
      74             :     typelib_CompoundTypeDescription * pTypeDescr,
      75             :     uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
      76             :     SAL_THROW(())
      77             : {
      78           0 :     if (pTypeDescr->pBaseTypeDescription &&
      79           0 :         !equalStruct( pDest, pSource, pTypeDescr->pBaseTypeDescription, queryInterface, release ))
      80             :     {
      81           0 :         return false;
      82             :     }
      83             : 
      84           0 :     typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs;
      85           0 :     sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets;
      86           0 :     sal_Int32 nDescr = pTypeDescr->nMembers;
      87             : 
      88           0 :     while (nDescr--)
      89             :     {
      90           0 :         sal_Int32 nOffset = pMemberOffsets[nDescr];
      91           0 :         if (! ::uno_type_equalData( (char *)pDest + nOffset,
      92           0 :                                     ppTypeRefs[nDescr],
      93           0 :                                     (char *)pSource + nOffset,
      94           0 :                                     ppTypeRefs[nDescr],
      95           0 :                                     queryInterface, release ))
      96             :         {
      97           0 :             return false;
      98             :         }
      99             :     }
     100           0 :     return true;
     101             : }
     102             : 
     103             : 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           0 : inline 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           0 :     if (pDest == pSource)
     116           0 :         return true;
     117           0 :     sal_Int32 nElements = pDest->nElements;
     118           0 :     if (nElements != pSource->nElements)
     119           0 :         return false;
     120           0 :     if (! nElements)
     121           0 :         return true;
     122             : 
     123           0 :     void * pDestElements = pDest->elements;
     124           0 :     void * pSourceElements = pSource->elements;
     125             : 
     126           0 :     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           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     133             :         {
     134           0 :             if ((((sal_Bool *)pDestElements)[nPos] != sal_False) !=
     135           0 :                 (((sal_Bool *)pSourceElements)[nPos] != sal_False))
     136             :             {
     137           0 :                 return false;
     138             :             }
     139             :         }
     140           0 :         return true;
     141             :     }
     142             :     case typelib_TypeClass_BYTE:
     143           0 :         return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int8) * nElements ));
     144             :     case typelib_TypeClass_SHORT:
     145             :     case typelib_TypeClass_UNSIGNED_SHORT:
     146           0 :         return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int16) * nElements ));
     147             :     case typelib_TypeClass_LONG:
     148             :     case typelib_TypeClass_UNSIGNED_LONG:
     149           0 :         return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
     150             :     case typelib_TypeClass_HYPER:
     151             :     case typelib_TypeClass_UNSIGNED_HYPER:
     152           0 :         return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int64) * nElements ));
     153             :     case typelib_TypeClass_FLOAT:
     154             :     {
     155           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     156             :         {
     157           0 :             if (((float *)pDestElements)[nPos] != ((float *)pSourceElements)[nPos])
     158           0 :                 return false;
     159             :         }
     160           0 :         return true;
     161             :     }
     162             :     case typelib_TypeClass_DOUBLE:
     163             :     {
     164           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     165             :         {
     166           0 :             if (((double *)pDestElements)[nPos] != ((double *)pSourceElements)[nPos])
     167           0 :                 return false;
     168             :         }
     169           0 :         return true;
     170             :     }
     171             :     case typelib_TypeClass_STRING:
     172             :     {
     173           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     174             :         {
     175           0 :             if (! ((::rtl::OUString *)pDestElements +nPos)->equals( ((const ::rtl::OUString *)pSourceElements)[nPos] ))
     176           0 :                 return false;
     177             :         }
     178           0 :         return 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 false;
     188             :             }
     189             :         }
     190           0 :         return true;
     191             :     }
     192             :     case typelib_TypeClass_ANY:
     193             :     {
     194           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     195             :         {
     196           0 :             uno_Any * pDest2 = (uno_Any *)pDestElements + nPos;
     197           0 :             uno_Any * pSource2 = (uno_Any *)pSourceElements + nPos;
     198           0 :             if (! ::uno_type_equalData( pDest2->pData, pDest2->pType,
     199             :                                         pSource2->pData, pSource2->pType,
     200           0 :                                         queryInterface, release ))
     201             :             {
     202           0 :                 return false;
     203             :             }
     204             :         }
     205           0 :         return true;
     206             :     }
     207             :     case typelib_TypeClass_ENUM:
     208           0 :         return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
     209             :     case typelib_TypeClass_STRUCT:
     210             :     case typelib_TypeClass_EXCEPTION:
     211             :     {
     212           0 :         typelib_TypeDescription * pElementTypeDescr = 0;
     213           0 :         TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
     214           0 :         sal_Int32 nElementSize = pElementTypeDescr->nSize;
     215           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     216             :         {
     217           0 :             if (! _equalStruct( (char *)pDestElements + (nPos * nElementSize),
     218           0 :                                 (char *)pSourceElements + (nPos * nElementSize),
     219             :                                 (typelib_CompoundTypeDescription *)pElementTypeDescr,
     220           0 :                                 queryInterface, release ))
     221             :             {
     222           0 :                 TYPELIB_DANGER_RELEASE( pElementTypeDescr );
     223           0 :                 return false;
     224             :             }
     225             :         }
     226           0 :         TYPELIB_DANGER_RELEASE( pElementTypeDescr );
     227           0 :         return true;
     228             :     }
     229             :     case typelib_TypeClass_SEQUENCE: // sequence of sequence
     230             :     {
     231           0 :         typelib_TypeDescription * pElementTypeDescr = 0;
     232           0 :         TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
     233             :         typelib_TypeDescriptionReference * pSeqElementType =
     234           0 :             ((typelib_IndirectTypeDescription *)pElementTypeDescr)->pType;
     235           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     236             :         {
     237           0 :             if (! equalSequence( ((uno_Sequence **)pDestElements)[nPos],
     238           0 :                                  ((uno_Sequence **)pSourceElements)[nPos],
     239           0 :                                  pSeqElementType, queryInterface, release ))
     240             :             {
     241           0 :                 TYPELIB_DANGER_RELEASE( pElementTypeDescr );
     242           0 :                 return false;
     243             :             }
     244             :         }
     245           0 :         TYPELIB_DANGER_RELEASE( pElementTypeDescr );
     246           0 :         return true;
     247             :     }
     248             :     case typelib_TypeClass_INTERFACE:
     249             :     {
     250           0 :         for ( sal_Int32 nPos = nElements; nPos--; )
     251             :         {
     252           0 :             if (! _equalObject( ((void **)pDestElements)[nPos], ((void **)pSourceElements)[nPos],
     253           0 :                                 queryInterface, release ))
     254             :             {
     255           0 :                 return false;
     256             :             }
     257             :         }
     258           0 :         return true;
     259             :     }
     260             :     default:
     261             :         OSL_ASSERT(false);
     262           0 :         return false;
     263             :     }
     264             : }
     265             : 
     266           0 : inline bool _equalData(
     267             :     void * pDest,
     268             :     typelib_TypeDescriptionReference * pDestType, typelib_TypeDescription * pDestTypeDescr,
     269             :     void * pSource,
     270             :     typelib_TypeDescriptionReference * pSourceType,
     271             :     uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
     272             :     SAL_THROW(())
     273             : {
     274             :     typelib_TypeClass eSourceTypeClass, eDestTypeClass;
     275           0 :     while (typelib_TypeClass_ANY == (eDestTypeClass = pDestType->eTypeClass))
     276             :     {
     277           0 :         pDestTypeDescr = 0;
     278           0 :         pDestType = ((uno_Any *)pDest)->pType;
     279           0 :         pDest = ((uno_Any *)pDest)->pData;
     280             :     }
     281           0 :     while (typelib_TypeClass_ANY == (eSourceTypeClass = pSourceType->eTypeClass))
     282             :     {
     283           0 :         pSourceType = ((uno_Any *)pSource)->pType;
     284           0 :         pSource = ((uno_Any *)pSource)->pData;
     285             :     }
     286             : 
     287           0 :     switch (eDestTypeClass)
     288             :     {
     289             :     case typelib_TypeClass_VOID:
     290           0 :         return eSourceTypeClass == typelib_TypeClass_VOID;
     291             :     case typelib_TypeClass_CHAR:
     292             :         return eSourceTypeClass == typelib_TypeClass_CHAR
     293           0 :             && *(sal_Unicode *)pDest == *(sal_Unicode *)pSource;
     294             :     case typelib_TypeClass_BOOLEAN:
     295             :         return eSourceTypeClass == typelib_TypeClass_BOOLEAN
     296           0 :             && ((*(sal_Bool *)pDest != sal_False)
     297           0 :                 == (*(sal_Bool *)pSource != sal_False));
     298             :     case typelib_TypeClass_BYTE:
     299           0 :         switch (eSourceTypeClass)
     300             :         {
     301             :         case typelib_TypeClass_BYTE:
     302           0 :             return (*(sal_Int8 *)pDest == *(sal_Int8 *)pSource);
     303             :         case typelib_TypeClass_SHORT:
     304           0 :             return ((sal_Int16)*(sal_Int8 *)pDest == *(sal_Int16 *)pSource);
     305             :         case typelib_TypeClass_UNSIGNED_SHORT:
     306           0 :             return ((sal_Int32)*(sal_Int8 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
     307             :         case typelib_TypeClass_LONG:
     308           0 :             return ((sal_Int32)*(sal_Int8 *)pDest == *(sal_Int32 *)pSource);
     309             :         case typelib_TypeClass_UNSIGNED_LONG:
     310           0 :             return ((sal_Int64)*(sal_Int8 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
     311             :         case typelib_TypeClass_HYPER:
     312           0 :             return ((sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource);
     313             :         case typelib_TypeClass_UNSIGNED_HYPER:
     314           0 :             return (*(sal_Int8 *)pDest >= 0 &&
     315           0 :                     (sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource); // same size
     316             :         case typelib_TypeClass_FLOAT:
     317           0 :             return ((float)*(sal_Int8 *)pDest == *(float *)pSource);
     318             :         case typelib_TypeClass_DOUBLE:
     319           0 :             return ((double)*(sal_Int8 *)pDest == *(double *)pSource);
     320             :         default:
     321           0 :             return false;
     322             :         }
     323             :     case typelib_TypeClass_SHORT:
     324           0 :         switch (eSourceTypeClass)
     325             :         {
     326             :         case typelib_TypeClass_BYTE:
     327           0 :             return (*(sal_Int16 *)pDest == (sal_Int16)*(sal_Int8 *)pSource);
     328             :         case typelib_TypeClass_SHORT:
     329           0 :             return (*(sal_Int16 *)pDest == *(sal_Int16 *)pSource);
     330             :         case typelib_TypeClass_UNSIGNED_SHORT:
     331           0 :             return ((sal_Int32)*(sal_Int16 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
     332             :         case typelib_TypeClass_LONG:
     333           0 :             return ((sal_Int32)*(sal_Int16 *)pDest == *(sal_Int32 *)pSource);
     334             :         case typelib_TypeClass_UNSIGNED_LONG:
     335           0 :             return ((sal_Int64)*(sal_Int16 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
     336             :         case typelib_TypeClass_HYPER:
     337           0 :             return ((sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource);
     338             :         case typelib_TypeClass_UNSIGNED_HYPER:
     339           0 :             return (*(sal_Int16 *)pDest >= 0 &&
     340           0 :                     (sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource); // same size
     341             :         case typelib_TypeClass_FLOAT:
     342           0 :             return ((float)*(sal_Int16 *)pDest == *(float *)pSource);
     343             :         case typelib_TypeClass_DOUBLE:
     344           0 :             return ((double)*(sal_Int16 *)pDest == *(double *)pSource);
     345             :         default:
     346           0 :             return false;
     347             :         }
     348             :     case typelib_TypeClass_UNSIGNED_SHORT:
     349           0 :         switch (eSourceTypeClass)
     350             :         {
     351             :         case typelib_TypeClass_BYTE:
     352           0 :             return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int8 *)pSource);
     353             :         case typelib_TypeClass_SHORT:
     354           0 :             return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int16 *)pSource);
     355             :         case typelib_TypeClass_UNSIGNED_SHORT:
     356           0 :             return (*(sal_uInt16 *)pDest == *(sal_uInt16 *)pSource);
     357             :         case typelib_TypeClass_LONG:
     358           0 :             return ((sal_Int32)*(sal_uInt16 *)pDest == *(sal_Int32 *)pSource);
     359             :         case typelib_TypeClass_UNSIGNED_LONG:
     360           0 :             return ((sal_uInt32)*(sal_uInt16 *)pDest == *(sal_uInt32 *)pSource);
     361             :         case typelib_TypeClass_HYPER:
     362           0 :             return ((sal_Int64)*(sal_uInt16 *)pDest == *(sal_Int64 *)pSource);
     363             :         case typelib_TypeClass_UNSIGNED_HYPER:
     364           0 :             return ((sal_uInt64)*(sal_uInt16 *)pDest == *(sal_uInt64 *)pSource);
     365             :         case typelib_TypeClass_FLOAT:
     366           0 :             return ((float)*(sal_uInt16 *)pDest == *(float *)pSource);
     367             :         case typelib_TypeClass_DOUBLE:
     368           0 :             return ((double)*(sal_uInt16 *)pDest == *(double *)pSource);
     369             :         default:
     370           0 :             return false;
     371             :         }
     372             :     case typelib_TypeClass_LONG:
     373           0 :         switch (eSourceTypeClass)
     374             :         {
     375             :         case typelib_TypeClass_BYTE:
     376           0 :             return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int8 *)pSource);
     377             :         case typelib_TypeClass_SHORT:
     378           0 :             return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int16 *)pSource);
     379             :         case typelib_TypeClass_UNSIGNED_SHORT:
     380           0 :             return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource);
     381             :         case typelib_TypeClass_LONG:
     382           0 :             return (*(sal_Int32 *)pDest == *(sal_Int32 *)pSource);
     383             :         case typelib_TypeClass_UNSIGNED_LONG:
     384           0 :             return ((sal_Int64)*(sal_Int32 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
     385             :         case typelib_TypeClass_HYPER:
     386           0 :             return ((sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource);
     387             :         case typelib_TypeClass_UNSIGNED_HYPER:
     388           0 :             return (*(sal_Int32 *)pDest >= 0 &&
     389           0 :                     (sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource); // same size
     390             :         case typelib_TypeClass_FLOAT:
     391           0 :             return ((float)*(sal_Int32 *)pDest == *(float *)pSource);
     392             :         case typelib_TypeClass_DOUBLE:
     393           0 :             return ((double)*(sal_Int32 *)pDest == *(double *)pSource);
     394             :         default:
     395           0 :             return false;
     396             :         }
     397             :     case typelib_TypeClass_UNSIGNED_LONG:
     398           0 :         switch (eSourceTypeClass)
     399             :         {
     400             :         case typelib_TypeClass_BYTE:
     401           0 :             return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int8 *)pSource);
     402             :         case typelib_TypeClass_SHORT:
     403           0 :             return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int16 *)pSource);
     404             :         case typelib_TypeClass_UNSIGNED_SHORT:
     405           0 :             return (*(sal_uInt32 *)pDest == (sal_uInt32)*(sal_uInt16 *)pSource);
     406             :         case typelib_TypeClass_LONG:
     407           0 :             return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int32 *)pSource);
     408             :         case typelib_TypeClass_UNSIGNED_LONG:
     409           0 :             return (*(sal_uInt32 *)pDest == *(sal_uInt32 *)pSource);
     410             :         case typelib_TypeClass_HYPER:
     411           0 :             return ((sal_Int64)*(sal_uInt32 *)pDest == *(sal_Int64 *)pSource);
     412             :         case typelib_TypeClass_UNSIGNED_HYPER:
     413           0 :             return ((sal_uInt64)*(sal_uInt32 *)pDest == *(sal_uInt64 *)pSource);
     414             :         case typelib_TypeClass_FLOAT:
     415           0 :             return ((float)*(sal_uInt32 *)pDest == *(float *)pSource);
     416             :         case typelib_TypeClass_DOUBLE:
     417           0 :             return ((double)*(sal_uInt32 *)pDest == *(double *)pSource);
     418             :         default:
     419           0 :             return false;
     420             :         }
     421             :     case typelib_TypeClass_HYPER:
     422           0 :         switch (eSourceTypeClass)
     423             :         {
     424             :         case typelib_TypeClass_BYTE:
     425           0 :             return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int8 *)pSource);
     426             :         case typelib_TypeClass_SHORT:
     427           0 :             return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int16 *)pSource);
     428             :         case typelib_TypeClass_UNSIGNED_SHORT:
     429           0 :             return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt16 *)pSource);
     430             :         case typelib_TypeClass_LONG:
     431           0 :             return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int32 *)pSource);
     432             :         case typelib_TypeClass_UNSIGNED_LONG:
     433           0 :             return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource);
     434             :         case typelib_TypeClass_HYPER:
     435           0 :             return (*(sal_Int64 *)pDest == *(sal_Int64 *)pSource);
     436             :         case typelib_TypeClass_UNSIGNED_HYPER:
     437           0 :             return (*(sal_Int64 *)pDest >= 0 &&
     438           0 :                     *(sal_Int64 *)pDest == *(sal_Int64 *)pSource); // same size
     439             :         case typelib_TypeClass_FLOAT:
     440           0 :             return ((float)*(sal_Int64 *)pDest == *(float *)pSource);
     441             :         case typelib_TypeClass_DOUBLE:
     442           0 :             return ((double)*(sal_Int64 *)pDest == *(double *)pSource);
     443             :         default:
     444           0 :             return false;
     445             :         }
     446             :     case typelib_TypeClass_UNSIGNED_HYPER:
     447           0 :         switch (eSourceTypeClass)
     448             :         {
     449             :         case typelib_TypeClass_BYTE:
     450           0 :             return (*(sal_Int8 *)pSource >= 0 &&
     451           0 :                     *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int8 *)pSource);
     452             :         case typelib_TypeClass_SHORT:
     453           0 :             return (*(sal_Int16 *)pSource >= 0 &&
     454           0 :                     *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int16 *)pSource);
     455             :         case typelib_TypeClass_UNSIGNED_SHORT:
     456           0 :             return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt16 *)pSource);
     457             :         case typelib_TypeClass_LONG:
     458           0 :             return (*(sal_Int32 *)pSource >= 0 &&
     459           0 :                     *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int32 *)pSource);
     460             :         case typelib_TypeClass_UNSIGNED_LONG:
     461           0 :             return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt32 *)pSource);
     462             :         case typelib_TypeClass_HYPER:
     463           0 :             return (*(sal_Int64 *)pSource >= 0 &&
     464           0 :                     *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int64 *)pSource);
     465             :         case typelib_TypeClass_UNSIGNED_HYPER:
     466           0 :             return (*(sal_uInt64 *)pDest == *(sal_uInt64 *)pSource);
     467             :         case typelib_TypeClass_FLOAT:
     468           0 :             if (::floor( *(float *)pSource ) != *(float *)pSource || *(float *)pSource < 0)
     469           0 :                 return false;
     470           0 :             return (*(sal_uInt64 *)pDest == (sal_uInt64)*(float *)pSource);
     471             :         case typelib_TypeClass_DOUBLE:
     472           0 :             if (::floor( *(double *)pSource ) != *(double *)pSource || *(double *)pSource < 0)
     473           0 :                 return false;
     474           0 :             return (*(sal_uInt64 *)pDest == (sal_uInt64)*(double *)pSource);
     475             :         default:
     476           0 :             return false;
     477             :         }
     478             :     case typelib_TypeClass_FLOAT:
     479           0 :         switch (eSourceTypeClass)
     480             :         {
     481             :         case typelib_TypeClass_BYTE:
     482           0 :             return (*(float *)pDest == (float)*(sal_Int8 *)pSource);
     483             :         case typelib_TypeClass_SHORT:
     484           0 :             return (*(float *)pDest == (float)*(sal_Int16 *)pSource);
     485             :         case typelib_TypeClass_UNSIGNED_SHORT:
     486           0 :             return (*(float *)pDest == (float)*(sal_uInt16 *)pSource);
     487             :         case typelib_TypeClass_LONG:
     488           0 :             return (*(float *)pDest == (float)*(sal_Int32 *)pSource);
     489             :         case typelib_TypeClass_UNSIGNED_LONG:
     490           0 :             return (*(float *)pDest == (float)*(sal_uInt32 *)pSource);
     491             :         case typelib_TypeClass_HYPER:
     492           0 :             return (*(float *)pDest == (float)*(sal_Int64 *)pSource);
     493             :         case typelib_TypeClass_UNSIGNED_HYPER:
     494           0 :             if (::floor( *(float *)pDest ) != *(float *)pDest || *(float *)pDest < 0)
     495           0 :                 return false;
     496           0 :             return ((sal_uInt64)*(float *)pDest == *(sal_uInt64 *)pSource);
     497             :         case typelib_TypeClass_FLOAT:
     498           0 :             return (*(float *)pDest == *(float *)pSource);
     499             :         case typelib_TypeClass_DOUBLE:
     500           0 :             return ((double)*(float *)pDest == *(double *)pSource);
     501             :         default:
     502           0 :             return false;
     503             :         }
     504             :     case typelib_TypeClass_DOUBLE:
     505           0 :         switch (eSourceTypeClass)
     506             :         {
     507             :         case typelib_TypeClass_BYTE:
     508           0 :             return (*(double *)pDest == (double)*(sal_Int8 *)pSource);
     509             :         case typelib_TypeClass_SHORT:
     510           0 :             return (*(double *)pDest == (double)*(sal_Int16 *)pSource);
     511             :         case typelib_TypeClass_UNSIGNED_SHORT:
     512           0 :             return (*(double *)pDest == (double)*(sal_uInt16 *)pSource);
     513             :         case typelib_TypeClass_LONG:
     514           0 :             return (*(double *)pDest == (double)*(sal_Int32 *)pSource);
     515             :         case typelib_TypeClass_UNSIGNED_LONG:
     516           0 :             return (*(double *)pDest == (double)*(sal_uInt32 *)pSource);
     517             :         case typelib_TypeClass_HYPER:
     518           0 :             return (*(double *)pDest == (double)*(sal_Int64 *)pSource);
     519             :         case typelib_TypeClass_UNSIGNED_HYPER:
     520           0 :             if (::floor( *(double *)pDest ) != *(double *)pDest || *(double *)pDest < 0)
     521           0 :                 return false;
     522           0 :             return ((sal_uInt64)*(double *)pDest == *(sal_uInt64 *)pSource);
     523             :         case typelib_TypeClass_FLOAT:
     524           0 :             return (*(double *)pDest == (double)*(float *)pSource);
     525             :         case typelib_TypeClass_DOUBLE:
     526           0 :             return (*(double *)pDest == *(double *)pSource);
     527             :         default:
     528           0 :             return false;
     529             :         }
     530             :     case typelib_TypeClass_STRING:
     531             :         return eSourceTypeClass == typelib_TypeClass_STRING
     532           0 :             && ((::rtl::OUString *)pDest)->equals(
     533           0 :                 *(::rtl::OUString const *)pSource );
     534             :     case typelib_TypeClass_TYPE:
     535             :         return eSourceTypeClass == typelib_TypeClass_TYPE
     536           0 :             && _type_equals(
     537             :                 *(typelib_TypeDescriptionReference **)pDest,
     538           0 :                 *(typelib_TypeDescriptionReference **)pSource );
     539             :     case typelib_TypeClass_ENUM:
     540           0 :         return (_type_equals( pDestType, pSourceType ) &&
     541           0 :                 *(sal_Int32 *)pDest == *(sal_Int32 *)pSource);
     542             :     case typelib_TypeClass_STRUCT:
     543             :     case typelib_TypeClass_EXCEPTION:
     544           0 :         if (! _type_equals( pDestType, pSourceType ))
     545           0 :             return false;
     546           0 :         if (pDestTypeDescr)
     547             :         {
     548             :             return _equalStruct(
     549             :                 pDest, pSource,
     550             :                 (typelib_CompoundTypeDescription *)pDestTypeDescr,
     551           0 :                 queryInterface, release );
     552             :         }
     553             :         else
     554             :         {
     555           0 :             TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType );
     556             :             bool bRet = _equalStruct(
     557             :                 pDest, pSource,
     558             :                 (typelib_CompoundTypeDescription *)pDestTypeDescr,
     559           0 :                 queryInterface, release );
     560           0 :             TYPELIB_DANGER_RELEASE( pDestTypeDescr );
     561           0 :             return bRet;
     562             :         }
     563             :     case typelib_TypeClass_SEQUENCE:
     564           0 :         if (_type_equals( pDestType, pSourceType ))
     565             :         {
     566           0 :             if (pDestTypeDescr)
     567             :             {
     568             :                 return _equalSequence(
     569             :                     *(uno_Sequence **)pDest, *(uno_Sequence **)pSource,
     570             :                     ((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType,
     571           0 :                     queryInterface, release );
     572             :             }
     573             :             else
     574             :             {
     575           0 :                 TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType );
     576             :                 bool bRet = _equalSequence(
     577             :                     *(uno_Sequence **)pDest, *(uno_Sequence **)pSource,
     578             :                     ((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType,
     579           0 :                     queryInterface, release );
     580           0 :                 TYPELIB_DANGER_RELEASE( pDestTypeDescr );
     581           0 :                 return bRet;
     582             :             }
     583             :         }
     584           0 :         return false;
     585             :     case typelib_TypeClass_INTERFACE:
     586           0 :         if (typelib_TypeClass_INTERFACE == eSourceTypeClass)
     587           0 :             return _equalObject( *(void **)pDest, *(void **)pSource, queryInterface, release );
     588           0 :         break;
     589             :     default:
     590             :         OSL_ASSERT(false);
     591           0 :         break;
     592             :     }
     593           0 :     return false;
     594             : }
     595             : 
     596             : }
     597             : 
     598             : #endif
     599             : 
     600             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10