summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx2
-rw-r--r--bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx391
-rw-r--r--bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx228
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx323
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx181
6 files changed, 547 insertions, 580 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index cc1528f53d89..21de11b5ea36 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -451,7 +451,7 @@ namespace
int index = functionIndex*nVtableOffsets + vtableOffset;
unsigned char *result = ((unsigned char *) &codeSnippets) + codeSnippets[index];
- SAL_INFO( "bridges.ios", "codeSnippet(" << OUString(type->aBase.pTypeName) << "::" << OUString(member->pTypeName) << "): [" << functionIndex << "," << vtableOffset << "]=" << (void *) result << " (" << std::hex << ((int*)result)[0] << "," << ((int*)result)[1] << "," << ((int*)result)[2] << "," << ((int*)result)[3] << ")");
+ SAL_INFO( "bridges", "codeSnippet(" << OUString(type->aBase.pTypeName) << "::" << OUString(member->pTypeName) << "): [" << functionIndex << "," << vtableOffset << "]=" << (void *) result << " (" << std::hex << ((int*)result)[0] << "," << ((int*)result)[1] << "," << ((int*)result)[2] << "," << ((int*)result)[3] << ")");
return result;
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
index 988502713639..f1cacf8d54ba 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
@@ -128,7 +128,7 @@ std::type_info * Rtti::getRtti(typelib_TypeDescription const & type) {
if (ptr != nullptr)
rtti = *ptr;
else
- SAL_WARN("bridges.osx", dlerror());
+ SAL_WARN("bridges", dlerror());
}
#endif
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx
index a5e0e53580ac..24a0837a6e30 100644
--- a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx
@@ -32,195 +32,188 @@
#include "msci.hxx"
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
namespace
{
static inline typelib_TypeClass cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
- const typelib_TypeDescription * pMemberTypeDescr,
- typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
- sal_Int32 nParams, typelib_MethodParameter * pParams,
+ const typelib_TypeDescription * pMemberTD,
+ typelib_TypeDescriptionReference * pReturnTypeRef, // nullptr indicates void return
+ sal_Int32 nParams,
+ typelib_MethodParameter * pParams,
void ** pCallStack,
- sal_Int64 * pRegisterReturn /* space for register return */ )
+ sal_Int64 * pRegisterReturn /* space for register return */)
{
// pCallStack: ret, this, [complex return ptr], params
- char * pCppStack = (char *)(pCallStack +2);
+ char * pCppCallStack = (char *)(pCallStack +2);
- // return
- typelib_TypeDescription * pReturnTypeDescr = 0;
+ // return type
+ typelib_TypeDescription * pReturnTD = nullptr;
if (pReturnTypeRef)
- {
- TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- }
+ TYPELIB_DANGER_GET(&pReturnTD, pReturnTypeRef);
void * pUnoReturn = nullptr;
- void * pCppReturn = nullptr; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
+ void * pCppReturn = nullptr; // complex return ptr: if != nullptr && != pUnoReturn, reconversion need
- if (pReturnTypeDescr)
+ if (pReturnTD)
{
- if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
- {
- pUnoReturn = pRegisterReturn; // direct way for simple types
- }
- else // complex return via ptr (pCppReturn)
+ if (bridges::cpp_uno::shared::isSimpleType(pReturnTD))
+ pUnoReturn = pRegisterReturn;
+ else
{
- pCppReturn = *(void **)pCppStack;
- pCppStack += sizeof(void *);
+ pCppReturn = *(void **)pCppCallStack;
+ pCppCallStack += sizeof(void *);
- pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(
- pReturnTypeDescr )
- ? alloca( pReturnTypeDescr->nSize )
- : pCppReturn); // direct way
+ pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(pReturnTD)
+ ? alloca(pReturnTD->nSize) : pCppReturn);
}
}
- // stack space
static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
- // parameters
- void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
+
+ // parameters passed to the UNO function
+ void ** pUnoArgs = static_cast<void **>(alloca(4 * sizeof(void *) * nParams));
+
+ // parameters received from C++
void ** pCppArgs = pUnoArgs + nParams;
- // indices of values this have to be converted (interface conversion cpp<=>uno)
- sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+
+ // indexes of values this have to be converted (interface conversion C++<=>UNO)
+ sal_Int32 * pTempIndexes = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams));
+
// type descriptions for reconversions
- typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
+ typelib_TypeDescription ** ppTempParamTD =
+ reinterpret_cast<typelib_TypeDescription **>(pUnoArgs + (3 * nParams));
- sal_Int32 nTempIndices = 0;
+ sal_Int32 nTempIndex = 0;
- for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
+ for (sal_Int32 nPos = 0; nPos < nParams; ++nPos)
{
const typelib_MethodParameter & rParam = pParams[nPos];
- typelib_TypeDescription * pParamTypeDescr = 0;
- TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
+ typelib_TypeDescription * pParamTD = nullptr;
+ TYPELIB_DANGER_GET(&pParamTD, rParam.pTypeRef);
- if (!rParam.bOut
- && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
- // value
+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTD))
{
- pCppArgs[nPos] = pCppStack;
- pUnoArgs[nPos] = pCppStack;
- switch (pParamTypeDescr->eTypeClass)
+ pCppArgs[nPos] = pCppCallStack;
+ pUnoArgs[nPos] = pCppCallStack;
+ switch (pParamTD->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
case typelib_TypeClass_DOUBLE:
- pCppStack += sizeof(sal_Int32); // extra long
+ pCppCallStack += sizeof(sal_Int32); // extra long
break;
default:
break;
}
// no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
else // ptr to complex value | ref
{
- pCppArgs[nPos] = *(void **)pCppStack;
+ pCppArgs[nPos] = *(void **)pCppCallStack;
- if (! rParam.bIn) // is pure out
+ if (!rParam.bIn) // is pure out
{
- // uno out is unconstructed mem!
- pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
- pTempIndices[nTempIndices] = nPos;
- // will be released at reconversion
- ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
+ // UNO out is unconstructed mem
+ pUnoArgs[nPos] = alloca(pParamTD->nSize);
+ pTempIndexes[nTempIndex] = nPos;
+ // pParamTD will be released at reconversion
+ ppTempParamTD[nTempIndex++] = pParamTD;
}
// is in/inout
- else if (bridges::cpp_uno::shared::relatesToInterfaceType(
- pParamTypeDescr ))
+ else if (bridges::cpp_uno::shared::relatesToInterfaceType(pParamTD))
{
::uno_copyAndConvertData(
- pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
- *(void **)pCppStack, pParamTypeDescr,
- pThis->getBridge()->getCpp2Uno() );
- pTempIndices[nTempIndices] = nPos; // has to be reconverted
- // will be released at reconversion
- ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
+ pUnoArgs[nPos] = alloca(pParamTD->nSize),
+ *(void **)pCppCallStack, pParamTD,
+ pThis->getBridge()->getCpp2Uno());
+ pTempIndexes[nTempIndex] = nPos; // has to be reconverted
+ // pParamTD will be released at reconversion
+ ppTempParamTD[nTempIndex++] = pParamTD;
}
else // direct way
{
- pUnoArgs[nPos] = *(void **)pCppStack;
+ pUnoArgs[nPos] = *(void **)pCppCallStack;
// no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
}
- pCppStack += sizeof(sal_Int32); // standard parameter length
+ pCppCallStack += sizeof(sal_Int32); // standard parameter length
}
// ExceptionHolder
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
- // invoke uno dispatch call
+ // invoke UNO dispatch call
(*pThis->getUnoI()->pDispatcher)(
- pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
+ pThis->getUnoI(), pMemberTD, pUnoReturn, pUnoArgs, &pUnoExc);
// in case an exception occurred...
if (pUnoExc)
{
// destruct temporary in/inout params
- while (nTempIndices--)
+ while (nTempIndex--)
{
- sal_Int32 nIndex = pTempIndices[nTempIndices];
+ sal_Int32 nIndex = pTempIndexes[nTempIndex];
if (pParams[nIndex].bIn) // is in/inout => was constructed
- {
- ::uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
- }
- TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
- }
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+ ::uno_destructData(pUnoArgs[nIndex], ppTempParamTD[nTempIndex], nullptr);
+ TYPELIB_DANGER_RELEASE(ppTempParamTD[nTempIndex]);
}
+ if (pReturnTD)
+ TYPELIB_DANGER_RELEASE(pReturnTD);
CPPU_CURRENT_NAMESPACE::msci_raiseException(
- &aUnoExc, pThis->getBridge()->getUno2Cpp() );
- // has to destruct the any
+ &aUnoExc, pThis->getBridge()->getUno2Cpp()); // has to destruct the any
+
// is here for dummy
return typelib_TypeClass_VOID;
}
- else // else no exception occurred...
+ else // no exception occurred...
{
// temporary params
- while (nTempIndices--)
+ while (nTempIndex--)
{
- sal_Int32 nIndex = pTempIndices[nTempIndices];
- typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
+ sal_Int32 nIndex = pTempIndexes[nTempIndex];
+ typelib_TypeDescription * pParamTD = ppTempParamTD[nTempIndex];
if (pParams[nIndex].bOut) // inout/out
{
// convert and assign
- ::uno_destructData(
- pCppArgs[nIndex], pParamTypeDescr, cpp_release );
+ ::uno_destructData(pCppArgs[nIndex], pParamTD, uno::cpp_release);
::uno_copyAndConvertData(
- pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
- pThis->getBridge()->getUno2Cpp() );
+ pCppArgs[nIndex], pUnoArgs[nIndex], pParamTD,
+ pThis->getBridge()->getUno2Cpp());
}
- // destroy temp uno param
- ::uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
+ // destroy temp UNO param
+ ::uno_destructData(pUnoArgs[nIndex], pParamTD, nullptr);
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
+
// return
if (pCppReturn) // has complex return
{
if (pUnoReturn != pCppReturn) // needs reconversion
{
::uno_copyAndConvertData(
- pCppReturn, pUnoReturn, pReturnTypeDescr,
- pThis->getBridge()->getUno2Cpp() );
- // destroy temp uno return
- ::uno_destructData(
- pUnoReturn, pReturnTypeDescr, 0 );
+ pCppReturn, pUnoReturn, pReturnTD,
+ pThis->getBridge()->getUno2Cpp());
+ // destroy temp UNO return
+ ::uno_destructData(pUnoReturn, pReturnTD, nullptr);
}
// complex return ptr is set to eax
*(void **)pRegisterReturn = pCppReturn;
}
- if (pReturnTypeDescr)
+
+ if (pReturnTD)
{
- typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+ typelib_TypeClass eRet = pReturnTD->eTypeClass;
+ TYPELIB_DANGER_RELEASE(pReturnTD);
return eRet;
}
else
@@ -229,132 +222,134 @@ static inline typelib_TypeClass cpp2uno_call(
}
static typelib_TypeClass __cdecl cpp_mediate(
- void ** pCallStack, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
- sal_Int64 * pRegisterReturn /* space for register return */ )
+ void ** pCallStack,
+ sal_Int32 nFunctionIndex,
+ sal_Int32 nVtableOffset,
+ sal_Int64 * pRegisterReturn) // space for register return
{
static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!");
// pCallStack: ret adr, this, [ret *], params
- void * pThis = static_cast< char * >(pCallStack[1]) - nVtableOffset;
- bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
- = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
- pThis);
+ // pRegisterReturn is either the direct "return value", or is set to
+ // "ret *" and the real return value is constructed at that pointer.
+
+ void* pThis = static_cast<char*>(pCallStack[1]) - nVtableOffset;
+ bridges::cpp_uno::shared::CppInterfaceProxy* pCppI
+ = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(pThis);
- typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
+ typelib_InterfaceTypeDescription * pInterfaceTD = pCppI->getTypeDescr();
- SAL_INFO( "bridges.win32", "cpp_vtable_call: pCallStack=[" <<
- std::hex << pCallStack[0] << "," << pCallStack[1] << "," << pCallStack[2] << ",...]" <<
- ", pThis=" << pThis << ", pCppI=" << pCppI <<
- std::dec << ", nFunctionIndex=" << nFunctionIndex << ", nVtableOffset=" << nVtableOffset );
- SAL_INFO( "bridges.win32", "name=" << OUString::unacquired(&pTypeDescr->aBase.pTypeName) );
+ SAL_INFO("bridges", "cpp_vtable_call: pCallStack=["
+ << std::hex << pCallStack[0] << "," << pCallStack[1] << ","
+ << pCallStack[2] << ",...], pThis=" << pThis << ", pCppI=" << pCppI
+ << std::dec << ", nFunctionIndex=" << nFunctionIndex
+ << ", nVtableOffset=" << nVtableOffset);
+ SAL_INFO("bridges", "name=" << OUString::unacquired(&pInterfaceTD->aBase.pTypeName));
- if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
+ if (nFunctionIndex >= pInterfaceTD->nMapFunctionIndexToMemberIndex)
{
- SAL_WARN(
- "bridges",
- "illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
- << " vtable index " << nFunctionIndex << "/"
- << pTypeDescr->nMapFunctionIndexToMemberIndex);
- throw RuntimeException(
- ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
- + " vtable index " + OUString::number(nFunctionIndex) + "/"
- + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
- (XInterface *)pThis );
+ OUString sError = "illegal " + OUString::unacquired(&pInterfaceTD->aBase.pTypeName)
+ + " vtable index " + OUString::number(nFunctionIndex) + "/"
+ + OUString::number(pInterfaceTD->nMapFunctionIndexToMemberIndex);
+ SAL_WARN("bridges", sError);
+ throw uno::RuntimeException(sError, reinterpret_cast<uno::XInterface*>(pThis));
}
// determine called method
- sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
- assert(nMemberPos < pTypeDescr->nAllMembers);
+ sal_Int32 nMemberPos = pInterfaceTD->pMapFunctionIndexToMemberIndex[nFunctionIndex];
+ assert(nMemberPos < pInterfaceTD->nAllMembers);
- TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
+ uno::TypeDescription aMemberDescr(pInterfaceTD->ppAllMembers[nMemberPos]);
- SAL_INFO( "bridges.win32", "Calling " << OUString::unacquired(&aMemberDescr.get()->pTypeName) );
+ SAL_INFO( "bridges", "Calling " << OUString::unacquired(&aMemberDescr.get()->pTypeName) );
typelib_TypeClass eRet = typelib_TypeClass_VOID;
switch (aMemberDescr.get()->eTypeClass)
{
- case typelib_TypeClass_INTERFACE_ATTRIBUTE:
- {
- if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
- {
- // is GET method
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
- 0, 0, // no params
- pCallStack, pRegisterReturn );
- }
- else
- {
- // is SET method
- typelib_MethodParameter aParam;
- aParam.pTypeRef =
- ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
- aParam.bIn = sal_True;
- aParam.bOut = sal_False;
-
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- 0, // indicates void return
- 1, &aParam,
- pCallStack, pRegisterReturn );
- }
- break;
- }
- case typelib_TypeClass_INTERFACE_METHOD:
- {
- // is METHOD
- switch (nFunctionIndex)
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
- // standard XInterface vtable calls
- case 1: // acquire()
- pCppI->acquireProxy(); // non virtual call!
- eRet = typelib_TypeClass_VOID;
- break;
- case 2: // release()
- pCppI->releaseProxy(); // non virtual call!
- eRet = typelib_TypeClass_VOID;
+ typelib_TypeDescriptionReference *pAttrTypeRef
+ = reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>(aMemberDescr.get())
+ ->pAttributeTypeRef;
+
+ if (pInterfaceTD->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
+ {
+ // is GET method
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), pAttrTypeRef, 0, nullptr, pCallStack,
+ pRegisterReturn);
+ }
+ else
+ {
+ // is SET method
+ typelib_MethodParameter aParam;
+ aParam.pTypeRef = pAttrTypeRef;
+ aParam.bIn = true;
+ aParam.bOut = false;
+
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), nullptr, 1, &aParam, pCallStack,
+ pRegisterReturn);
+ }
break;
- case 0: // queryInterface() opt
+ }
+ case typelib_TypeClass_INTERFACE_METHOD:
{
- typelib_TypeDescription * pTD = 0;
- TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pCallStack[3] )->getTypeLibType() );
- if (pTD)
+ // is METHOD
+ switch (nFunctionIndex)
{
- XInterface * pInterface = 0;
- (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
- pCppI->getBridge()->getCppEnv(),
- (void **)&pInterface, pCppI->getOid().pData,
- (typelib_InterfaceTypeDescription *)pTD );
-
- if (pInterface)
- {
- ::uno_any_construct(
- reinterpret_cast< uno_Any * >( pCallStack[2] ),
- &pInterface, pTD, cpp_acquire );
- pInterface->release();
- TYPELIB_DANGER_RELEASE( pTD );
- *(void **)pRegisterReturn = pCallStack[2];
- eRet = typelib_TypeClass_ANY;
+ // standard XInterface vtable calls
+ case 1: // acquire()
+ pCppI->acquireProxy(); // non virtual call!
+ eRet = typelib_TypeClass_VOID;
+ break;
+ case 2: // release()
+ pCppI->releaseProxy(); // non virtual call!
+ eRet = typelib_TypeClass_VOID;
break;
+ case 0: // queryInterface() opt
+ {
+ typelib_TypeDescription* pQueryTD = nullptr;
+ TYPELIB_DANGER_GET(&pQueryTD,
+ static_cast<uno::Type*>(pCallStack[3])->getTypeLibType());
+ if (pQueryTD)
+ {
+ uno::XInterface* pInterface = nullptr;
+
+ pCppI->getBridge()->getCppEnv()->getRegisteredInterface(
+ pCppI->getBridge()->getCppEnv(), reinterpret_cast<void**>(&pInterface),
+ pCppI->getOid().pData,
+ reinterpret_cast<typelib_InterfaceTypeDescription*>(pQueryTD));
+
+ if (pInterface)
+ {
+ ::uno_any_construct(static_cast<uno_Any*>(pCallStack[2]), &pInterface,
+ pQueryTD, uno::cpp_acquire);
+ pInterface->release();
+ TYPELIB_DANGER_RELEASE(pQueryTD);
+
+ *(void **)pRegisterReturn = pCallStack[2];
+ eRet = typelib_TypeClass_ANY;
+ break;
+ }
+ TYPELIB_DANGER_RELEASE(pQueryTD);
+ }
+ [[fallthrough]];
+ }
+ default: // perform queryInterface()
+ {
+ typelib_InterfaceMethodTypeDescription* pMethodTD
+ = reinterpret_cast<typelib_InterfaceMethodTypeDescription*>(
+ aMemberDescr.get());
+
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), pMethodTD->pReturnTypeRef,
+ pMethodTD->nParams, pMethodTD->pParams, pCallStack,
+ pRegisterReturn);
}
- TYPELIB_DANGER_RELEASE( pTD );
}
- } // else perform queryInterface()
- default:
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
- pCallStack, pRegisterReturn );
+ break;
}
- break;
- }
- default:
- {
- throw RuntimeException( "no member description found!", (XInterface *)pThis );
- }
+ default:
+ throw uno::RuntimeException("no member description found!",
+ reinterpret_cast<uno::XInterface*>(pThis));
}
return eRet;
@@ -457,7 +452,7 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock(
Rtti():
n0(0), n1(0), n2(0),
rtti(CPPU_CURRENT_NAMESPACE::msci_getRTTI(
- OUString("com.sun.star.uno.XInterface")))
+ "com.sun.star.uno.XInterface"))
{}
};
static Rtti rtti;
@@ -482,7 +477,9 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
}
void bridges::cpp_uno::shared::VtableFactory::flushCode(
- unsigned char const *, unsigned char const *)
-{}
+ unsigned char const *,
+ unsigned char const *)
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx
index 7c05112c41bf..bd7e5046d209 100644
--- a/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx
@@ -23,19 +23,19 @@
#include <com/sun/star/uno/genfunc.hxx>
#include <uno/data.h>
-#include "bridge.hxx"
-#include "types.hxx"
-#include "unointerfaceproxy.hxx"
-#include "vtables.hxx"
+#include <bridge.hxx>
+#include <types.hxx>
+#include <unointerfaceproxy.hxx>
+#include <vtables.hxx>
#include "msci.hxx"
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
namespace
{
-inline static void callVirtualMethod(
+inline void callVirtualMethod(
void * pAdjustedThisPtr, sal_Int32 nVtableIndex,
void * pRegisterReturn, typelib_TypeClass eReturnTypeClass,
sal_Int32 * pStackLongs, sal_Int32 nStackLongs )
@@ -134,27 +134,30 @@ Lcleanup:
}
}
-static void cpp_call(
+void cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
typelib_TypeDescriptionReference * pReturnTypeRef,
- sal_Int32 nParams, typelib_MethodParameter * pParams,
- void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc ) throw ()
+ sal_Int32 nParams,
+ typelib_MethodParameter * pParams,
+ void * pUnoReturn,
+ void * pUnoArgs[],
+ uno_Any ** ppUnoExc ) throw ()
{
// max space for: [complex ret ptr], values|ptr ...
char * pCppStack = (char *)alloca( sizeof(sal_Int32) + (nParams * sizeof(sal_Int64)) );
char * pCppStackStart = pCppStack;
- // return
- typelib_TypeDescription * pReturnTypeDescr = 0;
- TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- assert(pReturnTypeDescr);
+ // return type
+ typelib_TypeDescription * pReturnTD = nullptr;
+ TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
+ assert(pReturnTD);
void * pCppReturn = nullptr; // if != 0 && != pUnoReturn, needs reconversion
- if (pReturnTypeDescr)
+ if (pReturnTD)
{
- if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
+ if (bridges::cpp_uno::shared::isSimpleType( pReturnTD ))
{
pCppReturn = pUnoReturn; // direct way for simple types
}
@@ -163,8 +166,8 @@ static void cpp_call(
// complex return via ptr
pCppReturn = *(void **)pCppStack
= (bridges::cpp_uno::shared::relatesToInterfaceType(
- pReturnTypeDescr )
- ? alloca( pReturnTypeDescr->nSize )
+ pReturnTD )
+ ? alloca( pReturnTD->nSize )
: pUnoReturn); // direct way
pCppStack += sizeof(void *);
}
@@ -176,26 +179,25 @@ static void cpp_call(
// args
void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
// indices of values this have to be converted (interface conversion cpp<=>uno)
- sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
+ sal_Int32 * pTempIndexes = (sal_Int32 *)(pCppArgs + nParams);
// type descriptions for reconversions
- typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
+ typelib_TypeDescription ** pTempParamTD = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
- sal_Int32 nTempIndices = 0;
+ sal_Int32 nTempIndexes = 0;
- for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
+ for (int nPos = 0; nPos < nParams; ++nPos)
{
const typelib_MethodParameter & rParam = pParams[nPos];
- typelib_TypeDescription * pParamTypeDescr = 0;
- TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
+ typelib_TypeDescription * pParamTD = nullptr;
+ TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
- if (!rParam.bOut
- && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTD))
{
::uno_copyAndConvertData(
- pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
+ pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
- switch (pParamTypeDescr->eTypeClass)
+ switch (pParamTD->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
@@ -206,38 +208,42 @@ static void cpp_call(
break;
}
// no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
else // ptr to complex value | ref
{
if (! rParam.bIn) // is pure out
{
- // cpp out is constructed mem, uno out is not!
+ // C++ out is constructed mem, UNO out is not!
::uno_constructData(
- *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
- pParamTypeDescr );
- pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
+ *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTD->nSize ),
+ pParamTD );
+
+ // default constructed for C++ call
+ pTempIndexes[nTempIndexes] = nPos;
+
// will be released at reconversion
- ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
+ pTempParamTD[nTempIndexes++] = pParamTD;
}
// is in/inout
- else if (bridges::cpp_uno::shared::relatesToInterfaceType(
- pParamTypeDescr ))
+ else if (bridges::cpp_uno::shared::relatesToInterfaceType(pParamTD))
{
::uno_copyAndConvertData(
- *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
- pUnoArgs[nPos], pParamTypeDescr,
+ *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTD->nSize ),
+ pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
- pTempIndices[nTempIndices] = nPos; // has to be reconverted
+ // has to be reconverted
+ pTempIndexes[nTempIndexes] = nPos;
+
// will be released at reconversion
- ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
+ pTempParamTD[nTempIndexes++] = pParamTD;
}
else // direct way
{
*(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
// no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
}
pCppStack += sizeof(sal_Int32); // standard parameter length
@@ -249,7 +255,7 @@ static void cpp_call(
callVirtualMethod(
reinterpret_cast< void ** >(pThis->getCppI()) + aVtableSlot.offset,
aVtableSlot.index,
- pCppReturn, pReturnTypeDescr->eTypeClass,
+ pCppReturn, pReturnTD->eTypeClass,
(sal_Int32 *)pCppStackStart,
(pCppStack - pCppStackStart) / sizeof(sal_Int32) );
}
@@ -259,86 +265,89 @@ static void cpp_call(
{
// *ppUnoExc was constructed by filter function
// temporary params
- while (nTempIndices--)
+ while (nTempIndexes--)
{
- sal_Int32 nIndex = pTempIndices[nTempIndices];
- // destroy temp cpp param => cpp: every param was constructed
+ sal_Int32 nIndex = pTempIndexes[nTempIndexes];
+ // destroy temp C++ param => C++: every param was constructed
::uno_destructData(
- pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices],
- cpp_release );
- TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
+ pCppArgs[nIndex], pTempParamTD[nTempIndexes],
+ uno::cpp_release );
+ TYPELIB_DANGER_RELEASE( pTempParamTD[nTempIndexes] );
}
+
// return type
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
- }
- // end here
+ if (pReturnTD)
+ TYPELIB_DANGER_RELEASE( pReturnTD );
+
return;
}
// NO exception occurred
- *ppUnoExc = 0;
+ *ppUnoExc = nullptr;
// reconvert temporary params
- while (nTempIndices--)
+ while (nTempIndexes--)
{
- sal_Int32 nIndex = pTempIndices[nTempIndices];
- typelib_TypeDescription * pParamTypeDescr =
- ppTempParamTypeDescr[nTempIndices];
+ int nIndex = pTempIndexes[nTempIndexes];
+ typelib_TypeDescription * pParamTD =
+ pTempParamTD[nTempIndexes];
if (pParams[nIndex].bIn)
{
if (pParams[nIndex].bOut) // inout
{
::uno_destructData(
- pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
+ pUnoArgs[nIndex], pParamTD, nullptr ); // destroy UNO value
::uno_copyAndConvertData(
- pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
+ pUnoArgs[nIndex], pCppArgs[nIndex], pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
}
else // pure out
{
::uno_copyAndConvertData(
- pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
+ pUnoArgs[nIndex], pCppArgs[nIndex], pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
- // destroy temp cpp param => cpp: every param was constructed
+
+ // destroy temp C++ param => C++: every param was constructed
::uno_destructData(
- pCppArgs[nIndex], pParamTypeDescr, cpp_release );
+ pCppArgs[nIndex], pParamTD, uno::cpp_release );
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
+
// return value
if (pCppReturn && pUnoReturn != pCppReturn)
{
::uno_copyAndConvertData(
- pUnoReturn, pCppReturn, pReturnTypeDescr,
+ pUnoReturn, pCppReturn, pReturnTD,
pThis->getBridge()->getCpp2Uno() );
::uno_destructData(
- pCppReturn, pReturnTypeDescr, cpp_release );
+ pCppReturn, pReturnTD, uno::cpp_release );
}
+
// return type
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
- }
+ if ( pReturnTD )
+ TYPELIB_DANGER_RELEASE( pReturnTD );
}
-}
+} // namespace
namespace bridges::cpp_uno::shared {
void unoInterfaceProxyDispatch(
- uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
- void * pReturn, void * pArgs[], uno_Any ** ppException )
+ uno_Interface * pUnoI,
+ const typelib_TypeDescription * pMemberTD,
+ void * pReturn,
+ void * pArgs[],
+ uno_Any ** ppException )
{
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
- switch (pMemberDescr->eTypeClass)
+ switch (pMemberTD->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
@@ -346,14 +355,14 @@ void unoInterfaceProxyDispatch(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceAttributeTypeDescription const * >(
- pMemberDescr)));
- if (pReturn)
+ pMemberTD)));
+ if ( pReturn )
{
- // dependent dispatch
+ // is GET
cpp_call(
pThis, aVtableSlot,
- ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
- 0, 0, // no params
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef,
+ 0, nullptr, // no params
pReturn, pArgs, ppException );
}
else
@@ -361,16 +370,15 @@ void unoInterfaceProxyDispatch(
// is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
- ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
- typelib_TypeDescriptionReference * pReturnTypeRef = 0;
+ typelib_TypeDescriptionReference * pReturnTypeRef = nullptr;
OUString aVoidName("void");
typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
- // dependent dispatch
aVtableSlot.index += 1; // get, then set method
cpp_call(
pThis, aVtableSlot,
@@ -389,62 +397,60 @@ void unoInterfaceProxyDispatch(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription const * >(
- pMemberDescr)));
+ pMemberTD)));
+
switch (aVtableSlot.index)
{
- // standard calls
- case 1: // acquire uno interface
+ case 1: // acquire UNO interface
(*pUnoI->acquire)( pUnoI );
- *ppException = 0;
+ *ppException = nullptr;
break;
- case 2: // release uno interface
+ case 2: // release UNO interface
(*pUnoI->release)( pUnoI );
- *ppException = 0;
+ *ppException = nullptr;
break;
case 0: // queryInterface() opt
{
- typelib_TypeDescription * pTD = 0;
- TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
- if (pTD)
+ typelib_TypeDescription * pTD = nullptr;
+ TYPELIB_DANGER_GET( &pTD, static_cast< uno::Type * >( pArgs[0] )->getTypeLibType() );
+
+ if ( pTD )
{
- uno_Interface * pInterface = 0;
- (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
- pThis->pBridge->getUnoEnv(),
- (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
+ uno_Interface * pInterface = nullptr;
+ (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
+ pThis->getBridge()->getUnoEnv(),
+ reinterpret_cast<void **>(&pInterface), pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
- if (pInterface)
+ if ( pInterface )
{
::uno_any_construct(
- reinterpret_cast< uno_Any * >( pReturn ),
- &pInterface, pTD, 0 );
+ static_cast< uno_Any * >( pReturn ),
+ &pInterface, pTD, nullptr );
(*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD );
- *ppException = 0;
+ *ppException = nullptr;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
- } // else perform queryInterface()
+ [[fallthrough]]; // else perform queryInterface()
+ }
default:
- // dependent dispatch
- cpp_call(
- pThis, aVtableSlot,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
- pReturn, pArgs, ppException );
+ typelib_InterfaceMethodTypeDescription const* pMethodTD
+ = reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD);
+
+ cpp_call(pThis, aVtableSlot, pMethodTD->pReturnTypeRef, pMethodTD->nParams, pMethodTD->pParams,
+ pReturn, pArgs, ppException);
}
break;
}
default:
{
- ::com::sun::star::uno::RuntimeException aExc(
- "illegal member type description!",
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
+ uno::RuntimeException aExc("Illegal member type description!", uno::Reference<uno::XInterface>());
- Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
+ uno::Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
// binary identical null reference
- ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
+ ::uno_type_any_construct(*ppException, &aExc, rExcType.getTypeLibType(), nullptr);
}
}
}
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
index d8b2220fc94c..a229db4c2ffe 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
@@ -33,108 +33,100 @@
#include "call.hxx"
#include "mscx.hxx"
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
static typelib_TypeClass cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
const typelib_TypeDescription * pMemberTD,
- typelib_TypeDescriptionReference * pReturnTypeRef, // NULL indicates void return
+ typelib_TypeDescriptionReference * pReturnTypeRef, // nullptr indicates void return
sal_Int32 nParams,
typelib_MethodParameter * pParams,
- void ** pStack )
+ void ** pCallStack)
{
- // Return type
+ // return type
typelib_TypeDescription * pReturnTD = nullptr;
- if ( pReturnTypeRef )
- TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
+ if (pReturnTypeRef)
+ TYPELIB_DANGER_GET(&pReturnTD, pReturnTypeRef);
- int nFirstRealParam = 3; // Index into pStack, past return
+ int nFirstRealParam = 3; // Index into pCallStack, past return
// value, return address and 'this'
// pointer.
void * pUnoReturn = nullptr;
- void * pCppReturn = nullptr; // Complex return ptr: if != NULL && != pUnoReturn, reconversion need
+ void * pCppReturn = nullptr; // complex return ptr: if != nullptr && != pUnoReturn, reconversion need
- if ( pReturnTD )
+ if (pReturnTD)
{
- if ( bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
- {
- pUnoReturn = pStack;
- }
+ if (bridges::cpp_uno::shared::isSimpleType(pReturnTD))
+ pUnoReturn = pCallStack;
else
{
- pCppReturn = pStack[nFirstRealParam++];
-
- pUnoReturn = ( bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTD )
- ? alloca( pReturnTD->nSize )
- : pCppReturn ); // direct way
+ pCppReturn = pCallStack[nFirstRealParam++];
+ pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(pReturnTD)
+ ? alloca(pReturnTD->nSize) : pCppReturn);
}
}
- void ** pCppIncomingParams = pStack + nFirstRealParam;
+ void ** pCppIncomingParams = pCallStack + nFirstRealParam;
// Unlike this method for other archs, prefer clarity to
// micro-optimization, and allocate these array separately
- // Parameters passed to the UNO function
- void ** pUnoArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
+ // parameters passed to the UNO function
+ void ** pUnoArgs = static_cast<void **>(alloca(sizeof(void *) * nParams));
- // Parameters received from C++
- void ** pCppArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
+ // parameters received from C++
+ void ** pCppArgs = static_cast<void **>(alloca(sizeof(void *) * nParams));
- // Indexes of values this have to be converted (interface conversion C++<=>UNO)
- int * pTempIndexes =
- static_cast<int *>(alloca( sizeof(int) * nParams ));
+ // indexes of values this have to be converted (interface conversion C++<=>UNO)
+ sal_Int32 * pTempIndexes = static_cast<sal_Int32 *>(alloca(sizeof(sal_Int32) * nParams));
- // Type descriptions for reconversions
+ // type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTD =
- static_cast<typelib_TypeDescription **>(alloca( sizeof(void *) * nParams ));
+ static_cast<typelib_TypeDescription **>(alloca(sizeof(void *) * nParams));
- int nTempIndexes = 0;
+ sal_Int32 nTempIndex = 0;
- for ( int nPos = 0; nPos < nParams; ++nPos )
+ for (sal_Int32 nPos = 0; nPos < nParams; ++nPos)
{
const typelib_MethodParameter & rParam = pParams[nPos];
-
typelib_TypeDescription * pParamTD = nullptr;
- TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
+ TYPELIB_DANGER_GET(&pParamTD, rParam.pTypeRef);
- if ( !rParam.bOut &&
- bridges::cpp_uno::shared::isSimpleType( pParamTD ) )
+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTD))
{
pCppArgs[nPos] = pUnoArgs[nPos] = pCppIncomingParams++;
-
- TYPELIB_DANGER_RELEASE( pParamTD );
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
else // ptr to complex value | ref
{
- void * pCppStack;
+ void * pCppCallStack;
- pCppArgs[nPos] = pCppStack = *pCppIncomingParams++;
+ pCppArgs[nPos] = pCppCallStack = *pCppIncomingParams++;
- if ( !rParam.bIn ) // Pure out
+ if (!rParam.bIn) // is pure out
{
// UNO out is unconstructed mem
- pUnoArgs[nPos] = alloca( pParamTD->nSize );
- pTempIndexes[nTempIndexes] = nPos;
+ pUnoArgs[nPos] = alloca(pParamTD->nSize);
+ pTempIndexes[nTempIndex] = nPos;
// pParamTD will be released at reconversion
- ppTempParamTD[nTempIndexes++] = pParamTD;
+ ppTempParamTD[nTempIndex++] = pParamTD;
}
- else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTD ) )
+ else if (bridges::cpp_uno::shared::relatesToInterfaceType(pParamTD))
{
::uno_copyAndConvertData(
- pUnoArgs[nPos] = alloca( pParamTD->nSize ),
- pCppStack, pParamTD,
- pThis->getBridge()->getCpp2Uno() );
- pTempIndexes[nTempIndexes] = nPos; // Has to be reconverted
+ pUnoArgs[nPos] = alloca(pParamTD->nSize),
+ pCppCallStack, pParamTD,
+ pThis->getBridge()->getCpp2Uno());
+ pTempIndexes[nTempIndex] = nPos; // has to be reconverted
// pParamTD will be released at reconversion
- ppTempParamTD[nTempIndexes++] = pParamTD;
+ ppTempParamTD[nTempIndex++] = pParamTD;
}
else // direct way
{
- pUnoArgs[nPos] = pCppStack;
- // No longer needed
- TYPELIB_DANGER_RELEASE( pParamTD );
+ pUnoArgs[nPos] = pCppCallStack;
+ // no longer needed
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
}
}
@@ -145,71 +137,70 @@ static typelib_TypeClass cpp2uno_call(
// invoke UNO dispatch call
(*pThis->getUnoI()->pDispatcher)(
- pThis->getUnoI(), pMemberTD, pUnoReturn, pUnoArgs, &pUnoExc );
+ pThis->getUnoI(), pMemberTD, pUnoReturn, pUnoArgs, &pUnoExc);
// in case an exception occurred...
- if ( pUnoExc )
+ if (pUnoExc)
{
- // Destruct temporary in/inout params
- while ( nTempIndexes-- )
+ // destruct temporary in/inout params
+ while (nTempIndex--)
{
- int nIndex = pTempIndexes[nTempIndexes];
+ sal_Int32 nIndex = pTempIndexes[nTempIndex];
- if ( pParams[nIndex].bIn ) // Is in/inout => was constructed
- {
- ::uno_destructData( pUnoArgs[nIndex], ppTempParamTD[nTempIndexes], nullptr );
- }
- TYPELIB_DANGER_RELEASE( ppTempParamTD[nTempIndexes] );
+ if (pParams[nIndex].bIn) // is in/inout => was constructed
+ ::uno_destructData(pUnoArgs[nIndex], ppTempParamTD[nTempIndex], nullptr);
+ TYPELIB_DANGER_RELEASE(ppTempParamTD[nTempIndex]);
}
- if ( pReturnTD )
- TYPELIB_DANGER_RELEASE( pReturnTD );
+ if (pReturnTD)
+ TYPELIB_DANGER_RELEASE(pReturnTD);
CPPU_CURRENT_NAMESPACE::mscx_raiseException(
- &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // Has to destruct the any
+ &aUnoExc, pThis->getBridge()->getUno2Cpp()); // has to destruct the any
- // Is here for dummy
+ // is here for dummy
return typelib_TypeClass_VOID;
}
- else // Else, no exception occurred...
+ else // no exception occurred...
{
- // Temporary params
- while (nTempIndexes--)
+ // temporary params
+ while (nTempIndex--)
{
- int nIndex = pTempIndexes[nTempIndexes];
- typelib_TypeDescription * pParamTD = ppTempParamTD[nTempIndexes];
+ sal_Int32 nIndex = pTempIndexes[nTempIndex];
+ typelib_TypeDescription * pParamTD = ppTempParamTD[nTempIndex];
- if ( pParams[nIndex].bOut ) // inout/out
+ if (pParams[nIndex].bOut) // inout/out
{
- // Convert and assign
- ::uno_destructData(
- pCppArgs[nIndex], pParamTD, cpp_release );
+ // convert and assign
+ ::uno_destructData(pCppArgs[nIndex], pParamTD, uno::cpp_release);
::uno_copyAndConvertData(
pCppArgs[nIndex], pUnoArgs[nIndex], pParamTD,
- pThis->getBridge()->getUno2Cpp() );
+ pThis->getBridge()->getUno2Cpp());
}
- // Destroy temp UNO param
- ::uno_destructData( pUnoArgs[nIndex], pParamTD, nullptr );
+ // destroy temp UNO param
+ ::uno_destructData(pUnoArgs[nIndex], pParamTD, nullptr);
- TYPELIB_DANGER_RELEASE( pParamTD );
+ TYPELIB_DANGER_RELEASE(pParamTD);
}
- // Return
- if ( pCppReturn ) // Has complex return
+
+ // return
+ if (pCppReturn) // has complex return
{
- if ( pUnoReturn != pCppReturn ) // Needs reconversion
+ if (pUnoReturn != pCppReturn) // needs reconversion
{
::uno_copyAndConvertData(
pCppReturn, pUnoReturn, pReturnTD,
- pThis->getBridge()->getUno2Cpp() );
- // Destroy temp UNO return
- ::uno_destructData( pUnoReturn, pReturnTD, nullptr );
+ pThis->getBridge()->getUno2Cpp());
+ // destroy temp UNO return
+ ::uno_destructData(pUnoReturn, pReturnTD, nullptr);
}
- // Complex return ptr is set to eax
- pStack[0] = pCppReturn;
+ // complex return ptr is set to eax
+ pCallStack[0] = pCppReturn;
}
- if ( pReturnTD )
+
+ if (pReturnTD)
{
typelib_TypeClass eRet = pReturnTD->eTypeClass;
- TYPELIB_DANGER_RELEASE( pReturnTD );
+ TYPELIB_DANGER_RELEASE(pReturnTD);
return eRet;
}
else
@@ -219,93 +210,78 @@ static typelib_TypeClass cpp2uno_call(
extern "C" typelib_TypeClass cpp_vtable_call(
sal_Int64 nOffsetAndIndex,
- void ** pStack )
+ void ** pCallStack)
{
sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
sal_Int32 nVtableOffset = ((nOffsetAndIndex >> 32) & 0xFFFFFFFF);
- // pStack points to space for return value allocated by
- // privateSnippetExecutor() in call.asm, after which follows our
- // return address (uninteresting), then the integer or
- // floating-point register parameters (spilled by
- // privateSnippetExecutor()) from the call to the trampoline,
- // followed by stacked parameters. The first parameter is the
- // 'this' pointer. If the callee returns a large value, the
- // parameter after that is actually a pointer to where the callee
- // should store its return value.
-
- void * pThis = static_cast<char *>( pStack[2] ) - nVtableOffset;
+ // pCallStack: ret value, ret adr, this, [ret *], params
+ // pCallStack[0] is either the direct "return value", or is set to "ret *" and
+ // the real return value is constructed at that memory.
- bridges::cpp_uno::shared::CppInterfaceProxy * pCppI =
- bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( pThis );
+ void* pThis = static_cast<char*>(pCallStack[2]) - nVtableOffset;
+ bridges::cpp_uno::shared::CppInterfaceProxy* pCppI
+ = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(pThis);
- typelib_InterfaceTypeDescription * pTD = pCppI->getTypeDescr();
+ typelib_InterfaceTypeDescription * pInterfaceTD = pCppI->getTypeDescr();
- SAL_INFO( "bridges", "cpp_vtable_call: pCallStack=[" <<
- std::hex << pStack[0] << "," << pStack[1] << "," << pStack[2] << ",...], pThis=" <<
- pThis << ", pCppI=" << pCppI <<
- std::dec << ", nFunctionIndex=" << nFunctionIndex << ", nVtableOffset=" << nVtableOffset );
- SAL_INFO( "bridges", "name=" << OUString::unacquired(&pTD->aBase.pTypeName) );
+ SAL_INFO("bridges", "cpp_vtable_call: pCallStack=["
+ << std::hex << pCallStack[0] << "," << pCallStack[1] << ","
+ << pCallStack[2] << ",...], pThis=" << pThis << ", pCppI=" << pCppI
+ << std::dec << ", nFunctionIndex=" << nFunctionIndex
+ << ", nVtableOffset=" << nVtableOffset);
+ SAL_INFO("bridges", "name=" << OUString::unacquired(&pInterfaceTD->aBase.pTypeName));
- if ( nFunctionIndex >= pTD->nMapFunctionIndexToMemberIndex )
+ if (nFunctionIndex >= pInterfaceTD->nMapFunctionIndexToMemberIndex)
{
- SAL_WARN(
- "bridges",
- "illegal " << OUString::unacquired(&pTD->aBase.pTypeName)
- << " vtable index " << nFunctionIndex << "/"
- << pTD->nMapFunctionIndexToMemberIndex);
- throw RuntimeException(
- ("illegal " + OUString::unacquired(&pTD->aBase.pTypeName)
- + " vtable index " + OUString::number(nFunctionIndex) + "/"
- + OUString::number(pTD->nMapFunctionIndexToMemberIndex)),
- reinterpret_cast<XInterface *>( pCppI ) );
+ OUString sError = "illegal " + OUString::unacquired(&pInterfaceTD->aBase.pTypeName)
+ + " vtable index " + OUString::number(nFunctionIndex) + "/"
+ + OUString::number(pInterfaceTD->nMapFunctionIndexToMemberIndex);
+ SAL_WARN("bridges", sError);
+ throw uno::RuntimeException(sError, reinterpret_cast<uno::XInterface*>(pThis));
}
- // Determine called method
- int nMemberPos = pTD->pMapFunctionIndexToMemberIndex[nFunctionIndex];
- assert(nMemberPos < pTD->nAllMembers);
+ // determine called method
+ sal_Int32 nMemberPos = pInterfaceTD->pMapFunctionIndexToMemberIndex[nFunctionIndex];
+ assert(nMemberPos < pInterfaceTD->nAllMembers);
- TypeDescription aMemberDescr( pTD->ppAllMembers[nMemberPos] );
+ uno::TypeDescription aMemberDescr(pInterfaceTD->ppAllMembers[nMemberPos]);
SAL_INFO( "bridges", "Calling " << OUString::unacquired(&aMemberDescr.get()->pTypeName) );
- typelib_TypeClass eRet;
- switch ( aMemberDescr.get()->eTypeClass )
+ typelib_TypeClass eRet = typelib_TypeClass_VOID;
+ switch (aMemberDescr.get()->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
- typelib_TypeDescriptionReference *pAttrTypeRef =
- reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( aMemberDescr.get() )->pAttributeTypeRef;
+ typelib_TypeDescriptionReference *pAttrTypeRef
+ = reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>(aMemberDescr.get())
+ ->pAttributeTypeRef;
- if ( pTD->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex )
+ if (pInterfaceTD->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
{
// is GET method
- eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
- 0, nullptr, // No params
- pStack );
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), pAttrTypeRef, 0, nullptr, pCallStack);
}
else
{
// is SET method
typelib_MethodParameter aParam;
aParam.pTypeRef = pAttrTypeRef;
- aParam.bIn = true;
- aParam.bOut = false;
+ aParam.bIn = true;
+ aParam.bOut = false;
- eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
- nullptr, // Indicates void return
- 1, &aParam,
- pStack );
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), nullptr, 1, &aParam, pCallStack);
}
break;
}
case typelib_TypeClass_INTERFACE_METHOD:
{
// is METHOD
- switch ( nFunctionIndex )
+ switch (nFunctionIndex)
{
case 1: // acquire()
- pCppI->acquireProxy(); // Non virtual call!
+ pCppI->acquireProxy(); // non virtual call!
eRet = typelib_TypeClass_VOID;
break;
case 2: // release()
@@ -314,60 +290,51 @@ extern "C" typelib_TypeClass cpp_vtable_call(
break;
case 0: // queryInterface() opt
{
- typelib_TypeDescription * pTD2 = nullptr;
+ typelib_TypeDescription* pQueryTD = nullptr;
- // the incoming C++ parameters are: The this
- // pointer, the hidden return value pointer, and
- // then the actual queryInterface() only
- // parameter. Thus pStack[4]..
+ TYPELIB_DANGER_GET(&pQueryTD,
+ static_cast<uno::Type*>(pCallStack[4])->getTypeLibType());
- TYPELIB_DANGER_GET( &pTD2, static_cast<Type *>( pStack[4] )->getTypeLibType() );
-
- if ( pTD2 )
+ if (pQueryTD)
{
- XInterface * pInterface = nullptr;
- (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
- ( pCppI->getBridge()->getCppEnv(),
- reinterpret_cast<void **>(&pInterface),
- pCppI->getOid().pData,
- reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD2 ) );
-
- if ( pInterface )
- {
- // pStack[3] = hidden return value pointer
- ::uno_any_construct( static_cast<uno_Any *>( pStack[3] ),
- &pInterface, pTD2, cpp_acquire );
+ uno::XInterface* pInterface = nullptr;
+ pCppI->getBridge()->getCppEnv()->getRegisteredInterface(
+ pCppI->getBridge()->getCppEnv(), reinterpret_cast<void**>(&pInterface),
+ pCppI->getOid().pData,
+ reinterpret_cast<typelib_InterfaceTypeDescription*>(pQueryTD));
+
+ if (pInterface)
+ {
+ // pCallStack[3] = hidden return value pointer
+ ::uno_any_construct(static_cast<uno_Any*>(pCallStack[3]), &pInterface,
+ pQueryTD, uno::cpp_acquire);
pInterface->release();
- TYPELIB_DANGER_RELEASE( pTD2 );
+ TYPELIB_DANGER_RELEASE(pQueryTD);
- pStack[0] = pStack[3];
+ pCallStack[0] = pCallStack[3];
eRet = typelib_TypeClass_ANY;
break;
}
- TYPELIB_DANGER_RELEASE( pTD2 );
+ TYPELIB_DANGER_RELEASE(pQueryTD);
}
[[fallthrough]];
}
- default:
+ default: // perform queryInterface()
{
- typelib_InterfaceMethodTypeDescription * pMethodTD =
- reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( aMemberDescr.get() );
-
- eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
- pMethodTD->pReturnTypeRef,
- pMethodTD->nParams,
- pMethodTD->pParams,
- pStack );
+ typelib_InterfaceMethodTypeDescription* pMethodTD
+ = reinterpret_cast<typelib_InterfaceMethodTypeDescription*>(
+ aMemberDescr.get());
+
+ eRet = cpp2uno_call(pCppI, aMemberDescr.get(), pMethodTD->pReturnTypeRef,
+ pMethodTD->nParams, pMethodTD->pParams, pCallStack);
}
}
break;
}
default:
- {
- throw RuntimeException("No member description found!",
- reinterpret_cast<XInterface *>( pCppI ) );
- }
+ throw uno::RuntimeException("No member description found!",
+ reinterpret_cast<uno::XInterface*>(pThis));
}
return eRet;
@@ -460,7 +427,7 @@ bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(
}
std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
- sal_Int32 slotCount )
+ sal_Int32 slotCount)
{
return (slotCount + 1) * sizeof (Slot) + slotCount * codeSnippetSize;
}
@@ -469,7 +436,7 @@ bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
void * block,
sal_Int32 slotCount,
- sal_Int32, typelib_InterfaceTypeDescription * )
+ sal_Int32, typelib_InterfaceTypeDescription *)
{
struct Rtti {
sal_Int32 n0, n1, n2;
@@ -582,7 +549,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
void bridges::cpp_uno::shared::VtableFactory::flushCode(
unsigned char const *,
- unsigned char const * )
+ unsigned char const *)
{
}
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
index 99f87e23d216..aa0cdda9de3d 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
@@ -37,7 +37,7 @@
#include <stdio.h>
#endif
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
namespace
{
@@ -68,17 +68,17 @@ bool cpp_call(
sal_Int64 i;
void *p;
double d;
- } aCppParams[MAXPARAMS+2], uRetVal;
+ } aCppArgs[MAXPARAMS+2], uRetVal;
int nCppParamIndex = 0;
- // Return type
+ // return type
typelib_TypeDescription * pReturnTD = nullptr;
TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
assert(pReturnTD);
// 'this'
void * pAdjustedThisPtr = reinterpret_cast<void **>( pThis->getCppI() ) + aVtableSlot.offset;
- aCppParams[nCppParamIndex++].p = pAdjustedThisPtr;
+ aCppArgs[nCppParamIndex++].p = pAdjustedThisPtr;
enum class ReturnKind { Void, Simple, Complex, ComplexConvert };
ReturnKind retKind;
@@ -91,73 +91,73 @@ bool cpp_call(
} else if (bridges::cpp_uno::shared::relatesToInterfaceType(pReturnTD))
{
retKind = ReturnKind::ComplexConvert;
- aCppParams[nCppParamIndex++].p = alloca(pReturnTD->nSize);
+ aCppArgs[nCppParamIndex++].p = alloca(pReturnTD->nSize);
} else {
retKind = ReturnKind::Complex;
- aCppParams[nCppParamIndex++].p = pUnoReturn;
+ aCppArgs[nCppParamIndex++].p = pUnoReturn;
}
}
- // Indexes of values this have to be converted (interface conversion C++<=>UNO)
+ // indexes of values this have to be converted (interface conversion C++<=>UNO)
int pTempCppIndexes[MAXPARAMS];
int pTempIndexes[MAXPARAMS];
int nTempIndexes = 0;
- // Type descriptions for reconversions
- typelib_TypeDescription *pTempParamTypeDescr[MAXPARAMS];
+ // type descriptions for reconversions
+ typelib_TypeDescription *pTempParamTD[MAXPARAMS];
- for ( int nPos = 0; nPos < nParams; ++nPos, ++nCppParamIndex )
+ for (int nPos = 0; nPos < nParams; ++nPos, ++nCppParamIndex)
{
const typelib_MethodParameter & rParam = pParams[nPos];
-
typelib_TypeDescription * pParamTD = nullptr;
TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
- if ( !rParam.bOut &&
- bridges::cpp_uno::shared::isSimpleType( pParamTD ) )
+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTD))
{
::uno_copyAndConvertData(
- &aCppParams[nCppParamIndex], pUnoArgs[nPos], pParamTD,
+ &aCppArgs[nCppParamIndex], pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
- // No longer needed
+ // no longer needed
TYPELIB_DANGER_RELEASE( pParamTD );
}
- else // Ptr to complex value | ref
+ else // ptr to complex value | ref
{
- if ( !rParam.bIn ) // Is pure out
+ if (!rParam.bIn) // Is pure out
{
// C++ out is constructed mem, UNO out is not!
::uno_constructData(
- aCppParams[nCppParamIndex].p = alloca( pParamTD->nSize ),
+ aCppArgs[nCppParamIndex].p = alloca( pParamTD->nSize ),
pParamTD );
pTempCppIndexes[nTempIndexes] = nCppParamIndex;
- pTempIndexes[nTempIndexes] = nPos;
- // Will be released at reconversion
- pTempParamTypeDescr[nTempIndexes++] = pParamTD;
+ // default constructed for C++ call
+ pTempIndexes[nTempIndexes] = nPos;
+ // will be released at reconversion
+ pTempParamTD[nTempIndexes++] = pParamTD;
}
- // Is in/inout
- else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTD ) )
+ // is in/inout
+ else if (bridges::cpp_uno::shared::relatesToInterfaceType(pParamTD))
{
::uno_copyAndConvertData(
- aCppParams[nCppParamIndex].p = alloca( pParamTD->nSize ),
+ aCppArgs[nCppParamIndex].p = alloca( pParamTD->nSize ),
pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
pTempCppIndexes[nTempIndexes] = nCppParamIndex;
+
+ // has to be reconverted
pTempIndexes[nTempIndexes] = nPos;
- // Will be released at reconversion
- pTempParamTypeDescr[nTempIndexes++] = pParamTD;
+ // will be released at reconversion
+ pTempParamTD[nTempIndexes++] = pParamTD;
}
else // direct way
{
- aCppParams[nCppParamIndex].p = pUnoArgs[nPos];
-
- // No longer needed
+ aCppArgs[nCppParamIndex].p = pUnoArgs[nPos];
+ // no longer needed
TYPELIB_DANGER_RELEASE( pParamTD );
}
}
@@ -202,85 +202,85 @@ bool cpp_call(
(pReturnTD->eTypeClass == typelib_TypeClass_FLOAT ||
pReturnTD->eTypeClass == typelib_TypeClass_DOUBLE) )
uRetVal.d =
- pFMethod (aCppParams[0].i, aCppParams[1].d, aCppParams[2].d, aCppParams[3].d,
- aCppParams[4].i, aCppParams[5].i, aCppParams[6].i, aCppParams[7].i,
- aCppParams[8].i, aCppParams[9].i, aCppParams[10].i, aCppParams[11].i,
- aCppParams[12].i, aCppParams[13].i, aCppParams[14].i, aCppParams[15].i,
- aCppParams[16].i, aCppParams[17].i, aCppParams[18].i, aCppParams[19].i,
- aCppParams[20].i, aCppParams[21].i, aCppParams[22].i, aCppParams[23].i,
- aCppParams[24].i, aCppParams[25].i, aCppParams[26].i, aCppParams[27].i,
- aCppParams[28].i, aCppParams[29].i, aCppParams[30].i, aCppParams[31].i );
+ pFMethod (aCppArgs[0].i, aCppArgs[1].d, aCppArgs[2].d, aCppArgs[3].d,
+ aCppArgs[4].i, aCppArgs[5].i, aCppArgs[6].i, aCppArgs[7].i,
+ aCppArgs[8].i, aCppArgs[9].i, aCppArgs[10].i, aCppArgs[11].i,
+ aCppArgs[12].i, aCppArgs[13].i, aCppArgs[14].i, aCppArgs[15].i,
+ aCppArgs[16].i, aCppArgs[17].i, aCppArgs[18].i, aCppArgs[19].i,
+ aCppArgs[20].i, aCppArgs[21].i, aCppArgs[22].i, aCppArgs[23].i,
+ aCppArgs[24].i, aCppArgs[25].i, aCppArgs[26].i, aCppArgs[27].i,
+ aCppArgs[28].i, aCppArgs[29].i, aCppArgs[30].i, aCppArgs[31].i );
else
uRetVal.i =
- pIMethod (aCppParams[0].i, aCppParams[1].d, aCppParams[2].d, aCppParams[3].d,
- aCppParams[4].i, aCppParams[5].i, aCppParams[6].i, aCppParams[7].i,
- aCppParams[8].i, aCppParams[9].i, aCppParams[10].i, aCppParams[11].i,
- aCppParams[12].i, aCppParams[13].i, aCppParams[14].i, aCppParams[15].i,
- aCppParams[16].i, aCppParams[17].i, aCppParams[18].i, aCppParams[19].i,
- aCppParams[20].i, aCppParams[21].i, aCppParams[22].i, aCppParams[23].i,
- aCppParams[24].i, aCppParams[25].i, aCppParams[26].i, aCppParams[27].i,
- aCppParams[28].i, aCppParams[29].i, aCppParams[30].i, aCppParams[31].i );
+ pIMethod (aCppArgs[0].i, aCppArgs[1].d, aCppArgs[2].d, aCppArgs[3].d,
+ aCppArgs[4].i, aCppArgs[5].i, aCppArgs[6].i, aCppArgs[7].i,
+ aCppArgs[8].i, aCppArgs[9].i, aCppArgs[10].i, aCppArgs[11].i,
+ aCppArgs[12].i, aCppArgs[13].i, aCppArgs[14].i, aCppArgs[15].i,
+ aCppArgs[16].i, aCppArgs[17].i, aCppArgs[18].i, aCppArgs[19].i,
+ aCppArgs[20].i, aCppArgs[21].i, aCppArgs[22].i, aCppArgs[23].i,
+ aCppArgs[24].i, aCppArgs[25].i, aCppArgs[26].i, aCppArgs[27].i,
+ aCppArgs[28].i, aCppArgs[29].i, aCppArgs[30].i, aCppArgs[31].i );
}
__except (CPPU_CURRENT_NAMESPACE::mscx_filterCppException(
GetExceptionInformation(),
*ppUnoExc, pThis->getBridge()->getCpp2Uno() ))
{
- // *ppUnoExc was constructed by filter function.
- // Temporary params
- while ( nTempIndexes-- )
+ // *ppUnoExc was constructed by filter function
+ // temporary params
+ while (nTempIndexes--)
{
int nCppIndex = pTempCppIndexes[nTempIndexes];
- // Destroy temp C++ param => C++: every param was constructed
+ // destroy temp C++ param => C++: every param was constructed
::uno_destructData(
- aCppParams[nCppIndex].p, pTempParamTypeDescr[nTempIndexes],
- cpp_release );
- TYPELIB_DANGER_RELEASE( pTempParamTypeDescr[nTempIndexes] );
+ aCppArgs[nCppIndex].p, pTempParamTD[nTempIndexes],
+ uno::cpp_release );
+ TYPELIB_DANGER_RELEASE( pTempParamTD[nTempIndexes] );
}
- // Return type
- if ( pReturnTD )
+
+ // return type
+ if (pReturnTD)
TYPELIB_DANGER_RELEASE( pReturnTD );
- // End here
return true;
}
- // No exception occurred
+ // NO exception occurred
*ppUnoExc = nullptr;
- // Reconvert temporary params
- while ( nTempIndexes-- )
+ // reconvert temporary params
+ while (nTempIndexes--)
{
int nCppIndex = pTempCppIndexes[nTempIndexes];
int nIndex = pTempIndexes[nTempIndexes];
typelib_TypeDescription * pParamTD =
- pTempParamTypeDescr[nTempIndexes];
+ pTempParamTD[nTempIndexes];
- if ( pParams[nIndex].bIn )
+ if (pParams[nIndex].bIn)
{
- if ( pParams[nIndex].bOut ) // Inout
+ if (pParams[nIndex].bOut) // inout
{
::uno_destructData(
- pUnoArgs[nIndex], pParamTD, nullptr ); // Destroy UNO value
+ pUnoArgs[nIndex], pParamTD, nullptr ); // destroy UNO value
::uno_copyAndConvertData(
- pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTD,
+ pUnoArgs[nIndex], aCppArgs[nCppIndex].p, pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
}
- else // Pure out
+ else // pure out
{
::uno_copyAndConvertData(
- pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTD,
+ pUnoArgs[nIndex], aCppArgs[nCppIndex].p, pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
- // Destroy temp C++ param => C++: every param was constructed
+ // destroy temp C++ param => C++: every param was constructed
::uno_destructData(
- aCppParams[nCppIndex].p, pParamTD, cpp_release );
+ aCppArgs[nCppIndex].p, pParamTD, uno::cpp_release );
TYPELIB_DANGER_RELEASE( pParamTD );
}
- // Return value
+ // return value
switch (retKind) {
case ReturnKind::Void:
break;
@@ -291,22 +291,23 @@ bool cpp_call(
assert(uRetVal.p == pUnoReturn);
break;
case ReturnKind::ComplexConvert:
- assert(uRetVal.p == aCppParams[1].p);
+ assert(uRetVal.p == aCppArgs[1].p);
::uno_copyAndConvertData(
pUnoReturn, uRetVal.p, pReturnTD,
pThis->getBridge()->getCpp2Uno() );
::uno_destructData(
- uRetVal.p, pReturnTD, cpp_release );
+ uRetVal.p, pReturnTD, uno::cpp_release );
break;
}
+ // return type
if ( pReturnTD )
TYPELIB_DANGER_RELEASE( pReturnTD );
return true;
}
-}
+} // namespace
namespace bridges::cpp_uno::shared {
@@ -340,7 +341,7 @@ void unoInterfaceProxyDispatch(
pMemberTD)));
if ( pReturn )
{
- // Is GET
+ // is GET
cpp_call(
pThis, aVtableSlot,
reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef,
@@ -349,7 +350,7 @@ void unoInterfaceProxyDispatch(
}
else
{
- // Is SET
+ // is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef;
@@ -388,19 +389,18 @@ void unoInterfaceProxyDispatch(
switch (aVtableSlot.index)
{
- // Standard calls
- case 1: // Acquire UNO interface
+ case 1: // acquire UNO interface
(*pUnoI->acquire)( pUnoI );
*ppException = nullptr;
break;
- case 2: // Release UNO interface
+ case 2: // release UNO interface
(*pUnoI->release)( pUnoI );
*ppException = nullptr;
break;
case 0: // queryInterface() opt
{
typelib_TypeDescription * pTD = nullptr;
- TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pArgs[0] )->getTypeLibType() );
+ TYPELIB_DANGER_GET( &pTD, static_cast< uno::Type * >( pArgs[0] )->getTypeLibType() );
if ( pTD )
{
@@ -415,9 +415,7 @@ void unoInterfaceProxyDispatch(
static_cast< uno_Any * >( pReturn ),
&pInterface, pTD, nullptr );
(*pInterface->release)( pInterface );
-
TYPELIB_DANGER_RELEASE( pTD );
-
*ppException = nullptr;
break;
}
@@ -426,28 +424,27 @@ void unoInterfaceProxyDispatch(
[[fallthrough]]; // else perform queryInterface()
}
default:
- if ( ! cpp_call(
- pThis, aVtableSlot,
- reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->pReturnTypeRef,
- reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->nParams,
- reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->pParams,
- pReturn, pArgs, ppException ) )
+ typelib_InterfaceMethodTypeDescription const* pMethodTD
+ = reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD);
+
+ if (!cpp_call(pThis, aVtableSlot, pMethodTD->pReturnTypeRef, pMethodTD->nParams,
+ pMethodTD->pParams, pReturn, pArgs, ppException))
{
- RuntimeException aExc( "Too many parameters!" );
+ uno::RuntimeException aExc( "Too many parameters!" );
- Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
- ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr );
+ uno::Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
+ ::uno_type_any_construct(*ppException, &aExc, rExcType.getTypeLibType(), nullptr);
}
}
break;
}
default:
{
- RuntimeException aExc( "Illegal member type description!" );
+ uno::RuntimeException aExc("Illegal member type description!", uno::Reference<uno::XInterface>());
- Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
- // Binary identical null reference (whatever that comment means...)
- ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr );
+ uno::Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
+ // binary identical null reference
+ ::uno_type_any_construct(*ppException, &aExc, rExcType.getTypeLibType(), nullptr);
}
}
}