d46f659c75 follow-up: simplify checks

Change-Id: Ib95e7c562741f76a742cd31aa033956a0f0a3c45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124169
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2021-10-26 10:53:02 +03:00
parent 3fd9f90cfa
commit 58edf89898

View file

@ -384,20 +384,17 @@ inline bool _assignData(
}
return false;
case typelib_TypeClass_SEQUENCE:
if (typelib_TypeClass_SEQUENCE != pSourceType->eTypeClass)
if (!_type_equals( pDestType, pSourceType ))
return false;
// self assignment:
if (*static_cast<uno_Sequence **>(pSource) == *static_cast<uno_Sequence **>(pDest))
return _type_equals(pDestType, pSourceType); // E.g. static empty sequence may be shared
if (_type_equals( pDestType, pSourceType ))
// check self assignment (only after _type_equals, to account for shared static empty):
if (*static_cast<uno_Sequence **>(pSource) != *static_cast<uno_Sequence **>(pDest))
{
osl_atomic_increment( &(*static_cast<uno_Sequence **>(pSource))->nRefCount );
idestructSequence(
*static_cast<uno_Sequence **>(pDest), pDestType, pDestTypeDescr, release );
*static_cast<uno_Sequence **>(pDest) = *static_cast<uno_Sequence **>(pSource);
return true;
}
return false;
return true;
case typelib_TypeClass_INTERFACE:
if (typelib_TypeClass_INTERFACE != pSourceType->eTypeClass)
return false;