| File: | bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx |
| Location: | line 140, column 60 |
| Description: | Access to field 'nSize' results in a dereference of a null pointer (loaded from variable 'pParamTypeDescr') |
| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | |||||
| 2 | /************************************************************************* | |||||
| 3 | * | |||||
| 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |||||
| 5 | * | |||||
| 6 | * Copyright 2000, 2010 Oracle and/or its affiliates. | |||||
| 7 | * | |||||
| 8 | * OpenOffice.org - a multi-platform office productivity suite | |||||
| 9 | * | |||||
| 10 | * This file is part of OpenOffice.org. | |||||
| 11 | * | |||||
| 12 | * OpenOffice.org is free software: you can redistribute it and/or modify | |||||
| 13 | * it under the terms of the GNU Lesser General Public License version 3 | |||||
| 14 | * only, as published by the Free Software Foundation. | |||||
| 15 | * | |||||
| 16 | * OpenOffice.org is distributed in the hope that it will be useful, | |||||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| 19 | * GNU Lesser General Public License version 3 for more details | |||||
| 20 | * (a copy is included in the LICENSE file that accompanied this code). | |||||
| 21 | * | |||||
| 22 | * You should have received a copy of the GNU Lesser General Public License | |||||
| 23 | * version 3 along with OpenOffice.org. If not, see | |||||
| 24 | * <http://www.openoffice.org/license.html> | |||||
| 25 | * for a copy of the LGPLv3 License. | |||||
| 26 | * | |||||
| 27 | ************************************************************************/ | |||||
| 28 | ||||||
| 29 | ||||||
| 30 | #if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY) | |||||
| 31 | #include <stdlib.h> | |||||
| 32 | #else | |||||
| 33 | #include <alloca.h> | |||||
| 34 | #endif | |||||
| 35 | ||||||
| 36 | #include <com/sun/star/uno/genfunc.hxx> | |||||
| 37 | #include "com/sun/star/uno/RuntimeException.hpp" | |||||
| 38 | #include <uno/data.h> | |||||
| 39 | ||||||
| 40 | #include "bridges/cpp_uno/shared/bridge.hxx" | |||||
| 41 | #include "bridges/cpp_uno/shared/types.hxx" | |||||
| 42 | #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx" | |||||
| 43 | #include "bridges/cpp_uno/shared/vtables.hxx" | |||||
| 44 | ||||||
| 45 | #include "callvirtualmethod.hxx" | |||||
| 46 | #include "share.hxx" | |||||
| 47 | ||||||
| 48 | using namespace ::rtl; | |||||
| 49 | using namespace ::com::sun::star::uno; | |||||
| 50 | ||||||
| 51 | namespace | |||||
| 52 | { | |||||
| 53 | ||||||
| 54 | static void cpp_call( | |||||
| 55 | bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, | |||||
| 56 | bridges::cpp_uno::shared::VtableSlot aVtableSlot, | |||||
| 57 | typelib_TypeDescriptionReference * pReturnTypeRef, | |||||
| 58 | sal_Int32 nParams, typelib_MethodParameter * pParams, | |||||
| 59 | void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc ) | |||||
| 60 | { | |||||
| 61 | // max space for: [complex ret ptr], values|ptr ... | |||||
| 62 | char * pCppStack = | |||||
| 63 | (char *)alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) )__builtin_alloca (sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64 ))); | |||||
| 64 | char * pCppStackStart = pCppStack; | |||||
| 65 | ||||||
| 66 | // return | |||||
| 67 | typelib_TypeDescription * pReturnTypeDescr = 0; | |||||
| 68 | TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ){ typelib_TypeDescriptionReference * pMacroTypeRef = (pReturnTypeRef ); typelib_TypeDescription ** ppMacroTypeDescr = (&pReturnTypeDescr ); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr , pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef ->pType->pWeakRef) { typelib_typedescriptionreference_getDescription ( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release ( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef ->pType; } }; | |||||
| 69 | OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" )do { if (true && (!(pReturnTypeDescr))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx" ":" "69" ": "), "%s", "### expected return type description!" ); } } while (false); | |||||
| 70 | ||||||
| 71 | void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion | |||||
| 72 | bool bSimpleReturn = true; | |||||
| 73 | ||||||
| 74 | if (pReturnTypeDescr) | |||||
| 75 | { | |||||
| 76 | bSimpleReturn = x86::isSimpleReturnType(pReturnTypeDescr); | |||||
| 77 | if (bSimpleReturn) | |||||
| 78 | { | |||||
| 79 | pCppReturn = pUnoReturn; // direct way for simple types | |||||
| 80 | } | |||||
| 81 | else | |||||
| 82 | { | |||||
| 83 | // complex return via ptr | |||||
| 84 | pCppReturn = *(void **)pCppStack | |||||
| 85 | = (bridges::cpp_uno::shared::relatesToInterfaceType( | |||||
| 86 | pReturnTypeDescr ) | |||||
| 87 | ? alloca( pReturnTypeDescr->nSize )__builtin_alloca (pReturnTypeDescr->nSize) | |||||
| 88 | : pUnoReturn); // direct way | |||||
| 89 | pCppStack += sizeof(void *); | |||||
| 90 | } | |||||
| 91 | } | |||||
| 92 | // push this | |||||
| 93 | void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI()) | |||||
| 94 | + aVtableSlot.offset; | |||||
| 95 | *(void**)pCppStack = pAdjustedThisPtr; | |||||
| 96 | pCppStack += sizeof( void* ); | |||||
| 97 | ||||||
| 98 | // stack space | |||||
| 99 | OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" )do { if (true && (!(sizeof(void *) == sizeof(sal_Int32 )))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/usr/local/src/libreoffice/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx" ":" "99" ": "), "%s", "### unexpected size!"); } } while (false ); | |||||
| 100 | // args | |||||
| 101 | void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams )__builtin_alloca (3 * sizeof(void *) * nParams); | |||||
| 102 | // indizes of values this have to be converted (interface conversion cpp<=>uno) | |||||
| 103 | sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams); | |||||
| 104 | // type descriptions for reconversions | |||||
| 105 | typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams)); | |||||
| 106 | ||||||
| 107 | sal_Int32 nTempIndizes = 0; | |||||
| 108 | ||||||
| 109 | for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) | |||||
| 110 | { | |||||
| 111 | const typelib_MethodParameter & rParam = pParams[nPos]; | |||||
| 112 | typelib_TypeDescription * pParamTypeDescr = 0; | |||||
| 113 | TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ){ typelib_TypeDescriptionReference * pMacroTypeRef = (rParam. pTypeRef); typelib_TypeDescription ** ppMacroTypeDescr = (& pParamTypeDescr); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr , pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef ->pType->pWeakRef) { typelib_typedescriptionreference_getDescription ( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release ( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef ->pType; } }; | |||||
| 114 | ||||||
| 115 | if (!rParam.bOut | |||||
| 116 | && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) | |||||
| 117 | { | |||||
| 118 | uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr, | |||||
| 119 | pThis->getBridge()->getUno2Cpp() ); | |||||
| 120 | ||||||
| 121 | switch (pParamTypeDescr->eTypeClass) | |||||
| 122 | { | |||||
| 123 | case typelib_TypeClass_HYPER: | |||||
| 124 | case typelib_TypeClass_UNSIGNED_HYPER: | |||||
| 125 | case typelib_TypeClass_DOUBLE: | |||||
| 126 | pCppStack += sizeof(sal_Int32); // extra long | |||||
| 127 | break; | |||||
| 128 | default: | |||||
| 129 | break; | |||||
| 130 | } | |||||
| 131 | // no longer needed | |||||
| 132 | TYPELIB_DANGER_RELEASE( pParamTypeDescr ){ if ((((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pParamTypeDescr ); }; | |||||
| 133 | } | |||||
| 134 | else // ptr to complex value | ref | |||||
| 135 | { | |||||
| 136 | if (! rParam.bIn) // is pure out | |||||
| 137 | { | |||||
| 138 | // cpp out is constructed mem, uno out is not! | |||||
| 139 | uno_constructData( | |||||
| 140 | *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize )__builtin_alloca (pParamTypeDescr->nSize), | |||||
| ||||||
| 141 | pParamTypeDescr ); | |||||
| 142 | pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call | |||||
| 143 | // will be released at reconversion | |||||
| 144 | ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; | |||||
| 145 | } | |||||
| 146 | // is in/inout | |||||
| 147 | else if (bridges::cpp_uno::shared::relatesToInterfaceType( | |||||
| 148 | pParamTypeDescr )) | |||||
| 149 | { | |||||
| 150 | uno_copyAndConvertData( | |||||
| 151 | *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize )__builtin_alloca (pParamTypeDescr->nSize), | |||||
| 152 | pUnoArgs[nPos], pParamTypeDescr, | |||||
| 153 | pThis->getBridge()->getUno2Cpp() ); | |||||
| 154 | ||||||
| 155 | pTempIndizes[nTempIndizes] = nPos; // has to be reconverted | |||||
| 156 | // will be released at reconversion | |||||
| 157 | ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; | |||||
| 158 | } | |||||
| 159 | else // direct way | |||||
| 160 | { | |||||
| 161 | *(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos]; | |||||
| 162 | // no longer needed | |||||
| 163 | TYPELIB_DANGER_RELEASE( pParamTypeDescr ){ if ((((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pParamTypeDescr ); }; | |||||
| 164 | } | |||||
| 165 | } | |||||
| 166 | pCppStack += sizeof(sal_Int32); // standard parameter length | |||||
| 167 | } | |||||
| 168 | ||||||
| 169 | try | |||||
| 170 | { | |||||
| 171 | OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" )do { if (true && (!(!( (pCppStack - pCppStackStart ) & 3)))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/usr/local/src/libreoffice/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx" ":" "171" ": "), "%s", "UNALIGNED STACK !!! (Please DO panic)" ); } } while (false); | |||||
| 172 | CPPU_CURRENT_NAMESPACEgcc3::callVirtualMethod( | |||||
| 173 | pAdjustedThisPtr, aVtableSlot.index, | |||||
| 174 | pCppReturn, pReturnTypeDescr, bSimpleReturn, | |||||
| 175 | (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); | |||||
| 176 | // NO exception occurred... | |||||
| 177 | *ppUnoExc = 0; | |||||
| 178 | ||||||
| 179 | // reconvert temporary params | |||||
| 180 | for ( ; nTempIndizes--; ) | |||||
| 181 | { | |||||
| 182 | sal_Int32 nIndex = pTempIndizes[nTempIndizes]; | |||||
| 183 | typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes]; | |||||
| 184 | ||||||
| 185 | if (pParams[nIndex].bIn) | |||||
| 186 | { | |||||
| 187 | if (pParams[nIndex].bOut) // inout | |||||
| 188 | { | |||||
| 189 | uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value | |||||
| 190 | uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, | |||||
| 191 | pThis->getBridge()->getCpp2Uno() ); | |||||
| 192 | } | |||||
| 193 | } | |||||
| 194 | else // pure out | |||||
| 195 | { | |||||
| 196 | uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, | |||||
| 197 | pThis->getBridge()->getCpp2Uno() ); | |||||
| 198 | } | |||||
| 199 | // destroy temp cpp param => cpp: every param was constructed | |||||
| 200 | uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release ); | |||||
| 201 | ||||||
| 202 | TYPELIB_DANGER_RELEASE( pParamTypeDescr ){ if ((((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pParamTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pParamTypeDescr ); }; | |||||
| 203 | } | |||||
| 204 | // return value | |||||
| 205 | if (pCppReturn && pUnoReturn != pCppReturn) | |||||
| 206 | { | |||||
| 207 | uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr, | |||||
| 208 | pThis->getBridge()->getCpp2Uno() ); | |||||
| 209 | uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); | |||||
| 210 | } | |||||
| 211 | } | |||||
| 212 | catch (...) | |||||
| 213 | { | |||||
| 214 | // fill uno exception | |||||
| 215 | fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); | |||||
| 216 | ||||||
| 217 | // temporary params | |||||
| 218 | for ( ; nTempIndizes--; ) | |||||
| 219 | { | |||||
| 220 | sal_Int32 nIndex = pTempIndizes[nTempIndizes]; | |||||
| 221 | // destroy temp cpp param => cpp: every param was constructed | |||||
| 222 | uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release ); | |||||
| 223 | TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] ){ if ((((ppTempParamTypeDescr[nTempIndizes])->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((ppTempParamTypeDescr [nTempIndizes])->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( ppTempParamTypeDescr[nTempIndizes ] ); }; | |||||
| 224 | } | |||||
| 225 | // return type | |||||
| 226 | if (pReturnTypeDescr) | |||||
| 227 | TYPELIB_DANGER_RELEASE( pReturnTypeDescr ){ if ((((pReturnTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pReturnTypeDescr)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pReturnTypeDescr ); }; | |||||
| 228 | } | |||||
| 229 | } | |||||
| 230 | ||||||
| 231 | } | |||||
| 232 | ||||||
| 233 | namespace x86 | |||||
| 234 | { | |||||
| 235 | bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive) | |||||
| 236 | { | |||||
| 237 | if (bridges::cpp_uno::shared::isSimpleType( pTD )) | |||||
| 238 | return true; | |||||
| 239 | #if defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || \ | |||||
| 240 | defined(MACOSX) || defined(DRAGONFLY) | |||||
| 241 | // Only structs of exactly 1, 2, 4, or 8 bytes are returned through | |||||
| 242 | // registers, see <http://developer.apple.com/documentation/DeveloperTools/ | |||||
| 243 | // Conceptual/LowLevelABI/Articles/IA32.html>: | |||||
| 244 | if (pTD->eTypeClass == typelib_TypeClass_STRUCT && | |||||
| 245 | (recursive || pTD->nSize <= 2 || pTD->nSize == 4 || pTD->nSize == 8)) | |||||
| 246 | { | |||||
| 247 | typelib_CompoundTypeDescription *const pCompTD = | |||||
| 248 | (typelib_CompoundTypeDescription *) pTD; | |||||
| 249 | for ( sal_Int32 pos = pCompTD->nMembers; pos--; ) { | |||||
| 250 | typelib_TypeDescription * pMemberTD = 0; | |||||
| 251 | TYPELIB_DANGER_GET( &pMemberTD, pCompTD->ppTypeRefs[pos] ){ typelib_TypeDescriptionReference * pMacroTypeRef = (pCompTD ->ppTypeRefs[pos]); typelib_TypeDescription ** ppMacroTypeDescr = (&pMemberTD); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr , pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef ->pType->pWeakRef) { typelib_typedescriptionreference_getDescription ( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release ( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef ->pType; } }; | |||||
| 252 | bool const b = isSimpleReturnType(pMemberTD, true); | |||||
| 253 | TYPELIB_DANGER_RELEASE( pMemberTD ){ if ((((pMemberTD)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pMemberTD)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pMemberTD ); }; | |||||
| 254 | if (! b) | |||||
| 255 | return false; | |||||
| 256 | } | |||||
| 257 | return true; | |||||
| 258 | } | |||||
| 259 | #else | |||||
| 260 | (void)recursive; | |||||
| 261 | #endif | |||||
| 262 | return false; | |||||
| 263 | } | |||||
| 264 | } | |||||
| 265 | ||||||
| 266 | namespace bridges { namespace cpp_uno { namespace shared { | |||||
| 267 | ||||||
| 268 | void unoInterfaceProxyDispatch( | |||||
| 269 | uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr, | |||||
| 270 | void * pReturn, void * pArgs[], uno_Any ** ppException ) | |||||
| 271 | { | |||||
| 272 | // is my surrogate | |||||
| 273 | bridges::cpp_uno::shared::UnoInterfaceProxy * pThis | |||||
| 274 | = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI); | |||||
| 275 | ||||||
| 276 | switch (pMemberDescr->eTypeClass) | |||||
| ||||||
| 277 | { | |||||
| 278 | case typelib_TypeClass_INTERFACE_ATTRIBUTE: | |||||
| 279 | { | |||||
| 280 | VtableSlot aVtableSlot( | |||||
| 281 | getVtableSlot( | |||||
| 282 | reinterpret_cast< | |||||
| 283 | typelib_InterfaceAttributeTypeDescription const * >( | |||||
| 284 | pMemberDescr))); | |||||
| 285 | if (pReturn) | |||||
| 286 | { | |||||
| 287 | // dependent dispatch | |||||
| 288 | cpp_call( | |||||
| 289 | pThis, aVtableSlot, | |||||
| 290 | ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef, | |||||
| 291 | 0, 0, // no params | |||||
| 292 | pReturn, pArgs, ppException ); | |||||
| 293 | } | |||||
| 294 | else | |||||
| 295 | { | |||||
| 296 | // is SET | |||||
| 297 | typelib_MethodParameter aParam; | |||||
| 298 | aParam.pTypeRef = | |||||
| 299 | ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef; | |||||
| 300 | aParam.bIn = sal_True((sal_Bool)1); | |||||
| 301 | aParam.bOut = sal_False((sal_Bool)0); | |||||
| 302 | ||||||
| 303 | typelib_TypeDescriptionReference * pReturnTypeRef = 0; | |||||
| 304 | OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void")(&("void")[0]), ((sal_Int32)((sizeof ("void") / sizeof (( "void")[0]))-1)), (((rtl_TextEncoding) 11)) ); | |||||
| 305 | typelib_typedescriptionreference_new( | |||||
| 306 | &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData ); | |||||
| 307 | ||||||
| 308 | // dependent dispatch | |||||
| 309 | aVtableSlot.index += 1; // get, then set method | |||||
| 310 | cpp_call( | |||||
| 311 | pThis, aVtableSlot, | |||||
| 312 | pReturnTypeRef, | |||||
| 313 | 1, &aParam, | |||||
| 314 | pReturn, pArgs, ppException ); | |||||
| 315 | ||||||
| 316 | typelib_typedescriptionreference_release( pReturnTypeRef ); | |||||
| 317 | } | |||||
| 318 | ||||||
| 319 | break; | |||||
| 320 | } | |||||
| 321 | case typelib_TypeClass_INTERFACE_METHOD: | |||||
| 322 | { | |||||
| 323 | VtableSlot aVtableSlot( | |||||
| 324 | getVtableSlot( | |||||
| 325 | reinterpret_cast< | |||||
| 326 | typelib_InterfaceMethodTypeDescription const * >( | |||||
| 327 | pMemberDescr))); | |||||
| 328 | switch (aVtableSlot.index) | |||||
| 329 | { | |||||
| 330 | // standard calls | |||||
| 331 | case 1: // acquire uno interface | |||||
| 332 | (*pUnoI->acquire)( pUnoI ); | |||||
| 333 | *ppException = 0; | |||||
| 334 | break; | |||||
| 335 | case 2: // release uno interface | |||||
| 336 | (*pUnoI->release)( pUnoI ); | |||||
| 337 | *ppException = 0; | |||||
| 338 | break; | |||||
| 339 | case 0: // queryInterface() opt | |||||
| 340 | { | |||||
| 341 | typelib_TypeDescription * pTD = 0; | |||||
| 342 | TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() ){ typelib_TypeDescriptionReference * pMacroTypeRef = (reinterpret_cast < Type * >( pArgs[0] )->getTypeLibType()); typelib_TypeDescription ** ppMacroTypeDescr = (&pTD); if (((pMacroTypeRef->eTypeClass ) == typelib_TypeClass_INTERFACE_METHOD || (pMacroTypeRef-> eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE)) { typelib_typedescriptionreference_getDescription ( ppMacroTypeDescr, pMacroTypeRef ); } else if (!pMacroTypeRef ->pType || !pMacroTypeRef->pType->pWeakRef) { typelib_typedescriptionreference_getDescription ( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release ( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef ->pType; } }; | |||||
| 343 | if (pTD) | |||||
| 344 | { | |||||
| 345 | uno_Interface * pInterface = 0; | |||||
| 346 | (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)( | |||||
| 347 | pThis->pBridge->getUnoEnv(), | |||||
| 348 | (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD ); | |||||
| 349 | ||||||
| 350 | if (pInterface) | |||||
| 351 | { | |||||
| 352 | ::uno_any_construct( | |||||
| 353 | reinterpret_cast< uno_Any * >( pReturn ), | |||||
| 354 | &pInterface, pTD, 0 ); | |||||
| 355 | (*pInterface->release)( pInterface ); | |||||
| 356 | TYPELIB_DANGER_RELEASE( pTD ){ if ((((pTD)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pTD)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pTD ); }; | |||||
| 357 | *ppException = 0; | |||||
| 358 | break; | |||||
| 359 | } | |||||
| 360 | TYPELIB_DANGER_RELEASE( pTD ){ if ((((pTD)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || ((pTD)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE )) typelib_typedescription_release( pTD ); }; | |||||
| 361 | } | |||||
| 362 | } // else perform queryInterface() | |||||
| 363 | default: | |||||
| 364 | // dependent dispatch | |||||
| 365 | cpp_call( | |||||
| 366 | pThis, aVtableSlot, | |||||
| 367 | ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef, | |||||
| 368 | ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams, | |||||
| 369 | ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams, | |||||
| 370 | pReturn, pArgs, ppException ); | |||||
| 371 | } | |||||
| 372 | break; | |||||
| 373 | } | |||||
| 374 | default: | |||||
| 375 | { | |||||
| 376 | ::com::sun::star::uno::RuntimeException aExc( | |||||
| 377 | OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!")(&("illegal member type description!")[0]), ((sal_Int32)( (sizeof ("illegal member type description!") / sizeof (("illegal member type description!" )[0]))-1)), (((rtl_TextEncoding) 11)) ), | |||||
| 378 | ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); | |||||
| 379 | ||||||
| 380 | Type const & rExcType = ::getCppuType( &aExc ); | |||||
| 381 | // binary identical null reference | |||||
| 382 | ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 ); | |||||
| 383 | } | |||||
| 384 | } | |||||
| 385 | } | |||||
| 386 | ||||||
| 387 | } } } | |||||
| 388 | ||||||
| 389 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |