summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 14:55:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 16:35:38 +0200
commit11785217594d863efb518aa8b8f2910cdcb9c59d (patch)
treed8460fe0e3a9ee4212d7bd964c2fd3ee0d9074b4 /cppu
parent14471a694271777440c19916055d659337c0fb8d (diff)
loplugin:buriedassign in c*
Change-Id: Id14fed7e5c0f588ad3c927f12251432d12c1a7c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/typelib/static_types.cxx9
-rw-r--r--cppu/source/typelib/typelib.cxx59
-rw-r--r--cppu/source/uno/copy.hxx8
-rw-r--r--cppu/source/uno/lbenv.cxx7
-rw-r--r--cppu/source/uno/sequence.cxx4
5 files changed, 52 insertions, 35 deletions
diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx
index 6bbdf4c63eab..77f443a6a637 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -182,8 +182,9 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
&pTD, sTypeName.pData, 0, 0, 0, 0, 0, nullptr, 3, pMembers );
::typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription **>(&pTD) );
+ s_aTypes[typelib_TypeClass_INTERFACE] = pTD->aBase.pWeakRef;
::typelib_typedescriptionreference_acquire(
- s_aTypes[typelib_TypeClass_INTERFACE] = pTD->aBase.pWeakRef );
+ s_aTypes[typelib_TypeClass_INTERFACE] );
// another static ref:
++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount;
::typelib_typedescription_release( &pTD->aBase );
@@ -212,8 +213,9 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
::typelib_typedescription_new(
&pTD1, typelib_TypeClass_EXCEPTION, sTypeName1.pData, nullptr, 2, aMembers );
typelib_typedescription_register( &pTD1 );
+ s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef;
typelib_typedescriptionreference_acquire(
- s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef );
+ s_aTypes[typelib_TypeClass_EXCEPTION]);
// another static ref:
++s_aTypes[typelib_TypeClass_EXCEPTION]->nStaticRefCount;
// RuntimeException
@@ -369,8 +371,9 @@ void init(
}
for ( sal_Int32 i = 0 ; i < nMembers; ++i )
{
+ pComp->ppTypeRefs[i] = ppMembers[i];
::typelib_typedescriptionreference_acquire(
- pComp->ppTypeRefs[i] = ppMembers[i] );
+ pComp->ppTypeRefs[i] );
// write offset
typelib_TypeDescription * pTD = nullptr;
TYPELIB_DANGER_GET( &pTD, pComp->ppTypeRefs[i] );
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 1f7af60693e2..92a7e6ca5120 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -661,10 +661,10 @@ extern "C" void typelib_typedescription_newEmpty(
pRet->nRefCount = 1; // reference count is initially 1
pRet->nStaticRefCount = 0;
pRet->eTypeClass = eTypeClass;
- pRet->pTypeName = nullptr;
pRet->pUniqueIdentifier = nullptr;
pRet->pReserved = nullptr;
- rtl_uString_acquire( pRet->pTypeName = pTypeName );
+ pRet->pTypeName = pTypeName;
+ rtl_uString_acquire( pRet->pTypeName );
pRet->pSelf = pRet;
pRet->bComplete = true;
pRet->nSize = 0;
@@ -740,17 +740,17 @@ void newTypeDescription(
typelib_typedescriptionreference_new(
pTmp->ppTypeRefs +i, pCompoundMembers[i].eTypeClass,
pCompoundMembers[i].pTypeName );
- rtl_uString_acquire(
- pTmp->ppMemberNames[i]
- = pCompoundMembers[i].pMemberName );
+ pTmp->ppMemberNames[i]
+ = pCompoundMembers[i].pMemberName;
+ rtl_uString_acquire( pTmp->ppMemberNames[i] );
} else {
typelib_typedescriptionreference_new(
pTmp->ppTypeRefs +i,
pStructMembers[i].aBase.eTypeClass,
pStructMembers[i].aBase.pTypeName );
- rtl_uString_acquire(
- pTmp->ppMemberNames[i]
- = pStructMembers[i].aBase.pMemberName );
+ pTmp->ppMemberNames[i]
+ = pStructMembers[i].aBase.pMemberName;
+ rtl_uString_acquire(pTmp->ppMemberNames[i]);
}
// write offset
sal_Int32 size;
@@ -843,7 +843,8 @@ extern "C" void SAL_CALL typelib_typedescription_newEnum(
pEnum->ppEnumNames = new rtl_uString * [ nEnumValues ];
for ( sal_Int32 nPos = nEnumValues; nPos--; )
{
- rtl_uString_acquire( pEnum->ppEnumNames[nPos] = ppEnumNames[nPos] );
+ pEnum->ppEnumNames[nPos] = ppEnumNames[nPos];
+ rtl_uString_acquire( pEnum->ppEnumNames[nPos] );
}
pEnum->pEnumValues = new sal_Int32[ nEnumValues ];
::memcpy( pEnum->pEnumValues, pEnumValues, nEnumValues * sizeof(sal_Int32) );
@@ -1127,8 +1128,8 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod(
for( sal_Int32 i = 0; i < nParams; i++ )
{
// get the name of the parameter
- (*ppRet)->pParams[ i ].pName = nullptr;
- rtl_uString_acquire( (*ppRet)->pParams[ i ].pName = pParams[i].pParamName );
+ (*ppRet)->pParams[ i ].pName = pParams[i].pParamName;
+ rtl_uString_acquire( (*ppRet)->pParams[ i ].pName );
(*ppRet)->pParams[ i ].pTypeRef = nullptr;
// get the type name of the parameter and create the weak reference
typelib_typedescriptionreference_new(
@@ -1722,7 +1723,8 @@ typelib_TypeDescriptionReference ** copyExceptions(
typelib_TypeDescriptionReference ** p
= new typelib_TypeDescriptionReference *[count];
for (sal_Int32 i = 0; i < count; ++i) {
- typelib_typedescriptionreference_acquire(p[i] = source[i]);
+ p[i] = source[i];
+ typelib_typedescriptionreference_acquire(p[i]);
}
return p;
}
@@ -1746,21 +1748,25 @@ bool createDerivedInterfaceMemberDescription(
= reinterpret_cast<
typelib_InterfaceMethodTypeDescription * >(*result);
newMethod->aBase.nPosition = position;
+ newMethod->aBase.pMemberName
+ = baseMethod->aBase.pMemberName;
rtl_uString_acquire(
- newMethod->aBase.pMemberName
- = baseMethod->aBase.pMemberName);
+ newMethod->aBase.pMemberName);
+ newMethod->pReturnTypeRef = baseMethod->pReturnTypeRef;
typelib_typedescriptionreference_acquire(
- newMethod->pReturnTypeRef = baseMethod->pReturnTypeRef);
+ newMethod->pReturnTypeRef);
newMethod->nParams = baseMethod->nParams;
newMethod->pParams = new typelib_MethodParameter[
newMethod->nParams];
for (sal_Int32 i = 0; i < newMethod->nParams; ++i) {
+ newMethod->pParams[i].pName
+ = baseMethod->pParams[i].pName;
rtl_uString_acquire(
- newMethod->pParams[i].pName
- = baseMethod->pParams[i].pName);
+ newMethod->pParams[i].pName);
+ newMethod->pParams[i].pTypeRef
+ = baseMethod->pParams[i].pTypeRef;
typelib_typedescriptionreference_acquire(
- newMethod->pParams[i].pTypeRef
- = baseMethod->pParams[i].pTypeRef);
+ newMethod->pParams[i].pTypeRef);
newMethod->pParams[i].bIn = baseMethod->pParams[i].bIn;
newMethod->pParams[i].bOut = baseMethod->pParams[i].bOut;
}
@@ -1787,13 +1793,13 @@ bool createDerivedInterfaceMemberDescription(
= reinterpret_cast<
typelib_InterfaceAttributeTypeDescription * >(*result);
newAttribute->aBase.nPosition = position;
- rtl_uString_acquire(
- newAttribute->aBase.pMemberName
- = baseAttribute->aBase.pMemberName);
+ newAttribute->aBase.pMemberName
+ = baseAttribute->aBase.pMemberName;
+ rtl_uString_acquire(newAttribute->aBase.pMemberName);
newAttribute->bReadOnly = baseAttribute->bReadOnly;
- typelib_typedescriptionreference_acquire(
- newAttribute->pAttributeTypeRef
- = baseAttribute->pAttributeTypeRef);
+ newAttribute->pAttributeTypeRef
+ = baseAttribute->pAttributeTypeRef;
+ typelib_typedescriptionreference_acquire(newAttribute->pAttributeTypeRef);
newAttribute->pInterface
= reinterpret_cast< typelib_InterfaceTypeDescription * >(
interface);
@@ -2077,7 +2083,8 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new(
pTDR->eTypeClass = eTypeClass;
pTDR->pUniqueIdentifier = nullptr;
pTDR->pReserved = nullptr;
- rtl_uString_acquire( pTDR->pTypeName = pTypeName );
+ pTDR->pTypeName = pTypeName;
+ rtl_uString_acquire( pTDR->pTypeName );
pTDR->pType = nullptr;
*ppTDR = pTDR;
}
diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx
index b24e0e337bf5..b61973ec0b7f 100644
--- a/cppu/source/uno/copy.hxx
+++ b/cppu/source/uno/copy.hxx
@@ -244,7 +244,8 @@ inline void _copyConstructAnyFromData(
}
else
{
- _acquire( pDestAny->pReserved = *static_cast<void **>(pSource), acquire );
+ pDestAny->pReserved = *static_cast<void **>(pSource);
+ _acquire( pDestAny->pReserved, acquire );
}
break;
default:
@@ -640,7 +641,10 @@ inline void _copyConstructData(
if (mapping)
*static_cast<void **>(pDest) = _map( *static_cast<void **>(pSource), pType, pTypeDescr, mapping );
else
- _acquire( *static_cast<void **>(pDest) = *static_cast<void **>(pSource), acquire );
+ {
+ *static_cast<void **>(pDest) = *static_cast<void **>(pSource);
+ _acquire( *static_cast<void **>(pDest), acquire );
+ }
break;
default:
break;
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 8bbd71891247..aeac8b7ddd8a 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -497,7 +497,9 @@ static void defenv_getRegisteredInterfaces(
for (const auto& rEntry : that->aPtr2ObjectMap)
{
- (*pEnv->acquireInterface)( pEnv, ppInterfaces[nPos++] = rEntry.first );
+ ppInterfaces[nPos] = rEntry.first;
+ (*pEnv->acquireInterface)( pEnv, ppInterfaces[nPos] );
+ nPos++;
}
*pppInterfaces = ppInterfaces;
@@ -858,7 +860,8 @@ static void unoenv_computeObjectIdentifier(
// process;good guid
oid.append( unoenv_getStaticOIdPart() );
OUString aStr( oid.makeStringAndClear() );
- ::rtl_uString_acquire( *ppOId = aStr.pData );
+ *ppOId = aStr.pData;
+ ::rtl_uString_acquire( *ppOId );
}
}
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 43a5bc0d85f9..72d3e3ead42b 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -547,8 +547,8 @@ static bool icopyConstructFromElements(
void ** pDestElements = reinterpret_cast<void **>(pSeq->elements);
for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos )
{
- _acquire( pDestElements[nPos] =
- static_cast<void **>(pSourceElements)[nPos], acquire );
+ pDestElements[nPos] = static_cast<void **>(pSourceElements)[nPos];
+ _acquire( pDestElements[nPos], acquire );
}
}
break;