diff options
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 10 | ||||
-rw-r--r-- | stoc/source/corereflection/crarray.cxx | 10 | ||||
-rw-r--r-- | stoc/source/corereflection/crcomp.cxx | 6 | ||||
-rw-r--r-- | stoc/source/corereflection/crefl.cxx | 8 | ||||
-rw-r--r-- | stoc/source/corereflection/criface.cxx | 22 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 12 | ||||
-rw-r--r-- | stoc/source/invocation/invocation.cxx | 2 | ||||
-rw-r--r-- | stoc/source/invocation_adapterfactory/iafactory.cxx | 18 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 2 | ||||
-rw-r--r-- | stoc/source/typeconv/convert.cxx | 88 |
10 files changed, 89 insertions, 89 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 7e6eaf0efb7f..7c83960acd4f 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -403,11 +403,11 @@ inline bool coerce_assign( css::uno::Reference< css::uno::XInterface > xVal; if (extract( rSource, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD), xVal, pRefl )) { - if (*(css::uno::XInterface **)pDest) - (*(css::uno::XInterface **)pDest)->release(); - *(css::uno::XInterface **)pDest = xVal.get(); - if (*(css::uno::XInterface **)pDest) - (*(css::uno::XInterface **)pDest)->acquire(); + if (*static_cast<css::uno::XInterface **>(pDest)) + (*static_cast<css::uno::XInterface **>(pDest))->release(); + *static_cast<css::uno::XInterface **>(pDest) = xVal.get(); + if (*static_cast<css::uno::XInterface **>(pDest)) + (*static_cast<css::uno::XInterface **>(pDest))->acquire(); return true; } return false; diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx index e35d30ef1306..0d6fa9c29f89 100644 --- a/stoc/source/corereflection/crarray.cxx +++ b/stoc/source/corereflection/crarray.cxx @@ -94,7 +94,7 @@ void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen ) (XWeak *)(OWeakObject *)this, 1 ); } - uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue(); + uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue())); uno_sequence_realloc( ppSeq, &getTypeDescr()->aBase, nLen, reinterpret_cast< uno_AcquireFunc >(cpp_acquire), @@ -113,7 +113,7 @@ sal_Int32 ArrayIdlClassImpl::getLen( const Any & rArray ) (XWeak *)(OWeakObject *)this, 0 ); } - return (*(uno_Sequence **)rArray.getValue())->nElements; + return (*static_cast<uno_Sequence * const *>(rArray.getValue()))->nElements; } Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex ) @@ -127,7 +127,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex ) (XWeak *)(OWeakObject *)this, 0 ); } - uno_Sequence * pSeq = *(uno_Sequence **)rArray.getValue(); + uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue()); if (pSeq->nElements <= nIndex) { throw ArrayIndexOutOfBoundsException( @@ -158,7 +158,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal (XWeak *)(OWeakObject *)this, 0 ); } - uno_Sequence * pSeq = *(uno_Sequence **)rArray.getValue(); + uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue()); if (pSeq->nElements <= nIndex) { throw ArrayIndexOutOfBoundsException( @@ -166,7 +166,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal (XWeak *)(OWeakObject *)this ); } - uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue(); + uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue())); uno_sequence_reference2One( ppSeq, &getTypeDescr()->aBase, reinterpret_cast< uno_AcquireFunc >(cpp_acquire), diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index 9805938c56f0..995c74badb3f 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -190,7 +190,7 @@ Any IdlCompFieldImpl::get( const Any & rObj ) uno_any_destruct( &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) ); uno_any_construct( - &aRet, (char *)rObj.getValue() + _nOffset, getTypeDescr(), + &aRet, const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), reinterpret_cast< uno_AcquireFunc >(cpp_acquire) ); return aRet; } @@ -219,7 +219,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue ) if (pTD) { TYPELIB_DANGER_RELEASE( pObjTD ); - if (coerce_assign( (char *)rObj.getValue() + _nOffset, getTypeDescr(), rValue, getReflection() )) + if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() )) { return; } @@ -256,7 +256,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue ) if (pTD) { TYPELIB_DANGER_RELEASE( pObjTD ); - if (coerce_assign( (char *)rObj.getValue() + _nOffset, getTypeDescr(), rValue, getReflection() )) + if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() )) { return; } diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index 23089fb9f7cb..8710cf96a8aa 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -231,7 +231,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forName( const OUString & rType if (aAny.hasValue()) { if (aAny.getValueTypeClass() == TypeClass_INTERFACE) - xRet = *(const Reference< XIdlClass > *)aAny.getValue(); + xRet = *static_cast<const Reference< XIdlClass > *>(aAny.getValue()); } else { @@ -261,7 +261,7 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName ) if (aRet.getValueTypeClass() == TypeClass_INTERFACE) { // type retrieved from tdmgr - OSL_ASSERT( (*(Reference< XInterface > *)aRet.getValue())->queryInterface( + OSL_ASSERT( (*static_cast<Reference< XInterface > const *>(aRet.getValue()))->queryInterface( cppu::UnoType<XTypeDescription>::get()).hasValue() ); css::uno::Reference< css::reflection::XConstantTypeDescription > @@ -329,7 +329,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptio if (aAny.hasValue()) { if (aAny.getValueTypeClass() == TypeClass_INTERFACE) - xRet = *(const Reference< XIdlClass > *)aAny.getValue(); + xRet = *static_cast<const Reference< XIdlClass > *>(aAny.getValue()); } else { @@ -409,7 +409,7 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno( { Reference< XInterface > xObj; if (extract( rObj, pTo, xObj, this )) - return (uno_Interface *)getCpp2Uno().mapInterface( xObj.get(), pTo ); + return static_cast<uno_Interface *>(getCpp2Uno().mapInterface( xObj.get(), pTo )); throw RuntimeException( "illegal object given!", diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index 872f98b297d9..a3b72bc47ebf 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -247,7 +247,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) getReflection() ); if (bAssign) { - *(void **)pArg = getReflection()->getCpp2Uno().mapInterface( + *static_cast<void **>(pArg) = getReflection()->getCpp2Uno().mapInterface( xObj.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) ); } } @@ -287,7 +287,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) throw IllegalArgumentException( "illegal value given!", - *(const Reference< XInterface > *)rObj.getValue(), 1 ); + *static_cast<const Reference< XInterface > *>(rObj.getValue()), 1 ); } throw IllegalArgumentException( "illegal destination object given!", @@ -586,13 +586,13 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer, "com.sun.star.uno.XInterface::acquire" ) == 0) { - (*(const Reference< XInterface > *)rObj.getValue())->acquire(); + (*static_cast<const Reference< XInterface > *>(rObj.getValue()))->acquire(); return Any(); } else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer, "com.sun.star.uno.XInterface::release" ) == 0) { - (*(const Reference< XInterface > *)rObj.getValue())->release(); + (*static_cast<const Reference< XInterface > *>(rObj.getValue()))->release(); return Any(); } } @@ -608,7 +608,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & (*pUnoI->release)( pUnoI ); throw IllegalArgumentException( "arguments len differ!", - *(const Reference< XInterface > *)rObj.getValue(), 1 ); + *static_cast<const Reference< XInterface > *>(rObj.getValue()), 1 ); } Any * pCppArgs = rArgs.getArray(); @@ -618,8 +618,8 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & &pReturnType, getMethodTypeDescr()->pReturnTypeRef ); void * pUnoReturn = alloca( pReturnType->nSize ); - void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 ); - typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams); + void ** ppUnoArgs = static_cast<void **>(alloca( sizeof(void *) * nParams *2 )); + typelib_TypeDescription ** ppParamTypes = reinterpret_cast<typelib_TypeDescription **>(ppUnoArgs + nParams); // convert arguments for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) @@ -643,7 +643,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & else if (pTD->eTypeClass == typelib_TypeClass_ANY) { uno_type_any_constructAndConvert( - (uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(), + static_cast<uno_Any *>(ppUnoArgs[nPos]), (void *)pCppArgs[nPos].getValue(), pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() ); bAssign = true; } @@ -655,7 +655,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & xDest, getReflection() ); if (bAssign) { - *(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface( + *static_cast<void **>(ppUnoArgs[nPos]) = getReflection()->getCpp2Uno().mapInterface( xDest.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) ); } } @@ -682,7 +682,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & { IllegalArgumentException aExc( "cannot coerce argument type during corereflection call!", - *(const Reference< XInterface > *)rObj.getValue(), (sal_Int16)nPos ); + *static_cast<const Reference< XInterface > *>(rObj.getValue()), (sal_Int16)nPos ); // cleanup while (nPos--) @@ -719,7 +719,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & TYPELIB_DANGER_RELEASE( pReturnType ); InvocationTargetException aExc; - aExc.Context = *(const Reference< XInterface > *)rObj.getValue(); + aExc.Context = *static_cast<const Reference< XInterface > *>(rObj.getValue()); aExc.Message = "exception occurred during invocation!"; uno_any_destruct( &aExc.TargetException, diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index b725c38a2426..f30043bc650d 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -382,7 +382,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal Reference<XInterface> xInterface; if( eObjType == TypeClass_INTERFACE ) { - xInterface = *( Reference<XInterface>*)obj.getValue(); + xInterface = *static_cast<Reference<XInterface> const *>(obj.getValue()); } else if( nSequenceIndex >= mnPropCount || ( eObjType != TypeClass_STRUCT && eObjType != TypeClass_EXCEPTION ) ) { @@ -417,7 +417,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal //Reference<XIdlClass> xPropClass = rProp.Type; if( xPropClass.is() && xPropClass->getTypeClass() == TypeClass_INTERFACE ) { - Reference<XInterface> valInterface = *(Reference<XInterface>*)aValue.getValue(); + Reference<XInterface> valInterface = *static_cast<Reference<XInterface> const *>(aValue.getValue()); if( valInterface.is() ) { //Any queryInterface( const Type& rType ); @@ -526,7 +526,7 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_ Reference<XInterface> xInterface; if( eObjType == TypeClass_INTERFACE ) { - xInterface = *(Reference<XInterface>*)obj.getValue(); + xInterface = *static_cast<Reference<XInterface> const *>(obj.getValue()); } else if( nSequenceIndex >= mnPropCount || ( eObjType != TypeClass_STRUCT && eObjType != TypeClass_EXCEPTION ) ) { @@ -735,7 +735,7 @@ ImplIntrospectionAccess::ImplIntrospectionAccess // Objekt als Interface merken, wenn moeglich TypeClass eType = maInspectedObject.getValueType().getTypeClass(); if( eType == TypeClass_INTERFACE ) - mxIface = *(Reference<XInterface>*)maInspectedObject.getValue(); + mxIface = *static_cast<Reference<XInterface> const *>(maInspectedObject.getValue()); mnLastPropertyConcept = -1; mnLastMethodConcept = -1; @@ -869,7 +869,7 @@ ImplIntrospectionAdapter::ImplIntrospectionAdapter( ImplIntrospectionAccess* pAc TypeClass eType = mrInspectedObject.getValueType().getTypeClass(); if( eType == TypeClass_INTERFACE ) { - mxIface = *( Reference< XInterface >*)mrInspectedObject.getValue(); + mxIface = *static_cast<Reference< XInterface > const *>(mrInspectedObject.getValue()); mxObjElementAccess = Reference<XElementAccess>::query( mxIface ); mxObjNameAccess = Reference<XNameAccess>::query( mxIface ); @@ -1602,7 +1602,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( if( eType == TypeClass_INTERFACE ) { // Interface aus dem Any besorgen - x = *(Reference<XInterface>*)aToInspectObj.getValue(); + x = *static_cast<Reference<XInterface> const *>(aToInspectObj.getValue()); if( !x.is() ) return css::uno::Reference<css::beans::XIntrospectionAccess>(); } diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index da1b6a9e2182..c08dff06cf31 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -359,7 +359,7 @@ void Invocation_Impl::setMaterial( const Any& rMaterial ) Reference<XInterface> xObj; if (rMaterial.getValueType().getTypeClass() == TypeClass_INTERFACE) - xObj = *(Reference<XInterface>*)rMaterial.getValue(); + xObj = *static_cast<Reference<XInterface> const *>(rMaterial.getValue()); _aMaterial = rMaterial; // Ersteinmal alles ausserhalb des guards machen diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 6d6f35a18d40..d2e35676c23c 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -237,7 +237,7 @@ bool AdapterImpl::coerce_assign( if (typelib_TypeClass_ANY == pType->eTypeClass) { ::uno_type_any_assign( - (uno_Any *)pDest, pSource->pData, pSource->pType, 0, 0 ); + static_cast<uno_Any *>(pDest), pSource->pData, pSource->pType, 0, 0 ); return true; } if (::uno_type_assignData( @@ -340,7 +340,7 @@ static void handleInvokExc( uno_Any * pDest, uno_Any * pSource ) if (typelib_TypeClass_EXCEPTION == pSource->pType->eTypeClass) { constructRuntimeException( - pDest, ((Exception const *)pSource->pData)->Message ); + pDest, static_cast<Exception const *>(pSource->pData)->Message ); } else { @@ -576,7 +576,7 @@ static void SAL_CALL adapter_dispatch( static_cast< InterfaceAdapterImpl * >( pUnoI )->m_pAdapter; *ppException = 0; // no exc typelib_TypeDescriptionReference * pDemanded = - *(typelib_TypeDescriptionReference **)pArgs[0]; + *static_cast<typelib_TypeDescriptionReference **>(pArgs[0]); // pInterfaces[0] is XInterface for ( sal_Int32 nPos = 0; nPos < that->m_nInterfaces; ++nPos ) { @@ -588,14 +588,14 @@ static void SAL_CALL adapter_dispatch( { uno_Interface * pUnoI2 = &that->m_pInterfaces[nPos]; ::uno_any_construct( - (uno_Any *)pReturn, &pUnoI2, + static_cast<uno_Any *>(pReturn), &pUnoI2, &pTD->aBase, 0 ); return; } pTD = pTD->pBaseTypeDescription; } } - ::uno_any_construct( (uno_Any *)pReturn, 0, 0, 0 ); // clear() + ::uno_any_construct( static_cast<uno_Any *>(pReturn), 0, 0, 0 ); // clear() break; } case 1: // acquire() @@ -664,8 +664,8 @@ AdapterImpl::AdapterImpl( } // map receiver - m_pReceiver = (uno_Interface *)m_pFactory->m_aCpp2Uno.mapInterface( - xReceiver.get(), ::getCppuType( &xReceiver ) ); + m_pReceiver = static_cast<uno_Interface *>(m_pFactory->m_aCpp2Uno.mapInterface( + xReceiver.get(), ::getCppuType( &xReceiver ) )); OSL_ASSERT( 0 != m_pReceiver ); if (! m_pReceiver) { @@ -698,8 +698,8 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext ) OUString("com.sun.star.script.Converter"), xContext ), UNO_QUERY_THROW ); - m_pConverter = (uno_Interface *)m_aCpp2Uno.mapInterface( - xConverter.get(), ::getCppuType( &xConverter ) ); + m_pConverter = static_cast<uno_Interface *>(m_aCpp2Uno.mapInterface( + xConverter.get(), ::getCppuType( &xConverter ) )); OSL_ASSERT( 0 != m_pConverter ); // some type info: diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index cdf92db26d77..fd318eb58629 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -1198,7 +1198,7 @@ void OServiceManager::insert( const Any & Element ) for( sal_Int32 i = 0; i < aServiceNames.getLength(); i++ ) { m_ServiceMap.insert( HashMultimap_OWString_Interface::value_type( - pArray[i], *(Reference<XInterface > *)Element.getValue() ) ); + pArray[i], *static_cast<Reference<XInterface > const *>(Element.getValue()) ) ); } } } diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx index 5c7586794c43..184a434c0083 100644 --- a/stoc/source/typeconv/convert.cxx +++ b/stoc/source/typeconv/convert.cxx @@ -299,43 +299,43 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6 { // ENUM case TypeClass_ENUM: - nRet = *(sal_Int32 *)rAny.getValue(); + nRet = *static_cast<sal_Int32 const *>(rAny.getValue()); break; // BOOL case TypeClass_BOOLEAN: - nRet = (*(sal_Bool*)rAny.getValue() ? 1 : 0); + nRet = (*static_cast<sal_Bool const *>(rAny.getValue()) ? 1 : 0); break; // CHAR, BYTE case TypeClass_CHAR: - nRet = *(sal_Unicode *)rAny.getValue(); + nRet = *static_cast<sal_Unicode const *>(rAny.getValue()); break; case TypeClass_BYTE: - nRet = *(sal_Int8 *)rAny.getValue(); + nRet = *static_cast<sal_Int8 const *>(rAny.getValue()); break; // SHORT case TypeClass_SHORT: - nRet = *(sal_Int16 *)rAny.getValue(); + nRet = *static_cast<sal_Int16 const *>(rAny.getValue()); break; // UNSIGNED SHORT case TypeClass_UNSIGNED_SHORT: - nRet = *(sal_uInt16 *)rAny.getValue(); + nRet = *static_cast<sal_uInt16 const *>(rAny.getValue()); break; // LONG case TypeClass_LONG: - nRet = *(sal_Int32 *)rAny.getValue(); + nRet = *static_cast<sal_Int32 const *>(rAny.getValue()); break; // UNSIGNED LONG case TypeClass_UNSIGNED_LONG: - nRet = *(sal_uInt32 *)rAny.getValue(); + nRet = *static_cast<sal_uInt32 const *>(rAny.getValue()); break; // HYPER case TypeClass_HYPER: - nRet = *(sal_Int64 *)rAny.getValue(); + nRet = *static_cast<sal_Int64 const *>(rAny.getValue()); break; // UNSIGNED HYPER case TypeClass_UNSIGNED_HYPER: { - nRet = *(sal_Int64 *)rAny.getValue(); + nRet = *static_cast<sal_Int64 const *>(rAny.getValue()); if ((min < 0 || (sal_uInt64)nRet >= (sal_uInt64)min) && // lower bound (sal_uInt64)nRet <= max) // upper bound { @@ -349,7 +349,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6 // FLOAT, DOUBLE case TypeClass_FLOAT: { - double fVal = round( *(float *)rAny.getValue() ); + double fVal = round( *static_cast<float const *>(rAny.getValue()) ); nRet = (fVal > SAL_INT64_MAX ? (sal_Int64)(sal_uInt64)fVal : (sal_Int64)fVal); if (fVal >= min && fVal <= unsigned_int64_to_double( max )) { @@ -361,7 +361,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6 } case TypeClass_DOUBLE: { - double fVal = round( *(double *)rAny.getValue() ); + double fVal = round( *static_cast<double const *>(rAny.getValue()) ); nRet = (fVal > SAL_INT64_MAX ? (sal_Int64)(sal_uInt64)fVal : (sal_Int64)fVal); if (fVal >= min && fVal <= unsigned_int64_to_double( max )) { @@ -376,7 +376,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6 case TypeClass_STRING: { sal_Int64 nVal = SAL_CONST_INT64(0); - if (! getHyperValue( nVal, *(OUString const *)rAny.getValue() )) + if (! getHyperValue( nVal, *static_cast<OUString const *>(rAny.getValue()) )) { throw CannotConvertException( "invalid STRING value!", @@ -414,55 +414,55 @@ double TypeConverter_Impl::toDouble( const Any& rAny, double min, double max ) c { // ENUM case TypeClass_ENUM: - fRet = *(sal_Int32 *)rAny.getValue(); + fRet = *static_cast<sal_Int32 const *>(rAny.getValue()); break; // BOOL case TypeClass_BOOLEAN: - fRet = (*(sal_Bool*)rAny.getValue() ? 1.0 : 0.0); + fRet = (*static_cast<sal_Bool const *>(rAny.getValue()) ? 1.0 : 0.0); break; // CHAR, BYTE case TypeClass_CHAR: - fRet = *(sal_Unicode *)rAny.getValue(); + fRet = *static_cast<sal_Unicode const *>(rAny.getValue()); break; case TypeClass_BYTE: - fRet = *(sal_Int8 *)rAny.getValue(); + fRet = *static_cast<sal_Int8 const *>(rAny.getValue()); break; // SHORT case TypeClass_SHORT: - fRet = *(sal_Int16 *)rAny.getValue(); + fRet = *static_cast<sal_Int16 const *>(rAny.getValue()); break; // UNSIGNED SHORT case TypeClass_UNSIGNED_SHORT: - fRet = *(sal_uInt16 *)rAny.getValue(); + fRet = *static_cast<sal_uInt16 const *>(rAny.getValue()); break; // LONG case TypeClass_LONG: - fRet = *(sal_Int32 *)rAny.getValue(); + fRet = *static_cast<sal_Int32 const *>(rAny.getValue()); break; // UNSIGNED LONG case TypeClass_UNSIGNED_LONG: - fRet = *(sal_uInt32 *)rAny.getValue(); + fRet = *static_cast<sal_uInt32 const *>(rAny.getValue()); break; // HYPER case TypeClass_HYPER: - fRet = (double)*(sal_Int64 *)rAny.getValue(); + fRet = (double)*static_cast<sal_Int64 const *>(rAny.getValue()); break; // UNSIGNED HYPER case TypeClass_UNSIGNED_HYPER: - fRet = unsigned_int64_to_double( *(sal_uInt64 const *)rAny.getValue() ); + fRet = unsigned_int64_to_double( *static_cast<sal_uInt64 const *>(rAny.getValue()) ); break; // FLOAT, DOUBLE case TypeClass_FLOAT: - fRet = *(float *)rAny.getValue(); + fRet = *static_cast<float const *>(rAny.getValue()); break; case TypeClass_DOUBLE: - fRet = *(double *)rAny.getValue(); + fRet = *static_cast<double const *>(rAny.getValue()); break; // STRING case TypeClass_STRING: { - if (! getNumericValue( fRet, *(OUString *)rAny.getValue() )) + if (! getNumericValue( fRet, *static_cast<OUString const *>(rAny.getValue()) )) { throw CannotConvertException( "invalid STRING value!", @@ -539,13 +539,13 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy } if (rVal.getValueTypeClass() != TypeClass_INTERFACE || - !*(XInterface * const *)rVal.getValue()) + !*static_cast<XInterface * const *>(rVal.getValue())) { throw CannotConvertException( "value is no interface!", Reference< XInterface >(), aDestinationClass, FailReason::NO_SUCH_INTERFACE, 0 ); } - if (! (aRet = (*(XInterface * const *)rVal.getValue())->queryInterface( + if (! (aRet = (*static_cast<XInterface * const *>(rVal.getValue()))->queryInterface( aDestType )).hasValue()) { throw CannotConvertException( @@ -573,7 +573,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy &pDestElementTD, reinterpret_cast<typelib_IndirectTypeDescription *>(aDestTD.get())->pType ); - sal_uInt32 nPos = (*(const uno_Sequence * const *)rVal.getValue())->nElements; + sal_uInt32 nPos = (*static_cast<const uno_Sequence * const *>(rVal.getValue()))->nElements; uno_Sequence * pRet = 0; uno_sequence_construct( &pRet, aDestTD.get(), 0, nPos, @@ -584,9 +584,9 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy reinterpret_cast< uno_ReleaseFunc >(cpp_release) ); // decr ref count - char * pDestElements = (*(uno_Sequence * const *)aRet.getValue())->elements; + char * pDestElements = (*static_cast<uno_Sequence * const *>(aRet.getValue()))->elements; const char * pSourceElements = - (*(const uno_Sequence * const *)rVal.getValue())->elements; + (*static_cast<const uno_Sequence * const *>(rVal.getValue()))->elements; while (nPos--) { @@ -626,7 +626,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy { for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; ) { - if (((const OUString *)rVal.getValue())->equalsIgnoreAsciiCase( + if (static_cast<const OUString *>(rVal.getValue())->equalsIgnoreAsciiCase( reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->ppEnumNames[nPos] )) break; } @@ -739,7 +739,7 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina case TypeClass_STRING: { - const OUString & aStr = *(const OUString *)rVal.getValue(); + const OUString & aStr = *static_cast<const OUString *>(rVal.getValue()); if ( aStr == "0" || aStr.equalsIgnoreAsciiCase( "false" )) { sal_Bool bFalse = sal_False; @@ -765,8 +765,8 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina { if (aSourceClass==TypeClass_STRING) { - if ((*(const OUString *)rVal.getValue()).getLength() == 1) // single char - aRet.setValue( (*(const OUString *)rVal.getValue()).getStr(), ::getCharCppuType() ); + if ((*static_cast<const OUString *>(rVal.getValue())).getLength() == 1) // single char + aRet.setValue( (*static_cast<const OUString *>(rVal.getValue())).getStr(), ::getCharCppuType() ); } else if (aSourceClass!=TypeClass_ENUM && // exclude enums, chars aSourceClass!=TypeClass_CHAR) @@ -821,7 +821,7 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina TypeDescription aEnumTD( aSourceType ); aEnumTD.makeComplete(); sal_Int32 nPos; - sal_Int32 nEnumValue = *(sal_Int32 *)rVal.getValue(); + sal_Int32 nEnumValue = *static_cast<sal_Int32 const *>(rVal.getValue()); for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; ) { if (nEnumValue == reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->pEnumValues[nPos]) @@ -843,31 +843,31 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina } case TypeClass_BOOLEAN: - aRet <<= (*(sal_Bool *)rVal.getValue()) ? + aRet <<= *static_cast<sal_Bool const *>(rVal.getValue()) ? OUString("true") : OUString("false"); break; case TypeClass_CHAR: - aRet <<= OUString( (sal_Unicode *)rVal.getValue(), 1 ); + aRet <<= OUString( static_cast<sal_Unicode const *>(rVal.getValue()), 1 ); break; case TypeClass_BYTE: - aRet <<= OUString::number( *(sal_Int8 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_Int8 const *>(rVal.getValue()) ); break; case TypeClass_SHORT: - aRet <<= OUString::number( *(sal_Int16 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_Int16 const *>(rVal.getValue()) ); break; case TypeClass_UNSIGNED_SHORT: - aRet <<= OUString::number( *(sal_uInt16 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_uInt16 const *>(rVal.getValue()) ); break; case TypeClass_LONG: - aRet <<= OUString::number( *(sal_Int32 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_Int32 const *>(rVal.getValue()) ); break; case TypeClass_UNSIGNED_LONG: - aRet <<= OUString::number( *(sal_uInt32 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_uInt32 const *>(rVal.getValue()) ); break; case TypeClass_HYPER: - aRet <<= OUString::number( *(sal_Int64 const *)rVal.getValue() ); + aRet <<= OUString::number( *static_cast<sal_Int64 const *>(rVal.getValue()) ); break; // case TypeClass_UNSIGNED_HYPER: // aRet <<= OUString::valueOf( (sal_Int64)*(sal_uInt64 const *)rVal.getValue() ); |