loplugin:flatten in cppu

Change-Id: I202698a0310bd26b98c1f744c8f21288f87643f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92450
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-04-17 15:42:46 +02:00
parent dbda099d19
commit c12a5e8380
5 changed files with 422 additions and 422 deletions

View File

@@ -126,8 +126,9 @@ extern "C" {
static void delete_IdContainer( void * p )
{
if (p)
{
if (!p)
return;
IdContainer * pId = static_cast< IdContainer * >( p );
if (pId->pCurrentContext)
{
@@ -142,7 +143,6 @@ static void delete_IdContainer( void * p )
::rtl_byte_sequence_release( pId->pCurrentId );
}
delete pId;
}
}
}

View File

@@ -297,11 +297,13 @@ void SAL_CALL typelib_static_sequence_type_init(
typelib_TypeDescriptionReference * pElementType )
SAL_THROW_EXTERN_C()
{
if (! *ppRef)
{
if ( *ppRef)
return;
MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
if ( *ppRef)
return;
OUString aTypeName = "[]" + OUString::unacquired(&pElementType->pTypeName);
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
@@ -319,8 +321,6 @@ void SAL_CALL typelib_static_sequence_type_init(
}
// another static ref:
++((*ppRef)->nStaticRefCount);
}
}
}
@@ -335,11 +335,13 @@ void init(
{
assert( eTypeClass == typelib_TypeClass_STRUCT || eTypeClass == typelib_TypeClass_EXCEPTION );
if (! *ppRef)
{
if ( *ppRef)
return;
MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
if ( *ppRef)
return;
assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(eTypeClass) );
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
*ppRef = igetTypeByName( aTypeName.pData );
@@ -403,8 +405,6 @@ void init(
}
// another static ref:
++((*ppRef)->nStaticRefCount);
}
}
}
}
@@ -449,11 +449,13 @@ void SAL_CALL typelib_static_mi_interface_type_init(
typelib_TypeDescriptionReference ** ppBaseTypes )
SAL_THROW_EXTERN_C()
{
if (! *ppRef)
{
if ( *ppRef)
return;
MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
if ( *ppRef)
return;
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_INTERFACE) );
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
*ppRef = igetTypeByName( aTypeName.pData );
@@ -501,8 +503,6 @@ void SAL_CALL typelib_static_mi_interface_type_init(
}
// another static ref:
++((*ppRef)->nStaticRefCount);
}
}
}
@@ -512,11 +512,13 @@ void SAL_CALL typelib_static_enum_type_init(
sal_Int32 nDefaultValue )
SAL_THROW_EXTERN_C()
{
if (! *ppRef)
{
if ( *ppRef)
return;
MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
if ( *ppRef)
return;
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM) );
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
*ppRef = igetTypeByName( aTypeName.pData );
@@ -541,8 +543,6 @@ void SAL_CALL typelib_static_enum_type_init(
}
// another static ref:
++((*ppRef)->nStaticRefCount);
}
}
}
} // extern "C"

View File

