summaryrefslogtreecommitdiff
path: root/tools/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-28 19:08:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-28 19:09:27 +0100
commit9826b9cf5b8c78fe25eaab1009e0c95142678ecb (patch)
tree0bd7d583c44dbaa30eca8619ef5dae681aede302 /tools/source
parent93a8ef5a2d3b23b193261177eee4fb13758dd7cc (diff)
Clean up C-style casts from pointers to void
Change-Id: Ife048a705e899870a8b1d9987b109d5c0cd80599
Diffstat (limited to 'tools/source')
-rw-r--r--tools/source/inet/inetstrm.cxx14
-rw-r--r--tools/source/rc/rc.cxx2
-rw-r--r--tools/source/rc/resmgr.cxx56
-rw-r--r--tools/source/ref/errinf.cxx2
-rw-r--r--tools/source/stream/stream.cxx16
-rw-r--r--tools/source/zcodec/zcodec.cxx4
6 files changed, 47 insertions, 47 deletions
diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx
index 1ab22b18d9f9..bc0f45bc7471 100644
--- a/tools/source/inet/inetstrm.cxx
+++ b/tools/source/inet/inetstrm.cxx
@@ -213,7 +213,7 @@ int INetMessageIStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize)
}
}
- pMsgWrite = (sal_Char*)(pMsgBuffer->GetData());
+ pMsgWrite = const_cast<char *>(static_cast<sal_Char const *>(pMsgBuffer->GetData()));
pMsgRead = pMsgWrite + pMsgBuffer->Tell();
}
@@ -257,7 +257,7 @@ INetMessageOStream::INetMessageOStream(void)
INetMessageOStream::~INetMessageOStream(void)
{
if (pMsgBuffer->Tell() > 0)
- PutMsgLine((const sal_Char*) pMsgBuffer->GetData(), pMsgBuffer->Tell());
+ PutMsgLine(static_cast<const sal_Char*>(pMsgBuffer->GetData()), pMsgBuffer->Tell());
delete pMsgBuffer;
if (pTargetMsg)
@@ -296,7 +296,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
if (pMsgBuffer->Tell() > 0)
{
pMsgBuffer->WriteChar( '\0' );
- int status = PutMsgLine( (const sal_Char*) pMsgBuffer->GetData(),
+ int status = PutMsgLine( static_cast<const sal_Char*>(pMsgBuffer->GetData()),
pMsgBuffer->Tell());
if (status != INETSTREAM_STATUS_OK) return status;
}
@@ -321,7 +321,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
{
// Emit buffered header field now.
pMsgBuffer->WriteChar( '\0' );
- int status = PutMsgLine((const sal_Char*) pMsgBuffer->GetData(),
+ int status = PutMsgLine(static_cast<const sal_Char*>(pMsgBuffer->GetData()),
pMsgBuffer->Tell());
if (status != INETSTREAM_STATUS_OK) return status;
}
@@ -352,7 +352,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
else if (ascii_isWhitespace(*pData & 0x7f))
{
// Any <LWS> is folded into a single <SP> character.
- sal_Char c = *((const sal_Char*) pMsgBuffer->GetData() + pMsgBuffer->Tell() - 1);
+ sal_Char c = *(static_cast<const sal_Char*>(pMsgBuffer->GetData()) + pMsgBuffer->Tell() - 1);
if (!ascii_isWhitespace(c & 0x7f)) pMsgBuffer->WriteChar( ' ' );
// Skip over this <LWS> character.
@@ -716,7 +716,7 @@ int INetMessageDecodeQPStream_Impl::PutMsgLine( const sal_Char* pData,
sal_Size nDocSiz = pMsg->GetDocumentSize();
sal_Size nWrite = 0;
- pLB->FillAppend((sal_Char*)(pMsgBuffer->GetData()), nRead, &nWrite);
+ pLB->FillAppend(pMsgBuffer->GetData(), nRead, &nWrite);
pMsg->SetDocumentSize(nDocSiz + nWrite);
if (nWrite < nRead) return INETSTREAM_STATUS_ERROR;
@@ -1413,7 +1413,7 @@ int INetMIMEMessageStream::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize)
const sal_Char* pChar;
const sal_Char* pOldPos;
int status;
- for( pOldPos = pChar = (const sal_Char*) pMsgBuffer->GetData(); nBufSize--;
+ for( pOldPos = pChar = static_cast<const sal_Char*>(pMsgBuffer->GetData()); nBufSize--;
pChar++ )
{
if( *pChar == '\r' || *pChar == '\n' )
diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx
index b26628edbd67..ee7470c91d51 100644
--- a/tools/source/rc/rc.cxx
+++ b/tools/source/rc/rc.cxx
@@ -63,7 +63,7 @@ OUString ResId::toString() const
}
// String loading
- RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
+ RSHEADER_TYPE * pResHdr = static_cast<RSHEADER_TYPE*>(pResMgr->GetClass());
sal_Int32 nStringLen = rtl_str_getLength( reinterpret_cast<char*>(pResHdr+1) );
OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 56ad50e00de5..13b60e21ad02 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -494,10 +494,10 @@ bool InternalResMgr::Create()
lContLen = ResMgr::GetLong( &lContLen );
pStm->SeekRel( -lContLen );
// allocate stored ImpContent data (12 bytes per unit)
- sal_uInt8* pContentBuf = (sal_uInt8*)rtl_allocateMemory( lContLen );
+ sal_uInt8* pContentBuf = static_cast<sal_uInt8*>(rtl_allocateMemory( lContLen ));
pStm->Read( pContentBuf, lContLen );
// allocate ImpContent space (sizeof(ImpContent) per unit, not necessarily 12)
- pContent = (ImpContent *)rtl_allocateMemory( sizeof(ImpContent)*lContLen/12 );
+ pContent = static_cast<ImpContent *>(rtl_allocateMemory( sizeof(ImpContent)*lContLen/12 ));
// Shorten to number of ImpContent
nEntries = (sal_uInt32)lContLen / 12;
bEqual2Content = true;
@@ -592,7 +592,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
RSHEADER_TYPE aHdr;
pStm->Read( &aHdr, sizeof( aHdr ) );
nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection;
- pStringBlock = (sal_uInt8*)rtl_allocateMemory( nSize );
+ pStringBlock = static_cast<sal_uInt8*>(rtl_allocateMemory( nSize ));
pStm->Seek( pFirst->nOffset );
pStm->Read( pStringBlock, nSize );
}
@@ -607,7 +607,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) );
void * pRes = rtl_allocateMemory( aHeader.GetGlobOff() );
memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) );
- pStm->Read( (sal_uInt8*)pRes + sizeof( RSHEADER_TYPE ),
+ pStm->Read( static_cast<sal_uInt8*>(pRes) + sizeof( RSHEADER_TYPE ),
aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) );
return pRes;
}
@@ -1014,7 +1014,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
#endif
pTop->Flags |= RCFlags::NOTFOUND;
pTop->pClassRes = getEmptyBuffer();
- pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes;
+ pTop->pResource = static_cast<RSHEADER_TYPE*>(pTop->pClassRes);
return false;
}
}
@@ -1026,14 +1026,14 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
if ( pTop->pClassRes )
// local Resource, not a system Resource
- pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes;
+ pTop->pResource = static_cast<RSHEADER_TYPE *>(pTop->pClassRes);
else
{
pTop->pClassRes = pImpRes->LoadGlobalRes( nRT, nId, &pTop->aResHandle );
if ( pTop->pClassRes )
{
pTop->Flags |= RCFlags::GLOBAL;
- pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes;
+ pTop->pResource = static_cast<RSHEADER_TYPE *>(pTop->pClassRes);
}
else
{
@@ -1062,7 +1062,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
#endif
pTop->Flags |= RCFlags::NOTFOUND;
pTop->pClassRes = getEmptyBuffer();
- pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes;
+ pTop->pResource = static_cast<RSHEADER_TYPE*>(pTop->pClassRes);
return false;
}
}
@@ -1147,7 +1147,7 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
// Pointer is at the beginning of the resource, thus
// class pointer points to the header, and the remaining size
// equals to total size of allocated memory
- pHeader = (RSHEADER_TYPE*)rtl_allocateMemory( GetRemainSize() );
+ pHeader = static_cast<RSHEADER_TYPE*>(rtl_allocateMemory( GetRemainSize() ));
memcpy( pHeader, GetClass(), GetRemainSize() );
Increment( pHeader->GetLocalOff() ); //ans Ende setzen
if ( pHeader->GetLocalOff() != pHeader->GetGlobOff() )
@@ -1160,28 +1160,28 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
sal_Int16 ResMgr::GetShort( void * pShort )
{
- return ((*((sal_uInt8*)pShort + 0) << 8) |
- (*((sal_uInt8*)pShort + 1) << 0) );
+ return ((*(static_cast<sal_uInt8*>(pShort) + 0) << 8) |
+ (*(static_cast<sal_uInt8*>(pShort) + 1) << 0) );
}
sal_Int32 ResMgr::GetLong( void * pLong )
{
- return ((*((sal_uInt8*)pLong + 0) << 24) |
- (*((sal_uInt8*)pLong + 1) << 16) |
- (*((sal_uInt8*)pLong + 2) << 8) |
- (*((sal_uInt8*)pLong + 3) << 0) );
+ return ((*(static_cast<sal_uInt8*>(pLong) + 0) << 24) |
+ (*(static_cast<sal_uInt8*>(pLong) + 1) << 16) |
+ (*(static_cast<sal_uInt8*>(pLong) + 2) << 8) |
+ (*(static_cast<sal_uInt8*>(pLong) + 3) << 0) );
}
sal_uInt64 ResMgr::GetUInt64( void* pDatum )
{
- return ((sal_uInt64(*((sal_uInt8*)pDatum + 0)) << 56) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 1)) << 48) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 2)) << 40) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 3)) << 32) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 4)) << 24) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 5)) << 16) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 6)) << 8) |
- (sal_uInt64(*((sal_uInt8*)pDatum + 7)) << 0) );
+ return ((sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 0)) << 56) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 1)) << 48) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 2)) << 40) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 3)) << 32) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 4)) << 24) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 5)) << 16) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 6)) << 8) |
+ (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 7)) << 0) );
}
sal_uInt32 ResMgr::GetStringWithoutHook( OUString& rStr, const sal_uInt8* pStr )
@@ -1245,7 +1245,7 @@ void* ResMgr::Increment( sal_uInt32 nSize )
if( (rStack.Flags & RCFlags::NOTFOUND) )
return rStack.pClassRes;
- sal_uInt8* pClassRes = (sal_uInt8*)rStack.pClassRes + nSize;
+ sal_uInt8* pClassRes = static_cast<sal_uInt8*>(rStack.pClassRes) + nSize;
rStack.pClassRes = pClassRes;
@@ -1394,7 +1394,7 @@ OUString ResMgr::ReadStringWithoutHook()
#endif
}
else
- Increment( GetStringWithoutHook( aRet, (const sal_uInt8*)GetClass() ) );
+ Increment( GetStringWithoutHook( aRet, static_cast<const sal_uInt8*>(GetClass()) ) );
return aRet;
}
@@ -1424,7 +1424,7 @@ OString ResMgr::ReadByteString()
#endif
}
else
- Increment( GetByteString( aRet, (const sal_uInt8*)GetClass() ) );
+ Increment( GetByteString( aRet, static_cast<const sal_uInt8*>(GetClass()) ) );
return aRet;
}
@@ -1572,7 +1572,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId )
void* pResHandle = NULL;
InternalResMgr* pFallback = m_pResImpl;
- RSHEADER_TYPE* pResHeader = (RSHEADER_TYPE*)m_pResImpl->LoadGlobalRes( RSC_STRING, nId, &pResHandle );
+ RSHEADER_TYPE* pResHeader = static_cast<RSHEADER_TYPE*>(m_pResImpl->LoadGlobalRes( RSC_STRING, nId, &pResHandle ));
if ( !pResHeader )
{
osl::Guard<osl::Mutex> aGuard2( getResMgrMutex() );
@@ -1589,7 +1589,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId )
// handle possible recursion
if( pFallback->aLocale != m_pResImpl->aLocale )
{
- pResHeader = (RSHEADER_TYPE*)pFallback->LoadGlobalRes( RSC_STRING, nId, &pResHandle );
+ pResHeader = static_cast<RSHEADER_TYPE*>(pFallback->LoadGlobalRes( RSC_STRING, nId, &pResHandle ));
}
else
{
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index ff9ab0ed32ff..3ab7252def53 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -74,7 +74,7 @@ EDcrData *EDcrData::GetData()
#ifdef BOOTSTRAP
return 0x0;
#else
- EDcrData **ppDat=(EDcrData **)GetAppData(SHL_ERR);
+ EDcrData **ppDat=reinterpret_cast<EDcrData **>(GetAppData(SHL_ERR));
if(!*ppDat)
{
return (*ppDat=new EDcrData);
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index e8a2a5dc54ad..8e6c4de22a60 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1259,7 +1259,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
if( !pRWBuf )
{
- nCount = GetData( (char*)pData,nCount);
+ nCount = GetData( pData,nCount);
if( nCryptMask )
EncryptBuffer(pData, nCount);
m_nBufFilePos += nCount;
@@ -1300,7 +1300,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
SeekPos(m_nBufFilePos + nBufActualPos);
nBufActualLen = 0;
pBufPos = pRWBuf;
- nCount = GetData( (char*)pData, nCount );
+ nCount = GetData( pData, nCount );
if( nCryptMask )
EncryptBuffer(pData, nCount);
m_nBufFilePos += nCount;
@@ -1355,7 +1355,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
if( nCryptMask )
nCount = CryptAndWriteBuffer( pData, nCount );
else
- nCount = PutData( (char*)pData, nCount );
+ nCount = PutData( pData, nCount );
m_nBufFilePos += nCount;
return nCount;
}
@@ -1398,7 +1398,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
if( nCryptMask )
nCount = CryptAndWriteBuffer( pData, nCount );
else
- nCount = PutData( (char*)pData, nCount );
+ nCount = PutData( pData, nCount );
m_nBufFilePos += nCount;
}
else
@@ -1527,7 +1527,7 @@ SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32)
sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
{
unsigned char pTemp[CRYPT_BUFSIZE];
- unsigned char* pDataPtr = (unsigned char*)pStart;
+ unsigned char const * pDataPtr = static_cast<unsigned char const *>(pStart);
sal_Size nCount = 0;
sal_Size nBufCount;
unsigned char nMask = nCryptMask;
@@ -1557,7 +1557,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen)
{
- unsigned char* pTemp = (unsigned char*)pStart;
+ unsigned char* pTemp = static_cast<unsigned char*>(pStart);
unsigned char nMask = nCryptMask;
for ( sal_Size n=0; n < nLen; n++, pTemp++ )
@@ -1682,7 +1682,7 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize,
bIsWritable = false;
nEndOfData = bufSize;
bOwnsData = false;
- pBuf = (sal_uInt8 *) pBuffer;
+ pBuf = static_cast<sal_uInt8 *>(pBuffer);
nResize = 0L;
nSize = bufSize;
nPos = 0L;
@@ -1750,7 +1750,7 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
else
pResult = pBuf;
- pBuf = (sal_uInt8 *) pNewBuf;
+ pBuf = static_cast<sal_uInt8 *>(pNewBuf);
nPos = 0;
nSize = nCount;
nResize = 0;
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index 9693ccdc3620..fdb28829d3c4 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -25,7 +25,7 @@
#include <rtl/crc.h>
#include <osl/endian.h>
-#define PZSTREAM ((z_stream*) mpsC_Stream)
+#define PZSTREAM static_cast<z_stream*>(mpsC_Stream)
/* gzip flag byte */
// GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
@@ -57,7 +57,7 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize )
ZCodec::~ZCodec()
{
- delete (z_stream*) mpsC_Stream;
+ delete static_cast<z_stream*>(mpsC_Stream);
}
void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib )