From 14d38072b5bc6ec83d14fe827209c3a65e35c154 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:26:51 +0100 Subject: More loplugin:cstylecast: cppu auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I8531b2dc474b257c63016c8ae80014c7322e5a71 --- cppu/source/typelib/static_types.cxx | 2 +- cppu/source/typelib/typelib.cxx | 58 +++++++------- cppu/source/uno/destr.hxx | 30 ++++---- cppu/source/uno/eq.hxx | 142 +++++++++++++++++------------------ cppu/source/uno/lbenv.cxx | 4 +- cppu/source/uno/prim.hxx | 8 +- 6 files changed, 122 insertions(+), 122 deletions(-) (limited to 'cppu') diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 3fb0bf6ab62a..9b882afc6d22 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -70,7 +70,7 @@ struct AlignSize_Impl #endif // the value of the maximal alignment -static sal_Int32 nMaxAlignment = (sal_Int32)( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); +static sal_Int32 nMaxAlignment = static_cast( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) { diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 1077761710d7..676fa0ff2b83 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -75,7 +75,7 @@ struct AlignSize_Impl #endif // the value of the maximal alignment -static sal_Int32 nMaxAlignment = (sal_Int32)( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); +static sal_Int32 nMaxAlignment = static_cast( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) { @@ -110,35 +110,35 @@ static inline sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass ) switch( eTypeClass ) { case typelib_TypeClass_SEQUENCE: - nSize = (sal_Int32)sizeof( typelib_IndirectTypeDescription ); + nSize = sal_Int32(sizeof( typelib_IndirectTypeDescription )); break; case typelib_TypeClass_STRUCT: - nSize = (sal_Int32)sizeof( typelib_StructTypeDescription ); + nSize = sal_Int32(sizeof( typelib_StructTypeDescription )); break; case typelib_TypeClass_EXCEPTION: - nSize = (sal_Int32)sizeof( typelib_CompoundTypeDescription ); + nSize = sal_Int32(sizeof( typelib_CompoundTypeDescription )); break; case typelib_TypeClass_ENUM: - nSize = (sal_Int32)sizeof( typelib_EnumTypeDescription ); + nSize = sal_Int32(sizeof( typelib_EnumTypeDescription )); break; case typelib_TypeClass_INTERFACE: - nSize = (sal_Int32)sizeof( typelib_InterfaceTypeDescription ); + nSize = sal_Int32(sizeof( typelib_InterfaceTypeDescription )); break; case typelib_TypeClass_INTERFACE_METHOD: - nSize = (sal_Int32)sizeof( typelib_InterfaceMethodTypeDescription ); + nSize = sal_Int32(sizeof( typelib_InterfaceMethodTypeDescription )); break; case typelib_TypeClass_INTERFACE_ATTRIBUTE: - nSize = (sal_Int32)sizeof( typelib_InterfaceAttributeTypeDescription ); + nSize = sal_Int32(sizeof( typelib_InterfaceAttributeTypeDescription )); break; default: - nSize = (sal_Int32)sizeof( typelib_TypeDescription ); + nSize = sal_Int32(sizeof( typelib_TypeDescription )); } return nSize; } @@ -505,7 +505,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { MutexGuard aGuard( rInit.getMutex() ); if( !rInit.pCache ) rInit.pCache = new TypeDescriptionList_Impl; - if( (sal_Int32)rInit.pCache->size() >= nCacheSize ) + if( static_cast(rInit.pCache->size()) >= nCacheSize ) { typelib_typedescription_release( rInit.pCache->front() ); rInit.pCache->pop_front(); @@ -1622,10 +1622,10 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize( { case typelib_TypeClass_INTERFACE: // FEATURE_INTERFACE - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( void * )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( void * )); break; case typelib_TypeClass_ENUM: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( typelib_TypeClass )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( typelib_TypeClass )); break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: @@ -1648,7 +1648,7 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize( if (pMemberRef->eTypeClass == typelib_TypeClass_INTERFACE || pMemberRef->eTypeClass == typelib_TypeClass_SEQUENCE) { - nMaxIntegral = (sal_Int32)(sizeof(void *)); + nMaxIntegral = sal_Int32(sizeof(void *)); nStructSize = newAlignedSize( nStructSize, nMaxIntegral, nMaxIntegral ); } else @@ -1677,28 +1677,28 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize( } break; case typelib_TypeClass_SEQUENCE: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( void * )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( void * )); break; case typelib_TypeClass_ANY: // FEATURE_ANY - nSize = (sal_Int32)(sizeof( uno_Any )); - rMaxIntegralTypeSize = (sal_Int32)(sizeof( void * )); + nSize = sal_Int32(sizeof( uno_Any )); + rMaxIntegralTypeSize = sal_Int32(sizeof( void * )); break; case typelib_TypeClass_TYPE: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( typelib_TypeDescriptionReference * )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( typelib_TypeDescriptionReference * )); break; case typelib_TypeClass_BOOLEAN: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Bool )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Bool )); break; case typelib_TypeClass_CHAR: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Unicode )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Unicode )); break; case typelib_TypeClass_STRING: // FEATURE_STRING - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( rtl_uString * )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( rtl_uString * )); break; case typelib_TypeClass_FLOAT: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( float )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( float )); break; case typelib_TypeClass_DOUBLE: #ifdef AIX @@ -1706,23 +1706,23 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize( nSize = (sal_Int32)(sizeof(double)); rMaxIntegralTypeSize = (sal_Int32)(sizeof(void*)); #else - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( double )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( double )); #endif break; case typelib_TypeClass_BYTE: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Int8 )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Int8 )); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Int16 )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Int16 )); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Int32 )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Int32 )); break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - nSize = rMaxIntegralTypeSize = (sal_Int32)(sizeof( sal_Int64 )); + nSize = rMaxIntegralTypeSize = sal_Int32(sizeof( sal_Int64 )); break; case typelib_TypeClass_UNKNOWN: case typelib_TypeClass_SERVICE: @@ -2002,7 +2002,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( MutexGuard aGuard( rInit.getMutex() ); if( !rInit.pCache ) rInit.pCache = new TypeDescriptionList_Impl; - if( (sal_Int32)rInit.pCache->size() >= nCacheSize ) + if( static_cast(rInit.pCache->size()) >= nCacheSize ) { typelib_typedescription_release( rInit.pCache->front() ); rInit.pCache->pop_front(); @@ -2060,7 +2060,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( MutexGuard aGuard( rInit.getMutex() ); if( !rInit.pCache ) rInit.pCache = new TypeDescriptionList_Impl; - if( (sal_Int32)rInit.pCache->size() >= nCacheSize ) + if( static_cast(rInit.pCache->size()) >= nCacheSize ) { typelib_typedescription_release( rInit.pCache->front() ); rInit.pCache->pop_front(); @@ -2279,7 +2279,7 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize ) MutexGuard aGuard( rInit.getMutex() ); if ((nNewSize < nCacheSize) && rInit.pCache) { - while ((sal_Int32)rInit.pCache->size() != nNewSize) + while (static_cast(rInit.pCache->size()) != nNewSize) { typelib_typedescription_release( rInit.pCache->front() ); rInit.pCache->pop_front(); diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 580620814b93..4c017615d987 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -132,7 +132,7 @@ inline void _destructAny( break; } #if OSL_DEBUG_LEVEL > 0 - pAny->pData = reinterpret_cast((uintptr_t)0xdeadbeef); + pAny->pData = reinterpret_cast(uintptr_t(0xdeadbeef)); #endif ::typelib_typedescriptionreference_release( pType ); @@ -146,24 +146,24 @@ inline sal_Int32 idestructElements( switch (pElementType->eTypeClass) { case typelib_TypeClass_CHAR: - return (sal_Int32)(sizeof(sal_Unicode)); + return sal_Int32(sizeof(sal_Unicode)); case typelib_TypeClass_BOOLEAN: - return (sal_Int32)(sizeof(sal_Bool)); + return sal_Int32(sizeof(sal_Bool)); case typelib_TypeClass_BYTE: - return (sal_Int32)(sizeof(sal_Int8)); + return sal_Int32(sizeof(sal_Int8)); case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - return (sal_Int32)(sizeof(sal_Int16)); + return sal_Int32(sizeof(sal_Int16)); case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - return (sal_Int32)(sizeof(sal_Int32)); + return sal_Int32(sizeof(sal_Int32)); case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - return (sal_Int32)(sizeof(sal_Int64)); + return sal_Int32(sizeof(sal_Int64)); case typelib_TypeClass_FLOAT: - return (sal_Int32)(sizeof(float)); + return sal_Int32(sizeof(float)); case typelib_TypeClass_DOUBLE: - return (sal_Int32)(sizeof(double)); + return sal_Int32(sizeof(double)); case typelib_TypeClass_STRING: { @@ -172,7 +172,7 @@ inline sal_Int32 idestructElements( { ::rtl_uString_release( pDest[nPos] ); } - return (sal_Int32)(sizeof(rtl_uString *)); + return sal_Int32(sizeof(rtl_uString *)); } case typelib_TypeClass_TYPE: { @@ -181,7 +181,7 @@ inline sal_Int32 idestructElements( { ::typelib_typedescriptionreference_release( pDest[nPos] ); } - return (sal_Int32)(sizeof(typelib_TypeDescriptionReference *)); + return sal_Int32(sizeof(typelib_TypeDescriptionReference *)); } case typelib_TypeClass_ANY: { @@ -190,10 +190,10 @@ inline sal_Int32 idestructElements( { _destructAny( &pDest[nPos], release ); } - return (sal_Int32)(sizeof(uno_Any)); + return sal_Int32(sizeof(uno_Any)); } case typelib_TypeClass_ENUM: - return (sal_Int32)(sizeof(sal_Int32)); + return sal_Int32(sizeof(sal_Int32)); case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { @@ -224,7 +224,7 @@ inline sal_Int32 idestructElements( release ); } TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - return (sal_Int32)(sizeof(uno_Sequence *)); + return sal_Int32(sizeof(uno_Sequence *)); } case typelib_TypeClass_INTERFACE: { @@ -250,7 +250,7 @@ inline sal_Int32 idestructElements( } } } - return (sal_Int32)(sizeof(void *)); + return sal_Int32(sizeof(void *)); } default: OSL_ASSERT(false); diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index 64a4d631ff4a..df0be91ed0b1 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -294,22 +294,22 @@ inline bool _equalData( case typelib_TypeClass_BYTE: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_SHORT: - return ((sal_Int16)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return ((sal_Int32)*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return ((sal_Int32)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: - return ((sal_Int64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: return (*static_cast(pDest) >= 0 && - (sal_Int64)*static_cast(pDest) == *static_cast(pSource)); // same size + static_cast(*static_cast(pDest)) == *static_cast(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -317,24 +317,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*static_cast(pDest) == (sal_Int16)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return ((sal_Int32)*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return ((sal_Int32)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: - return ((sal_Int64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: return (*static_cast(pDest) >= 0 && - (sal_Int64)*static_cast(pDest) == *static_cast(pSource)); // same size + static_cast(*static_cast(pDest)) == *static_cast(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -342,23 +342,23 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return ((sal_Int32)*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return ((sal_Int32)*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_LONG: - return ((sal_Int32)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_uInt32)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return ((sal_uInt64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -366,24 +366,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return (*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (sal_Int32)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: - return ((sal_Int64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: return (*static_cast(pDest) >= 0 && - (sal_Int64)*static_cast(pDest) == *static_cast(pSource)); // same size + static_cast(*static_cast(pDest)) == *static_cast(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -391,23 +391,23 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (sal_uInt32)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return ((sal_Int64)*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_LONG: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return ((sal_uInt64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -415,24 +415,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return (*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return (*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_LONG: - return (*static_cast(pDest) == (sal_Int64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: return (*static_cast(pDest) >= 0 && *static_cast(pDest) == *static_cast(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -441,30 +441,30 @@ inline bool _equalData( { case typelib_TypeClass_BYTE: return (*static_cast(pSource) >= 0 && - *static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + *static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: return (*static_cast(pSource) >= 0 && - *static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + *static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: return (*static_cast(pSource) >= 0 && - *static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + *static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_LONG: - return (*static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: return (*static_cast(pSource) >= 0 && - *static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + *static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_HYPER: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_FLOAT: if (::floor( *static_cast(pSource) ) != *static_cast(pSource) || *static_cast(pSource) < 0) return false; - return (*static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_DOUBLE: if (::floor( *static_cast(pSource) ) != *static_cast(pSource) || *static_cast(pSource) < 0) return false; - return (*static_cast(pDest) == (sal_uInt64)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); default: return false; } @@ -472,25 +472,25 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_LONG: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: - return (*static_cast(pDest) == (float)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_HYPER: if (::floor( *static_cast(pDest) ) != *static_cast(pDest) || *static_cast(pDest) < 0) return false; - return ((sal_uInt64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_FLOAT: return (*static_cast(pDest) == *static_cast(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); default: return false; } @@ -498,23 +498,23 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_SHORT: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_SHORT: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_LONG: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_LONG: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_HYPER: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_UNSIGNED_HYPER: if (::floor( *static_cast(pDest) ) != *static_cast(pDest) || *static_cast(pDest) < 0) return false; - return ((sal_uInt64)*static_cast(pDest) == *static_cast(pSource)); + return (static_cast(*static_cast(pDest)) == *static_cast(pSource)); case typelib_TypeClass_FLOAT: - return (*static_cast(pDest) == (double)*static_cast(pSource)); + return (*static_cast(pDest) == static_cast(*static_cast(pSource))); case typelib_TypeClass_DOUBLE: return (*static_cast(pDest) == *static_cast(pSource)); default: diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 8ca96dc0a7ae..7f40be041ec4 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -806,7 +806,7 @@ namespace if (::osl_getProcessInfo( nullptr, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) { - aRet.append( (sal_Int64)info.Ident, 16 ); + aRet.append( static_cast(info.Ident), 16 ); } else { @@ -817,7 +817,7 @@ namespace ::rtl_getGlobalProcessId( ar ); aRet.append( ';' ); for (unsigned char i : ar) - aRet.append( (sal_Int32)i, 16 ); + aRet.append( static_cast(i), 16 ); m_sOidPart = aRet.makeStringAndClear(); } diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index e8245248be6f..105fabf0f0d8 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -99,12 +99,12 @@ inline sal_uInt32 calcSeqMemSize( sal_Int32 nElementSize, sal_Int32 nElements ) { sal_uInt64 nSize = - (sal_uInt64) SAL_SEQUENCE_HEADER_SIZE + - ((sal_uInt64) nElementSize * (sal_uInt64) nElements); + static_cast(SAL_SEQUENCE_HEADER_SIZE) + + (static_cast(nElementSize) * static_cast(nElements)); if (nSize > 0xffffffffU) return 0; else - return (sal_uInt32) nSize; + return static_cast(nSize); } @@ -127,7 +127,7 @@ inline typelib_TypeDescriptionReference * _getVoidType() inline void CONSTRUCT_EMPTY_ANY(uno_Any * pAny) { pAny->pType = _getVoidType(); #if OSL_DEBUG_LEVEL > 0 - pAny->pData = reinterpret_cast((uintptr_t)0xdeadbeef); + pAny->pData = reinterpret_cast(uintptr_t(0xdeadbeef)); #else pAny->pData = pAny; #endif -- cgit