@@ -362,8 +362,9 @@ static void typelib_typedescription_initTables(
}
MutexGuard aGuard( Init::get().getMutex() );
if( !pTD->bComplete )
{
if( pTD->bComplete )
return;
// create the index table from member to function table
pITD->pMapMemberIndexToFunctionIndex = new sal_Int32[ pITD->nAllMembers ];
sal_Int32 nAdditionalOffset = 0; // +1 for read/write attributes
@@ -397,7 +398,6 @@ static void typelib_typedescription_initTables(
// must be the last action after all initialization is done
pITD->nMapFunctionIndexToMemberIndex = pITD->nAllMembers + nAdditionalOffset;
pTD->bComplete = true;
}
}
namespace {
@@ -1363,8 +1363,9 @@ extern "C" void SAL_CALL typelib_typedescription_release(
{
sal_Int32 ref = osl_atomic_decrement( &pTD->nRefCount );
OSL_ASSERT(ref >= 0);
if (0 == ref)
{
if (0 != ref)
return;
TypeDescriptor_Init_Impl &rInit = Init::get();
if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
{
@@ -1424,7 +1425,6 @@ extern "C" void SAL_CALL typelib_typedescription_release(
#endif
freeTypeDescription(pTD);
}
}
@@ -1899,8 +1899,9 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
typelib_typedescriptionreference_release( pTDR );
}
if (nullptr == *ppRet)
{
if (nullptr != *ppRet)
return;
// check for sequence
OUString const & name = OUString::unacquired( &pName );
if (2 < name.getLength() && '[' == name[ 0 ])
@@ -1963,8 +1964,9 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
rInit.callChain( ppRet, pName );
}
if( *ppRet )
{
if( !(*ppRet) )
return;
// typedescription found
if (typelib_TypeClass_TYPEDEF == (*ppRet)->eTypeClass)
{
@@ -1995,8 +1997,6 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
typelib_typedescription_acquire( *ppRet );
rInit.pCache->push_back( *ppRet );
}
}
}
}
extern "C" void SAL_CALL typelib_typedescriptionreference_newByAsciiName(
@@ -2204,12 +2204,14 @@ extern "C" void typelib_typedescriptionreference_getByName(
*ppRet = nullptr;
}
TypeDescriptor_Init_Impl &rInit = Init::get();
if( rInit.pWeakMap )
{
if( !rInit.pWeakMap )
return;
MutexGuard aGuard( rInit.getMutex() );
WeakMap_Impl::const_iterator aIt = rInit.pWeakMap->find( pName->buffer );
if( aIt != rInit.pWeakMap->end() )
{
if( aIt == rInit.pWeakMap->end() )
return;
sal_Int32 n = osl_atomic_increment( &(*aIt).second->nRefCount );
if( n > 1 )
{
@@ -2223,8 +2225,6 @@ extern "C" void typelib_typedescriptionreference_getByName(
// no access through this weak reference
(void)osl_atomic_decrement( &(*aIt).second->nRefCount );
}
}
}
}
@@ -2258,8 +2258,9 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize )
SAL_THROW_EXTERN_C()
{
OSL_ENSURE( nNewSize >= 0, "### illegal cache size given!" );
if (nNewSize >= 0)
{
if (nNewSize < 0)
return;
TypeDescriptor_Init_Impl &rInit = Init::get();
MutexGuard aGuard( rInit.getMutex() );
if ((nNewSize < nCacheSize) && rInit.pCache)
@@ -2271,7 +2272,6 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize )
}
}
nCacheSize = nNewSize;
}
}

View File

@@ -844,8 +844,9 @@ static void unoenv_computeObjectIdentifier(
::cppu::binuno_queryInterface(
pInterface, *typelib_static_type_getByTypeClass(
typelib_TypeClass_INTERFACE ) ));
if (nullptr != pUnoI)
{
if (nullptr == pUnoI)
return;
(*pUnoI->release)( pUnoI );
// interface
OUStringBuffer oid( 64 );
@@ -862,7 +863,6 @@ static void unoenv_computeObjectIdentifier(
OUString aStr( oid.makeStringAndClear() );
*ppOId = aStr.pData;
::rtl_uString_acquire( *ppOId );
}
}

View File

@@ -236,8 +236,9 @@ static void mediate_mapInterface(
typelib_InterfaceTypeDescription * pInterfaceTypeDescr )
{
OSL_ENSURE( pMapping && ppOut, "### null ptr!" );
if (pMapping && ppOut)
{
if (!(pMapping && ppOut))
return;
uno_Mediate_Mapping * that = static_cast< uno_Mediate_Mapping * >( pMapping );
uno_Mapping * pFrom2Uno = that->aFrom2Uno.get();
@@ -261,7 +262,6 @@ static void mediate_mapInterface(
(*pUno2To->mapInterface)( pUno2To, ppOut, pUnoI, pInterfaceTypeDescr );
(*pUnoI->release)( pUnoI );
}
}
}
}