summaryrefslogtreecommitdiff
path: root/cppu/source/typelib/typelib.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppu/source/typelib/typelib.cxx')
-rw-r--r--cppu/source/typelib/typelib.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index d4a65a6f7b5e..1f7af60693e2 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -848,6 +848,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEnum(
pEnum->pEnumValues = new sal_Int32[ nEnumValues ];
::memcpy( pEnum->pEnumValues, pEnumValues, nEnumValues * sizeof(sal_Int32) );
+ static_assert(!TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM));
(*ppRet)->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(*ppRet);
// sizeof(void) not allowed
(*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;
- if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE ) )
- pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
+ static_assert( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE ) );
+ pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
pTmp->nSize = typelib_typedescription_getAlignedUnoSize( pTmp, 0, pTmp->nAlignment );
pTmp->nAlignment = adjustAlignment( pTmp->nAlignment );
pTmp->bComplete = false;
@@ -1111,7 +1112,6 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod(
typelib_typedescription_newEmpty(
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,
pTypeName->buffer + nOffset +1,
@@ -1146,8 +1146,8 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod(
&& nAbsolutePosition < pInterface->nAllMembers);
(*ppRet)->nIndex = nAbsolutePosition
- (pInterface->nAllMembers - pInterface->nMembers);
- if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_METHOD ) )
- pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
+ static_assert( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_METHOD ) );
+ assert(reinterpret_cast<typelib_TypeDescription *>(*ppRet)->pWeakRef == nullptr);
}
@@ -1203,7 +1203,6 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
typelib_typedescription_newEmpty(
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,
pTypeName->buffer + nOffset +1,
@@ -1224,8 +1223,8 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(
(*ppRet)->nSetExceptions = nSetExceptions;
(*ppRet)->ppSetExceptions = copyExceptions(
nSetExceptions, ppSetExceptionNames);
- if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_ATTRIBUTE ) )
- pTmp->pWeakRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pTmp);
+ static_assert( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( typelib_TypeClass_INTERFACE_ATTRIBUTE ) );
+ assert(reinterpret_cast<typelib_TypeDescription *>(*ppRet)->pWeakRef == nullptr);
}