Kaydet (Commit) 1777f6fe authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up C-style casts from pointers to void

Change-Id: I834eb4ecd0fa71caf6fa746901367fac8b538305
üst d18aa948
...@@ -168,7 +168,7 @@ bool LogBridge::v_isValid(rtl::OUString * pReason) ...@@ -168,7 +168,7 @@ bool LogBridge::v_isValid(rtl::OUString * pReason)
break; break;
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
{ {
const ::rtl::OString sValue( ::rtl::OUStringToOString(((com::sun::star::uno::Type*)pArg)->getTypeName(),osl_getThreadTextEncoding())); const ::rtl::OString sValue( ::rtl::OUStringToOString(static_cast<com::sun::star::uno::Type*>(pArg)->getTypeName(),osl_getThreadTextEncoding()));
SAL_INFO("cppu.log", "" << sValue.getStr()); SAL_INFO("cppu.log", "" << sValue.getStr());
} }
break; break;
......
...@@ -404,7 +404,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, ...@@ -404,7 +404,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef,
pArgs, pArgs,
ppException); ppException);
void ** args = (void **) alloca( sizeof (void *) * nParams ); void ** args = static_cast<void **>(alloca( sizeof (void *) * nParams ));
typelib_TypeDescription * return_td = 0; typelib_TypeDescription * return_td = 0;
void * ret = pReturn; void * ret = pReturn;
......
...@@ -384,7 +384,7 @@ static inline void typelib_typedescription_initTables( ...@@ -384,7 +384,7 @@ static inline void typelib_typedescription_initTables(
{ {
typelib_InterfaceTypeDescription * pITD = reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD); typelib_InterfaceTypeDescription * pITD = reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD);
sal_Bool * pReadWriteAttributes = (sal_Bool *)alloca( pITD->nAllMembers ); sal_Bool * pReadWriteAttributes = static_cast<sal_Bool *>(alloca( pITD->nAllMembers ));
for ( sal_Int32 i = pITD->nAllMembers; i--; ) for ( sal_Int32 i = pITD->nAllMembers; i--; )
{ {
pReadWriteAttributes[i] = sal_False; pReadWriteAttributes[i] = sal_False;
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ inline void _defaultConstructStruct( ...@@ -49,7 +49,7 @@ inline void _defaultConstructStruct(
while (nDescr--) while (nDescr--)
{ {
::uno_type_constructData( (char *)pMem + pMemberOffsets[nDescr], ppTypeRefs[nDescr] ); ::uno_type_constructData( static_cast<char *>(pMem) + pMemberOffsets[nDescr], ppTypeRefs[nDescr] );
} }
} }
...@@ -62,51 +62,51 @@ inline void _defaultConstructData( ...@@ -62,51 +62,51 @@ inline void _defaultConstructData(
switch (pType->eTypeClass) switch (pType->eTypeClass)
{ {
case typelib_TypeClass_CHAR: case typelib_TypeClass_CHAR:
*(sal_Unicode *)pMem = '\0'; *static_cast<sal_Unicode *>(pMem) = '\0';
break; break;
case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BOOLEAN:
*(sal_Bool *)pMem = sal_False; *static_cast<sal_Bool *>(pMem) = sal_False;
break; break;
case typelib_TypeClass_BYTE: case typelib_TypeClass_BYTE:
*(sal_Int8 *)pMem = 0; *static_cast<sal_Int8 *>(pMem) = 0;
break; break;
case typelib_TypeClass_SHORT: case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_UNSIGNED_SHORT:
*(sal_Int16 *)pMem = 0; *static_cast<sal_Int16 *>(pMem) = 0;
break; break;
case typelib_TypeClass_LONG: case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_UNSIGNED_LONG:
*(sal_Int32 *)pMem = 0; *static_cast<sal_Int32 *>(pMem) = 0;
break; break;
case typelib_TypeClass_HYPER: case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_UNSIGNED_HYPER:
*(sal_Int64 *)pMem = 0; *static_cast<sal_Int64 *>(pMem) = 0;
break; break;
case typelib_TypeClass_FLOAT: case typelib_TypeClass_FLOAT:
*(float *)pMem = 0.0; *static_cast<float *>(pMem) = 0.0;
break; break;
case typelib_TypeClass_DOUBLE: case typelib_TypeClass_DOUBLE:
*(double *)pMem = 0.0; *static_cast<double *>(pMem) = 0.0;
break; break;
case typelib_TypeClass_STRING: case typelib_TypeClass_STRING:
*(rtl_uString **)pMem = 0; *static_cast<rtl_uString **>(pMem) = 0;
::rtl_uString_new( (rtl_uString **)pMem ); ::rtl_uString_new( static_cast<rtl_uString **>(pMem) );
break; break;
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
*(typelib_TypeDescriptionReference **)pMem = _getVoidType(); *static_cast<typelib_TypeDescriptionReference **>(pMem) = _getVoidType();
break; break;
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
CONSTRUCT_EMPTY_ANY( (uno_Any *)pMem ); CONSTRUCT_EMPTY_ANY( static_cast<uno_Any *>(pMem) );
break; break;
case typelib_TypeClass_ENUM: case typelib_TypeClass_ENUM:
if (pTypeDescr) if (pTypeDescr)
{ {
*(sal_Int32 *)pMem = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; *static_cast<sal_Int32 *>(pMem) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue;
} }
else else
{ {
TYPELIB_DANGER_GET( &pTypeDescr, pType ); TYPELIB_DANGER_GET( &pTypeDescr, pType );
*(sal_Int32 *)pMem = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; *static_cast<sal_Int32 *>(pMem) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue;
TYPELIB_DANGER_RELEASE( pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr );
} }
break; break;
...@@ -124,10 +124,10 @@ inline void _defaultConstructData( ...@@ -124,10 +124,10 @@ inline void _defaultConstructData(
} }
break; break;
case typelib_TypeClass_SEQUENCE: case typelib_TypeClass_SEQUENCE:
*(uno_Sequence **)pMem = createEmptySequence(); *static_cast<uno_Sequence **>(pMem) = createEmptySequence();
break; break;
case typelib_TypeClass_INTERFACE: case typelib_TypeClass_INTERFACE:
*(void **)pMem = 0; // either cpp or c-uno interface *static_cast<void **>(pMem) = 0; // either cpp or c-uno interface
break; break;
default: default:
OSL_ASSERT(false); OSL_ASSERT(false);
......
This diff is collapsed.
...@@ -66,8 +66,8 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p ...@@ -66,8 +66,8 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p
uno_Any * pExc = &aExc; uno_Any * pExc = &aExc;
void * aArgs[ 1 ]; void * aArgs[ 1 ];
aArgs[ 0 ] = &pDestType; aArgs[ 0 ] = &pDestType;
(*((uno_Interface *) pUnoI)->pDispatcher)( (*static_cast<uno_Interface *>(pUnoI)->pDispatcher)(
(uno_Interface *) pUnoI, g_pQITD, &aRet, aArgs, &pExc ); static_cast<uno_Interface *>(pUnoI), g_pQITD, &aRet, aArgs, &pExc );
uno_Interface * ret = 0; uno_Interface * ret = 0;
if (0 == pExc) if (0 == pExc)
...@@ -81,7 +81,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p ...@@ -81,7 +81,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p
case typelib_TypeClass_INTERFACE: case typelib_TypeClass_INTERFACE:
// tweaky... avoiding acquire/ release pair // tweaky... avoiding acquire/ release pair
typelib_typedescriptionreference_release( ret_type ); typelib_typedescriptionreference_release( ret_type );
ret = (uno_Interface *) aRet.pReserved; // serving acquired interface ret = static_cast<uno_Interface *>(aRet.pReserved); // serving acquired interface
break; break;
default: default:
_destructAny( &aRet, 0 ); _destructAny( &aRet, 0 );
...@@ -307,7 +307,7 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( ...@@ -307,7 +307,7 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData(
// query // query
if (0 == pFrom) if (0 == pFrom)
return sal_False; return sal_False;
void * pInterface = *(void **)pFrom; void * pInterface = *static_cast<void **>(pFrom);
if (0 == pInterface) if (0 == pInterface)
return sal_False; return sal_False;
......
...@@ -55,7 +55,7 @@ inline void _destructStruct( ...@@ -55,7 +55,7 @@ inline void _destructStruct(
while (nDescr--) while (nDescr--)
{ {
::uno_type_destructData( ::uno_type_destructData(
(char *)pValue + pMemberOffsets[nDescr], static_cast<char *>(pValue) + pMemberOffsets[nDescr],
ppTypeRefs[nDescr], release ); ppTypeRefs[nDescr], release );
} }
} }
...@@ -96,15 +96,15 @@ inline void _destructAny( ...@@ -96,15 +96,15 @@ inline void _destructAny(
} }
break; break;
case typelib_TypeClass_STRING: case typelib_TypeClass_STRING:
::rtl_uString_release( (rtl_uString *)pAny->pReserved ); ::rtl_uString_release( static_cast<rtl_uString *>(pAny->pReserved) );
break; break;
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
::typelib_typedescriptionreference_release( ::typelib_typedescriptionreference_release(
(typelib_TypeDescriptionReference *)pAny->pReserved ); static_cast<typelib_TypeDescriptionReference *>(pAny->pReserved) );
break; break;
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
OSL_FAIL( "### unexpected nested any!" ); OSL_FAIL( "### unexpected nested any!" );
::uno_any_destruct( (uno_Any *)pAny->pData, release ); ::uno_any_destruct( static_cast<uno_Any *>(pAny->pData), release );
::rtl_freeMemory( pAny->pData ); ::rtl_freeMemory( pAny->pData );
break; break;
case typelib_TypeClass_TYPEDEF: case typelib_TypeClass_TYPEDEF:
...@@ -168,7 +168,7 @@ inline sal_Int32 idestructElements( ...@@ -168,7 +168,7 @@ inline sal_Int32 idestructElements(
case typelib_TypeClass_STRING: case typelib_TypeClass_STRING:
{ {
rtl_uString ** pDest = (rtl_uString **)pElements; rtl_uString ** pDest = static_cast<rtl_uString **>(pElements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
::rtl_uString_release( pDest[nPos] ); ::rtl_uString_release( pDest[nPos] );
...@@ -177,7 +177,7 @@ inline sal_Int32 idestructElements( ...@@ -177,7 +177,7 @@ inline sal_Int32 idestructElements(
} }
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
{ {
typelib_TypeDescriptionReference ** pDest = (typelib_TypeDescriptionReference **)pElements; typelib_TypeDescriptionReference ** pDest = static_cast<typelib_TypeDescriptionReference **>(pElements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
::typelib_typedescriptionreference_release( pDest[nPos] ); ::typelib_typedescriptionreference_release( pDest[nPos] );
...@@ -186,7 +186,7 @@ inline sal_Int32 idestructElements( ...@@ -186,7 +186,7 @@ inline sal_Int32 idestructElements(
} }
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
{ {
uno_Any * pDest = (uno_Any *)pElements; uno_Any * pDest = static_cast<uno_Any *>(pElements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
_destructAny( &pDest[nPos], release ); _destructAny( &pDest[nPos], release );
...@@ -204,7 +204,7 @@ inline sal_Int32 idestructElements( ...@@ -204,7 +204,7 @@ inline sal_Int32 idestructElements(
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
_destructStruct( _destructStruct(
(char *)pElements + (nElementSize * nPos), static_cast<char *>(pElements) + (nElementSize * nPos),
reinterpret_cast<typelib_CompoundTypeDescription *>(pElementTypeDescr), reinterpret_cast<typelib_CompoundTypeDescription *>(pElementTypeDescr),
release ); release );
} }
...@@ -216,7 +216,7 @@ inline sal_Int32 idestructElements( ...@@ -216,7 +216,7 @@ inline sal_Int32 idestructElements(
{ {
typelib_TypeDescription * pElementTypeDescr = 0; typelib_TypeDescription * pElementTypeDescr = 0;
TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
uno_Sequence ** pDest = (uno_Sequence **)pElements; uno_Sequence ** pDest = static_cast<uno_Sequence **>(pElements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
destructSequence( destructSequence(
...@@ -233,7 +233,7 @@ inline sal_Int32 idestructElements( ...@@ -233,7 +233,7 @@ inline sal_Int32 idestructElements(
{ {
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
void * p = ((void **)pElements)[nPos]; void * p = static_cast<void **>(pElements)[nPos];
if (p) if (p)
{ {
(*release)( p ); (*release)( p );
...@@ -244,7 +244,7 @@ inline sal_Int32 idestructElements( ...@@ -244,7 +244,7 @@ inline sal_Int32 idestructElements(
{ {
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
uno_Interface * p = ((uno_Interface **)pElements)[nPos]; uno_Interface * p = static_cast<uno_Interface **>(pElements)[nPos];
if (p) if (p)
{ {
(*p->release)( p ); (*p->release)( p );
...@@ -310,13 +310,13 @@ inline void _destructData( ...@@ -310,13 +310,13 @@ inline void _destructData(
switch (pType->eTypeClass) switch (pType->eTypeClass)
{ {
case typelib_TypeClass_STRING: case typelib_TypeClass_STRING:
::rtl_uString_release( *(rtl_uString **)pValue ); ::rtl_uString_release( *static_cast<rtl_uString **>(pValue) );
break; break;
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
::typelib_typedescriptionreference_release( *(typelib_TypeDescriptionReference **)pValue ); ::typelib_typedescriptionreference_release( *static_cast<typelib_TypeDescriptionReference **>(pValue) );
break; break;
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
_destructAny( (uno_Any *)pValue, release ); _destructAny( static_cast<uno_Any *>(pValue), release );
break; break;
case typelib_TypeClass_TYPEDEF: case typelib_TypeClass_TYPEDEF:
OSL_FAIL( "### unexpected typedef!" ); OSL_FAIL( "### unexpected typedef!" );
...@@ -337,11 +337,11 @@ inline void _destructData( ...@@ -337,11 +337,11 @@ inline void _destructData(
case typelib_TypeClass_SEQUENCE: case typelib_TypeClass_SEQUENCE:
{ {
idestructSequence( idestructSequence(
*(uno_Sequence **)pValue, pType, pTypeDescr, release ); *static_cast<uno_Sequence **>(pValue), pType, pTypeDescr, release );
break; break;
} }
case typelib_TypeClass_INTERFACE: case typelib_TypeClass_INTERFACE:
_release( *(void **)pValue, release ); _release( *static_cast<void **>(pValue), release );
break; break;
default: default:
break; break;
......
This diff is collapsed.
...@@ -502,7 +502,7 @@ static void SAL_CALL defenv_getRegisteredInterfaces( ...@@ -502,7 +502,7 @@ static void SAL_CALL defenv_getRegisteredInterfaces(
sal_Int32 nLen = that->aPtr2ObjectMap.size(); sal_Int32 nLen = that->aPtr2ObjectMap.size();
sal_Int32 nPos = 0; sal_Int32 nPos = 0;
void ** ppInterfaces = (void **) (*memAlloc)( nLen * sizeof (void *) ); void ** ppInterfaces = static_cast<void **>((*memAlloc)( nLen * sizeof (void *) ));
Ptr2ObjectMap::const_iterator iPos( that->aPtr2ObjectMap.begin() ); Ptr2ObjectMap::const_iterator iPos( that->aPtr2ObjectMap.begin() );
Ptr2ObjectMap::const_iterator const iEnd( that->aPtr2ObjectMap.end() ); Ptr2ObjectMap::const_iterator const iEnd( that->aPtr2ObjectMap.end() );
...@@ -656,7 +656,7 @@ static void writeLine( ...@@ -656,7 +656,7 @@ static void writeLine(
{ {
if (stream) if (stream)
{ {
fprintf( (FILE *) stream, "%s\n", pLine ); fprintf( static_cast<FILE *>(stream), "%s\n", pLine );
} }
else else
{ {
...@@ -671,7 +671,7 @@ static void writeLine( ...@@ -671,7 +671,7 @@ static void writeLine(
{ {
if (stream) if (stream)
{ {
fprintf( (FILE *) stream, "%s\n", pLine ); fprintf( static_cast<FILE *>(stream), "%s\n", pLine );
} }
else else
{ {
...@@ -854,10 +854,10 @@ static void SAL_CALL unoenv_computeObjectIdentifier( ...@@ -854,10 +854,10 @@ static void SAL_CALL unoenv_computeObjectIdentifier(
*ppOId = 0; *ppOId = 0;
} }
uno_Interface * pUnoI = (uno_Interface *) uno_Interface * pUnoI = static_cast<uno_Interface *>(
::cppu::binuno_queryInterface( ::cppu::binuno_queryInterface(
pInterface, *typelib_static_type_getByTypeClass( pInterface, *typelib_static_type_getByTypeClass(
typelib_TypeClass_INTERFACE ) ); typelib_TypeClass_INTERFACE ) ));
if (0 != pUnoI) if (0 != pUnoI)
{ {
(*pUnoI->release)( pUnoI ); (*pUnoI->release)( pUnoI );
...@@ -993,8 +993,8 @@ inline void EnvironmentsData::getRegisteredEnvironments( ...@@ -993,8 +993,8 @@ inline void EnvironmentsData::getRegisteredEnvironments(
assert(pppEnvs && pnLen && memAlloc && "### null ptr!"); assert(pppEnvs && pnLen && memAlloc && "### null ptr!");
// max size // max size
uno_Environment ** ppFound = (uno_Environment **)alloca( uno_Environment ** ppFound = static_cast<uno_Environment **>(alloca(
sizeof(uno_Environment *) * aName2EnvMap.size() ); sizeof(uno_Environment *) * aName2EnvMap.size() ));
sal_Int32 nSize = 0; sal_Int32 nSize = 0;
// find matching environment // find matching environment
...@@ -1015,8 +1015,8 @@ inline void EnvironmentsData::getRegisteredEnvironments( ...@@ -1015,8 +1015,8 @@ inline void EnvironmentsData::getRegisteredEnvironments(
*pnLen = nSize; *pnLen = nSize;
if (nSize) if (nSize)
{ {
*pppEnvs = (uno_Environment **) (*memAlloc)( *pppEnvs = static_cast<uno_Environment **>((*memAlloc)(
sizeof (uno_Environment *) * nSize ); sizeof (uno_Environment *) * nSize ));
OSL_ASSERT( *pppEnvs ); OSL_ASSERT( *pppEnvs );
while (nSize--) while (nSize--)
{ {
...@@ -1058,7 +1058,7 @@ static bool loadEnv(OUString const & cLibStem, ...@@ -1058,7 +1058,7 @@ static bool loadEnv(OUString const & cLibStem,
return false; return false;
OUString aSymbolName(UNO_INIT_ENVIRONMENT); OUString aSymbolName(UNO_INIT_ENVIRONMENT);
uno_initEnvironmentFunc fpInit = (uno_initEnvironmentFunc)aMod.getSymbol(aSymbolName); uno_initEnvironmentFunc fpInit = reinterpret_cast<uno_initEnvironmentFunc>(aMod.getSymbol(aSymbolName));
if (!fpInit) if (!fpInit)
return false; return false;
......
...@@ -419,7 +419,7 @@ static Mapping loadExternalMapping( ...@@ -419,7 +419,7 @@ static Mapping loadExternalMapping(
{ {
OUString aSymbolName( UNO_EXT_GETMAPPING ); OUString aSymbolName( UNO_EXT_GETMAPPING );
uno_ext_getMappingFunc fpGetMapFunc = uno_ext_getMappingFunc fpGetMapFunc =
(uno_ext_getMappingFunc)aModule.getSymbol( aSymbolName ); reinterpret_cast<uno_ext_getMappingFunc>(aModule.getSymbol( aSymbolName ));
if (fpGetMapFunc) if (fpGetMapFunc)
{ {
......
...@@ -80,7 +80,7 @@ inline void _acquire( void * p, uno_AcquireFunc acquire ) ...@@ -80,7 +80,7 @@ inline void _acquire( void * p, uno_AcquireFunc acquire )
} }
else else
{ {
(*((uno_Interface *)p)->acquire)( (uno_Interface *)p ); (*static_cast<uno_Interface *>(p)->acquire)( static_cast<uno_Interface *>(p) );
} }
} }
} }
...@@ -95,7 +95,7 @@ inline void _release( void * p, uno_ReleaseFunc release ) ...@@ -95,7 +95,7 @@ inline void _release( void * p, uno_ReleaseFunc release )
} }
else else
{ {
(*((uno_Interface *)p)->release)( (uno_Interface *)p ); (*static_cast<uno_Interface *>(p)->release)( static_cast<uno_Interface *>(p) );
} }
} }
} }
......
...@@ -51,11 +51,11 @@ static inline uno_Sequence * reallocSeq( ...@@ -51,11 +51,11 @@ static inline uno_Sequence * reallocSeq(
{ {
if (pReallocate == 0) if (pReallocate == 0)
{ {
pNew = (uno_Sequence *) rtl_allocateMemory( nSize ); pNew = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize ));
} }
else else
{ {
pNew = (uno_Sequence *) rtl_reallocateMemory( pReallocate, nSize ); pNew = static_cast<uno_Sequence *>(rtl_reallocateMemory( pReallocate, nSize ));
} }
if (pNew != 0) if (pNew != 0)
{ {
...@@ -330,7 +330,7 @@ static inline bool icopyConstructFromElements( ...@@ -330,7 +330,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), pSeq->elements + (sizeof(sal_Unicode) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Unicode) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Unicode) * nStartIndex),
sizeof(sal_Unicode) * (nStopIndex - nStartIndex) ); sizeof(sal_Unicode) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -341,7 +341,7 @@ static inline bool icopyConstructFromElements( ...@@ -341,7 +341,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Bool) * nStartIndex), pSeq->elements + (sizeof(sal_Bool) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Bool) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Bool) * nStartIndex),
sizeof(sal_Bool) * (nStopIndex - nStartIndex) ); sizeof(sal_Bool) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -352,7 +352,7 @@ static inline bool icopyConstructFromElements( ...@@ -352,7 +352,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Int8) * nStartIndex), pSeq->elements + (sizeof(sal_Int8) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Int8) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Int8) * nStartIndex),
sizeof(sal_Int8) * (nStopIndex - nStartIndex) ); sizeof(sal_Int8) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -364,7 +364,7 @@ static inline bool icopyConstructFromElements( ...@@ -364,7 +364,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Int16) * nStartIndex), pSeq->elements + (sizeof(sal_Int16) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Int16) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Int16) * nStartIndex),
sizeof(sal_Int16) * (nStopIndex - nStartIndex) ); sizeof(sal_Int16) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -376,7 +376,7 @@ static inline bool icopyConstructFromElements( ...@@ -376,7 +376,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Int32) * nStartIndex), pSeq->elements + (sizeof(sal_Int32) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Int32) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Int32) * nStartIndex),
sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); sizeof(sal_Int32) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -388,7 +388,7 @@ static inline bool icopyConstructFromElements( ...@@ -388,7 +388,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Int64) * nStartIndex), pSeq->elements + (sizeof(sal_Int64) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Int64) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Int64) * nStartIndex),
sizeof(sal_Int64) * (nStopIndex - nStartIndex) ); sizeof(sal_Int64) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -399,7 +399,7 @@ static inline bool icopyConstructFromElements( ...@@ -399,7 +399,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(float) * nStartIndex), pSeq->elements + (sizeof(float) * nStartIndex),
(char *)pSourceElements + (sizeof(float) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(float) * nStartIndex),
sizeof(float) * (nStopIndex - nStartIndex) ); sizeof(float) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -410,7 +410,7 @@ static inline bool icopyConstructFromElements( ...@@ -410,7 +410,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(double) * nStartIndex), pSeq->elements + (sizeof(double) * nStartIndex),
(char *)pSourceElements + (sizeof(double) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(double) * nStartIndex),
sizeof(double) * (nStopIndex - nStartIndex) ); sizeof(double) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -421,7 +421,7 @@ static inline bool icopyConstructFromElements( ...@@ -421,7 +421,7 @@ static inline bool icopyConstructFromElements(
{ {
memcpy( memcpy(
pSeq->elements + (sizeof(sal_Int32) * nStartIndex), pSeq->elements + (sizeof(sal_Int32) * nStartIndex),
(char *)pSourceElements + (sizeof(sal_Int32) * nStartIndex), static_cast<char *>(pSourceElements) + (sizeof(sal_Int32) * nStartIndex),
sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); sizeof(sal_Int32) * (nStopIndex - nStartIndex) );
} }
break; break;
...@@ -437,8 +437,8 @@ static inline bool icopyConstructFromElements( ...@@ -437,8 +437,8 @@ static inline bool icopyConstructFromElements(
// This code tends to trigger coverity's overrun-buffer-arg warning // This code tends to trigger coverity's overrun-buffer-arg warning
// coverity[index_parm_via_loop_bound] - https://communities.coverity.com/thread/2993 // coverity[index_parm_via_loop_bound] - https://communities.coverity.com/thread/2993
::rtl_uString_acquire( ::rtl_uString_acquire(
((rtl_uString **)pSourceElements)[nPos] ); static_cast<rtl_uString **>(pSourceElements)[nPos] );
pDestElements[nPos] = ((rtl_uString **)pSourceElements)[nPos]; pDestElements[nPos] = static_cast<rtl_uString **>(pSourceElements)[nPos];
} }
} }
break; break;
...@@ -457,10 +457,10 @@ static inline bool icopyConstructFromElements( ...@@ -457,10 +457,10 @@ static inline bool icopyConstructFromElements(
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
TYPE_ACQUIRE( TYPE_ACQUIRE(
((typelib_TypeDescriptionReference **) static_cast<typelib_TypeDescriptionReference **>(
pSourceElements)[nPos] ); pSourceElements)[nPos] );
pDestElements[nPos] = pDestElements[nPos] =
((typelib_TypeDescriptionReference **) static_cast<typelib_TypeDescriptionReference **>(
pSourceElements)[nPos]; pSourceElements)[nPos];
} }
} }
...@@ -475,7 +475,7 @@ static inline bool icopyConstructFromElements( ...@@ -475,7 +475,7 @@ static inline bool icopyConstructFromElements(
uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements); uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
uno_Any * pSource = (uno_Any *)pSourceElements + nPos; uno_Any * pSource = static_cast<uno_Any *>(pSourceElements) + nPos;
_copyConstructAny( _copyConstructAny(
&pDestElements[nPos], &pDestElements[nPos],
pSource->pData, pSource->pData,
...@@ -505,7 +505,7 @@ static inline bool icopyConstructFromElements( ...@@ -505,7 +505,7 @@ static inline bool icopyConstructFromElements(
char * pDest = char * pDest =
pDestElements + (nElementSize * nPos); pDestElements + (nElementSize * nPos);
char * pSource = char * pSource =
(char *)pSourceElements + (nElementSize * nPos); static_cast<char *>(pSourceElements) + (nElementSize * nPos);
if (pTypeDescr->pBaseTypeDescription) if (pTypeDescr->pBaseTypeDescription)
{ {
...@@ -551,7 +551,7 @@ static inline bool icopyConstructFromElements( ...@@ -551,7 +551,7 @@ static inline bool icopyConstructFromElements(
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
uno_Sequence * pNew = icopyConstructSequence( uno_Sequence * pNew = icopyConstructSequence(
((uno_Sequence **) pSourceElements)[nPos], static_cast<uno_Sequence **>(pSourceElements)[nPos],
pSeqElementType, acquire, 0 ); pSeqElementType, acquire, 0 );
OSL_ASSERT( pNew != 0 ); OSL_ASSERT( pNew != 0 );
// ought never be a memory allocation problem, // ought never be a memory allocation problem,
...@@ -572,7 +572,7 @@ static inline bool icopyConstructFromElements( ...@@ -572,7 +572,7 @@ static inline bool icopyConstructFromElements(
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{ {
_acquire( pDestElements[nPos] = _acquire( pDestElements[nPos] =
((void **)pSourceElements)[nPos], acquire ); static_cast<void **>(pSourceElements)[nPos], acquire );
} }
} }
break; break;
......
...@@ -63,14 +63,14 @@ private: ...@@ -63,14 +63,14 @@ private:
Enterable & operator = (Enterable const &) SAL_DELETED_FUNCTION; Enterable & operator = (Enterable const &) SAL_DELETED_FUNCTION;
}; };
extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); } extern "C" inline void Enterable_call_enter (void * context) { static_cast<Enterable *>(context)->v_enter(); }
extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); } extern "C" inline void Enterable_call_leave (void * context) { static_cast<Enterable *>(context)->v_leave(); }
extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam) extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam)
{ ((Enterable *)context)->v_callInto_v(pCallee, pParam); } { static_cast<Enterable *>(context)->v_callInto_v(pCallee, pParam); }
extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam) extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam)
{ ((Enterable *)context)->v_callOut_v(pCallee, pParam); } { static_cast<Enterable *>(context)->v_callOut_v(pCallee, pParam); }
extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason) extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason)
{return ((Enterable *)context)->v_isValid(reinterpret_cast<rtl::OUString *>(pReason));} {return static_cast<Enterable *>(context)->v_isValid(reinterpret_cast<rtl::OUString *>(pReason));}
Enterable::Enterable(void) Enterable::Enterable(void)
......
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