Fix some warnings for Raspberry pi 4 (part3)

fix for these kinds of things:
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:494:17: error:
C-style cast from 'sal_uInt32 *' (aka 'unsigned long *') to 'double *' (BitCast) [loplugin:cstylecast]
                INSERT_DOUBLE( pCppArgs[nPos], nGPR, pGPR, pStack, pStackStart );
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:365:14: note: expanded from macro 'INSERT_DOUBLE'
            *(double *)pDS = *reinterpret_cast<double *>( pSV );\
             ^~~~~~~~~~~~~
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:645:18: error:
C-style cast from 'const typelib_TypeDescription *' (aka 'const _typelib_TypeDescription *') to 'typelib_InterfaceAttributeTypeDescription *' (aka '_typelib_InterfaceAttributeTypeDescription *') (BitCast) [loplugin:cstylecast]
                ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:655:31: error: use 'true' instead of 'sal_True' [loplugin:fakebool]
            aParam.bIn      = sal_True;
                              ^~~~~~~~
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:656:31: error: use 'false' instead of 'sal_False' [loplugin:fakebool]
            aParam.bOut     = sal_False;

/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:112:47: error: NullToPointer ValueDependentIsNotNull ZeroLiteral -> nullptr [loplugin:nullptr]
                typelib_TypeDescription * t = 0;
                                              ^
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:123:40: error: NullToPointer ValueDependentIsNotNull ZeroLiteral -> nullptr [loplugin:nullptr]
        if (p->pBaseTypeDescription != 0)
                                       ^
/home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:148:52: error: NullToPointer ValueDependentIsNotNull ZeroLiteral -> nullptr [loplugin:nullptr]
            typelib_TypeDescription * pTypeDescr = 0;
                                                   ^

Change-Id: Ibca65077131277380ddeefa994b52c7c1193c1f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108570
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2021-01-02 14:36:44 +01:00
parent 83de497ae9
commit dd91d3389c
3 changed files with 117 additions and 88 deletions

View File

