Kaydet (Commit) 581c5075 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Reduce to static_cast any reinterpret_cast from void pointers

Change-Id: I062024d4768374e319b6c67ed8c7abcc89f9d552
üst b57f8a94
...@@ -196,7 +196,7 @@ void appendValue( OUStringBuffer & buf, ...@@ -196,7 +196,7 @@ void appendValue( OUStringBuffer & buf,
break; break;
} }
case typelib_TypeClass_TYPE: case typelib_TypeClass_TYPE:
buf.append( (*reinterpret_cast< buf.append( (*static_cast<
typelib_TypeDescriptionReference * const * >(val) typelib_TypeDescriptionReference * const * >(val)
)->pTypeName ); )->pTypeName );
break; break;
......
...@@ -167,7 +167,7 @@ template<class TYPE> ...@@ -167,7 +167,7 @@ template<class TYPE>
bool tryCompare(const void* _pData, const Any& _rValue, bool& _bIdentical, TYPE& _rOut) bool tryCompare(const void* _pData, const Any& _rValue, bool& _bIdentical, TYPE& _rOut)
{ {
bool bSuccess = _rValue >>= _rOut; bool bSuccess = _rValue >>= _rOut;
_bIdentical = bSuccess && (_rOut == *reinterpret_cast<const TYPE*>(_pData)); _bIdentical = bSuccess && (_rOut == *static_cast<const TYPE*>(_pData));
return bSuccess; return bSuccess;
} }
...@@ -191,13 +191,13 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -191,13 +191,13 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
// beides AnyWerte // beides AnyWerte
if (_rValue.getValueType().getTypeClass() == TypeClass_ANY) if (_rValue.getValueType().getTypeClass() == TypeClass_ANY)
bRes = compare_impl( bRes = compare_impl(
reinterpret_cast<const Any*>(pData)->getValueType(), static_cast<const Any*>(pData)->getValueType(),
reinterpret_cast<const Any*>(pData)->getValue(), static_cast<const Any*>(pData)->getValue(),
*reinterpret_cast<const Any*>(_rValue.getValue())); *static_cast<const Any*>(_rValue.getValue()));
else else
bRes = compare_impl( bRes = compare_impl(
reinterpret_cast<const Any*>(pData)->getValueType(), static_cast<const Any*>(pData)->getValueType(),
reinterpret_cast<const Any*>(pData)->getValue(), static_cast<const Any*>(pData)->getValue(),
_rValue); _rValue);
} }
else if ( (_rType.getTypeClass() == TypeClass_VOID) else if ( (_rType.getTypeClass() == TypeClass_VOID)
...@@ -261,7 +261,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -261,7 +261,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
{ {
sal_Int32 nAsInt32 = 0; sal_Int32 nAsInt32 = 0;
bConversionSuccess = ::cppu::enum2int(nAsInt32, _rValue); bConversionSuccess = ::cppu::enum2int(nAsInt32, _rValue);
bRes = bConversionSuccess && (nAsInt32== *reinterpret_cast<const sal_Int32*>(pData)); bRes = bConversionSuccess && (nAsInt32== *static_cast<const sal_Int32*>(pData));
break; break;
} }
case TypeClass_LONG: case TypeClass_LONG:
...@@ -327,7 +327,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -327,7 +327,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_Int8>& rLeftSeq = *reinterpret_cast<const Sequence<sal_Int8>*>(pData); const Sequence<sal_Int8>& rLeftSeq = *static_cast<const Sequence<sal_Int8>*>(pData);
const Sequence<sal_Int8>& rRightSeq = aTemp; const Sequence<sal_Int8>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0;
...@@ -339,7 +339,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -339,7 +339,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_uInt8>& rLeftSeq = *reinterpret_cast<const Sequence<sal_uInt8>*>(pData); const Sequence<sal_uInt8>& rLeftSeq = *static_cast<const Sequence<sal_uInt8>*>(pData);
const Sequence<sal_uInt8>& rRightSeq = aTemp; const Sequence<sal_uInt8>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0;
...@@ -351,7 +351,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -351,7 +351,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_Int16>& rLeftSeq = *reinterpret_cast<const Sequence<sal_Int16>*>(pData); const Sequence<sal_Int16>& rLeftSeq = *static_cast<const Sequence<sal_Int16>*>(pData);
const Sequence<sal_Int16>& rRightSeq = aTemp; const Sequence<sal_Int16>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int16)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int16)) == 0;
...@@ -363,7 +363,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -363,7 +363,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_uInt16>& rLeftSeq = *reinterpret_cast<const Sequence<sal_uInt16>*>(pData); const Sequence<sal_uInt16>& rLeftSeq = *static_cast<const Sequence<sal_uInt16>*>(pData);
const Sequence<sal_uInt16>& rRightSeq = aTemp; const Sequence<sal_uInt16>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt16)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt16)) == 0;
...@@ -375,7 +375,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -375,7 +375,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_Int32>& rLeftSeq = *reinterpret_cast<const Sequence<sal_Int32>*>(pData); const Sequence<sal_Int32>& rLeftSeq = *static_cast<const Sequence<sal_Int32>*>(pData);
const Sequence<sal_Int32>& rRightSeq = aTemp; const Sequence<sal_Int32>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int32)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int32)) == 0;
...@@ -387,7 +387,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -387,7 +387,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence<sal_uInt32>& rLeftSeq = *reinterpret_cast<const Sequence<sal_uInt32>*>(pData); const Sequence<sal_uInt32>& rLeftSeq = *static_cast<const Sequence<sal_uInt32>*>(pData);
const Sequence<sal_uInt32>& rRightSeq = aTemp; const Sequence<sal_uInt32>& rRightSeq = aTemp;
bRes = rLeftSeq.getLength() == rRightSeq.getLength() && bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt32)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt32)) == 0;
...@@ -399,7 +399,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -399,7 +399,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
if (bConversionSuccess) if (bConversionSuccess)
{ {
const Sequence< OUString >& rLeftSeq = *reinterpret_cast<const Sequence< OUString>*>(pData); const Sequence< OUString >& rLeftSeq = *static_cast<const Sequence< OUString>*>(pData);
const Sequence< OUString >& rRightSeq = aTemp; const Sequence< OUString >& rRightSeq = aTemp;
sal_Int32 nSeqLen = rLeftSeq.getLength(); sal_Int32 nSeqLen = rLeftSeq.getLength();
bRes = ( nSeqLen == rRightSeq.getLength() ); bRes = ( nSeqLen == rRightSeq.getLength() );
......
...@@ -288,7 +288,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( ...@@ -288,7 +288,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue(
pPropContainer = &(*aIter); pPropContainer = &(*aIter);
} }
else else
pPropContainer = reinterpret_cast<Any*>(aPos->aLocation.pDerivedClassMember); pPropContainer = static_cast<Any*>(aPos->aLocation.pDerivedClassMember);
// check if the new value differs from the current one // check if the new value differs from the current one
if (!pPropContainer->hasValue() || !aNewRequestedValue.hasValue()) if (!pPropContainer->hasValue() || !aNewRequestedValue.hasValue())
...@@ -386,7 +386,7 @@ bool OPropertyContainerHelper::setFastPropertyValue(sal_Int32 _nHandle, const An ...@@ -386,7 +386,7 @@ bool OPropertyContainerHelper::setFastPropertyValue(sal_Int32 _nHandle, const An
break; break;
case PropertyDescription::ltDerivedClassAnyType: case PropertyDescription::ltDerivedClassAnyType:
*reinterpret_cast< Any* >(aPos->aLocation.pDerivedClassMember) = _rValue; *static_cast< Any* >(aPos->aLocation.pDerivedClassMember) = _rValue;
break; break;
case PropertyDescription::ltDerivedClassRealType: case PropertyDescription::ltDerivedClassRealType:
...@@ -427,7 +427,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa ...@@ -427,7 +427,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa
_rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex]; _rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex];
break; break;
case PropertyDescription::ltDerivedClassAnyType: case PropertyDescription::ltDerivedClassAnyType:
_rValue = *reinterpret_cast<Any*>(aPos->aLocation.pDerivedClassMember); _rValue = *static_cast<Any*>(aPos->aLocation.pDerivedClassMember);
break; break;
case PropertyDescription::ltDerivedClassRealType: case PropertyDescription::ltDerivedClassRealType:
_rValue.setValue(aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type); _rValue.setValue(aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type);
......
...@@ -57,7 +57,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const ::com::sun::star::uno:: ...@@ -57,7 +57,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const ::com::sun::star::uno::
{ {
if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_ENUM) if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_ENUM)
{ {
rnEnum = * reinterpret_cast< const int * >( rAny.getValue() ); rnEnum = * static_cast< const int * >( rAny.getValue() );
return true; return true;
} }
......
...@@ -187,7 +187,7 @@ namespace comphelper ...@@ -187,7 +187,7 @@ namespace comphelper
::com::sun::star::uno::Any aCheck = _rxAggregate->queryAggregation( ::com::sun::star::uno::Any aCheck = _rxAggregate->queryAggregation(
cppu::UnoType<iface>::get()); cppu::UnoType<iface>::get());
if (aCheck.hasValue()) if (aCheck.hasValue())
_rxOut = *reinterpret_cast<const ::com::sun::star::uno::Reference<iface>*>(aCheck.getValue()); _rxOut = *static_cast<const ::com::sun::star::uno::Reference<iface>*>(aCheck.getValue());
} }
return _rxOut.is(); return _rxOut.is();
} }
...@@ -208,7 +208,7 @@ namespace comphelper ...@@ -208,7 +208,7 @@ namespace comphelper
cppu::UnoType<iface>::get()); cppu::UnoType<iface>::get());
if(aCheck.hasValue()) if(aCheck.hasValue())
{ {
_rxOut = *reinterpret_cast<const ::com::sun::star::uno::Reference<iface>*>(aCheck.getValue()); _rxOut = *static_cast<const ::com::sun::star::uno::Reference<iface>*>(aCheck.getValue());
return _rxOut.is(); return _rxOut.is();
} }
} }
......
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