Kaydet (Commit) 14d38072 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: cppu

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I8531b2dc474b257c63016c8ae80014c7322e5a71
üst 71a6caf4
......@@ -70,7 +70,7 @@ struct AlignSize_Impl
#endif
// the value of the maximal alignment
static sal_Int32 nMaxAlignment = (sal_Int32)( reinterpret_cast<sal_Size>(&reinterpret_cast<AlignSize_Impl *>(16)->dDouble) - 16);
static sal_Int32 nMaxAlignment = static_cast<sal_Int32>( reinterpret_cast<sal_Size>(&reinterpret_cast<AlignSize_Impl *>(16)->dDouble) - 16);
static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment )
{
......
......@@ -75,7 +75,7 @@ struct AlignSize_Impl
#endif
// the value of the maximal alignment
static sal_Int32 nMaxAlignment = (sal_Int32)( reinterpret_cast<sal_Size>(&reinterpret_cast<AlignSize_Impl *>(16)->dDouble) - 16);
static sal_Int32 nMaxAlignment = static_cast<sal_Int32>( reinterpret_cast<sal_Size>(&reinterpret_cast<AlignSize_Impl *>(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<sal_Int32>(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<sal_Int32>(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<sal_Int32>(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<sal_Int32>(rInit.pCache->size()) != nNewSize)
{
typelib_typedescription_release( rInit.pCache->front() );
rInit.pCache->pop_front();
......
......@@ -132,7 +132,7 @@ inline void _destructAny(
break;
}
#if OSL_DEBUG_LEVEL > 0
pAny->pData = reinterpret_cast<void *>((uintptr_t)0xdeadbeef);
pAny->pData = reinterpret_cast<void *>(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);
......
This diff is collapsed.
......@@ -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<sal_Int64>(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<sal_Int32>(i), 16 );
m_sOidPart = aRet.makeStringAndClear();
}
......
......@@ -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_uInt64>(SAL_SEQUENCE_HEADER_SIZE) +
(static_cast<sal_uInt64>(nElementSize) * static_cast<sal_uInt64>(nElements));
if (nSize > 0xffffffffU)
return 0;
else
return (sal_uInt32) nSize;
return static_cast<sal_uInt32>(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<void *>((uintptr_t)0xdeadbeef);
pAny->pData = reinterpret_cast<void *>(uintptr_t(0xdeadbeef));
#else
pAny->pData = pAny;
#endif
......
......@@ -390,7 +390,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
value = (sal_uInt16)( * static_cast< const sal_Int8 * >( rAny.pData ) );
value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
return true;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
......@@ -431,10 +431,10 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
value = (sal_uInt32)( * static_cast< const sal_Int8 * >( rAny.pData ) );
value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
return true;
case typelib_TypeClass_SHORT:
value = (sal_uInt32)( * static_cast< const sal_Int16 * >( rAny.pData ) );
value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
return true;
case typelib_TypeClass_UNSIGNED_SHORT:
value = * static_cast< const sal_uInt16 * >( rAny.pData );
......@@ -484,16 +484,16 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
switch (rAny.pType->eTypeClass)
{
case typelib_TypeClass_BYTE:
value = (sal_uInt64)( * static_cast< const sal_Int8 * >( rAny.pData ) );
value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
return true;
case typelib_TypeClass_SHORT:
value = (sal_uInt64)( * static_cast< const sal_Int16 * >( rAny.pData ) );
value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
return true;
case typelib_TypeClass_UNSIGNED_SHORT:
value = * static_cast< const sal_uInt16 * >( rAny.pData );
return true;
case typelib_TypeClass_LONG:
value = (sal_uInt64)( * static_cast< const sal_Int32 * >( rAny.pData ) );
value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
return true;
case typelib_TypeClass_UNSIGNED_LONG:
value = * static_cast< const sal_uInt32 * >( rAny.pData );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment