summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/osl/socket.hxx2
-rw-r--r--include/rtl/byteseq.h2
-rw-r--r--include/rtl/byteseq.hxx2
-rw-r--r--sal/osl/unx/pipe.cxx8
-rw-r--r--sal/osl/unx/socket.cxx26
-rw-r--r--sal/qa/osl/file/osl_File.cxx4
-rw-r--r--sal/qa/rtl/cipher/rtl_cipher.cxx4
-rw-r--r--sal/qa/rtl/digest/rtl_digest.cxx8
-rw-r--r--sal/rtl/alloc_global.cxx6
-rw-r--r--sal/rtl/bootstrap.cxx4
-rw-r--r--sal/rtl/byteseq.cxx2
-rw-r--r--sal/rtl/digest.cxx6
-rw-r--r--sal/rtl/logfile.cxx22
-rw-r--r--sal/rtl/random.cxx8
-rw-r--r--sal/rtl/strtmpl.cxx20
-rw-r--r--sal/rtl/uuid.cxx8
-rw-r--r--sal/textenc/convertbig5hkscs.cxx2
-rw-r--r--sal/textenc/converteuctw.cxx2
-rw-r--r--sal/textenc/convertgb18030.cxx2
-rw-r--r--sal/textenc/convertiso2022cn.cxx2
-rw-r--r--sal/textenc/convertiso2022jp.cxx2
-rw-r--r--sal/textenc/convertiso2022kr.cxx2
-rw-r--r--sal/textenc/tcvtutf8.cxx2
23 files changed, 76 insertions, 70 deletions
diff --git a/include/osl/socket.hxx b/include/osl/socket.hxx
index b8557efc0e69..4d41bed3c20c 100644
--- a/include/osl/socket.hxx
+++ b/include/osl/socket.hxx
@@ -112,7 +112,7 @@ namespace osl
inline ::rtl::ByteSequence SAL_CALL SocketAddr::getAddr( oslSocketResult *pResult ) const
{
::rtl::ByteSequence sequence;
- oslSocketResult result = osl_getAddrOfSocketAddr( m_handle,(sal_Sequence **) &sequence );
+ oslSocketResult result = osl_getAddrOfSocketAddr( m_handle, reinterpret_cast<sal_Sequence **>(&sequence) );
if( pResult )
*pResult = result;
return sequence;
diff --git a/include/rtl/byteseq.h b/include/rtl/byteseq.h
index 1365a91a5e24..47712bbbd05d 100644
--- a/include/rtl/byteseq.h
+++ b/include/rtl/byteseq.h
@@ -242,7 +242,7 @@ public:
@return pointer to byte array
*/
inline const sal_Int8 * SAL_CALL getConstArray() const
- { return (const sal_Int8 *)_pSequence->elements; }
+ { return reinterpret_cast<sal_Int8 *>(_pSequence->elements); }
/** Gets a pointer to elements array for READING AND WRITING. In general if the sequence
has a handle acquired by other sequences (reference count > 1), then a new sequence is
created copying all bytes to keep value semantics!
diff --git a/include/rtl/byteseq.hxx b/include/rtl/byteseq.hxx
index c49e37125998..494b17c4d8bd 100644
--- a/include/rtl/byteseq.hxx
+++ b/include/rtl/byteseq.hxx
@@ -95,7 +95,7 @@ inline sal_Int8 * ByteSequence::getArray()
::rtl_byte_sequence_reference2One( &_pSequence );
if (_pSequence == 0)
throw ::std::bad_alloc();
- return (sal_Int8 *)_pSequence->elements;
+ return reinterpret_cast<sal_Int8 *>(_pSequence->elements);
}
inline void ByteSequence::realloc( sal_Int32 nSize )
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index 337d41267837..cc2e7589a68b 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -279,7 +279,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
if ( ( stat(name, &status) == 0) &&
( S_ISSOCK(status.st_mode) || S_ISFIFO(status.st_mode) ) )
{
- if ( connect(pPipe->m_Socket,(struct sockaddr *)&addr,len) >= 0 )
+ if ( connect(pPipe->m_Socket, reinterpret_cast<sockaddr *>(&addr), len) >= 0 )
{
OSL_TRACE("osl_createPipe : Pipe already in use. Errno: %d; %s",errno,strerror(errno));
close (pPipe->m_Socket);
@@ -291,7 +291,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
}
/* ok, fs clean */
- if ( bind(pPipe->m_Socket, (struct sockaddr *)&addr, len) < 0 )
+ if ( bind(pPipe->m_Socket, reinterpret_cast<sockaddr *>(&addr), len) < 0 )
{
OSL_TRACE("osl_createPipe : failed to bind socket. Errno: %d; %s",errno,strerror(errno));
close (pPipe->m_Socket);
@@ -326,7 +326,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
{ /* osl_pipe_OPEN */
if ( access(name, F_OK) != -1 )
{
- if ( connect( pPipe->m_Socket, (struct sockaddr *)&addr, len) >= 0 )
+ if ( connect( pPipe->m_Socket, reinterpret_cast<sockaddr *>(&addr), len) >= 0 )
{
return (pPipe);
}
@@ -402,7 +402,7 @@ void SAL_CALL osl_closePipe( oslPipe pPipe )
strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path) - 1);
size_t len = sizeof(addr);
- nRet = connect( fd, (struct sockaddr *)&addr, len);
+ nRet = connect( fd, reinterpret_cast<sockaddr *>(&addr), len);
if ( nRet < 0 )
{
OSL_TRACE("connect in osl_destroyPipe failed with error: %s", strerror(errno));
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index b32987ef6351..ce8a4f38d8b5 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -487,7 +487,7 @@ static oslSocketAddr __osl_createSocketAddrWithFamily(
{
case osl_Socket_FamilyInet:
{
- struct sockaddr_in* pInetAddr= (struct sockaddr_in*)&(pAddr->m_sockaddr);
+ struct sockaddr_in* pInetAddr= reinterpret_cast<sockaddr_in*>(&pAddr->m_sockaddr);
pInetAddr->sin_family = FAMILY_TO_NATIVE(osl_Socket_FamilyInet);
pInetAddr->sin_addr.s_addr = nAddr;
@@ -567,8 +567,8 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
{
case AF_INET:
{
- struct sockaddr_in* pInetAddr1= (struct sockaddr_in*)pAddr1;
- struct sockaddr_in* pInetAddr2= (struct sockaddr_in*)pAddr2;
+ struct sockaddr_in* pInetAddr1= reinterpret_cast<sockaddr_in*>(pAddr1);
+ struct sockaddr_in* pInetAddr2= reinterpret_cast<sockaddr_in*>(pAddr2);
if ((pInetAddr1->sin_family == pInetAddr2->sin_family) &&
(pInetAddr1->sin_addr.s_addr == pInetAddr2->sin_addr.s_addr) &&
@@ -693,7 +693,7 @@ oslSocketResult SAL_CALL osl_setAddrOfSocketAddr( oslSocketAddr pAddr, sal_Seque
OSL_ASSERT( pAddr->m_sockaddr.sa_family == FAMILY_TO_NATIVE( osl_Socket_FamilyInet ) );
OSL_ASSERT( pByteSeq->nElements == 4 );
- pSystemInetAddr = (struct sockaddr_in * ) &(pAddr->m_sockaddr);
+ pSystemInetAddr = reinterpret_cast<sockaddr_in *>(&pAddr->m_sockaddr);
memcpy( &(pSystemInetAddr->sin_addr) , pByteSeq->elements , 4 );
res = osl_Socket_Ok;
}
@@ -709,8 +709,8 @@ oslSocketResult SAL_CALL osl_getAddrOfSocketAddr( oslSocketAddr pAddr, sal_Seque
if( pAddr && ppByteSeq )
{
- struct sockaddr_in * pSystemInetAddr = (struct sockaddr_in * ) &(pAddr->m_sockaddr);
- rtl_byte_sequence_constructFromArray( ppByteSeq , (sal_Int8 *) &(pSystemInetAddr->sin_addr),4);
+ struct sockaddr_in * pSystemInetAddr = reinterpret_cast<sockaddr_in *>(&pAddr->m_sockaddr);
+ rtl_byte_sequence_constructFromArray( ppByteSeq, reinterpret_cast<sal_Int8 *>(&pSystemInetAddr->sin_addr), 4);
res = osl_Socket_Ok;
}
return res;
@@ -813,7 +813,7 @@ static oslHostAddr _osl_hostentToHostAddr (const struct hostent *he)
pSockAddr->m_sockaddr.sa_family= he->h_addrtype;
if (pSockAddr->m_sockaddr.sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
{
- struct sockaddr_in *sin= (struct sockaddr_in *)&(pSockAddr->m_sockaddr);
+ struct sockaddr_in *sin= reinterpret_cast<sockaddr_in *>(&pSockAddr->m_sockaddr);
memcpy (
&(sin->sin_addr.s_addr),
he->h_addr_list[0],
@@ -955,13 +955,13 @@ oslHostAddr SAL_CALL osl_createHostAddrByAddr (const oslSocketAddr pAddr)
if (pAddr->m_sockaddr.sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
{
- const struct sockaddr_in *sin= (const struct sockaddr_in *)&(pAddr->m_sockaddr);
+ const struct sockaddr_in *sin= reinterpret_cast<sockaddr_in *>(&pAddr->m_sockaddr);
struct hostent *he;
if (sin->sin_addr.s_addr == htonl(INADDR_ANY))
return ((oslHostAddr)NULL);
- he= gethostbyaddr((sal_Char *)&(sin->sin_addr),
+ he= gethostbyaddr(&sin->sin_addr,
sizeof (sin->sin_addr),
sin->sin_family);
return _osl_hostentToHostAddr (he);
@@ -1208,7 +1208,7 @@ sal_Int32 SAL_CALL osl_getInetPortOfSocketAddr(oslSocketAddr pAddr)
OSL_ASSERT(pAddr);
if( pAddr )
{
- struct sockaddr_in* pSystemInetAddr= (struct sockaddr_in*)&(pAddr->m_sockaddr);
+ struct sockaddr_in* pSystemInetAddr= reinterpret_cast<sockaddr_in*>(&pAddr->m_sockaddr);
if ( pSystemInetAddr->sin_family == FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
return ntohs(pSystemInetAddr->sin_port);
@@ -1221,7 +1221,7 @@ sal_Bool SAL_CALL osl_setInetPortOfSocketAddr(oslSocketAddr pAddr, sal_Int32 Por
OSL_ASSERT(pAddr);
if( pAddr )
{
- struct sockaddr_in* pSystemInetAddr= (struct sockaddr_in*)&(pAddr->m_sockaddr);
+ struct sockaddr_in* pSystemInetAddr= reinterpret_cast<sockaddr_in*>(&pAddr->m_sockaddr);
if ( pSystemInetAddr->sin_family == FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
{
pSystemInetAddr->sin_port= htons((short)Port);
@@ -1290,7 +1290,7 @@ oslSocketResult SAL_CALL osl_psz_getDottedInetAddrOfSocketAddr(oslSocketAddr pAd
if( pAddr )
{
- struct sockaddr_in* pSystemInetAddr = ( struct sockaddr_in * ) &(pAddr->m_sockaddr);
+ struct sockaddr_in* pSystemInetAddr = reinterpret_cast<sockaddr_in *>(&pAddr->m_sockaddr);
if (pSystemInetAddr->sin_family == FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
{
@@ -2272,7 +2272,7 @@ oslSocketType SAL_CALL osl_getSocketType(oslSocket pSocket)
if(getsockopt(pSocket->m_Socket,
OPTION_LEVEL_TO_NATIVE(osl_Socket_LevelSocket),
OPTION_TO_NATIVE(osl_Socket_OptionType),
- (sal_Char*)&Type,
+ &Type,
&TypeSize) == -1)
{
/* error */
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index e573d4a04a19..434c0b7dc5af 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -2941,7 +2941,7 @@ namespace osl_File
CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 );
CPPUNIT_ASSERT_MESSAGE( "test for readLine function: read the first line of the file.",
( ::osl::FileBase::E_None == nError1 ) &&
- ( 0 == strncmp( ( const char * )aSequence.getArray(), pBuffer_Char, 5 ) ) );
+ ( 0 == strncmp( reinterpret_cast<char *>(aSequence.getArray()), pBuffer_Char, 5 ) ) );
}
void readLine_002()
@@ -2962,7 +2962,7 @@ namespace osl_File
CPPUNIT_ASSERT_MESSAGE( "test for readLine function: read three lines of the file and check the file pointer moving.",
*pEOF &&
- ( 0 == strncmp( ( const char * )aSequence.getArray(), &pBuffer_Char[26], 26 ) ) );
+ ( 0 == strncmp( reinterpret_cast<char *>(aSequence.getArray()), &pBuffer_Char[26], 26 ) ) );
}
CPPUNIT_TEST_SUITE( readLine );
CPPUNIT_TEST( readLine_001 );
diff --git a/sal/qa/rtl/cipher/rtl_cipher.cxx b/sal/qa/rtl/cipher/rtl_cipher.cxx
index 0f713738e8cf..315fb9d57fc0 100644
--- a/sal/qa/rtl/cipher/rtl_cipher.cxx
+++ b/sal/qa/rtl/cipher/rtl_cipher.cxx
@@ -183,7 +183,7 @@ public:
sal_uInt32 nPlainTextLen = 16;
sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
memset(pPlainTextBuffer, 0, nPlainTextLen);
- strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
+ strncpy(reinterpret_cast<char*>(pPlainTextBuffer), _sPlainTextStr.getStr(), 16);
sal_uInt32 nCipherLen = 16;
sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
@@ -231,7 +231,7 @@ public:
sal_uInt32 nPlainTextLen = 16;
sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
memset(pPlainTextBuffer, 0, nPlainTextLen);
- strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
+ strncpy(reinterpret_cast<char*>(pPlainTextBuffer), _sPlainTextStr.getStr(), 16);
sal_uInt32 nCipherLen = 16;
sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
diff --git a/sal/qa/rtl/digest/rtl_digest.cxx b/sal/qa/rtl/digest/rtl_digest.cxx
index 94d18b87c283..9e84e0630166 100644
--- a/sal/qa/rtl/digest/rtl_digest.cxx
+++ b/sal/qa/rtl/digest/rtl_digest.cxx
@@ -88,7 +88,7 @@ OString getDigest(const OString& aMessage, rtlDigestAlgorithm aAlgorithm)
{
rtlDigest handle = rtl_digest_create(aAlgorithm);
- const sal_uInt8* pData = (const sal_uInt8*) aMessage.getStr();
+ const sal_uInt8* pData = reinterpret_cast<const sal_uInt8*>(aMessage.getStr());
sal_uInt32 nSize = aMessage.getLength();
rtl_digest_init(handle, pData, nSize);
@@ -178,7 +178,7 @@ public:
handle = rtl_digest_create(constDigestAlgorithms[i]);
OString aMessage = sSampleString;
- const sal_uInt8* pData = (const sal_uInt8*) aMessage.getStr();
+ const sal_uInt8* pData = reinterpret_cast<const sal_uInt8*>(aMessage.getStr());
sal_uInt32 nSize = aMessage.getLength();
aError = rtl_digest_init(handle, pData, nSize);
@@ -239,7 +239,7 @@ public:
memset(pKeyBuffer.get(), 0, nKeyLen);
- sal_uInt8* pPassword = (sal_uInt8*)sPassword.getStr();
+ sal_uInt8 const * pPassword = reinterpret_cast<sal_uInt8 const *>(sPassword.getStr());
sal_Int32 nPasswordLen = sPassword.getLength();
sal_uInt32 nSaltDataLen = RTL_DIGEST_LENGTH_HMAC_SHA1;
@@ -299,7 +299,7 @@ public:
aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", aHandle != 0);
- const sal_uInt8* pData = (const sal_uInt8*)sSampleString.getStr();
+ const sal_uInt8* pData = reinterpret_cast<const sal_uInt8*>(sSampleString.getStr());
sal_uInt32 nSize = sSampleString.getLength();
aError = rtl_digest_updateMD2(aHandle, NULL, 0);
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index d040f1515baa..a18527106f24 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -116,7 +116,7 @@ try_alloc:
if (addr != 0)
{
- ((sal_Size*)(addr))[0] = size;
+ reinterpret_cast<sal_Size*>(addr)[0] = size;
p = addr + RTL_MEMALIGN;
}
else if (gp_alloc_arena == 0)
@@ -139,7 +139,7 @@ void SAL_CALL rtl_freeMemory_CUSTOM (void * p) SAL_THROW_EXTERN_C()
if (p != 0)
{
char * addr = (char*)(p) - RTL_MEMALIGN;
- sal_Size size = ((sal_Size*)(addr))[0];
+ sal_Size size = reinterpret_cast<sal_Size*>(addr)[0];
if (size <= RTL_MEMORY_CACHED_LIMIT)
rtl_cache_free(g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT], addr);
@@ -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 = ((sal_Size*)( (char*)(p) - RTL_MEMALIGN ))[0] - RTL_MEMALIGN;
+ sal_Size n_old = reinterpret_cast<sal_Size*>( (char*)(p) - RTL_MEMALIGN )[0] - RTL_MEMALIGN;
p = rtl_allocateMemory (n);
if (p != 0)
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index a62daffbd4ac..e2ff943afe3a 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -365,9 +365,9 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
{
rtl::ByteSequence seq;
- while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
+ while (osl_File_E_None == osl_readLine(handle , reinterpret_cast<sal_Sequence **>(&seq)))
{
- OString line( (const sal_Char *) seq.getConstArray(), seq.getLength() );
+ OString line( reinterpret_cast<const char *>(seq.getConstArray()), seq.getLength() );
sal_Int32 nIndex = line.indexOf('=');
if (nIndex >= 1)
{
diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx
index f0f190125dce..cd25a62a25e0 100644
--- a/sal/rtl/byteseq.cxx
+++ b/sal/rtl/byteseq.cxx
@@ -234,7 +234,7 @@ sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Seque
const sal_Int8 *SAL_CALL rtl_byte_sequence_getConstArray( sal_Sequence *pSequence )
SAL_THROW_EXTERN_C()
{
- return ((const sal_Int8*)(pSequence->elements));
+ return reinterpret_cast<sal_Int8*>(pSequence->elements);
}
sal_Int32 SAL_CALL rtl_byte_sequence_getLength( sal_Sequence *pSequence )
diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx
index b35700e7cefb..205db64f76b4 100644
--- a/sal/rtl/digest.cxx
+++ b/sal/rtl/digest.cxx
@@ -802,7 +802,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 (
if (ctx->m_nDatLen)
{
- sal_uInt8 *p = (sal_uInt8 *)(ctx->m_pData) + ctx->m_nDatLen;
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(ctx->m_pData) + ctx->m_nDatLen;
sal_uInt32 n = DIGEST_CBLOCK_MD5 - ctx->m_nDatLen;
if (nDatLen < n)
@@ -1286,7 +1286,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA (
if (ctx->m_nDatLen)
{
- sal_uInt8 *p = (sal_uInt8 *)(ctx->m_pData) + ctx->m_nDatLen;
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(ctx->m_pData) + ctx->m_nDatLen;
sal_uInt32 n = DIGEST_CBLOCK_SHA - ctx->m_nDatLen;
if (nDatLen < n)
@@ -1476,7 +1476,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
if (ctx->m_nDatLen)
{
- sal_uInt8 *p = (sal_uInt8 *)(ctx->m_pData) + ctx->m_nDatLen;
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(ctx->m_pData) + ctx->m_nDatLen;
sal_uInt32 n = DIGEST_CBLOCK_SHA - ctx->m_nDatLen;
if (nDatLen < n)
diff --git a/sal/rtl/logfile.cxx b/sal/rtl/logfile.cxx
index a78eb084ffab..637f2eb8640e 100644
--- a/sal/rtl/logfile.cxx
+++ b/sal/rtl/logfile.cxx
@@ -125,16 +125,16 @@ Logger::Logger(): aFile(0), buffer(0)
if( nConverted > 0 )
{
- sal_Int64 nWritten;
- osl_writeFile( aFile, buffer, nConverted , (sal_uInt64 *)&nWritten );
+ sal_uInt64 nWritten;
+ osl_writeFile( aFile, buffer, nConverted , &nWritten );
}
}
nConverted = sprintf (buffer, "Process id is %" SAL_PRIuUINT32 "\n", aProcessId);
if( nConverted )
{
- sal_Int64 nWritten;
- osl_writeFile( aFile, buffer, nConverted, (sal_uInt64 *)&nWritten );
+ sal_uInt64 nWritten;
+ osl_writeFile( aFile, buffer, nConverted, &nWritten );
}
}
else
@@ -150,10 +150,13 @@ Logger::~Logger()
{
if( buffer )
{
- sal_Int64 nWritten, nConverted =
+ sal_Int64 nConverted =
sprintf( buffer, "closing log file at %06" SAL_PRIuUINT32, osl_getGlobalTimer() );
if( nConverted > 0 )
- osl_writeFile( aFile, buffer, nConverted, (sal_uInt64 *)&nWritten );
+ {
+ sal_uInt64 nWritten;
+ osl_writeFile( aFile, buffer, nConverted, &nWritten );
+ }
osl_closeFile( aFile );
rtl_freeMemory( buffer );
}
@@ -171,12 +174,15 @@ extern "C" void SAL_CALL rtl_logfile_trace ( const char *pszFormat, ... )
va_list args;
va_start(args, pszFormat);
{
- sal_Int64 nConverted, nWritten;
+ sal_Int64 nConverted;
MutexGuard guard( logger.mutex );
nConverted = vsnprintf( logger.buffer , g_BUFFERSIZE, pszFormat, args );
nConverted = (nConverted > g_BUFFERSIZE ? g_BUFFERSIZE : nConverted );
if( nConverted > 0 )
- osl_writeFile( logger.aFile, logger.buffer, nConverted, (sal_uInt64*)&nWritten );
+ {
+ sal_uInt64 nWritten;
+ osl_writeFile( logger.aFile, logger.buffer, nConverted, &nWritten );
+ }
}
va_end(args);
}
diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx
index 53cce865e822..851dbffb1dda 100644
--- a/sal/rtl/random.cxx
+++ b/sal/rtl/random.cxx
@@ -131,22 +131,22 @@ static bool __rtl_random_initPool (RandomPool_Impl *pImpl)
tid = osl::Thread::getCurrentIdentifier();
tid = RTL_RANDOM_RNG_2(RTL_RANDOM_RNG_1(tid));
- __rtl_random_seedPool (pImpl, (sal_uInt8*)&tid, sizeof(tid));
+ __rtl_random_seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&tid), sizeof(tid));
osl_getSystemTime (&tv);
tv.Seconds = RTL_RANDOM_RNG_2(tv.Seconds);
tv.Nanosec = RTL_RANDOM_RNG_2(tv.Nanosec);
- __rtl_random_seedPool (pImpl, (sal_uInt8*)&tv, sizeof(tv));
+ __rtl_random_seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&tv), sizeof(tv));
rd.m_nX = (sal_Int16)(((tid >> 1) << 1) + 1);
rd.m_nY = (sal_Int16)(((tv.Seconds >> 1) << 1) + 1);
rd.m_nZ = (sal_Int16)(((tv.Nanosec >> 1) << 1) + 1);
- __rtl_random_seedPool (pImpl, (sal_uInt8*)&rd, sizeof(rd));
+ __rtl_random_seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&rd), sizeof(rd));
while (pImpl->m_nData < RTL_RANDOM_SIZE_POOL)
{
seed = __rtl_random_data (&rd);
- __rtl_random_seedPool (pImpl, (sal_uInt8*)&seed, sizeof(seed));
+ __rtl_random_seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&seed), sizeof(seed));
}
return true;
}
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 1a1e74f8827f..8bea7db482ea 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -69,7 +69,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- return wcslen((wchar_t*)pStr);
+ return wcslen(reinterpret_cast<wchar_t const *>(pStr));
}
else
{
@@ -94,7 +94,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- return wcscmp((wchar_t*)pStr1, (wchar_t*)pStr2);
+ return wcscmp(reinterpret_cast<wchar_t const *>(pStr1), reinterpret_cast<wchar_t const *>(pStr2));
}
else
{
@@ -130,7 +130,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCOD
{
// take advantage of builtin optimisations
sal_Int32 nMin = std::min(nStr1Len, nStr2Len);
- sal_Int32 nRet = wcsncmp((wchar_t*)pStr1, (wchar_t*)pStr2, nMin);
+ sal_Int32 nRet = wcsncmp(reinterpret_cast<wchar_t const *>(pStr1), reinterpret_cast<wchar_t const *>(pStr2), nMin);
return nRet == 0 ? nStr1Len - nStr2Len : nRet;
}
else
@@ -172,7 +172,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompare_WithLength )( const IMPL_R
{
// take advantage of builtin optimisations
sal_Int32 nMin = std::min(std::min(nStr1Len, nStr2Len), nShortenedLength);
- sal_Int32 nRet = wcsncmp((wchar_t*)pStr1, (wchar_t*)pStr2, nMin);
+ sal_Int32 nRet = wcsncmp(reinterpret_cast<wchar_t const *>(pStr1), reinterpret_cast<wchar_t const *>(pStr2), nMin);
if (nRet == 0 && nShortenedLength > std::min(nStr1Len, nStr2Len))
return nStr1Len - nStr2Len;
return nRet;
@@ -340,8 +340,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- wchar_t* p = wcschr((wchar_t*)pStr, (wchar_t)c);
- return p ? p - (wchar_t*)pStr : -1;
+ wchar_t* p = wcschr(reinterpret_cast<wchar_t const *>(pStr), (wchar_t)c);
+ return p ? p - reinterpret_cast<wchar_t const *>(pStr) : -1;
}
else
{
@@ -399,8 +399,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE*
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- wchar_t* p = wcsrchr((wchar_t*)pStr, (wchar_t)c);
- return p ? p - (wchar_t*)pStr : -1;
+ wchar_t* p = wcsrchr(reinterpret_cast<wchar_t const *>(pStr), (wchar_t)c);
+ return p ? p - reinterpret_cast<wchar_t const *>(pStr) : -1;
}
else
{
@@ -443,8 +443,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr )( const IMPL_RTL_STRCODE* pStr,
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- wchar_t* p = wcsstr((wchar_t*)pStr, (wchar_t*)pSubStr);
- return p ? p - (wchar_t*)pStr : -1;
+ wchar_t* p = wcsstr(reinterpret_cast<wchar_t const *>(pStr), reinterpret_cast<wchar_t const *>(pSubStr));
+ return p ? p - reinterpret_cast<wchar_t const *>(pStr) : -1;
}
else
{
diff --git a/sal/rtl/uuid.cxx b/sal/rtl/uuid.cxx
index ea850546f36c..8eb0566e9e2f 100644
--- a/sal/rtl/uuid.cxx
+++ b/sal/rtl/uuid.cxx
@@ -27,7 +27,7 @@
#define SWAP_INT32_TO_NETWORK(x)\
{ sal_uInt32 y = x;\
- sal_uInt8 *p = (sal_uInt8 * )&(x); \
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(x)); \
p[0] = (sal_uInt8) ( ( y >> 24 ) & 0xff );\
p[1] = (sal_uInt8) ( ( y >> 16 ) & 0xff );\
p[2] = (sal_uInt8) ( ( y >> 8 ) & 0xff );\
@@ -35,20 +35,20 @@
}
#define SWAP_INT16_TO_NETWORK(x)\
{ sal_uInt16 y = x;\
- sal_uInt8 *p = (sal_uInt8 * )&(x); \
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(x)); \
p[0] = (sal_uInt8) ( ( y >> 8 ) & 0xff );\
p[1] = (sal_uInt8) ( ( y ) & 0xff);\
}
#define SWAP_NETWORK_TO_INT16(x)\
{ sal_uInt16 y = x;\
- sal_uInt8 *p = (sal_uInt8 * )&(y);\
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(y));\
x = ( ( ((sal_uInt16)p[0]) & 0xff) << 8 ) |\
( ( (sal_uInt16)p[1]) & 0xff);\
}
#define SWAP_NETWORK_TO_INT32(x)\
{ sal_uInt32 y = x;\
- sal_uInt8 *p = (sal_uInt8 * )&(y); \
+ sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(y)); \
x = ( ( ((sal_uInt32)p[0]) & 0xff) << 24 ) |\
( ( ((sal_uInt32)p[1]) & 0xff) << 16 ) |\
( ( ((sal_uInt32)p[2]) & 0xff) << 8 ) |\
diff --git a/sal/textenc/convertbig5hkscs.cxx b/sal/textenc/convertbig5hkscs.cxx
index 7b882db98a03..bec9f66abcee 100644
--- a/sal/textenc/convertbig5hkscs.cxx
+++ b/sal/textenc/convertbig5hkscs.cxx
@@ -89,7 +89,7 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
if (nRow == 0)
if (nChar < 0x80)
if (pDestBufPtr != pDestBufEnd)
diff --git a/sal/textenc/converteuctw.cxx b/sal/textenc/converteuctw.cxx
index 5dd5898d0b31..972f88772772 100644
--- a/sal/textenc/converteuctw.cxx
+++ b/sal/textenc/converteuctw.cxx
@@ -104,7 +104,7 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
switch (eState)
{
case IMPL_EUC_TW_TO_UNICODE_STATE_0:
diff --git a/sal/textenc/convertgb18030.cxx b/sal/textenc/convertgb18030.cxx
index 0a36b292a1ad..758db82a8b8b 100644
--- a/sal/textenc/convertgb18030.cxx
+++ b/sal/textenc/convertgb18030.cxx
@@ -96,7 +96,7 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
switch (eState)
{
case IMPL_GB_18030_TO_UNICODE_STATE_0:
diff --git a/sal/textenc/convertiso2022cn.cxx b/sal/textenc/convertiso2022cn.cxx
index 9d361ed3452a..afe946d62383 100644
--- a/sal/textenc/convertiso2022cn.cxx
+++ b/sal/textenc/convertiso2022cn.cxx
@@ -136,7 +136,7 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
sal_uInt32 nPlane;
switch (eState)
{
diff --git a/sal/textenc/convertiso2022jp.cxx b/sal/textenc/convertiso2022jp.cxx
index 2aa9587ff28e..bb89509e2e69 100644
--- a/sal/textenc/convertiso2022jp.cxx
+++ b/sal/textenc/convertiso2022jp.cxx
@@ -104,7 +104,7 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
switch (eState)
{
case IMPL_ISO_2022_JP_TO_UNICODE_STATE_ASCII:
diff --git a/sal/textenc/convertiso2022kr.cxx b/sal/textenc/convertiso2022kr.cxx
index 95a6520a8758..687e8dfc3db1 100644
--- a/sal/textenc/convertiso2022kr.cxx
+++ b/sal/textenc/convertiso2022kr.cxx
@@ -110,7 +110,7 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData,
for (; nConverted < nSrcBytes; ++nConverted)
{
bool bUndefined = true;
- sal_uInt32 nChar = *(unsigned char const *) pSrcBuf++;
+ sal_uInt32 nChar = *reinterpret_cast<unsigned char const *>(pSrcBuf++);
switch (eState)
{
case IMPL_ISO_2022_KR_TO_UNICODE_STATE_ASCII:
diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx
index 932d13e883a6..9fb46dc02d4c 100644
--- a/sal/textenc/tcvtutf8.cxx
+++ b/sal/textenc/tcvtutf8.cxx
@@ -80,7 +80,7 @@ sal_Size ImplConvertUtf8ToUnicode(
int nShift = -1;
bool bCheckBom = true;
sal_uInt32 nInfo = 0;
- unsigned char const * pSrcBufPtr = (unsigned char const *) pSrcBuf;
+ unsigned char const * pSrcBufPtr = reinterpret_cast<unsigned char const *>(pSrcBuf);
unsigned char const * pSrcBufEnd = pSrcBufPtr + nSrcBytes;
sal_Unicode * pDestBufPtr = pDestBuf;
sal_Unicode * pDestBufEnd = pDestBufPtr + nDestChars;