Make TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK constexpr
...and make dynamic verifications static where applicable Change-Id: I3fb7ebe6885ee70e493ec1365601a1177d181347 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90002 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
5e518d6608
commit
af1a158724
3 changed files with 13 additions and 11 deletions
|
@ -302,7 +302,7 @@ void SAL_CALL typelib_static_sequence_type_init(
|
||||||
{
|
{
|
||||||
OUString aTypeName = "[]" + OUString::unacquired(&pElementType->pTypeName);
|
OUString aTypeName = "[]" + OUString::unacquired(&pElementType->pTypeName);
|
||||||
|
|
||||||
assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
|
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
|
||||||
*ppRef = igetTypeByName( aTypeName.pData );
|
*ppRef = igetTypeByName( aTypeName.pData );
|
||||||
if (!*ppRef)
|
if (!*ppRef)
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ void SAL_CALL typelib_static_mi_interface_type_init(
|
||||||
MutexGuard aGuard( typelib_StaticInitMutex::get() );
|
MutexGuard aGuard( typelib_StaticInitMutex::get() );
|
||||||
if (! *ppRef)
|
if (! *ppRef)
|
||||||
{
|
{
|
||||||
assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_INTERFACE) );
|
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_INTERFACE) );
|
||||||
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
|
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
|
||||||
*ppRef = igetTypeByName( aTypeName.pData );
|
*ppRef = igetTypeByName( aTypeName.pData );
|
||||||
if (!*ppRef)
|
if (!*ppRef)
|
||||||
|
@ -514,7 +514,7 @@ void SAL_CALL typelib_static_enum_type_init(
|
||||||
MutexGuard aGuard( typelib_StaticInitMutex::get() );
|
MutexGuard aGuard( typelib_StaticInitMutex::get() );
|
||||||
if (! *ppRef)
|
if (! *ppRef)
|
||||||
{
|
{
|
||||||
assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM) );
|
static_assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM) );
|
||||||
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
|
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
|
||||||
*ppRef = igetTypeByName( aTypeName.pData );
|
*ppRef = igetTypeByName( aTypeName.pData );
|
||||||
if (!*ppRef)
|
if (!*ppRef)
|
||||||
|
|
|
@ -848,6 +848,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEnum(
|
||||||
pEnum->pEnumValues = new sal_Int32[ nEnumValues ];
|
pEnum->pEnumValues = new sal_Int32[ nEnumValues ];
|
||||||
::memcpy( pEnum->pEnumValues, pEnumValues, nEnumValues * sizeof(sal_Int32) );
|
::memcpy( pEnum->pEnumValues, pEnumValues, nEnumValues * sizeof(sal_Int32) );
|
||||||
|
|
||||||
|
static_assert(!TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM));
|
||||||
(*ppRet)->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(*ppRet);
|
(*ppRet)->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(*ppRet);
|
||||||
// sizeof(void) not allowed
|
// sizeof(void) not allowed
|
||||||
(*ppRet)->nSize = typelib_typedescription_getAlignedUnoSize( (*ppRet), 0, (*ppRet)->nAlignment );
|
(*ppRet)->nSize = typelib_typedescription_getAlignedUnoSize( (*ppRet), 0, (*ppRet)->nAlignment );
|
||||||
|
@ -1041,8 +1042,8 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
typelib_TypeDescription * pTmp = &pITD->aBase;
|
typelib_TypeDescription * pTmp = &pITD->aBase;
|
||||||
if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE ) )
|
static_assert( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE ) );
|
||||||
pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
|
pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
|
||||||
pTmp->nSize = typelib_typedescription_getAlignedUnoSize( pTmp, 0, pTmp->nAlignment );
|
pTmp->nSize = typelib_typedescription_getAlignedUnoSize( pTmp, 0, pTmp->nAlignment );
|
||||||
pTmp->nAlignment = adjustAlignment( pTmp->nAlignment );
|
pTmp->nAlignment = adjustAlignment( pTmp->nAlignment );
|
||||||
pTmp->bComplete = false;
|
pTmp->bComplete = false;
|
||||||
|
@ -1111,7 +1112,6 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod(
|
||||||
|
|
||||||
typelib_typedescription_newEmpty(
|
typelib_typedescription_newEmpty(
|
||||||
reinterpret_cast<typelib_TypeDescription **>(ppRet), typelib_TypeClass_INTERFACE_METHOD, pTypeName );
|
reinterpret_cast<typelib_TypeDescription **>(ppRet), typelib_TypeClass_INTERFACE_METHOD, pTypeName );
|
||||||
typelib_TypeDescription * pTmp = reinterpret_cast<typelib_TypeDescription *>(*ppRet);
|
|
||||||
|
|
||||||
rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName,
|
rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName,
|
||||||
pTypeName->buffer + nOffset +1,
|
pTypeName->buffer + nOffset +1,
|
||||||
|
@ -1146,8 +1146,8 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod(
|
||||||
&& nAbsolutePosition < pInterface->nAllMembers);
|
&& nAbsolutePosition < pInterface->nAllMembers);
|
||||||
(*ppRet)->nIndex = nAbsolutePosition
|
(*ppRet)->nIndex = nAbsolutePosition
|
||||||
- (pInterface->nAllMembers - pInterface->nMembers);
|
- (pInterface->nAllMembers - pInterface->nMembers);
|
||||||
if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_METHOD ) )
|
static_assert( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_METHOD ) );
|
||||||
pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
|
assert(reinterpret_cast<typelib_TypeDescription *>(*ppRet)->pWeakRef == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1203,7 +1203,6 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
|
||||||
|
|
||||||
typelib_typedescription_newEmpty(
|
typelib_typedescription_newEmpty(
|
||||||
reinterpret_cast<typelib_TypeDescription **>(ppRet), typelib_TypeClass_INTERFACE_ATTRIBUTE, pTypeName );
|
reinterpret_cast<typelib_TypeDescription **>(ppRet), typelib_TypeClass_INTERFACE_ATTRIBUTE, pTypeName );
|
||||||
typelib_TypeDescription * pTmp = reinterpret_cast<typelib_TypeDescription *>(*ppRet);
|
|
||||||
|
|
||||||
rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName,
|
rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName,
|
||||||
pTypeName->buffer + nOffset +1,
|
pTypeName->buffer + nOffset +1,
|
||||||
|
@ -1224,8 +1223,8 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
|
||||||
(*ppRet)->nSetExceptions = nSetExceptions;
|
(*ppRet)->nSetExceptions = nSetExceptions;
|
||||||
(*ppRet)->ppSetExceptions = copyExceptions(
|
(*ppRet)->ppSetExceptions = copyExceptions(
|
||||||
nSetExceptions, ppSetExceptionNames);
|
nSetExceptions, ppSetExceptionNames);
|
||||||
if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_ATTRIBUTE ) )
|
static_assert( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_ATTRIBUTE ) );
|
||||||
pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
|
assert(reinterpret_cast<typelib_TypeDescription *>(*ppRet)->pWeakRef == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -987,6 +987,9 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_complete(
|
||||||
description is not initialized.
|
description is not initialized.
|
||||||
@internal
|
@internal
|
||||||
*/
|
*/
|
||||||
|
#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
|
||||||
|
constexpr
|
||||||
|
#endif
|
||||||
inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
|
inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
|
||||||
{
|
{
|
||||||
return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
|
return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
|
||||||
|
|
Loading…
Reference in a new issue