summaryrefslogtreecommitdiffstats
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.cxx46
1 files changed, 9 insertions, 37 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index d659171f1722..e665b2b4273e 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -35,6 +35,7 @@
#include <osl/diagnose.h>
#include <typelib/typedescription.h>
#include <uno/any2.h>
+#include <o3tl/string_view.hxx>
#include "typelib.hxx"
using namespace osl;
@@ -54,14 +55,7 @@ namespace {
struct AlignSize_Impl
{
sal_Int16 nInt16;
-#ifdef AIX
- //double: doubleword aligned if -qalign=natural/-malign=natural
- //which isn't the default ABI. Otherwise word aligned, While a long long int
- //is always doubleword aligned, so use that instead.
- sal_Int64 dDouble;
-#else
double dDouble;
-#endif
};
}
@@ -160,7 +154,7 @@ typedef std::list< CallbackEntry > CallbackSet_Impl;
typedef std::list< typelib_TypeDescription * > TypeDescriptionList_Impl;
// # of cached elements
-static sal_Int32 nCacheSize = 256;
+constexpr auto nCacheSize = 256;
namespace {
@@ -299,8 +293,7 @@ extern "C" void SAL_CALL typelib_typedescription_revokeCallback(
// todo mt safe: guard is no solution, can not acquire while calling callback!
// OslGuard aGuard( rInit.getMutex() );
CallbackEntry aEntry( pContext, pCallback );
- rInit.maCallbacks.erase(std::remove(rInit.maCallbacks.begin(), rInit.maCallbacks.end(), aEntry),
- rInit.maCallbacks.end());
+ std::erase(rInit.maCallbacks, aEntry);
}
}
@@ -446,7 +439,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) {
// insert into the cache
MutexGuard aGuard( rInit.maMutex );
- if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
+ if( rInit.maCache.size() >= nCacheSize )
{
typelib_typedescription_release( rInit.maCache.front() );
rInit.maCache.pop_front();
@@ -1723,13 +1716,7 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize(
nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( float ));
break;
case typelib_TypeClass_DOUBLE:
-#ifdef AIX
- //See previous AIX ifdef comment for an explanation
- nSize = (sal_Int32)(sizeof(double));
- rMaxIntegralTypeSize = (sal_Int32)(sizeof(void*));
-#else
nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( double ));
-#endif
break;
case typelib_TypeClass_BYTE:
nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Int8 ));
@@ -1984,8 +1971,8 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
&pInterface, name.copy(i4 + 1).pData);
if (!createDerivedInterfaceMemberDescription(
ppRet, name, pBaseRef, pBase, pInterface,
- name.copy(i2, i3 - i2).toInt32(),
- name.copy(i3 + 1, i4 - i3 - 1).toInt32()))
+ o3tl::toInt32(name.subView(i2, i3 - i2)),
+ o3tl::toInt32(name.subView(i3 + 1, i4 - i3 - 1))))
{
if (pInterface != nullptr) {
typelib_typedescription_release(pInterface);
@@ -2030,7 +2017,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
// insert into the cache
MutexGuard aGuard( rInit.maMutex );
- if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
+ if( rInit.maCache.size() >= nCacheSize )
{
typelib_typedescription_release( rInit.maCache.front() );
rInit.maCache.pop_front();
@@ -2084,7 +2071,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new(
// insert into the cache
MutexGuard aGuard( rInit.maMutex );
- if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
+ if( rInit.maCache.size() >= nCacheSize )
{
typelib_typedescription_release( rInit.maCache.front() );
rInit.maCache.pop_front();
@@ -2287,24 +2274,9 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_assign(
}
-extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize )
+extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 )
SAL_THROW_EXTERN_C()
{
- OSL_ENSURE( nNewSize >= 0, "### illegal cache size given!" );
- if (nNewSize < 0)
- return;
-
- TypeDescriptor_Init_Impl &rInit = Init();
- MutexGuard aGuard( rInit.maMutex );
- if (nNewSize < nCacheSize)
- {
- while (static_cast<sal_Int32>(rInit.maCache.size()) != nNewSize)
- {
- typelib_typedescription_release( rInit.maCache.front() );
- rInit.maCache.pop_front();
- }
- }
- nCacheSize = nNewSize;
}