diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:00:10 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:18 +0100 |
commit | 1777f6fedbd59b440e06c17f90842a2c2b5e349c (patch) | |
tree | 017706ce6823516bd42b79b7fb5bbf3c99feb2b4 /cppu | |
parent | d18aa948685c4533694b89af9e3c8bce6dd1e854 (diff) |
Clean up C-style casts from pointers to void
Change-Id: I834eb4ecd0fa71caf6fa746901367fac8b538305
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/source/LogBridge/LogBridge.cxx | 2 | ||||
-rw-r--r-- | cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx | 2 | ||||
-rw-r--r-- | cppu/source/typelib/typelib.cxx | 2 | ||||
-rw-r--r-- | cppu/source/uno/assign.hxx | 108 | ||||
-rw-r--r-- | cppu/source/uno/constr.hxx | 34 | ||||
-rw-r--r-- | cppu/source/uno/copy.hxx | 126 | ||||
-rw-r--r-- | cppu/source/uno/data.cxx | 8 | ||||
-rw-r--r-- | cppu/source/uno/destr.hxx | 32 | ||||
-rw-r--r-- | cppu/source/uno/eq.hxx | 248 | ||||
-rw-r--r-- | cppu/source/uno/lbenv.cxx | 20 | ||||
-rw-r--r-- | cppu/source/uno/lbmap.cxx | 2 | ||||
-rw-r--r-- | cppu/source/uno/prim.hxx | 4 | ||||
-rw-r--r-- | cppu/source/uno/sequence.cxx | 38 |
13 files changed, 313 insertions, 313 deletions
diff --git a/cppu/source/LogBridge/LogBridge.cxx b/cppu/source/LogBridge/LogBridge.cxx index 7df03f55281b..30cde7fee365 100644 --- a/cppu/source/LogBridge/LogBridge.cxx +++ b/cppu/source/LogBridge/LogBridge.cxx @@ -168,7 +168,7 @@ bool LogBridge::v_isValid(rtl::OUString * pReason) break; 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()); } break; diff --git a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx index b51ea547733f..2b90a37027e1 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx @@ -404,7 +404,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, pArgs, ppException); - void ** args = (void **) alloca( sizeof (void *) * nParams ); + void ** args = static_cast<void **>(alloca( sizeof (void *) * nParams )); typelib_TypeDescription * return_td = 0; void * ret = pReturn; diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 17fc0998639e..f0a31d29f94c 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -384,7 +384,7 @@ static inline void typelib_typedescription_initTables( { 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--; ) { pReadWriteAttributes[i] = sal_False; diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx index 473cd8659071..cd4b21b00414 100644 --- a/cppu/source/uno/assign.hxx +++ b/cppu/source/uno/assign.hxx @@ -86,9 +86,9 @@ inline bool _assignStruct( sal_Int32 nDescr = pTypeDescr->nMembers; while (nDescr--) { - if (! ::uno_type_assignData( (char *)pDest + pMemberOffsets[nDescr], + if (! ::uno_type_assignData( static_cast<char *>(pDest) + pMemberOffsets[nDescr], ppTypeRefs[nDescr], - (char *)pSource + pMemberOffsets[nDescr], + static_cast<char *>(pSource) + pMemberOffsets[nDescr], ppTypeRefs[nDescr], queryInterface, acquire, release )) { @@ -117,8 +117,8 @@ inline bool _assignData( while (typelib_TypeClass_ANY == pSourceType->eTypeClass) { pSourceTypeDescr = 0; - pSourceType = ((uno_Any *)pSource)->pType; - pSource = ((uno_Any *)pSource)->pData; + pSourceType = static_cast<uno_Any *>(pSource)->pType; + pSource = static_cast<uno_Any *>(pSource)->pData; if (pDest == pSource) return true; } @@ -131,7 +131,7 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_CHAR: - *(sal_Unicode *)pDest = *(sal_Unicode *)pSource; + *static_cast<sal_Unicode *>(pDest) = *static_cast<sal_Unicode *>(pSource); return true; default: return false; @@ -140,7 +140,7 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BOOLEAN: - *(sal_Bool *)pDest = (*(sal_Bool *)pSource != sal_False); + *static_cast<sal_Bool *>(pDest) = (*static_cast<sal_Bool *>(pSource) != sal_False); return true; default: return false; @@ -149,7 +149,7 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_Int8 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_Int8 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; default: return false; @@ -158,11 +158,11 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_Int16 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_Int16 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_Int16 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_Int16 *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; default: return false; @@ -171,11 +171,11 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_uInt16 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_uInt16 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_uInt16 *)pDest = *(sal_uInt16 *)pSource; + *static_cast<sal_uInt16 *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; default: return false; @@ -184,17 +184,17 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_Int32 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(sal_Int32 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_Int32 *)pDest = *(sal_uInt16 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - *(sal_Int32 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int32 *>(pSource); return true; default: return false; @@ -203,17 +203,17 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_uInt32 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_uInt32 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(sal_uInt32 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_uInt32 *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_uInt32 *)pDest = *(sal_uInt16 *)pSource; + *static_cast<sal_uInt32 *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - *(sal_uInt32 *)pDest = *(sal_uInt32 *)pSource; + *static_cast<sal_uInt32 *>(pDest) = *static_cast<sal_uInt32 *>(pSource); return true; default: return false; @@ -222,23 +222,23 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_Int64 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(sal_Int64 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_Int64 *)pDest = *(sal_uInt16 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_LONG: - *(sal_Int64 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int32 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_LONG: - *(sal_Int64 *)pDest = *(sal_uInt32 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_uInt32 *>(pSource); return true; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - *(sal_Int64 *)pDest = *(sal_Int64 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int64 *>(pSource); return true; default: return false; @@ -247,23 +247,23 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(sal_uInt64 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(sal_uInt64 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_uInt64 *)pDest = *(sal_uInt16 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_LONG: - *(sal_uInt64 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_Int32 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_LONG: - *(sal_uInt64 *)pDest = *(sal_uInt32 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_uInt32 *>(pSource); return true; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - *(sal_uInt64 *)pDest = *(sal_uInt64 *)pSource; + *static_cast<sal_uInt64 *>(pDest) = *static_cast<sal_uInt64 *>(pSource); return true; default: return false; @@ -272,16 +272,16 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(float *)pDest = *(sal_Int8 *)pSource; + *static_cast<float *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(float *)pDest = *(sal_Int16 *)pSource; + *static_cast<float *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(float *)pDest = *(sal_uInt16 *)pSource; + *static_cast<float *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_FLOAT: - *(float *)pDest = *(float *)pSource; + *static_cast<float *>(pDest) = *static_cast<float *>(pSource); return true; default: return false; @@ -290,25 +290,25 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_BYTE: - *(double *)pDest = *(sal_Int8 *)pSource; + *static_cast<double *>(pDest) = *static_cast<sal_Int8 *>(pSource); return true; case typelib_TypeClass_SHORT: - *(double *)pDest = *(sal_Int16 *)pSource; + *static_cast<double *>(pDest) = *static_cast<sal_Int16 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_SHORT: - *(double *)pDest = *(sal_uInt16 *)pSource; + *static_cast<double *>(pDest) = *static_cast<sal_uInt16 *>(pSource); return true; case typelib_TypeClass_LONG: - *(double *)pDest = *(sal_Int32 *)pSource; + *static_cast<double *>(pDest) = *static_cast<sal_Int32 *>(pSource); return true; case typelib_TypeClass_UNSIGNED_LONG: - *(double *)pDest = *(sal_uInt32 *)pSource; + *static_cast<double *>(pDest) = *static_cast<sal_uInt32 *>(pSource); return true; case typelib_TypeClass_FLOAT: - *(double *)pDest = *(float *)pSource; + *static_cast<double *>(pDest) = *static_cast<float *>(pSource); return true; case typelib_TypeClass_DOUBLE: - *(double *)pDest = *(double *)pSource; + *static_cast<double *>(pDest) = *static_cast<double *>(pSource); return true; default: return false; @@ -317,7 +317,7 @@ inline bool _assignData( switch (pSourceType->eTypeClass) { case typelib_TypeClass_STRING: - ::rtl_uString_assign( (rtl_uString **)pDest, *(rtl_uString **)pSource ); + ::rtl_uString_assign( static_cast<rtl_uString **>(pDest), *static_cast<rtl_uString **>(pSource) ); return true; default: return false; @@ -327,9 +327,9 @@ inline bool _assignData( { case typelib_TypeClass_TYPE: { - typelib_TypeDescriptionReference ** pp = (typelib_TypeDescriptionReference **)pDest; + typelib_TypeDescriptionReference ** pp = static_cast<typelib_TypeDescriptionReference **>(pDest); ::typelib_typedescriptionreference_release( *pp ); - *pp = *(typelib_TypeDescriptionReference **)pSource; + *pp = *static_cast<typelib_TypeDescriptionReference **>(pSource); TYPE_ACQUIRE( *pp ); return true; } @@ -337,13 +337,13 @@ inline bool _assignData( return false; } case typelib_TypeClass_ANY: - _destructAny( (uno_Any *)pDest, release ); - _copyConstructAny( (uno_Any *)pDest, pSource, pSourceType, pSourceTypeDescr, acquire, 0 ); + _destructAny( static_cast<uno_Any *>(pDest), release ); + _copyConstructAny( static_cast<uno_Any *>(pDest), pSource, pSourceType, pSourceTypeDescr, acquire, 0 ); return true; case typelib_TypeClass_ENUM: if (_type_equals( pDestType, pSourceType )) { - *(sal_Int32 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int32 *>(pSource); return true; } return false; @@ -392,14 +392,14 @@ inline bool _assignData( if (typelib_TypeClass_SEQUENCE != pSourceType->eTypeClass) return false; // self assignment: - if (*(uno_Sequence **)pSource == *(uno_Sequence **)pDest) + if (*static_cast<uno_Sequence **>(pSource) == *static_cast<uno_Sequence **>(pDest)) return true; if (_type_equals( pDestType, pSourceType )) { - osl_atomic_increment( &(*(uno_Sequence **)pSource)->nRefCount ); + osl_atomic_increment( &(*static_cast<uno_Sequence **>(pSource))->nRefCount ); idestructSequence( - *(uno_Sequence **)pDest, pDestType, pDestTypeDescr, release ); - *(uno_Sequence **)pDest = *(uno_Sequence **)pSource; + *static_cast<uno_Sequence **>(pDest), pDestType, pDestTypeDescr, release ); + *static_cast<uno_Sequence **>(pDest) = *static_cast<uno_Sequence **>(pSource); return true; } return false; @@ -408,7 +408,7 @@ inline bool _assignData( return false; if (_type_equals( pDestType, pSourceType )) { - _assignInterface( (void **)pDest, *(void **)pSource, acquire, release ); + _assignInterface( static_cast<void **>(pDest), *static_cast<void **>(pSource), acquire, release ); return true; } else if (*static_cast< void ** >(pSource) == 0) @@ -431,7 +431,7 @@ inline bool _assignData( } if (pTD) // is base of dest { - _assignInterface( (void **)pDest, *(void **)pSource, acquire, release ); + _assignInterface( static_cast<void **>(pDest), *static_cast<void **>(pSource), acquire, release ); return true; } } diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx index 10e12a933b83..a1242da507ce 100644 --- a/cppu/source/uno/constr.hxx +++ b/cppu/source/uno/constr.hxx @@ -49,7 +49,7 @@ inline void _defaultConstructStruct( 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( switch (pType->eTypeClass) { case typelib_TypeClass_CHAR: - *(sal_Unicode *)pMem = '\0'; + *static_cast<sal_Unicode *>(pMem) = '\0'; break; case typelib_TypeClass_BOOLEAN: - *(sal_Bool *)pMem = sal_False; + *static_cast<sal_Bool *>(pMem) = sal_False; break; case typelib_TypeClass_BYTE: - *(sal_Int8 *)pMem = 0; + *static_cast<sal_Int8 *>(pMem) = 0; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_Int16 *)pMem = 0; + *static_cast<sal_Int16 *>(pMem) = 0; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - *(sal_Int32 *)pMem = 0; + *static_cast<sal_Int32 *>(pMem) = 0; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - *(sal_Int64 *)pMem = 0; + *static_cast<sal_Int64 *>(pMem) = 0; break; case typelib_TypeClass_FLOAT: - *(float *)pMem = 0.0; + *static_cast<float *>(pMem) = 0.0; break; case typelib_TypeClass_DOUBLE: - *(double *)pMem = 0.0; + *static_cast<double *>(pMem) = 0.0; break; case typelib_TypeClass_STRING: - *(rtl_uString **)pMem = 0; - ::rtl_uString_new( (rtl_uString **)pMem ); + *static_cast<rtl_uString **>(pMem) = 0; + ::rtl_uString_new( static_cast<rtl_uString **>(pMem) ); break; case typelib_TypeClass_TYPE: - *(typelib_TypeDescriptionReference **)pMem = _getVoidType(); + *static_cast<typelib_TypeDescriptionReference **>(pMem) = _getVoidType(); break; case typelib_TypeClass_ANY: - CONSTRUCT_EMPTY_ANY( (uno_Any *)pMem ); + CONSTRUCT_EMPTY_ANY( static_cast<uno_Any *>(pMem) ); break; case typelib_TypeClass_ENUM: if (pTypeDescr) { - *(sal_Int32 *)pMem = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; + *static_cast<sal_Int32 *>(pMem) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; } else { 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 ); } break; @@ -124,10 +124,10 @@ inline void _defaultConstructData( } break; case typelib_TypeClass_SEQUENCE: - *(uno_Sequence **)pMem = createEmptySequence(); + *static_cast<uno_Sequence **>(pMem) = createEmptySequence(); break; 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; default: OSL_ASSERT(false); diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index 24d7864825c6..322238ff640f 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -39,7 +39,7 @@ inline uno_Sequence * allocSeq( sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements ); if (nSize > 0) { - pSeq = (uno_Sequence *) rtl_allocateMemory( nSize ); + pSeq = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); if (pSeq != 0) { // header init @@ -77,8 +77,8 @@ inline void _copyConstructStruct( while (nDescr--) { ::uno_type_copyAndConvertData( - (char *)pDest + pMemberOffsets[nDescr], - (char *)pSource + pMemberOffsets[nDescr], + static_cast<char *>(pDest) + pMemberOffsets[nDescr], + static_cast<char *>(pSource) + pMemberOffsets[nDescr], ppTypeRefs[nDescr], mapping ); } } @@ -87,8 +87,8 @@ inline void _copyConstructStruct( while (nDescr--) { ::uno_type_copyData( - (char *)pDest + pMemberOffsets[nDescr], - (char *)pSource + pMemberOffsets[nDescr], + static_cast<char *>(pDest) + pMemberOffsets[nDescr], + static_cast<char *>(pSource) + pMemberOffsets[nDescr], ppTypeRefs[nDescr], acquire ); } } @@ -113,25 +113,25 @@ inline void _copyConstructAnyFromData( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)pDestAny->pData = *(sal_Unicode *)pSource; + *static_cast<sal_Unicode *>(pDestAny->pData) = *static_cast<sal_Unicode *>(pSource); break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)pDestAny->pData = (*(sal_Bool *)pSource != sal_False); + *static_cast<sal_Bool *>(pDestAny->pData) = (*static_cast<sal_Bool *>(pSource) != sal_False); break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)pDestAny->pData = *(sal_Int8 *)pSource; + *static_cast<sal_Int8 *>(pDestAny->pData) = *static_cast<sal_Int8 *>(pSource); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)pDestAny->pData = *(sal_Int16 *)pSource; + *static_cast<sal_Int16 *>(pDestAny->pData) = *static_cast<sal_Int16 *>(pSource); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDestAny->pData) = *static_cast<sal_Int32 *>(pSource); break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: @@ -139,31 +139,31 @@ inline void _copyConstructAnyFromData( pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) ); - *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource; + *static_cast<sal_Int64 *>(pDestAny->pData) = *static_cast<sal_Int64 *>(pSource); break; case typelib_TypeClass_FLOAT: if (sizeof(void *) >= sizeof(float)) pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(float) ); - *(float *)pDestAny->pData = *(float *)pSource; + *static_cast<float *>(pDestAny->pData) = *static_cast<float *>(pSource); break; case typelib_TypeClass_DOUBLE: if (sizeof(void *) >= sizeof(double)) pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(double) ); - *(double *)pDestAny->pData = *(double *)pSource; + *static_cast<double *>(pDestAny->pData) = *static_cast<double *>(pSource); break; case typelib_TypeClass_STRING: - ::rtl_uString_acquire( *(rtl_uString **)pSource ); + ::rtl_uString_acquire( *static_cast<rtl_uString **>(pSource) ); pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)pDestAny->pData = *(rtl_uString **)pSource; + *static_cast<rtl_uString **>(pDestAny->pData) = *static_cast<rtl_uString **>(pSource); break; case typelib_TypeClass_TYPE: - TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource ); + TYPE_ACQUIRE( *static_cast<typelib_TypeDescriptionReference **>(pSource) ); pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)pDestAny->pData = *(typelib_TypeDescriptionReference **)pSource; + *static_cast<typelib_TypeDescriptionReference **>(pDestAny->pData) = *static_cast<typelib_TypeDescriptionReference **>(pSource); break; case typelib_TypeClass_ANY: OSL_FAIL( "### unexpected nested any!" ); @@ -171,7 +171,7 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; // enum is forced to 32bit long - *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDestAny->pData) = *static_cast<sal_Int32 *>(pSource); break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: @@ -198,16 +198,16 @@ inline void _copyConstructAnyFromData( pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(uno_Sequence **)pDestAny->pData = copyConstructSequence( - *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDestAny->pData) = copyConstructSequence( + *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, acquire, mapping ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(uno_Sequence **)pDestAny->pData = copyConstructSequence( - *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDestAny->pData) = copyConstructSequence( + *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); @@ -217,11 +217,11 @@ inline void _copyConstructAnyFromData( pDestAny->pData = &pDestAny->pReserved; if (mapping) { - pDestAny->pReserved = _map( *(void **)pSource, pType, pTypeDescr, mapping ); + pDestAny->pReserved = _map( *static_cast<void **>(pSource), pType, pTypeDescr, mapping ); } else { - _acquire( pDestAny->pReserved = *(void **)pSource, acquire ); + _acquire( pDestAny->pReserved = *static_cast<void **>(pSource), acquire ); } break; default: @@ -245,14 +245,14 @@ inline void _copyConstructAny( { if (pSource) { - pType = ((uno_Any *)pSource)->pType; + pType = static_cast<uno_Any *>(pSource)->pType; if (typelib_TypeClass_VOID == pType->eTypeClass) { CONSTRUCT_EMPTY_ANY( pDestAny ); return; } pTypeDescr = 0; - pSource = ((uno_Any *)pSource)->pData; + pSource = static_cast<uno_Any *>(pSource)->pData; } else { @@ -272,25 +272,25 @@ inline void _copyConstructAny( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)pDestAny->pData = '\0'; + *static_cast<sal_Unicode *>(pDestAny->pData) = '\0'; break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)pDestAny->pData = sal_False; + *static_cast<sal_Bool *>(pDestAny->pData) = sal_False; break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)pDestAny->pData = 0; + *static_cast<sal_Int8 *>(pDestAny->pData) = 0; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)pDestAny->pData = 0; + *static_cast<sal_Int16 *>(pDestAny->pData) = 0; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)pDestAny->pData = 0; + *static_cast<sal_Int32 *>(pDestAny->pData) = 0; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: @@ -298,41 +298,41 @@ inline void _copyConstructAny( pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) ); - *(sal_Int64 *)pDestAny->pData = 0; + *static_cast<sal_Int64 *>(pDestAny->pData) = 0; break; case typelib_TypeClass_FLOAT: if (sizeof(void *) >= sizeof(float)) pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(float) ); - *(float *)pDestAny->pData = 0.0; + *static_cast<float *>(pDestAny->pData) = 0.0; break; case typelib_TypeClass_DOUBLE: if (sizeof(void *) >= sizeof(double)) pDestAny->pData = &pDestAny->pReserved; else pDestAny->pData = ::rtl_allocateMemory( sizeof(double) ); - *(double *)pDestAny->pData = 0.0; + *static_cast<double *>(pDestAny->pData) = 0.0; break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)pDestAny->pData = 0; - ::rtl_uString_new( (rtl_uString **)pDestAny->pData ); + *static_cast<rtl_uString **>(pDestAny->pData) = 0; + ::rtl_uString_new( static_cast<rtl_uString **>(pDestAny->pData) ); break; case typelib_TypeClass_TYPE: pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)pDestAny->pData = _getVoidType(); + *static_cast<typelib_TypeDescriptionReference **>(pDestAny->pData) = _getVoidType(); break; case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(sal_Int32 *)pDestAny->pData = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; + *static_cast<sal_Int32 *>(pDestAny->pData) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(sal_Int32 *)pDestAny->pData = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; + *static_cast<sal_Int32 *>(pDestAny->pData) = reinterpret_cast<typelib_EnumTypeDescription *>(pTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -355,7 +355,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_SEQUENCE: pDestAny->pData = &pDestAny->pReserved; - *(uno_Sequence **)pDestAny->pData = createEmptySequence(); + *static_cast<uno_Sequence **>(pDestAny->pData) = createEmptySequence(); break; case typelib_TypeClass_INTERFACE: pDestAny->pData = &pDestAny->pReserved; @@ -522,48 +522,48 @@ inline void _copyConstructData( switch (pType->eTypeClass) { case typelib_TypeClass_CHAR: - *(sal_Unicode *)pDest = *(sal_Unicode *)pSource; + *static_cast<sal_Unicode *>(pDest) = *static_cast<sal_Unicode *>(pSource); break; case typelib_TypeClass_BOOLEAN: - *(sal_Bool *)pDest = (*(sal_Bool *)pSource != sal_False); + *static_cast<sal_Bool *>(pDest) = (*static_cast<sal_Bool *>(pSource) != sal_False); break; case typelib_TypeClass_BYTE: - *(sal_Int8 *)pDest = *(sal_Int8 *)pSource; + *static_cast<sal_Int8 *>(pDest) = *static_cast<sal_Int8 *>(pSource); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - *(sal_Int16 *)pDest = *(sal_Int16 *)pSource; + *static_cast<sal_Int16 *>(pDest) = *static_cast<sal_Int16 *>(pSource); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - *(sal_Int32 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int32 *>(pSource); break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - *(sal_Int64 *)pDest = *(sal_Int64 *)pSource; + *static_cast<sal_Int64 *>(pDest) = *static_cast<sal_Int64 *>(pSource); break; case typelib_TypeClass_FLOAT: - *(float *)pDest = *(float *)pSource; + *static_cast<float *>(pDest) = *static_cast<float *>(pSource); break; case typelib_TypeClass_DOUBLE: - *(double *)pDest = *(double *)pSource; + *static_cast<double *>(pDest) = *static_cast<double *>(pSource); break; case typelib_TypeClass_STRING: - ::rtl_uString_acquire( *(rtl_uString **)pSource ); - *(rtl_uString **)pDest = *(rtl_uString **)pSource; + ::rtl_uString_acquire( *static_cast<rtl_uString **>(pSource) ); + *static_cast<rtl_uString **>(pDest) = *static_cast<rtl_uString **>(pSource); break; case typelib_TypeClass_TYPE: - TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource ); - *(typelib_TypeDescriptionReference **)pDest = *(typelib_TypeDescriptionReference **)pSource; + TYPE_ACQUIRE( *static_cast<typelib_TypeDescriptionReference **>(pSource) ); + *static_cast<typelib_TypeDescriptionReference **>(pDest) = *static_cast<typelib_TypeDescriptionReference **>(pSource); break; case typelib_TypeClass_ANY: _copyConstructAny( - (uno_Any *)pDest, ((uno_Any *)pSource)->pData, - ((uno_Any *)pSource)->pType, 0, + static_cast<uno_Any *>(pDest), static_cast<uno_Any *>(pSource)->pData, + static_cast<uno_Any *>(pSource)->pType, 0, acquire, mapping ); break; case typelib_TypeClass_ENUM: - *(sal_Int32 *)pDest = *(sal_Int32 *)pSource; + *static_cast<sal_Int32 *>(pDest) = *static_cast<sal_Int32 *>(pSource); break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: @@ -589,16 +589,16 @@ inline void _copyConstructData( { if (pTypeDescr) { - *(uno_Sequence **)pDest = icopyConstructSequence( - *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDest) = icopyConstructSequence( + *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, acquire, mapping ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(uno_Sequence **)pDest = icopyConstructSequence( - *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDest) = icopyConstructSequence( + *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); @@ -606,15 +606,15 @@ inline void _copyConstructData( } else { - osl_atomic_increment( &(*(uno_Sequence **)pSource)->nRefCount ); - *(uno_Sequence **)pDest = *(uno_Sequence **)pSource; + osl_atomic_increment( &(*static_cast<uno_Sequence **>(pSource))->nRefCount ); + *static_cast<uno_Sequence **>(pDest) = *static_cast<uno_Sequence **>(pSource); } break; case typelib_TypeClass_INTERFACE: if (mapping) - *(void **)pDest = _map( *(void **)pSource, pType, pTypeDescr, mapping ); + *static_cast<void **>(pDest) = _map( *static_cast<void **>(pSource), pType, pTypeDescr, mapping ); else - _acquire( *(void **)pDest = *(void **)pSource, acquire ); + _acquire( *static_cast<void **>(pDest) = *static_cast<void **>(pSource), acquire ); break; default: break; diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 5a950444024a..896b6094a0f1 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -66,8 +66,8 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p uno_Any * pExc = &aExc; void * aArgs[ 1 ]; aArgs[ 0 ] = &pDestType; - (*((uno_Interface *) pUnoI)->pDispatcher)( - (uno_Interface *) pUnoI, g_pQITD, &aRet, aArgs, &pExc ); + (*static_cast<uno_Interface *>(pUnoI)->pDispatcher)( + static_cast<uno_Interface *>(pUnoI), g_pQITD, &aRet, aArgs, &pExc ); uno_Interface * ret = 0; if (0 == pExc) @@ -81,7 +81,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p case typelib_TypeClass_INTERFACE: // tweaky... avoiding acquire/ release pair typelib_typedescriptionreference_release( ret_type ); - ret = (uno_Interface *) aRet.pReserved; // serving acquired interface + ret = static_cast<uno_Interface *>(aRet.pReserved); // serving acquired interface break; default: _destructAny( &aRet, 0 ); @@ -307,7 +307,7 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( // query if (0 == pFrom) return sal_False; - void * pInterface = *(void **)pFrom; + void * pInterface = *static_cast<void **>(pFrom); if (0 == pInterface) return sal_False; diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 89144742d4a0..1f0cc3213bb3 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -55,7 +55,7 @@ inline void _destructStruct( while (nDescr--) { ::uno_type_destructData( - (char *)pValue + pMemberOffsets[nDescr], + static_cast<char *>(pValue) + pMemberOffsets[nDescr], ppTypeRefs[nDescr], release ); } } @@ -96,15 +96,15 @@ inline void _destructAny( } break; case typelib_TypeClass_STRING: - ::rtl_uString_release( (rtl_uString *)pAny->pReserved ); + ::rtl_uString_release( static_cast<rtl_uString *>(pAny->pReserved) ); break; case typelib_TypeClass_TYPE: ::typelib_typedescriptionreference_release( - (typelib_TypeDescriptionReference *)pAny->pReserved ); + static_cast<typelib_TypeDescriptionReference *>(pAny->pReserved) ); break; case typelib_TypeClass_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 ); break; case typelib_TypeClass_TYPEDEF: @@ -168,7 +168,7 @@ inline sal_Int32 idestructElements( 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 ) { ::rtl_uString_release( pDest[nPos] ); @@ -177,7 +177,7 @@ inline sal_Int32 idestructElements( } 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 ) { ::typelib_typedescriptionreference_release( pDest[nPos] ); @@ -186,7 +186,7 @@ inline sal_Int32 idestructElements( } 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 ) { _destructAny( &pDest[nPos], release ); @@ -204,7 +204,7 @@ inline sal_Int32 idestructElements( for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { _destructStruct( - (char *)pElements + (nElementSize * nPos), + static_cast<char *>(pElements) + (nElementSize * nPos), reinterpret_cast<typelib_CompoundTypeDescription *>(pElementTypeDescr), release ); } @@ -216,7 +216,7 @@ inline sal_Int32 idestructElements( { typelib_TypeDescription * pElementTypeDescr = 0; 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 ) { destructSequence( @@ -233,7 +233,7 @@ inline sal_Int32 idestructElements( { for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { - void * p = ((void **)pElements)[nPos]; + void * p = static_cast<void **>(pElements)[nPos]; if (p) { (*release)( p ); @@ -244,7 +244,7 @@ inline sal_Int32 idestructElements( { 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) { (*p->release)( p ); @@ -310,13 +310,13 @@ inline void _destructData( switch (pType->eTypeClass) { case typelib_TypeClass_STRING: - ::rtl_uString_release( *(rtl_uString **)pValue ); + ::rtl_uString_release( *static_cast<rtl_uString **>(pValue) ); break; case typelib_TypeClass_TYPE: - ::typelib_typedescriptionreference_release( *(typelib_TypeDescriptionReference **)pValue ); + ::typelib_typedescriptionreference_release( *static_cast<typelib_TypeDescriptionReference **>(pValue) ); break; case typelib_TypeClass_ANY: - _destructAny( (uno_Any *)pValue, release ); + _destructAny( static_cast<uno_Any *>(pValue), release ); break; case typelib_TypeClass_TYPEDEF: OSL_FAIL( "### unexpected typedef!" ); @@ -337,11 +337,11 @@ inline void _destructData( case typelib_TypeClass_SEQUENCE: { idestructSequence( - *(uno_Sequence **)pValue, pType, pTypeDescr, release ); + *static_cast<uno_Sequence **>(pValue), pType, pTypeDescr, release ); break; } case typelib_TypeClass_INTERFACE: - _release( *(void **)pValue, release ); + _release( *static_cast<void **>(pValue), release ); break; default: break; diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index 5c6a973d05a2..cd734ed2e215 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -85,9 +85,9 @@ inline bool _equalStruct( while (nDescr--) { sal_Int32 nOffset = pMemberOffsets[nDescr]; - if (! ::uno_type_equalData( (char *)pDest + nOffset, + if (! ::uno_type_equalData( static_cast<char *>(pDest) + nOffset, ppTypeRefs[nDescr], - (char *)pSource + nOffset, + static_cast<char *>(pSource) + nOffset, ppTypeRefs[nDescr], queryInterface, release )) { @@ -126,8 +126,8 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if ((((sal_Bool *)pDestElements)[nPos] != sal_False) != - (((sal_Bool *)pSourceElements)[nPos] != sal_False)) + if ((static_cast<sal_Bool *>(pDestElements)[nPos] != sal_False) != + (static_cast<sal_Bool *>(pSourceElements)[nPos] != sal_False)) { return false; } @@ -149,7 +149,7 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if (((float *)pDestElements)[nPos] != ((float *)pSourceElements)[nPos]) + if (static_cast<float *>(pDestElements)[nPos] != static_cast<float *>(pSourceElements)[nPos]) return false; } return true; @@ -158,7 +158,7 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if (((double *)pDestElements)[nPos] != ((double *)pSourceElements)[nPos]) + if (static_cast<double *>(pDestElements)[nPos] != static_cast<double *>(pSourceElements)[nPos]) return false; } return true; @@ -167,7 +167,7 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if (! ((::rtl::OUString *)pDestElements +nPos)->equals( ((const ::rtl::OUString *)pSourceElements)[nPos] )) + if (! (static_cast<OUString *>(pDestElements) +nPos)->equals( static_cast<const ::rtl::OUString *>(pSourceElements)[nPos] )) return false; } return true; @@ -176,8 +176,8 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if (! _type_equals( ((typelib_TypeDescriptionReference **)pDestElements)[nPos], - ((typelib_TypeDescriptionReference **)pSourceElements)[nPos] )) + if (! _type_equals( static_cast<typelib_TypeDescriptionReference **>(pDestElements)[nPos], + static_cast<typelib_TypeDescriptionReference **>(pSourceElements)[nPos] )) { return false; } @@ -188,8 +188,8 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - uno_Any * pDest2 = (uno_Any *)pDestElements + nPos; - uno_Any * pSource2 = (uno_Any *)pSourceElements + nPos; + uno_Any * pDest2 = static_cast<uno_Any *>(pDestElements) + nPos; + uno_Any * pSource2 = static_cast<uno_Any *>(pSourceElements) + nPos; if (! ::uno_type_equalData( pDest2->pData, pDest2->pType, pSource2->pData, pSource2->pType, queryInterface, release )) @@ -209,8 +209,8 @@ inline bool _equalSequence( sal_Int32 nElementSize = pElementTypeDescr->nSize; for ( sal_Int32 nPos = nElements; nPos--; ) { - if (! _equalStruct( (char *)pDestElements + (nPos * nElementSize), - (char *)pSourceElements + (nPos * nElementSize), + if (! _equalStruct( static_cast<char *>(pDestElements) + (nPos * nElementSize), + static_cast<char *>(pSourceElements) + (nPos * nElementSize), reinterpret_cast<typelib_CompoundTypeDescription *>(pElementTypeDescr), queryInterface, release )) { @@ -229,8 +229,8 @@ inline bool _equalSequence( reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; for ( sal_Int32 nPos = nElements; nPos--; ) { - if (! equalSequence( ((uno_Sequence **)pDestElements)[nPos], - ((uno_Sequence **)pSourceElements)[nPos], + if (! equalSequence( static_cast<uno_Sequence **>(pDestElements)[nPos], + static_cast<uno_Sequence **>(pSourceElements)[nPos], pSeqElementType, queryInterface, release )) { TYPELIB_DANGER_RELEASE( pElementTypeDescr ); @@ -244,7 +244,7 @@ inline bool _equalSequence( { for ( sal_Int32 nPos = nElements; nPos--; ) { - if (! _equalObject( ((void **)pDestElements)[nPos], ((void **)pSourceElements)[nPos], + if (! _equalObject( static_cast<void **>(pDestElements)[nPos], static_cast<void **>(pSourceElements)[nPos], queryInterface, release )) { return false; @@ -269,13 +269,13 @@ inline bool _equalData( while (typelib_TypeClass_ANY == (eDestTypeClass = pDestType->eTypeClass)) { pDestTypeDescr = 0; - pDestType = ((uno_Any *)pDest)->pType; - pDest = ((uno_Any *)pDest)->pData; + pDestType = static_cast<uno_Any *>(pDest)->pType; + pDest = static_cast<uno_Any *>(pDest)->pData; } while (typelib_TypeClass_ANY == (eSourceTypeClass = pSourceType->eTypeClass)) { - pSourceType = ((uno_Any *)pSource)->pType; - pSource = ((uno_Any *)pSource)->pData; + pSourceType = static_cast<uno_Any *>(pSource)->pType; + pSource = static_cast<uno_Any *>(pSource)->pData; } switch (eDestTypeClass) @@ -284,33 +284,33 @@ inline bool _equalData( return eSourceTypeClass == typelib_TypeClass_VOID; case typelib_TypeClass_CHAR: return eSourceTypeClass == typelib_TypeClass_CHAR - && *(sal_Unicode *)pDest == *(sal_Unicode *)pSource; + && *static_cast<sal_Unicode *>(pDest) == *static_cast<sal_Unicode *>(pSource); case typelib_TypeClass_BOOLEAN: return eSourceTypeClass == typelib_TypeClass_BOOLEAN - && ((*(sal_Bool *)pDest != sal_False) - == (*(sal_Bool *)pSource != sal_False)); + && ((*static_cast<sal_Bool *>(pDest) != sal_False) + == (*static_cast<sal_Bool *>(pSource) != sal_False)); case typelib_TypeClass_BYTE: switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(sal_Int8 *)pDest == *(sal_Int8 *)pSource); + return (*static_cast<sal_Int8 *>(pDest) == *static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return ((sal_Int16)*(sal_Int8 *)pDest == *(sal_Int16 *)pSource); + return ((sal_Int16)*static_cast<sal_Int8 *>(pDest) == *static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return ((sal_Int32)*(sal_Int8 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource); + return ((sal_Int32)*static_cast<sal_Int8 *>(pDest) == (sal_Int32)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return ((sal_Int32)*(sal_Int8 *)pDest == *(sal_Int32 *)pSource); + return ((sal_Int32)*static_cast<sal_Int8 *>(pDest) == *static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*(sal_Int8 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource); + return ((sal_Int64)*static_cast<sal_Int8 *>(pDest) == (sal_Int64)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource); + return ((sal_Int64)*static_cast<sal_Int8 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return (*(sal_Int8 *)pDest >= 0 && - (sal_Int64)*(sal_Int8 *)pDest == *(sal_Int64 *)pSource); // same size + return (*static_cast<sal_Int8 *>(pDest) >= 0 && + (sal_Int64)*static_cast<sal_Int8 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*(sal_Int8 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_Int8 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_Int8 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_Int8 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -318,24 +318,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(sal_Int16 *)pDest == (sal_Int16)*(sal_Int8 *)pSource); + return (*static_cast<sal_Int16 *>(pDest) == (sal_Int16)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(sal_Int16 *)pDest == *(sal_Int16 *)pSource); + return (*static_cast<sal_Int16 *>(pDest) == *static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return ((sal_Int32)*(sal_Int16 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource); + return ((sal_Int32)*static_cast<sal_Int16 *>(pDest) == (sal_Int32)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return ((sal_Int32)*(sal_Int16 *)pDest == *(sal_Int32 *)pSource); + return ((sal_Int32)*static_cast<sal_Int16 *>(pDest) == *static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*(sal_Int16 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource); + return ((sal_Int64)*static_cast<sal_Int16 *>(pDest) == (sal_Int64)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource); + return ((sal_Int64)*static_cast<sal_Int16 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return (*(sal_Int16 *)pDest >= 0 && - (sal_Int64)*(sal_Int16 *)pDest == *(sal_Int64 *)pSource); // same size + return (*static_cast<sal_Int16 *>(pDest) >= 0 && + (sal_Int64)*static_cast<sal_Int16 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*(sal_Int16 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_Int16 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_Int16 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_Int16 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -343,23 +343,23 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int8 *)pSource); + return ((sal_Int32)*static_cast<sal_uInt16 *>(pDest) == (sal_Int32)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return ((sal_Int32)*(sal_uInt16 *)pDest == (sal_Int32)*(sal_Int16 *)pSource); + return ((sal_Int32)*static_cast<sal_uInt16 *>(pDest) == (sal_Int32)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(sal_uInt16 *)pDest == *(sal_uInt16 *)pSource); + return (*static_cast<sal_uInt16 *>(pDest) == *static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return ((sal_Int32)*(sal_uInt16 *)pDest == *(sal_Int32 *)pSource); + return ((sal_Int32)*static_cast<sal_uInt16 *>(pDest) == *static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_uInt32)*(sal_uInt16 *)pDest == *(sal_uInt32 *)pSource); + return ((sal_uInt32)*static_cast<sal_uInt16 *>(pDest) == *static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*(sal_uInt16 *)pDest == *(sal_Int64 *)pSource); + return ((sal_Int64)*static_cast<sal_uInt16 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return ((sal_uInt64)*(sal_uInt16 *)pDest == *(sal_uInt64 *)pSource); + return ((sal_uInt64)*static_cast<sal_uInt16 *>(pDest) == *static_cast<sal_uInt64 *>(pSource)); case typelib_TypeClass_FLOAT: - return ((float)*(sal_uInt16 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_uInt16 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_uInt16 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_uInt16 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -367,24 +367,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int8 *)pSource); + return (*static_cast<sal_Int32 *>(pDest) == (sal_Int32)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_Int16 *)pSource); + return (*static_cast<sal_Int32 *>(pDest) == (sal_Int32)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(sal_Int32 *)pDest == (sal_Int32)*(sal_uInt16 *)pSource); + return (*static_cast<sal_Int32 *>(pDest) == (sal_Int32)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return (*(sal_Int32 *)pDest == *(sal_Int32 *)pSource); + return (*static_cast<sal_Int32 *>(pDest) == *static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return ((sal_Int64)*(sal_Int32 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource); + return ((sal_Int64)*static_cast<sal_Int32 *>(pDest) == (sal_Int64)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource); + return ((sal_Int64)*static_cast<sal_Int32 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return (*(sal_Int32 *)pDest >= 0 && - (sal_Int64)*(sal_Int32 *)pDest == *(sal_Int64 *)pSource); // same size + return (*static_cast<sal_Int32 *>(pDest) >= 0 && + (sal_Int64)*static_cast<sal_Int32 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*(sal_Int32 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_Int32 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_Int32 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_Int32 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -392,23 +392,23 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int8 *)pSource); + return ((sal_Int64)*static_cast<sal_uInt32 *>(pDest) == (sal_Int64)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int16 *)pSource); + return ((sal_Int64)*static_cast<sal_uInt32 *>(pDest) == (sal_Int64)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(sal_uInt32 *)pDest == (sal_uInt32)*(sal_uInt16 *)pSource); + return (*static_cast<sal_uInt32 *>(pDest) == (sal_uInt32)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return ((sal_Int64)*(sal_uInt32 *)pDest == (sal_Int64)*(sal_Int32 *)pSource); + return ((sal_Int64)*static_cast<sal_uInt32 *>(pDest) == (sal_Int64)*static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return (*(sal_uInt32 *)pDest == *(sal_uInt32 *)pSource); + return (*static_cast<sal_uInt32 *>(pDest) == *static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return ((sal_Int64)*(sal_uInt32 *)pDest == *(sal_Int64 *)pSource); + return ((sal_Int64)*static_cast<sal_uInt32 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return ((sal_uInt64)*(sal_uInt32 *)pDest == *(sal_uInt64 *)pSource); + return ((sal_uInt64)*static_cast<sal_uInt32 *>(pDest) == *static_cast<sal_uInt64 *>(pSource)); case typelib_TypeClass_FLOAT: - return ((float)*(sal_uInt32 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_uInt32 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_uInt32 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_uInt32 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -416,24 +416,24 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int8 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == (sal_Int64)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int16 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == (sal_Int64)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt16 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == (sal_Int64)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_Int32 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == (sal_Int64)*static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return (*(sal_Int64 *)pDest == (sal_Int64)*(sal_uInt32 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == (sal_Int64)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return (*(sal_Int64 *)pDest == *(sal_Int64 *)pSource); + return (*static_cast<sal_Int64 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return (*(sal_Int64 *)pDest >= 0 && - *(sal_Int64 *)pDest == *(sal_Int64 *)pSource); // same size + return (*static_cast<sal_Int64 *>(pDest) >= 0 && + *static_cast<sal_Int64 *>(pDest) == *static_cast<sal_Int64 *>(pSource)); // same size case typelib_TypeClass_FLOAT: - return ((float)*(sal_Int64 *)pDest == *(float *)pSource); + return ((float)*static_cast<sal_Int64 *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(sal_Int64 *)pDest == *(double *)pSource); + return ((double)*static_cast<sal_Int64 *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -441,31 +441,31 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(sal_Int8 *)pSource >= 0 && - *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int8 *)pSource); + return (*static_cast<sal_Int8 *>(pSource) >= 0 && + *static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(sal_Int16 *)pSource >= 0 && - *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int16 *)pSource); + return (*static_cast<sal_Int16 *>(pSource) >= 0 && + *static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt16 *)pSource); + return (*static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return (*(sal_Int32 *)pSource >= 0 && - *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int32 *)pSource); + return (*static_cast<sal_Int32 *>(pSource) >= 0 && + *static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return (*(sal_uInt64 *)pDest == (sal_uInt64)*(sal_uInt32 *)pSource); + return (*static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return (*(sal_Int64 *)pSource >= 0 && - *(sal_uInt64 *)pDest == (sal_uInt64)*(sal_Int64 *)pSource); + return (*static_cast<sal_Int64 *>(pSource) >= 0 && + *static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - return (*(sal_uInt64 *)pDest == *(sal_uInt64 *)pSource); + return (*static_cast<sal_uInt64 *>(pDest) == *static_cast<sal_uInt64 *>(pSource)); case typelib_TypeClass_FLOAT: - if (::floor( *(float *)pSource ) != *(float *)pSource || *(float *)pSource < 0) + if (::floor( *static_cast<float *>(pSource) ) != *static_cast<float *>(pSource) || *static_cast<float *>(pSource) < 0) return false; - return (*(sal_uInt64 *)pDest == (sal_uInt64)*(float *)pSource); + return (*static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - if (::floor( *(double *)pSource ) != *(double *)pSource || *(double *)pSource < 0) + if (::floor( *static_cast<double *>(pSource) ) != *static_cast<double *>(pSource) || *static_cast<double *>(pSource) < 0) return false; - return (*(sal_uInt64 *)pDest == (sal_uInt64)*(double *)pSource); + return (*static_cast<sal_uInt64 *>(pDest) == (sal_uInt64)*static_cast<double *>(pSource)); default: return false; } @@ -473,25 +473,25 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(float *)pDest == (float)*(sal_Int8 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(float *)pDest == (float)*(sal_Int16 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(float *)pDest == (float)*(sal_uInt16 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return (*(float *)pDest == (float)*(sal_Int32 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return (*(float *)pDest == (float)*(sal_uInt32 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return (*(float *)pDest == (float)*(sal_Int64 *)pSource); + return (*static_cast<float *>(pDest) == (float)*static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - if (::floor( *(float *)pDest ) != *(float *)pDest || *(float *)pDest < 0) + if (::floor( *static_cast<float *>(pDest) ) != *static_cast<float *>(pDest) || *static_cast<float *>(pDest) < 0) return false; - return ((sal_uInt64)*(float *)pDest == *(sal_uInt64 *)pSource); + return ((sal_uInt64)*static_cast<float *>(pDest) == *static_cast<sal_uInt64 *>(pSource)); case typelib_TypeClass_FLOAT: - return (*(float *)pDest == *(float *)pSource); + return (*static_cast<float *>(pDest) == *static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return ((double)*(float *)pDest == *(double *)pSource); + return ((double)*static_cast<float *>(pDest) == *static_cast<double *>(pSource)); default: return false; } @@ -499,40 +499,40 @@ inline bool _equalData( switch (eSourceTypeClass) { case typelib_TypeClass_BYTE: - return (*(double *)pDest == (double)*(sal_Int8 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_Int8 *>(pSource)); case typelib_TypeClass_SHORT: - return (*(double *)pDest == (double)*(sal_Int16 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_Int16 *>(pSource)); case typelib_TypeClass_UNSIGNED_SHORT: - return (*(double *)pDest == (double)*(sal_uInt16 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_uInt16 *>(pSource)); case typelib_TypeClass_LONG: - return (*(double *)pDest == (double)*(sal_Int32 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_UNSIGNED_LONG: - return (*(double *)pDest == (double)*(sal_uInt32 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_uInt32 *>(pSource)); case typelib_TypeClass_HYPER: - return (*(double *)pDest == (double)*(sal_Int64 *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<sal_Int64 *>(pSource)); case typelib_TypeClass_UNSIGNED_HYPER: - if (::floor( *(double *)pDest ) != *(double *)pDest || *(double *)pDest < 0) + if (::floor( *static_cast<double *>(pDest) ) != *static_cast<double *>(pDest) || *static_cast<double *>(pDest) < 0) return false; - return ((sal_uInt64)*(double *)pDest == *(sal_uInt64 *)pSource); + return ((sal_uInt64)*static_cast<double *>(pDest) == *static_cast<sal_uInt64 *>(pSource)); case typelib_TypeClass_FLOAT: - return (*(double *)pDest == (double)*(float *)pSource); + return (*static_cast<double *>(pDest) == (double)*static_cast<float *>(pSource)); case typelib_TypeClass_DOUBLE: - return (*(double *)pDest == *(double *)pSource); + return (*static_cast<double *>(pDest) == *static_cast<double *>(pSource)); default: return false; } case typelib_TypeClass_STRING: return eSourceTypeClass == typelib_TypeClass_STRING - && ((::rtl::OUString *)pDest)->equals( - *(::rtl::OUString const *)pSource ); + && (static_cast<OUString *>(pDest))->equals( + *static_cast<OUString const *>(pSource) ); case typelib_TypeClass_TYPE: return eSourceTypeClass == typelib_TypeClass_TYPE && _type_equals( - *(typelib_TypeDescriptionReference **)pDest, - *(typelib_TypeDescriptionReference **)pSource ); + *static_cast<typelib_TypeDescriptionReference **>(pDest), + *static_cast<typelib_TypeDescriptionReference **>(pSource) ); case typelib_TypeClass_ENUM: return (_type_equals( pDestType, pSourceType ) && - *(sal_Int32 *)pDest == *(sal_Int32 *)pSource); + *static_cast<sal_Int32 *>(pDest) == *static_cast<sal_Int32 *>(pSource)); case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: if (! _type_equals( pDestType, pSourceType )) @@ -560,7 +560,7 @@ inline bool _equalData( if (pDestTypeDescr) { return _equalSequence( - *(uno_Sequence **)pDest, *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDest), *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pDestTypeDescr)->pType, queryInterface, release ); } @@ -568,7 +568,7 @@ inline bool _equalData( { TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType ); bool bRet = _equalSequence( - *(uno_Sequence **)pDest, *(uno_Sequence **)pSource, + *static_cast<uno_Sequence **>(pDest), *static_cast<uno_Sequence **>(pSource), reinterpret_cast<typelib_IndirectTypeDescription *>(pDestTypeDescr)->pType, queryInterface, release ); TYPELIB_DANGER_RELEASE( pDestTypeDescr ); @@ -578,7 +578,7 @@ inline bool _equalData( return false; case typelib_TypeClass_INTERFACE: if (typelib_TypeClass_INTERFACE == eSourceTypeClass) - return _equalObject( *(void **)pDest, *(void **)pSource, queryInterface, release ); + return _equalObject( *static_cast<void **>(pDest), *static_cast<void **>(pSource), queryInterface, release ); break; default: OSL_ASSERT(false); diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 5cba0fcf4184..19578469fbeb 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -502,7 +502,7 @@ static void SAL_CALL defenv_getRegisteredInterfaces( sal_Int32 nLen = that->aPtr2ObjectMap.size(); 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 const iEnd( that->aPtr2ObjectMap.end() ); @@ -656,7 +656,7 @@ static void writeLine( { if (stream) { - fprintf( (FILE *) stream, "%s\n", pLine ); + fprintf( static_cast<FILE *>(stream), "%s\n", pLine ); } else { @@ -671,7 +671,7 @@ static void writeLine( { if (stream) { - fprintf( (FILE *) stream, "%s\n", pLine ); + fprintf( static_cast<FILE *>(stream), "%s\n", pLine ); } else { @@ -854,10 +854,10 @@ static void SAL_CALL unoenv_computeObjectIdentifier( *ppOId = 0; } - uno_Interface * pUnoI = (uno_Interface *) + uno_Interface * pUnoI = static_cast<uno_Interface *>( ::cppu::binuno_queryInterface( pInterface, *typelib_static_type_getByTypeClass( - typelib_TypeClass_INTERFACE ) ); + typelib_TypeClass_INTERFACE ) )); if (0 != pUnoI) { (*pUnoI->release)( pUnoI ); @@ -993,8 +993,8 @@ inline void EnvironmentsData::getRegisteredEnvironments( assert(pppEnvs && pnLen && memAlloc && "### null ptr!"); // max size - uno_Environment ** ppFound = (uno_Environment **)alloca( - sizeof(uno_Environment *) * aName2EnvMap.size() ); + uno_Environment ** ppFound = static_cast<uno_Environment **>(alloca( + sizeof(uno_Environment *) * aName2EnvMap.size() )); sal_Int32 nSize = 0; // find matching environment @@ -1015,8 +1015,8 @@ inline void EnvironmentsData::getRegisteredEnvironments( *pnLen = nSize; if (nSize) { - *pppEnvs = (uno_Environment **) (*memAlloc)( - sizeof (uno_Environment *) * nSize ); + *pppEnvs = static_cast<uno_Environment **>((*memAlloc)( + sizeof (uno_Environment *) * nSize )); OSL_ASSERT( *pppEnvs ); while (nSize--) { @@ -1058,7 +1058,7 @@ static bool loadEnv(OUString const & cLibStem, return false; 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) return false; diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 257417d4906e..f4cc581811c9 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -419,7 +419,7 @@ static Mapping loadExternalMapping( { OUString aSymbolName( UNO_EXT_GETMAPPING ); uno_ext_getMappingFunc fpGetMapFunc = - (uno_ext_getMappingFunc)aModule.getSymbol( aSymbolName ); + reinterpret_cast<uno_ext_getMappingFunc>(aModule.getSymbol( aSymbolName )); if (fpGetMapFunc) { diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index 6f50f9282ce7..d168fe86f9f8 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -80,7 +80,7 @@ inline void _acquire( void * p, uno_AcquireFunc acquire ) } 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 ) } else { - (*((uno_Interface *)p)->release)( (uno_Interface *)p ); + (*static_cast<uno_Interface *>(p)->release)( static_cast<uno_Interface *>(p) ); } } } diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 7dc3e9f861bc..cd536a853614 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -51,11 +51,11 @@ static inline uno_Sequence * reallocSeq( { if (pReallocate == 0) { - pNew = (uno_Sequence *) rtl_allocateMemory( nSize ); + pNew = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); } else { - pNew = (uno_Sequence *) rtl_reallocateMemory( pReallocate, nSize ); + pNew = static_cast<uno_Sequence *>(rtl_reallocateMemory( pReallocate, nSize )); } if (pNew != 0) { @@ -330,7 +330,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -341,7 +341,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -352,7 +352,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -364,7 +364,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -376,7 +376,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -388,7 +388,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -399,7 +399,7 @@ static inline bool icopyConstructFromElements( { memcpy( pSeq->elements + (sizeof(float) * nStartIndex), - (char *)pSourceElements + (sizeof(float) * nStartIndex), + static_cast<char *>(pSourceElements) + (sizeof(float) * nStartIndex), sizeof(float) * (nStopIndex - nStartIndex) ); } break; @@ -410,7 +410,7 @@ static inline bool icopyConstructFromElements( { memcpy( pSeq->elements + (sizeof(double) * nStartIndex), - (char *)pSourceElements + (sizeof(double) * nStartIndex), + static_cast<char *>(pSourceElements) + (sizeof(double) * nStartIndex), sizeof(double) * (nStopIndex - nStartIndex) ); } break; @@ -421,7 +421,7 @@ static inline bool icopyConstructFromElements( { memcpy( 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) ); } break; @@ -437,8 +437,8 @@ static inline bool icopyConstructFromElements( // This code tends to trigger coverity's overrun-buffer-arg warning // coverity[index_parm_via_loop_bound] - https://communities.coverity.com/thread/2993 ::rtl_uString_acquire( - ((rtl_uString **)pSourceElements)[nPos] ); - pDestElements[nPos] = ((rtl_uString **)pSourceElements)[nPos]; + static_cast<rtl_uString **>(pSourceElements)[nPos] ); + pDestElements[nPos] = static_cast<rtl_uString **>(pSourceElements)[nPos]; } } break; @@ -457,10 +457,10 @@ static inline bool icopyConstructFromElements( for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { TYPE_ACQUIRE( - ((typelib_TypeDescriptionReference **) + static_cast<typelib_TypeDescriptionReference **>( pSourceElements)[nPos] ); pDestElements[nPos] = - ((typelib_TypeDescriptionReference **) + static_cast<typelib_TypeDescriptionReference **>( pSourceElements)[nPos]; } } @@ -475,7 +475,7 @@ static inline bool icopyConstructFromElements( uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements); 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( &pDestElements[nPos], pSource->pData, @@ -505,7 +505,7 @@ static inline bool icopyConstructFromElements( char * pDest = pDestElements + (nElementSize * nPos); char * pSource = - (char *)pSourceElements + (nElementSize * nPos); + static_cast<char *>(pSourceElements) + (nElementSize * nPos); if (pTypeDescr->pBaseTypeDescription) { @@ -551,7 +551,7 @@ static inline bool icopyConstructFromElements( for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { uno_Sequence * pNew = icopyConstructSequence( - ((uno_Sequence **) pSourceElements)[nPos], + static_cast<uno_Sequence **>(pSourceElements)[nPos], pSeqElementType, acquire, 0 ); OSL_ASSERT( pNew != 0 ); // ought never be a memory allocation problem, @@ -572,7 +572,7 @@ static inline bool icopyConstructFromElements( for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { _acquire( pDestElements[nPos] = - ((void **)pSourceElements)[nPos], acquire ); + static_cast<void **>(pSourceElements)[nPos], acquire ); } } break; |