From d57d81e529a44d8042401e36057a69ebe97e870a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 28 Mar 2015 19:05:46 +0100 Subject: Clean up C-style casts from pointers to void Change-Id: I5e370445affbcd32b05588111f74590bf24f39d6 --- sal/rtl/alloc_arena.cxx | 12 ++++----- sal/rtl/alloc_cache.cxx | 20 +++++++-------- sal/rtl/alloc_global.cxx | 8 +++--- sal/rtl/byteseq.cxx | 14 +++++------ sal/rtl/cipher.cxx | 36 +++++++++++++-------------- sal/rtl/cmdargs.cxx | 2 +- sal/rtl/crc.cxx | 2 +- sal/rtl/digest.cxx | 64 ++++++++++++++++++++++++------------------------ sal/rtl/hash.cxx | 4 +-- sal/rtl/locale.cxx | 8 +++--- sal/rtl/random.cxx | 12 ++++----- sal/rtl/strtmpl.cxx | 6 ++--- 12 files changed, 94 insertions(+), 94 deletions(-) (limited to 'sal/rtl') diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index b7447175039a..329d013dfafb 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -91,7 +91,7 @@ rtl_machdep_pagesize(); int rtl_arena_segment_constructor (void * obj) { - rtl_arena_segment_type * segment = (rtl_arena_segment_type*)(obj); + rtl_arena_segment_type * segment = static_cast(obj); QUEUE_START_NAMED(segment, s); QUEUE_START_NAMED(segment, f); @@ -272,7 +272,7 @@ rtl_arena_hash_rescale ( sal_Size new_bytes; new_bytes = new_size * sizeof(rtl_arena_segment_type*); - new_table = (rtl_arena_segment_type **)rtl_arena_alloc (gp_arena_arena, &new_bytes); + new_table = static_cast(rtl_arena_alloc (gp_arena_arena, &new_bytes)); if (new_table != 0) { @@ -586,7 +586,7 @@ rtl_arena_segment_coalesce ( void rtl_arena_constructor (void * obj) { - rtl_arena_type * arena = (rtl_arena_type*)(obj); + rtl_arena_type * arena = static_cast(obj); rtl_arena_segment_type * head; size_t i; @@ -627,7 +627,7 @@ rtl_arena_constructor (void * obj) void rtl_arena_destructor (void * obj) { - rtl_arena_type * arena = (rtl_arena_type*)(obj); + rtl_arena_type * arena = static_cast(obj); rtl_arena_segment_type * head; size_t i; @@ -705,7 +705,7 @@ rtl_arena_activate ( int i, n = (arena->m_qcache_max >> arena->m_quantum_shift); sal_Size size = n * sizeof(rtl_cache_type*); - arena->m_qcache_ptr = (rtl_cache_type**)rtl_arena_alloc (gp_arena_arena, &size); + arena->m_qcache_ptr = static_cast(rtl_arena_alloc (gp_arena_arena, &size)); if (!(arena->m_qcache_ptr)) { /* out of memory */ @@ -878,7 +878,7 @@ SAL_CALL rtl_arena_create ( sal_Size size = sizeof(rtl_arena_type); try_alloc: - result = (rtl_arena_type*)rtl_arena_alloc (gp_arena_arena, &size); + result = static_cast(rtl_arena_alloc (gp_arena_arena, &size)); if (result != 0) { rtl_arena_type * arena = result; diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx index d63ae65dbb42..5944043eebb3 100644 --- a/sal/rtl/alloc_cache.cxx +++ b/sal/rtl/alloc_cache.cxx @@ -102,7 +102,7 @@ rtl_cache_hash_rescale ( sal_Size new_bytes; new_bytes = new_size * sizeof(rtl_cache_bufctl_type*); - new_table = (rtl_cache_bufctl_type**)rtl_arena_alloc(gp_cache_arena, &new_bytes); + new_table = static_cast(rtl_arena_alloc(gp_cache_arena, &new_bytes)); if (new_table != 0) { @@ -236,7 +236,7 @@ rtl_cache_hash_remove ( int rtl_cache_slab_constructor (void * obj, SAL_UNUSED_PARAMETER void *) { - rtl_cache_slab_type * slab = (rtl_cache_slab_type*)(obj); + rtl_cache_slab_type * slab = static_cast(obj); QUEUE_START_NAMED(slab, slab_); slab->m_ntypes = 0; @@ -278,7 +278,7 @@ rtl_cache_slab_create ( { /* allocate slab struct from slab cache */ assert(cache != gp_cache_slab_cache); - slab = (rtl_cache_slab_type*)rtl_cache_alloc (gp_cache_slab_cache); + slab = static_cast(rtl_cache_alloc (gp_cache_slab_cache)); } else { @@ -413,7 +413,7 @@ rtl_cache_slab_alloc ( { /* allocate bufctl */ assert(cache != gp_cache_bufctl_cache); - bufctl = (rtl_cache_bufctl_type*)rtl_cache_alloc (gp_cache_bufctl_cache); + bufctl = static_cast(rtl_cache_alloc (gp_cache_bufctl_cache)); if (bufctl == 0) { /* out of memory */ @@ -490,7 +490,7 @@ rtl_cache_slab_free ( else { /* embedded slab struct */ - bufctl = (rtl_cache_bufctl_type*)(addr); + bufctl = static_cast(addr); slab = RTL_CACHE_SLAB(addr, cache->m_slab_size); } @@ -540,7 +540,7 @@ rtl_cache_slab_free ( int rtl_cache_magazine_constructor (void * obj, SAL_UNUSED_PARAMETER void *) { - rtl_cache_magazine_type * mag = (rtl_cache_magazine_type*)(obj); + rtl_cache_magazine_type * mag = static_cast(obj); /* @@@ sal_Size size = (sal_Size)(arg); @@@ */ mag->m_mag_next = 0; @@ -704,7 +704,7 @@ rtl_cache_depot_populate ( { /* allocate new empty magazine */ RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); - empty = (rtl_cache_magazine_type*)rtl_cache_alloc (cache->m_magazine_cache); + empty = static_cast(rtl_cache_alloc (cache->m_magazine_cache)); RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock)); if (empty != 0) { @@ -722,7 +722,7 @@ rtl_cache_depot_populate ( int rtl_cache_constructor (void * obj) { - rtl_cache_type * cache = (rtl_cache_type*)(obj); + rtl_cache_type * cache = static_cast(obj); memset (cache, 0, sizeof(rtl_cache_type)); @@ -750,7 +750,7 @@ rtl_cache_constructor (void * obj) void rtl_cache_destructor (void * obj) { - rtl_cache_type * cache = (rtl_cache_type*)(obj); + rtl_cache_type * cache = static_cast(obj); /* linkage */ assert(QUEUE_STARTED_NAMED(cache, cache_)); @@ -1059,7 +1059,7 @@ SAL_CALL rtl_cache_create ( sal_Size size = sizeof(rtl_cache_type); try_alloc: - result = (rtl_cache_type*)rtl_arena_alloc (gp_cache_arena, &size); + result = static_cast(rtl_arena_alloc (gp_cache_arena, &size)); if (result != 0) { rtl_cache_type * cache = result; diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx index cff293c97083..69313708e3e5 100644 --- a/sal/rtl/alloc_global.cxx +++ b/sal/rtl/alloc_global.cxx @@ -110,9 +110,9 @@ SAL_CALL rtl_allocateMemory_CUSTOM (sal_Size n) SAL_THROW_EXTERN_C() try_alloc: if (size <= RTL_MEMORY_CACHED_LIMIT) - addr = (char*)rtl_cache_alloc(g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT]); + addr = static_cast(rtl_cache_alloc(g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT])); else - addr = (char*)rtl_arena_alloc (gp_alloc_arena, &size); + addr = static_cast(rtl_arena_alloc (gp_alloc_arena, &size)); if (addr != 0) { @@ -138,7 +138,7 @@ void SAL_CALL rtl_freeMemory_CUSTOM (void * p) SAL_THROW_EXTERN_C() { if (p != 0) { - char * addr = (char*)(p) - RTL_MEMALIGN; + char * addr = static_cast(p) - RTL_MEMALIGN; sal_Size size = reinterpret_cast(addr)[0]; if (size <= RTL_MEMORY_CACHED_LIMIT) @@ -157,7 +157,7 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT if (p != 0) { void * p_old = p; - sal_Size n_old = reinterpret_cast( (char*)(p) - RTL_MEMALIGN )[0] - RTL_MEMALIGN; + sal_Size n_old = reinterpret_cast( static_cast(p) - RTL_MEMALIGN )[0] - RTL_MEMALIGN; p = rtl_allocateMemory (n); if (p != 0) diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx index cd25a62a25e0..a3744863bd8d 100644 --- a/sal/rtl/byteseq.cxx +++ b/sal/rtl/byteseq.cxx @@ -50,7 +50,7 @@ void SAL_CALL rtl_byte_sequence_reference2One( nElements = pSequence->nElements; if (nElements) { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements ); + pNew = static_cast(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements )); if ( pNew != 0 ) memcpy( pNew->elements, pSequence->elements, nElements ); @@ -60,7 +60,7 @@ void SAL_CALL rtl_byte_sequence_reference2One( } else { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE ); + pNew = static_cast(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE )); } if ( pNew != 0 ) @@ -88,7 +88,7 @@ void SAL_CALL rtl_byte_sequence_realloc( if (pSequence->nRefCount > 1) // split { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nSize ); + pNew = static_cast(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nSize )); if ( pNew != 0 ) { @@ -109,8 +109,8 @@ void SAL_CALL rtl_byte_sequence_realloc( } else { - pSequence = (sal_Sequence *)rtl_reallocateMemory( - pSequence, SAL_SEQUENCE_HEADER_SIZE + nSize ); + pSequence = static_cast(rtl_reallocateMemory( + pSequence, SAL_SEQUENCE_HEADER_SIZE + nSize )); } if ( pSequence != 0 ) @@ -153,7 +153,7 @@ void SAL_CALL rtl_byte_sequence_construct( sal_Sequence **ppSequence , sal_Int32 if( nLength ) { - *ppSequence = (sal_Sequence *) rtl_allocateZeroMemory( SAL_SEQUENCE_HEADER_SIZE + nLength ); + *ppSequence = static_cast(rtl_allocateZeroMemory( SAL_SEQUENCE_HEADER_SIZE + nLength )); if ( *ppSequence != 0 ) { @@ -178,7 +178,7 @@ void SAL_CALL rtl_byte_sequence_constructNoDefault( sal_Sequence **ppSequence , *ppSequence = 0; } - *ppSequence = (sal_Sequence *) rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nLength ); + *ppSequence = static_cast(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nLength )); if ( *ppSequence != 0 ) { diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index ba799ec846ca..50de1a9ad822 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -138,7 +138,7 @@ rtlCipherError SAL_CALL rtl_cipher_init ( const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_init == NULL) @@ -156,7 +156,7 @@ rtlCipherError SAL_CALL rtl_cipher_encode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_encode == NULL) @@ -173,7 +173,7 @@ rtlCipherError SAL_CALL rtl_cipher_decode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_decode == NULL) @@ -187,7 +187,7 @@ rtlCipherError SAL_CALL rtl_cipher_decode ( */ void SAL_CALL rtl_cipher_destroy (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast(Cipher); if (pImpl && pImpl->m_delete) pImpl->m_delete (Cipher); } @@ -1010,7 +1010,7 @@ rtlCipher SAL_CALL rtl_cipher_createBF (rtlCipherMode Mode) SAL_THROW_EXTERN_C() if (Mode == rtl_Cipher_ModeInvalid) return ((rtlCipher)NULL); - pImpl = ((CipherBF_Impl*)rtl_allocateZeroMemory (sizeof (CipherBF_Impl))); + pImpl = static_cast(rtl_allocateZeroMemory (sizeof (CipherBF_Impl))); if (pImpl) { pImpl->m_cipher.m_algorithm = rtl_Cipher_AlgorithmBF; @@ -1034,7 +1034,7 @@ rtlCipherError SAL_CALL rtl_cipher_initBF ( const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast(Cipher); if ((pImpl == NULL) || (pKeyData == NULL)) return rtl_Cipher_E_Argument; @@ -1060,7 +1060,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1075,7 +1075,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF ( return __rtl_cipherBF_update ( &(pImpl->m_context), pImpl->m_cipher.m_mode, rtl_Cipher_DirectionEncode, - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1086,7 +1086,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1101,7 +1101,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( return __rtl_cipherBF_update ( &(pImpl->m_context), pImpl->m_cipher.m_mode, rtl_Cipher_DirectionDecode, - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1109,7 +1109,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( */ void SAL_CALL rtl_cipher_destroyBF (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast(Cipher); if (pImpl) { if (pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmBF) @@ -1246,7 +1246,7 @@ rtlCipher SAL_CALL rtl_cipher_createARCFOUR (rtlCipherMode Mode) if (!(Mode == rtl_Cipher_ModeStream)) return ((rtlCipher)NULL); - pImpl = ((CipherARCFOUR_Impl*)rtl_allocateZeroMemory (sizeof (CipherARCFOUR_Impl))); + pImpl = static_cast(rtl_allocateZeroMemory (sizeof (CipherARCFOUR_Impl))); if (pImpl) { pImpl->m_cipher.m_algorithm = rtl_Cipher_AlgorithmARCFOUR; @@ -1271,7 +1271,7 @@ rtlCipherError SAL_CALL rtl_cipher_initARCFOUR ( SAL_UNUSED_PARAMETER const sal_uInt8 *, SAL_UNUSED_PARAMETER sal_Size) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast(Cipher); if ((pImpl == NULL) || (pKeyData == NULL)) return rtl_Cipher_E_Argument; @@ -1295,7 +1295,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1307,7 +1307,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR ( return rtl_cipherARCFOUR_update_Impl ( &(pImpl->m_context), - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1318,7 +1318,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1330,7 +1330,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( return rtl_cipherARCFOUR_update_Impl ( &(pImpl->m_context), - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1338,7 +1338,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( */ void SAL_CALL rtl_cipher_destroyARCFOUR (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast(Cipher); if (pImpl) { if (pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmARCFOUR) diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx index ef9f9bde2ae3..0baae609efdf 100644 --- a/sal/rtl/cmdargs.cxx +++ b/sal/rtl/cmdargs.cxx @@ -52,7 +52,7 @@ void init() sal_Int32 i, n = osl_getCommandArgCount(); g_ppCommandArgs = - (rtl_uString**)rtl_allocateZeroMemory (n * sizeof(rtl_uString*)); + static_cast(rtl_allocateZeroMemory (n * sizeof(rtl_uString*))); for (i = 0; i < n; i++) { rtl_uString * pArg = 0; diff --git a/sal/rtl/crc.cxx b/sal/rtl/crc.cxx index 1e2c6736b045..beae3750c832 100644 --- a/sal/rtl/crc.cxx +++ b/sal/rtl/crc.cxx @@ -141,7 +141,7 @@ sal_uInt32 SAL_CALL rtl_crc32 ( { if (Data) { - const sal_uInt8 *p = (const sal_uInt8 *)Data; + const sal_uInt8 *p = static_cast(Data); const sal_uInt8 *q = p + DatLen; Crc = ~Crc; diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx index d8321fa9cada..5aba0ea91b67 100644 --- a/sal/rtl/digest.cxx +++ b/sal/rtl/digest.cxx @@ -29,7 +29,7 @@ * rtlDigest internals. * *======================================================================*/ -#define RTL_DIGEST_CREATE(T) ((T*)(rtl_allocateZeroMemory(sizeof(T)))) +#define RTL_DIGEST_CREATE(T) (static_cast(rtl_allocateZeroMemory(sizeof(T)))) #define RTL_DIGEST_ROTL(a,n) (((a) << (n)) | ((a) >> (32 - (n)))) @@ -132,7 +132,7 @@ rtlDigest SAL_CALL rtl_digest_create (rtlDigestAlgorithm Algorithm) rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl) return pImpl->m_algorithm; else @@ -145,7 +145,7 @@ rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest) sal_uInt32 SAL_CALL rtl_digest_queryLength (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl) return pImpl->m_length; else @@ -159,7 +159,7 @@ rtlDigestError SAL_CALL rtl_digest_init ( rtlDigest Digest, const sal_uInt8 *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_init) @@ -177,7 +177,7 @@ rtlDigestError SAL_CALL rtl_digest_update ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl && pImpl->m_update) return pImpl->m_update (Digest, pData, nDatLen); else @@ -191,7 +191,7 @@ rtlDigestError SAL_CALL rtl_digest_get ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl && pImpl->m_get) return pImpl->m_get (Digest, pBuffer, nBufLen); else @@ -203,7 +203,7 @@ rtlDigestError SAL_CALL rtl_digest_get ( */ void SAL_CALL rtl_digest_destroy (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast(Digest); if (pImpl && pImpl->m_delete) pImpl->m_delete (Digest); } @@ -407,8 +407,8 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestMD2_Impl *pImpl = static_cast(Digest); + const sal_uInt8 *d = static_cast(pData); DigestContextMD2 *ctx; @@ -466,7 +466,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; + DigestMD2_Impl *pImpl = static_cast(Digest); sal_uInt32 i; DigestContextMD2 *ctx; @@ -495,7 +495,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2 ( */ void SAL_CALL rtl_digest_destroyMD2 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; + DigestMD2_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD2) @@ -778,8 +778,8 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestMD5_Impl *pImpl = static_cast(Digest); + const sal_uInt8 *d = static_cast(pData); DigestContextMD5 *ctx; sal_uInt32 len; @@ -851,7 +851,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast(Digest); sal_uInt8 *p = pBuffer; DigestContextMD5 *ctx; @@ -884,7 +884,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast(Digest); sal_uInt8 *p = pBuffer; DigestContextMD5 *ctx; @@ -915,7 +915,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5 ( */ void SAL_CALL rtl_digest_destroyMD5 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD5) @@ -1262,8 +1262,8 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestSHA_Impl *pImpl = static_cast(Digest); + const sal_uInt8 *d = static_cast(pData); DigestContextSHA *ctx; sal_uInt32 len; @@ -1335,7 +1335,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast(Digest); sal_uInt8 *p = pBuffer; DigestContextSHA *ctx; @@ -1367,7 +1367,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA ( */ void SAL_CALL rtl_digest_destroySHA (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA) @@ -1452,8 +1452,8 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestSHA_Impl *pImpl = static_cast(Digest); + const sal_uInt8 *d = static_cast(pData); DigestContextSHA *ctx; sal_uInt32 len; @@ -1525,7 +1525,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast(Digest); sal_uInt8 *p = pBuffer; DigestContextSHA *ctx; @@ -1557,7 +1557,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 ( */ void SAL_CALL rtl_digest_destroySHA1 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA1) @@ -1695,7 +1695,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 ( rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pKeyData == NULL)) @@ -1734,7 +1734,7 @@ rtlDigestError SAL_CALL rtl_digest_updateHMAC_MD5 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pData == NULL)) @@ -1756,7 +1756,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pBuffer == NULL)) @@ -1789,7 +1789,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 ( */ void SAL_CALL rtl_digest_destroyHMAC_MD5 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_MD5) @@ -1927,7 +1927,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 ( rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pKeyData == NULL)) @@ -1966,7 +1966,7 @@ rtlDigestError SAL_CALL rtl_digest_updateHMAC_SHA1 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pData == NULL)) @@ -1988,7 +1988,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pBuffer == NULL)) @@ -2022,7 +2022,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 ( void SAL_CALL rtl_digest_destroyHMAC_SHA1 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_SHA1) diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index 4de72e3f6ec7..03ae02dcc4ee 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -76,11 +76,11 @@ hashString (rtl_uString *pString) static StringHashTable * rtl_str_hash_new (sal_uInt32 nSize) { - StringHashTable *pHash = (StringHashTable *)malloc (sizeof (StringHashTable)); + StringHashTable *pHash = static_cast(malloc (sizeof (StringHashTable))); pHash->nEntries = 0; pHash->nSize = getNextSize (nSize); - pHash->pData = (rtl_uString **) calloc (sizeof (rtl_uString *), pHash->nSize); + pHash->pData = static_cast(calloc (sizeof (rtl_uString *), pHash->nSize)); return pHash; } diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx index d075eda742f1..8cdff09738fa 100644 --- a/sal/rtl/locale.cxx +++ b/sal/rtl/locale.cxx @@ -88,12 +88,12 @@ extern "C" void rtl_hashtable_init(RTL_HASHTABLE** table, sal_Int8 sizeIndex) if (*table) rtl_hashtable_destroy(*table); - *table = (RTL_HASHTABLE*)rtl_allocateMemory( sizeof(RTL_HASHTABLE) ); + *table = static_cast(rtl_allocateMemory( sizeof(RTL_HASHTABLE) )); (*table)->iSize = sizeIndex; (*table)->Size = nSize; (*table)->Elements = 0; - (*table)->Table = (RTL_HASHENTRY**)rtl_allocateMemory( (*table)->Size * sizeof(RTL_HASHENTRY*) ); + (*table)->Table = static_cast(rtl_allocateMemory( (*table)->Size * sizeof(RTL_HASHENTRY*) )); while (nSize) { @@ -129,7 +129,7 @@ extern "C" rtl_Locale* rtl_hashtable_add(RTL_HASHTABLE** table, rtl_Locale* valu pEntry = &(*pEntry)->Next; } - RTL_HASHENTRY *newEntry = (RTL_HASHENTRY*)rtl_allocateMemory( sizeof(RTL_HASHENTRY) ); + RTL_HASHENTRY *newEntry = static_cast(rtl_allocateMemory( sizeof(RTL_HASHENTRY) )); newEntry->Entry = value; newEntry->Next = NULL; *pEntry = newEntry; @@ -248,7 +248,7 @@ rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const s rtl_uString_newFromStr(&sCountry, country); rtl_uString_newFromStr(&sVariant, variant); - newLocale = (rtl_Locale*)rtl_allocateMemory( sizeof(rtl_Locale) ); + newLocale = static_cast(rtl_allocateMemory( sizeof(rtl_Locale) )); newLocale->Language = sLanguage; newLocale->Country = sCountry; diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index 912074eb789f..0a5638f57423 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -269,7 +269,7 @@ static void __rtl_random_readPool ( rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C() { RandomPool_Impl *pImpl = (RandomPool_Impl*)NULL; - pImpl = (RandomPool_Impl*)rtl_allocateZeroMemory (sizeof(RandomPool_Impl)); + pImpl = static_cast(rtl_allocateZeroMemory (sizeof(RandomPool_Impl))); if (pImpl) { if (!__rtl_random_initPool (pImpl)) @@ -286,7 +286,7 @@ rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C() */ void SAL_CALL rtl_random_destroyPool (rtlRandomPool Pool) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; + RandomPool_Impl *pImpl = static_cast(Pool); if (pImpl) { rtl_digest_destroy (pImpl->m_hDigest); @@ -300,8 +300,8 @@ void SAL_CALL rtl_random_destroyPool (rtlRandomPool Pool) SAL_THROW_EXTERN_C() rtlRandomError SAL_CALL rtl_random_addBytes ( rtlRandomPool Pool, const void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; - const sal_uInt8 *pBuffer = (const sal_uInt8 *)Buffer; + RandomPool_Impl *pImpl = static_cast(Pool); + const sal_uInt8 *pBuffer = static_cast(Buffer); if ((pImpl == NULL) || (pBuffer == NULL)) return rtl_Random_E_Argument; @@ -316,8 +316,8 @@ rtlRandomError SAL_CALL rtl_random_addBytes ( rtlRandomError SAL_CALL rtl_random_getBytes ( rtlRandomPool Pool, void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; - sal_uInt8 *pBuffer = (sal_uInt8 *)Buffer; + RandomPool_Impl *pImpl = static_cast(Pool); + sal_uInt8 *pBuffer = static_cast(Buffer); if ((pImpl == NULL) || (pBuffer == NULL)) return rtl_Random_E_Argument; diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index 55351501ab3e..1dba94baf6e3 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -387,7 +387,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST // assert(nLen >= 0); #if !IMPL_RTL_IS_USTRING // take advantage of builtin optimisations - IMPL_RTL_STRCODE* p = (IMPL_RTL_STRCODE*) memchr(pStr, c, nLen); + IMPL_RTL_STRCODE* p = static_cast(const_cast(memchr(pStr, c, nLen))); return p ? p - pStr : -1; #else const IMPL_RTL_STRCODE* pTempStr = pStr; @@ -1148,8 +1148,8 @@ static IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )( sal_Int32 nLen ) = (sal::static_int_cast< sal_uInt32 >(nLen) <= ((SAL_MAX_UINT32 - sizeof (IMPL_RTL_STRINGDATA)) / sizeof (IMPL_RTL_STRCODE))) - ? (IMPL_RTL_STRINGDATA *) rtl_allocateMemory( - sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE)) + ? static_cast(rtl_allocateMemory( + sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE))) : NULL; if (pData != NULL) { pData->refCount = 1; -- cgit