@@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <sal/config.h>
#include <sal/types.h>
extern "C" sal_Int64 cpp_vtable_call(long* pFunctionAndOffset, void** pCallStack);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -33,6 +33,7 @@
#include <vtablefactory.hxx> #include <vtablefactory.hxx>
#include "share.hxx" #include "share.hxx"
#include "call.hxx"
#include <dlfcn.h> #include <dlfcn.h>
@@ -46,7 +47,7 @@ using namespace ::com::sun::star::uno;
namespace namespace
{ {
static typelib_TypeClass cpp2uno_call( typelib_TypeClass cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy* pThis, bridges::cpp_uno::shared::CppInterfaceProxy* pThis,
const typelib_TypeDescription * pMemberTypeDescr, const typelib_TypeDescription * pMemberTypeDescr,
typelib_TypeDescriptionReference * pReturnTypeRef, typelib_TypeDescriptionReference * pReturnTypeRef,
@@ -55,21 +56,21 @@ namespace
sal_Int64 * pRegisterReturn /* space for register return */ ) sal_Int64 * pRegisterReturn /* space for register return */ )
{ {
// pCallStack: ret, [return ptr], this, params // pCallStack: ret, [return ptr], this, params
char * pTopStack = (char *)(pCallStack + 0); char * pTopStack = reinterpret_cast<char *>(pCallStack + 0);
char * pCppStack = pTopStack; char * pCppStack = pTopStack;
#ifdef __ARM_PCS_VFP #ifdef __ARM_PCS_VFP
int dc = 0; int dc = 0;
char * pFloatArgs = (char *)(pCppStack - 64); char * pFloatArgs = reinterpret_cast<char *>(pCppStack - 64);
#endif #endif
// return // return
typelib_TypeDescription * pReturnTypeDescr = 0; typelib_TypeDescription * pReturnTypeDescr = nullptr;
if (pReturnTypeRef) if (pReturnTypeRef)
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
void * pUnoReturn = 0; void * pUnoReturn = nullptr;
// complex return ptr: if != 0 && != pUnoReturn, reconversion need // complex return ptr: if != 0 && != pUnoReturn, reconversion need
void * pCppReturn = 0; void * pCppReturn = nullptr;
if (pReturnTypeDescr) if (pReturnTypeDescr)
{ {
@@ -77,7 +78,7 @@ namespace
pUnoReturn = pRegisterReturn; // direct way for simple types pUnoReturn = pRegisterReturn; // direct way for simple types
else // complex return via ptr (pCppReturn) else // complex return via ptr (pCppReturn)
{ {
pCppReturn = *(void **)pCppStack; pCppReturn = *reinterpret_cast<void **>(pCppStack);
pCppStack += sizeof(void *); pCppStack += sizeof(void *);
pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(
@@ -93,21 +94,21 @@ namespace
static_assert(sizeof(void *) == sizeof(sal_Int32), static_assert(sizeof(void *) == sizeof(sal_Int32),
"### unexpected size!"); "### unexpected size!");
// parameters // parameters
void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pUnoArgs = static_cast<void **>(alloca( 4 * sizeof(void *) * nParams ));
void ** pCppArgs = pUnoArgs + nParams; void ** pCppArgs = pUnoArgs + nParams;
// indices of values this have to be converted (interface conversion // indices of values this have to be converted (interface conversion
// cpp<=>uno) // cpp<=>uno)
sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams)); sal_Int32 * pTempIndices = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams));
// type descriptions for reconversions // type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = typelib_TypeDescription ** ppTempParamTypeDescr =
(typelib_TypeDescription **)(pUnoArgs + (3 * nParams)); reinterpret_cast<typelib_TypeDescription **>(pUnoArgs + (3 * nParams));
sal_Int32 nTempIndices = 0; sal_Int32 nTempIndices = 0;
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{ {
const typelib_MethodParameter & rParam = pParams[nPos]; const typelib_MethodParameter & rParam = pParams[nPos];
typelib_TypeDescription * pParamTypeDescr = 0; typelib_TypeDescription * pParamTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
if (!rParam.bOut && if (!rParam.bOut &&
@@ -166,7 +167,7 @@ namespace
} }
else // ptr to complex value | ref else // ptr to complex value | ref
{ {
pCppArgs[nPos] = *(void **)pCppStack; pCppArgs[nPos] = *reinterpret_cast<void **>(pCppStack);
if (! rParam.bIn) // is pure out if (! rParam.bIn) // is pure out
{ {
@@ -182,7 +183,7 @@ namespace
{ {
uno_copyAndConvertData( pUnoArgs[nPos] = uno_copyAndConvertData( pUnoArgs[nPos] =
alloca( pParamTypeDescr->nSize ), alloca( pParamTypeDescr->nSize ),
*(void **)pCppStack, pParamTypeDescr, *reinterpret_cast<void **>(pCppStack), pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() ); pThis->getBridge()->getCpp2Uno() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted pTempIndices[nTempIndices] = nPos; // has to be reconverted
// will be released at reconversion // will be released at reconversion
@@ -190,7 +191,7 @@ namespace
} }
else // direct way else // direct way
{ {
pUnoArgs[nPos] = *(void **)pCppStack; pUnoArgs[nPos] = *reinterpret_cast<void **>(pCppStack);
// no longer needed // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr ); TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} }
@@ -223,7 +224,7 @@ namespace
if (pParams[nIndex].bIn) // is in/inout => was constructed if (pParams[nIndex].bIn) // is in/inout => was constructed
uno_destructData( pUnoArgs[nIndex], uno_destructData( pUnoArgs[nIndex],
ppTempParamTypeDescr[nTempIndices], 0 ); ppTempParamTypeDescr[nTempIndices], nullptr );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] ); TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
} }
if (pReturnTypeDescr) if (pReturnTypeDescr)
@@ -252,7 +253,7 @@ namespace
pParamTypeDescr, pThis->getBridge()->getUno2Cpp() ); pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
} }
// destroy temp uno param // destroy temp uno param
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, nullptr );
TYPELIB_DANGER_RELEASE( pParamTypeDescr ); TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} }
@@ -264,15 +265,15 @@ namespace
uno_copyAndConvertData( pCppReturn, pUnoReturn, uno_copyAndConvertData( pCppReturn, pUnoReturn,
pReturnTypeDescr, pThis->getBridge()->getUno2Cpp() ); pReturnTypeDescr, pThis->getBridge()->getUno2Cpp() );
// destroy temp uno return // destroy temp uno return
uno_destructData( pUnoReturn, pReturnTypeDescr, 0 ); uno_destructData( pUnoReturn, pReturnTypeDescr, nullptr );
} }
// complex return ptr is set to eax // complex return ptr is set to eax
*(void **)pRegisterReturn = pCppReturn; *reinterpret_cast<void **>(pRegisterReturn) = pCppReturn;
} }
if (pReturnTypeDescr) if (pReturnTypeDescr)
{ {
typelib_TypeClass eRet = typelib_TypeClass eRet =
(typelib_TypeClass)pReturnTypeDescr->eTypeClass; static_cast<typelib_TypeClass>(pReturnTypeDescr->eTypeClass);
TYPELIB_DANGER_RELEASE( pReturnTypeDescr ); TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
return eRet; return eRet;
} }
@@ -282,7 +283,7 @@ namespace
} }
static typelib_TypeClass cpp_mediate( typelib_TypeClass cpp_mediate(
sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
void ** pCallStack, void ** pCallStack,
sal_Int64 * pRegisterReturn /* space for register return */ ) sal_Int64 * pRegisterReturn /* space for register return */ )
@@ -320,7 +321,7 @@ namespace
("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName) ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
+ " vtable index " + OUString::number(nFunctionIndex) + "/" + " vtable index " + OUString::number(nFunctionIndex) + "/"
+ OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)), + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
(XInterface *)pCppI); reinterpret_cast<XInterface *>(pCppI));
} }
// determine called method // determine called method
@@ -342,8 +343,8 @@ namespace
// is GET method // is GET method
eRet = cpp2uno_call( eRet = cpp2uno_call(
pCppI, aMemberDescr.get(), pCppI, aMemberDescr.get(),
((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef, reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>(aMemberDescr.get())->pAttributeTypeRef,
0, 0, // no params 0, nullptr, // no params
pCallStack, pRegisterReturn ); pCallStack, pRegisterReturn );
} }
else else
@@ -351,13 +352,13 @@ namespace
// is SET method // is SET method
typelib_MethodParameter aParam; typelib_MethodParameter aParam;
aParam.pTypeRef = aParam.pTypeRef =
((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef; reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>(aMemberDescr.get())->pAttributeTypeRef;
aParam.bIn = sal_True; aParam.bIn = true;
aParam.bOut = sal_False; aParam.bOut = false;
eRet = cpp2uno_call( eRet = cpp2uno_call(
pCppI, aMemberDescr.get(), pCppI, aMemberDescr.get(),
0, // indicates void return nullptr, // indicates void return
1, &aParam, 1, &aParam,
pCallStack, pRegisterReturn ); pCallStack, pRegisterReturn );
} }
@@ -378,16 +379,16 @@ namespace
break; break;
case 0: // queryInterface() opt case 0: // queryInterface() opt
{ {
typelib_TypeDescription * pTD = 0; typelib_TypeDescription * pTD = nullptr;
TYPELIB_DANGER_GET(&pTD, TYPELIB_DANGER_GET(&pTD,
reinterpret_cast<Type *>(pCallStack[2])->getTypeLibType()); reinterpret_cast<Type *>(pCallStack[2])->getTypeLibType());
if (pTD) if (pTD)
{ {
XInterface * pInterface = 0; XInterface * pInterface = nullptr;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)( (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
pCppI->getBridge()->getCppEnv(), pCppI->getBridge()->getCppEnv(),
(void **)&pInterface, pCppI->getOid().pData, reinterpret_cast<void **>(&pInterface), pCppI->getOid().pData,
(typelib_InterfaceTypeDescription *)pTD ); reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
if (pInterface) if (pInterface)
{ {
@@ -396,7 +397,7 @@ namespace
&pInterface, pTD, cpp_acquire ); &pInterface, pTD, cpp_acquire );
pInterface->release(); pInterface->release();
TYPELIB_DANGER_RELEASE( pTD ); TYPELIB_DANGER_RELEASE( pTD );
*(void **)pRegisterReturn = pCallStack[0]; *reinterpret_cast<void **>(pRegisterReturn) = pCallStack[0];
eRet = typelib_TypeClass_ANY; eRet = typelib_TypeClass_ANY;
break; break;
} }
@@ -406,16 +407,16 @@ namespace
default: default:
eRet = cpp2uno_call( eRet = cpp2uno_call(
pCppI, aMemberDescr.get(), pCppI, aMemberDescr.get(),
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef, reinterpret_cast<typelib_InterfaceMethodTypeDescription *>(aMemberDescr.get())->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams, reinterpret_cast<typelib_InterfaceMethodTypeDescription *>(aMemberDescr.get())->nParams,
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams, reinterpret_cast<typelib_InterfaceMethodTypeDescription *>(aMemberDescr.get())->pParams,
pCallStack, pRegisterReturn ); pCallStack, pRegisterReturn );
} }
break; break;
} }
default: default:
{ {
throw RuntimeException( "no member description found!", (XInterface *)pCppI ); throw RuntimeException( "no member description found!", reinterpret_cast<XInterface *>(pCppI) );
} }
} }
@@ -428,7 +429,7 @@ namespace
* (called by asm snippets) * (called by asm snippets)
*/ */
extern "C" sal_Int64 cpp_vtable_call( long *pFunctionAndOffset, sal_Int64 cpp_vtable_call( long *pFunctionAndOffset,
void **pCallStack ) void **pCallStack )
{ {
sal_Int64 nRegReturn; sal_Int64 nRegReturn;
@@ -439,17 +440,17 @@ extern "C" sal_Int64 cpp_vtable_call( long *pFunctionAndOffset,
{ {
case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE: case typelib_TypeClass_BYTE:
nRegReturn = (unsigned long)(*(unsigned char *)&nRegReturn); nRegReturn = static_cast<unsigned long>(*reinterpret_cast<unsigned char *>(&nRegReturn));
break; break;
case typelib_TypeClass_CHAR: case typelib_TypeClass_CHAR:
case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_UNSIGNED_SHORT:
case typelib_TypeClass_SHORT: case typelib_TypeClass_SHORT:
nRegReturn = (unsigned long)(*(unsigned short *)&nRegReturn); nRegReturn = static_cast<unsigned long>(*reinterpret_cast<unsigned short *>(&nRegReturn));
break; break;
case typelib_TypeClass_ENUM: case typelib_TypeClass_ENUM:
case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_LONG: case typelib_TypeClass_LONG:
nRegReturn = (unsigned long)(*(unsigned int *)&nRegReturn); nRegReturn = static_cast<unsigned long>(*reinterpret_cast<unsigned int *>(&nRegReturn));
break; break;
case typelib_TypeClass_VOID: case typelib_TypeClass_VOID:
default: default:
@@ -469,16 +470,16 @@ namespace
if (bHasHiddenParam) if (bHasHiddenParam)
functionIndex |= 0x80000000; functionIndex |= 0x80000000;
unsigned long * p = (unsigned long *)code; unsigned long * p = reinterpret_cast<unsigned long *>(code);
// ARM (not thumb) mode instructions // ARM (not thumb) mode instructions
// mov ip, pc // mov ip, pc
*p++ = 0xE1A0C00F; *p++ = 0xE1A0C00F;
// ldr pc, [pc, #4] // ldr pc, [pc, #4]
*p++ = 0xE59FF004; *p++ = 0xE59FF004;
*p++ = (unsigned long)functionIndex; *p++ = static_cast<unsigned long>(functionIndex);
*p++ = (unsigned long)vtableOffset; *p++ = static_cast<unsigned long>(vtableOffset);
*p++ = (unsigned long)privateSnippetExecutor; *p++ = reinterpret_cast<unsigned long>(privateSnippetExecutor);
return code + codeSnippetSize; return code + codeSnippetSize;
} }
@@ -504,8 +505,8 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock(
typelib_InterfaceTypeDescription *) typelib_InterfaceTypeDescription *)
{ {
Slot * slots = mapBlockToVtable(block); Slot * slots = mapBlockToVtable(block);
slots[-2].fn = 0; slots[-2].fn = nullptr;
slots[-1].fn = 0; slots[-1].fn = nullptr;
return slots + slotCount; return slots + slotCount;
} }
@@ -524,7 +525,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
Slot * s = *slots; Slot * s = *slots;
for (sal_Int32 i = 0; i < type->nMembers; ++i) for (sal_Int32 i = 0; i < type->nMembers; ++i)
{ {
typelib_TypeDescription * member = 0; typelib_TypeDescription * member = nullptr;
TYPELIB_DANGER_GET(&member, type->ppMembers[i]); TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
assert(member != 0); assert(member != 0);
switch (member->eTypeClass) switch (member->eTypeClass)

View File

@@ -109,7 +109,7 @@ namespace arm
if (p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_STRUCT || if (p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_STRUCT ||
p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_EXCEPTION) p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_EXCEPTION)
{ {
typelib_TypeDescription * t = 0; typelib_TypeDescription * t = nullptr;
TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]); TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
bool b = is_complex_struct(t); bool b = is_complex_struct(t);
TYPELIB_DANGER_RELEASE(t); TYPELIB_DANGER_RELEASE(t);
@@ -120,7 +120,7 @@ namespace arm
else if (!bridges::cpp_uno::shared::isSimpleType(p->ppTypeRefs[i]->eTypeClass)) else if (!bridges::cpp_uno::shared::isSimpleType(p->ppTypeRefs[i]->eTypeClass))
return true; return true;
} }
if (p->pBaseTypeDescription != 0) if (p->pBaseTypeDescription != nullptr)
return is_complex_struct(&p->pBaseTypeDescription->aBase); return is_complex_struct(&p->pBaseTypeDescription->aBase);
return false; return false;
} }
@@ -145,7 +145,7 @@ namespace arm
return false; return false;
else if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT || pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION) else if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT || pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION)
{ {
typelib_TypeDescription * pTypeDescr = 0; typelib_TypeDescription * pTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef ); TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
//A Composite Type not larger than 4 bytes is returned in r0 //A Composite Type not larger than 4 bytes is returned in r0
@@ -298,9 +298,9 @@ void callVirtualMethod(
#define INSERT_INT32( pSV, nr, pGPR, pDS ) \ #define INSERT_INT32( pSV, nr, pGPR, pDS ) \
if ( nr < arm::MAX_GPR_REGS ) \ if ( nr < arm::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ pGPR[nr++] = reinterpret_cast<sal_uInt32>( pSV ); \
else \ else \
*pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV ); *pDS++ = reinterpret_cast<sal_uInt32>( pSV );
#ifdef __ARM_EABI__ #ifdef __ARM_EABI__
#define INSERT_INT64( pSV, nr, pGPR, pDS, pStart ) \ #define INSERT_INT64( pSV, nr, pGPR, pDS, pStart ) \
@@ -310,8 +310,8 @@ void callVirtualMethod(
} \ } \
if ( nr < arm::MAX_GPR_REGS ) \ if ( nr < arm::MAX_GPR_REGS ) \
{ \ { \
pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ *reinterpret_cast<sal_uInt32 *>(pGPR[nr++]) = *static_cast<sal_uInt32 *>( pSV ); \
pGPR[nr++] = *(reinterpret_cast<sal_uInt32 *>( pSV ) + 1); \ *reinterpret_cast<sal_uInt32 *>(pGPR[nr++]) = *(static_cast<sal_uInt32 *>( pSV ) + 1); \
} \ } \
else \ else \
{ \ { \
@@ -319,8 +319,8 @@ void callVirtualMethod(
{ \ { \
++pDS; \ ++pDS; \
} \ } \
*pDS++ = reinterpret_cast<sal_uInt32 *>( pSV )[0]; \ *reinterpret_cast<sal_uInt32 *>(*pDS++) = static_cast<sal_uInt32 *>( pSV )[0]; \
*pDS++ = reinterpret_cast<sal_uInt32 *>( pSV )[1]; \ *reinterpret_cast<sal_uInt32 *>(*pDS++) = static_cast<sal_uInt32 *>( pSV )[1]; \
} }
#else #else
#define INSERT_INT64( pSV, nr, pGPR, pDS, pStart ) \ #define INSERT_INT64( pSV, nr, pGPR, pDS, pStart ) \
@@ -343,18 +343,18 @@ void callVirtualMethod(
nSR = 2*nDR; \ nSR = 2*nDR; \
}\ }\
if ( nSR < arm::MAX_FPR_REGS*2 ) {\ if ( nSR < arm::MAX_FPR_REGS*2 ) {\
pSPR[nSR++] = *reinterpret_cast<float *>( pSV ); \ pSPR[nSR++] = *static_cast<float const *>( pSV ); \
if ((nSR % 2 == 1) && (nSR > 2*nDR)) {\ if ((nSR % 2 == 1) && (nSR > 2*nDR)) {\
nDR++; \ nDR++; \
}\ }\
}\ }\
else \ else \
{\ {\
*pDS++ = *reinterpret_cast<float *>( pSV );\ *pDS++ = *static_cast<float const *>( pSV );\
} }
#define INSERT_DOUBLE( pSV, nr, pGPR, pDS, pStart ) \ #define INSERT_DOUBLE( pSV, nr, pGPR, pDS, pStart ) \
if ( nDR < arm::MAX_FPR_REGS ) { \ if ( nDR < arm::MAX_FPR_REGS ) { \
pFPR[nDR++] = *reinterpret_cast<double *>( pSV ); \ pFPR[nDR++] = *static_cast<double const *>( pSV ); \
}\ }\
else\ else\
{\ {\
@@ -362,7 +362,7 @@ void callVirtualMethod(
{ \ { \
++pDS; \ ++pDS; \
} \ } \
*(double *)pDS = *reinterpret_cast<double *>( pSV );\ *reinterpret_cast<double *>(pDS) = *static_cast<double const *>( pSV );\
pDS += 2;\ pDS += 2;\
} }
#else #else
@@ -375,15 +375,15 @@ void callVirtualMethod(
#define INSERT_INT16( pSV, nr, pGPR, pDS ) \ #define INSERT_INT16( pSV, nr, pGPR, pDS ) \
if ( nr < arm::MAX_GPR_REGS ) \ if ( nr < arm::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \ pGPR[nr++] = *static_cast<sal_uInt16 const *>( pSV ); \
else \ else \
*pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV ); *pDS++ = *static_cast<sal_uInt16 const *>( pSV );
#define INSERT_INT8( pSV, nr, pGPR, pDS ) \ #define INSERT_INT8( pSV, nr, pGPR, pDS ) \
if ( nr < arm::MAX_GPR_REGS ) \ if ( nr < arm::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \ pGPR[nr++] = *static_cast<sal_uInt8 const *>( pSV ); \
else \ else \
*pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV ); *pDS++ = *static_cast<sal_uInt8 const *>( pSV );
namespace { namespace {
@@ -411,11 +411,11 @@ void cpp_call(
#endif #endif
// return // return
typelib_TypeDescription * pReturnTypeDescr = 0; typelib_TypeDescription * pReturnTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
assert(pReturnTypeDescr); assert(pReturnTypeDescr);
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion void * pCppReturn = nullptr; // if != 0 && != pUnoReturn, needs reconversion
if (pReturnTypeDescr) if (pReturnTypeDescr)
{ {
@@ -452,7 +452,7 @@ void cpp_call(
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{ {
const typelib_MethodParameter & rParam = pParams[nPos]; const typelib_MethodParameter & rParam = pParams[nPos];
typelib_TypeDescription * pParamTypeDescr = 0; typelib_TypeDescription * pParamTypeDescr = nullptr;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
@@ -553,7 +553,7 @@ void cpp_call(
} }
// NO exception occurred... // NO exception occurred...
*ppUnoExc = 0; *ppUnoExc = nullptr;
// reconvert temporary params // reconvert temporary params
for ( ; nTempIndices--; ) for ( ; nTempIndices--; )
@@ -565,7 +565,7 @@ void cpp_call(
{ {
if (pParams[nIndex].bOut) // inout if (pParams[nIndex].bOut) // inout
{ {
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, nullptr ); // destroy uno value
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() ); pThis->getBridge()->getCpp2Uno() );
} }
@@ -642,8 +642,8 @@ void unoInterfaceProxyDispatch(
// dependent dispatch // dependent dispatch
cpp_call( cpp_call(
pThis, aVtableSlot, pThis, aVtableSlot,
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef, reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberDescr)->pAttributeTypeRef,
0, 0, // no params 0, nullptr, // no params
pReturn, pArgs, ppException ); pReturn, pArgs, ppException );
} }
else else
@@ -651,11 +651,11 @@ void unoInterfaceProxyDispatch(
// is SET // is SET
typelib_MethodParameter aParam; typelib_MethodParameter aParam;
aParam.pTypeRef = aParam.pTypeRef =
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef; reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberDescr)->pAttributeTypeRef;
aParam.bIn = sal_True; aParam.bIn = true;
aParam.bOut = sal_False; aParam.bOut = false;
typelib_TypeDescriptionReference * pReturnTypeRef = 0; typelib_TypeDescriptionReference * pReturnTypeRef = nullptr;
OUString aVoidName("void"); OUString aVoidName("void");
typelib_typedescriptionreference_new( typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData ); &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
@@ -691,31 +691,31 @@ void unoInterfaceProxyDispatch(
// standard calls // standard calls
case 1: // acquire uno interface case 1: // acquire uno interface
(*pUnoI->acquire)( pUnoI ); (*pUnoI->acquire)( pUnoI );
*ppException = 0; *ppException = nullptr;
break; break;
case 2: // release uno interface case 2: // release uno interface
(*pUnoI->release)( pUnoI ); (*pUnoI->release)( pUnoI );
*ppException = 0; *ppException = nullptr;
break; break;
case 0: // queryInterface() opt case 0: // queryInterface() opt
{ {
typelib_TypeDescription * pTD = 0; typelib_TypeDescription * pTD = nullptr;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() ); TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pArgs[0] )->getTypeLibType() );
if (pTD) if (pTD)
{ {
uno_Interface * pInterface = 0; uno_Interface * pInterface = nullptr;
(*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)( (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
pThis->getBridge()->getUnoEnv(), pThis->getBridge()->getUnoEnv(),
(void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD ); reinterpret_cast<void **>(&pInterface), pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
if (pInterface) if (pInterface)
{ {
::uno_any_construct( ::uno_any_construct(
reinterpret_cast< uno_Any * >( pReturn ), static_cast< uno_Any * >( pReturn ),
&pInterface, pTD, 0 ); &pInterface, pTD, nullptr );
(*pInterface->release)( pInterface ); (*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD ); TYPELIB_DANGER_RELEASE( pTD );
*ppException = 0; *ppException = nullptr;
break; break;
} }
TYPELIB_DANGER_RELEASE( pTD ); TYPELIB_DANGER_RELEASE( pTD );
@@ -725,9 +725,9 @@ void unoInterfaceProxyDispatch(
// dependent dispatch // dependent dispatch
cpp_call( cpp_call(
pThis, aVtableSlot, pThis, aVtableSlot,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef, reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberDescr)->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams, reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberDescr)->nParams,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams, reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberDescr)->pParams,
pReturn, pArgs, ppException ); pReturn, pArgs, ppException );
} }
break; break;
@@ -740,7 +740,7 @@ void unoInterfaceProxyDispatch(
Type const & rExcType = cppu::UnoType<decltype(aExc)>::get(); Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
// binary identical null reference // binary identical null reference
::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 ); ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr );
} }
} }
} }