Kaydet (Commit) 9826b9cf authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up C-style casts from pointers to void

Change-Id: Ife048a705e899870a8b1d9987b109d5c0cd80599
üst 93a8ef5a
...@@ -61,7 +61,7 @@ TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL ); ...@@ -61,7 +61,7 @@ TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
inline DbgData* DbgGetData() inline DbgData* DbgGetData()
{ {
return (DbgData*)DbgFunc( DBG_FUNC_GETDATA ); return static_cast<DbgData*>(DbgFunc( DBG_FUNC_GETDATA ));
} }
inline void DbgSaveData( const DbgData& rData ) inline void DbgSaveData( const DbgData& rData )
......
...@@ -45,20 +45,20 @@ typedef sal_IntPtr (*PSTUB)( void*, void* ); ...@@ -45,20 +45,20 @@ typedef sal_IntPtr (*PSTUB)( void*, void* );
#define IMPL_STUB(Class, Method, ArgType) \ #define IMPL_STUB(Class, Method, ArgType) \
sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \
{ \ { \
return static_cast<Class*>(pThis)->Method( (ArgType)pCaller ); \ return static_cast<Class*>(pThis)->Method( static_cast<ArgType>(pCaller) ); \
} }
#define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \ #define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \
sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \
{ \ { \
return Method( static_cast<Class*>(pThis), (ArgType)pCaller ); \ return Method( static_cast<Class*>(pThis), static_cast<ArgType>(pCaller) ); \
} \ } \
sal_IntPtr Class::Method( Class* pThis, ArgType ArgName ) sal_IntPtr Class::Method( Class* pThis, ArgType ArgName )
#define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \ #define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \
sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \
{ \ { \
return Method( static_cast<Class*>(pThis), (ArgType)pCaller ); \ return Method( static_cast<Class*>(pThis), static_cast<ArgType>(pCaller) ); \
} \ } \
sal_IntPtr Class::Method( SAL_UNUSED_PARAMETER Class*, ArgType ArgName ) sal_IntPtr Class::Method( SAL_UNUSED_PARAMETER Class*, ArgType ArgName )
......
...@@ -213,7 +213,7 @@ int INetMessageIStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) ...@@ -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(); pMsgRead = pMsgWrite + pMsgBuffer->Tell();
} }
...@@ -257,7 +257,7 @@ INetMessageOStream::INetMessageOStream(void) ...@@ -257,7 +257,7 @@ INetMessageOStream::INetMessageOStream(void)
INetMessageOStream::~INetMessageOStream(void) INetMessageOStream::~INetMessageOStream(void)
{ {
if (pMsgBuffer->Tell() > 0) if (pMsgBuffer->Tell() > 0)
PutMsgLine((const sal_Char*) pMsgBuffer->GetData(), pMsgBuffer->Tell()); PutMsgLine(static_cast<const sal_Char*>(pMsgBuffer->GetData()), pMsgBuffer->Tell());
delete pMsgBuffer; delete pMsgBuffer;
if (pTargetMsg) if (pTargetMsg)
...@@ -296,7 +296,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize) ...@@ -296,7 +296,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
if (pMsgBuffer->Tell() > 0) if (pMsgBuffer->Tell() > 0)
{ {
pMsgBuffer->WriteChar( '\0' ); pMsgBuffer->WriteChar( '\0' );
int status = PutMsgLine( (const sal_Char*) pMsgBuffer->GetData(), int status = PutMsgLine( static_cast<const sal_Char*>(pMsgBuffer->GetData()),
pMsgBuffer->Tell()); pMsgBuffer->Tell());
if (status != INETSTREAM_STATUS_OK) return status; if (status != INETSTREAM_STATUS_OK) return status;
} }
...@@ -321,7 +321,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize) ...@@ -321,7 +321,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
{ {
// Emit buffered header field now. // Emit buffered header field now.
pMsgBuffer->WriteChar( '\0' ); pMsgBuffer->WriteChar( '\0' );
int status = PutMsgLine((const sal_Char*) pMsgBuffer->GetData(), int status = PutMsgLine(static_cast<const sal_Char*>(pMsgBuffer->GetData()),
pMsgBuffer->Tell()); pMsgBuffer->Tell());
if (status != INETSTREAM_STATUS_OK) return status; if (status != INETSTREAM_STATUS_OK) return status;
} }
...@@ -352,7 +352,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize) ...@@ -352,7 +352,7 @@ int INetMessageOStream::Write(const sal_Char* pData, sal_uIntPtr nSize)
else if (ascii_isWhitespace(*pData & 0x7f)) else if (ascii_isWhitespace(*pData & 0x7f))
{ {
// Any <LWS> is folded into a single <SP> character. // 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( ' ' ); if (!ascii_isWhitespace(c & 0x7f)) pMsgBuffer->WriteChar( ' ' );
// Skip over this <LWS> character. // Skip over this <LWS> character.
...@@ -716,7 +716,7 @@ int INetMessageDecodeQPStream_Impl::PutMsgLine( const sal_Char* pData, ...@@ -716,7 +716,7 @@ int INetMessageDecodeQPStream_Impl::PutMsgLine( const sal_Char* pData,
sal_Size nDocSiz = pMsg->GetDocumentSize(); sal_Size nDocSiz = pMsg->GetDocumentSize();
sal_Size nWrite = 0; sal_Size nWrite = 0;
pLB->FillAppend((sal_Char*)(pMsgBuffer->GetData()), nRead, &nWrite); pLB->FillAppend(pMsgBuffer->GetData(), nRead, &nWrite);
pMsg->SetDocumentSize(nDocSiz + nWrite); pMsg->SetDocumentSize(nDocSiz + nWrite);
if (nWrite < nRead) return INETSTREAM_STATUS_ERROR; if (nWrite < nRead) return INETSTREAM_STATUS_ERROR;
...@@ -1413,7 +1413,7 @@ int INetMIMEMessageStream::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize) ...@@ -1413,7 +1413,7 @@ int INetMIMEMessageStream::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize)
const sal_Char* pChar; const sal_Char* pChar;
const sal_Char* pOldPos; const sal_Char* pOldPos;
int status; int status;
for( pOldPos = pChar = (const sal_Char*) pMsgBuffer->GetData(); nBufSize--; for( pOldPos = pChar = static_cast<const sal_Char*>(pMsgBuffer->GetData()); nBufSize--;
pChar++ ) pChar++ )
{ {
if( *pChar == '\r' || *pChar == '\n' ) if( *pChar == '\r' || *pChar == '\n' )
......
...@@ -63,7 +63,7 @@ OUString ResId::toString() const ...@@ -63,7 +63,7 @@ OUString ResId::toString() const
} }
// String loading // 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) ); sal_Int32 nStringLen = rtl_str_getLength( reinterpret_cast<char*>(pResHdr+1) );
OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8); OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
......
...@@ -494,10 +494,10 @@ bool InternalResMgr::Create() ...@@ -494,10 +494,10 @@ bool InternalResMgr::Create()
lContLen = ResMgr::GetLong( &lContLen ); lContLen = ResMgr::GetLong( &lContLen );
pStm->SeekRel( -lContLen ); pStm->SeekRel( -lContLen );
// allocate stored ImpContent data (12 bytes per unit) // 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 ); pStm->Read( pContentBuf, lContLen );
// allocate ImpContent space (sizeof(ImpContent) per unit, not necessarily 12) // 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 // Shorten to number of ImpContent
nEntries = (sal_uInt32)lContLen / 12; nEntries = (sal_uInt32)lContLen / 12;
bEqual2Content = true; bEqual2Content = true;
...@@ -592,7 +592,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, ...@@ -592,7 +592,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
RSHEADER_TYPE aHdr; RSHEADER_TYPE aHdr;
pStm->Read( &aHdr, sizeof( aHdr ) ); pStm->Read( &aHdr, sizeof( aHdr ) );
nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection; 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->Seek( pFirst->nOffset );
pStm->Read( pStringBlock, nSize ); pStm->Read( pStringBlock, nSize );
} }
...@@ -607,7 +607,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, ...@@ -607,7 +607,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) ); pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) );
void * pRes = rtl_allocateMemory( aHeader.GetGlobOff() ); void * pRes = rtl_allocateMemory( aHeader.GetGlobOff() );
memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) ); 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 ) ); aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) );
return pRes; return pRes;
} }
...@@ -1014,7 +1014,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) ...@@ -1014,7 +1014,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
#endif #endif
pTop->Flags |= RCFlags::NOTFOUND; pTop->Flags |= RCFlags::NOTFOUND;
pTop->pClassRes = getEmptyBuffer(); pTop->pClassRes = getEmptyBuffer();
pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes; pTop->pResource = static_cast<RSHEADER_TYPE*>(pTop->pClassRes);
return false; return false;
} }
} }
...@@ -1026,14 +1026,14 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) ...@@ -1026,14 +1026,14 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
if ( pTop->pClassRes ) if ( pTop->pClassRes )
// local Resource, not a system Resource // local Resource, not a system Resource
pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes; pTop->pResource = static_cast<RSHEADER_TYPE *>(pTop->pClassRes);
else else
{ {
pTop->pClassRes = pImpRes->LoadGlobalRes( nRT, nId, &pTop->aResHandle ); pTop->pClassRes = pImpRes->LoadGlobalRes( nRT, nId, &pTop->aResHandle );
if ( pTop->pClassRes ) if ( pTop->pClassRes )
{ {
pTop->Flags |= RCFlags::GLOBAL; pTop->Flags |= RCFlags::GLOBAL;
pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes; pTop->pResource = static_cast<RSHEADER_TYPE *>(pTop->pClassRes);
} }
else else
{ {
...@@ -1062,7 +1062,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) ...@@ -1062,7 +1062,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
#endif #endif
pTop->Flags |= RCFlags::NOTFOUND; pTop->Flags |= RCFlags::NOTFOUND;
pTop->pClassRes = getEmptyBuffer(); pTop->pClassRes = getEmptyBuffer();
pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes; pTop->pResource = static_cast<RSHEADER_TYPE*>(pTop->pClassRes);
return false; return false;
} }
} }
...@@ -1147,7 +1147,7 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId ) ...@@ -1147,7 +1147,7 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
// Pointer is at the beginning of the resource, thus // Pointer is at the beginning of the resource, thus
// class pointer points to the header, and the remaining size // class pointer points to the header, and the remaining size
// equals to total size of allocated memory // 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() ); memcpy( pHeader, GetClass(), GetRemainSize() );
Increment( pHeader->GetLocalOff() ); //ans Ende setzen Increment( pHeader->GetLocalOff() ); //ans Ende setzen
if ( pHeader->GetLocalOff() != pHeader->GetGlobOff() ) if ( pHeader->GetLocalOff() != pHeader->GetGlobOff() )
...@@ -1160,28 +1160,28 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId ) ...@@ -1160,28 +1160,28 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
sal_Int16 ResMgr::GetShort( void * pShort ) sal_Int16 ResMgr::GetShort( void * pShort )
{ {
return ((*((sal_uInt8*)pShort + 0) << 8) | return ((*(static_cast<sal_uInt8*>(pShort) + 0) << 8) |
(*((sal_uInt8*)pShort + 1) << 0) ); (*(static_cast<sal_uInt8*>(pShort) + 1) << 0) );
} }
sal_Int32 ResMgr::GetLong( void * pLong ) sal_Int32 ResMgr::GetLong( void * pLong )
{ {
return ((*((sal_uInt8*)pLong + 0) << 24) | return ((*(static_cast<sal_uInt8*>(pLong) + 0) << 24) |
(*((sal_uInt8*)pLong + 1) << 16) | (*(static_cast<sal_uInt8*>(pLong) + 1) << 16) |
(*((sal_uInt8*)pLong + 2) << 8) | (*(static_cast<sal_uInt8*>(pLong) + 2) << 8) |
(*((sal_uInt8*)pLong + 3) << 0) ); (*(static_cast<sal_uInt8*>(pLong) + 3) << 0) );
} }
sal_uInt64 ResMgr::GetUInt64( void* pDatum ) sal_uInt64 ResMgr::GetUInt64( void* pDatum )
{ {
return ((sal_uInt64(*((sal_uInt8*)pDatum + 0)) << 56) | return ((sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 0)) << 56) |
(sal_uInt64(*((sal_uInt8*)pDatum + 1)) << 48) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 1)) << 48) |
(sal_uInt64(*((sal_uInt8*)pDatum + 2)) << 40) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 2)) << 40) |
(sal_uInt64(*((sal_uInt8*)pDatum + 3)) << 32) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 3)) << 32) |
(sal_uInt64(*((sal_uInt8*)pDatum + 4)) << 24) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 4)) << 24) |
(sal_uInt64(*((sal_uInt8*)pDatum + 5)) << 16) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 5)) << 16) |
(sal_uInt64(*((sal_uInt8*)pDatum + 6)) << 8) | (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 6)) << 8) |
(sal_uInt64(*((sal_uInt8*)pDatum + 7)) << 0) ); (sal_uInt64(*(static_cast<sal_uInt8*>(pDatum) + 7)) << 0) );
} }
sal_uInt32 ResMgr::GetStringWithoutHook( OUString& rStr, const sal_uInt8* pStr ) sal_uInt32 ResMgr::GetStringWithoutHook( OUString& rStr, const sal_uInt8* pStr )
...@@ -1245,7 +1245,7 @@ void* ResMgr::Increment( sal_uInt32 nSize ) ...@@ -1245,7 +1245,7 @@ void* ResMgr::Increment( sal_uInt32 nSize )
if( (rStack.Flags & RCFlags::NOTFOUND) ) if( (rStack.Flags & RCFlags::NOTFOUND) )
return rStack.pClassRes; return rStack.pClassRes;
sal_uInt8* pClassRes = (sal_uInt8*)rStack.pClassRes + nSize; sal_uInt8* pClassRes = static_cast<sal_uInt8*>(rStack.pClassRes) + nSize;
rStack.pClassRes = pClassRes; rStack.pClassRes = pClassRes;
...@@ -1394,7 +1394,7 @@ OUString ResMgr::ReadStringWithoutHook() ...@@ -1394,7 +1394,7 @@ OUString ResMgr::ReadStringWithoutHook()
#endif #endif
} }
else else
Increment( GetStringWithoutHook( aRet, (const sal_uInt8*)GetClass() ) ); Increment( GetStringWithoutHook( aRet, static_cast<const sal_uInt8*>(GetClass()) ) );
return aRet; return aRet;
} }
...@@ -1424,7 +1424,7 @@ OString ResMgr::ReadByteString() ...@@ -1424,7 +1424,7 @@ OString ResMgr::ReadByteString()
#endif #endif
} }
else else
Increment( GetByteString( aRet, (const sal_uInt8*)GetClass() ) ); Increment( GetByteString( aRet, static_cast<const sal_uInt8*>(GetClass()) ) );
return aRet; return aRet;
} }
...@@ -1572,7 +1572,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId ) ...@@ -1572,7 +1572,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId )
void* pResHandle = NULL; void* pResHandle = NULL;
InternalResMgr* pFallback = m_pResImpl; 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 ) if ( !pResHeader )
{ {
osl::Guard<osl::Mutex> aGuard2( getResMgrMutex() ); osl::Guard<osl::Mutex> aGuard2( getResMgrMutex() );
...@@ -1589,7 +1589,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId ) ...@@ -1589,7 +1589,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId )
// handle possible recursion // handle possible recursion
if( pFallback->aLocale != m_pResImpl->aLocale ) 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 else
{ {
......
...@@ -74,7 +74,7 @@ EDcrData *EDcrData::GetData() ...@@ -74,7 +74,7 @@ EDcrData *EDcrData::GetData()
#ifdef BOOTSTRAP #ifdef BOOTSTRAP
return 0x0; return 0x0;
#else #else
EDcrData **ppDat=(EDcrData **)GetAppData(SHL_ERR); EDcrData **ppDat=reinterpret_cast<EDcrData **>(GetAppData(SHL_ERR));
if(!*ppDat) if(!*ppDat)
{ {
return (*ppDat=new EDcrData); return (*ppDat=new EDcrData);
......
...@@ -1259,7 +1259,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) ...@@ -1259,7 +1259,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
if( !pRWBuf ) if( !pRWBuf )
{ {
nCount = GetData( (char*)pData,nCount); nCount = GetData( pData,nCount);
if( nCryptMask ) if( nCryptMask )
EncryptBuffer(pData, nCount); EncryptBuffer(pData, nCount);
m_nBufFilePos += nCount; m_nBufFilePos += nCount;
...@@ -1300,7 +1300,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) ...@@ -1300,7 +1300,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
SeekPos(m_nBufFilePos + nBufActualPos); SeekPos(m_nBufFilePos + nBufActualPos);
nBufActualLen = 0; nBufActualLen = 0;
pBufPos = pRWBuf; pBufPos = pRWBuf;
nCount = GetData( (char*)pData, nCount ); nCount = GetData( pData, nCount );
if( nCryptMask ) if( nCryptMask )
EncryptBuffer(pData, nCount); EncryptBuffer(pData, nCount);
m_nBufFilePos += nCount; m_nBufFilePos += nCount;
...@@ -1355,7 +1355,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) ...@@ -1355,7 +1355,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
if( nCryptMask ) if( nCryptMask )
nCount = CryptAndWriteBuffer( pData, nCount ); nCount = CryptAndWriteBuffer( pData, nCount );
else else
nCount = PutData( (char*)pData, nCount ); nCount = PutData( pData, nCount );
m_nBufFilePos += nCount; m_nBufFilePos += nCount;
return nCount; return nCount;
} }
...@@ -1398,7 +1398,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) ...@@ -1398,7 +1398,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
if( nCryptMask ) if( nCryptMask )
nCount = CryptAndWriteBuffer( pData, nCount ); nCount = CryptAndWriteBuffer( pData, nCount );
else else
nCount = PutData( (char*)pData, nCount ); nCount = PutData( pData, nCount );
m_nBufFilePos += nCount; m_nBufFilePos += nCount;
} }
else else
...@@ -1527,7 +1527,7 @@ SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32) ...@@ -1527,7 +1527,7 @@ SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32)
sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
{ {
unsigned char pTemp[CRYPT_BUFSIZE]; 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 nCount = 0;
sal_Size nBufCount; sal_Size nBufCount;
unsigned char nMask = nCryptMask; unsigned char nMask = nCryptMask;
...@@ -1557,7 +1557,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) ...@@ -1557,7 +1557,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
bool SvStream::EncryptBuffer(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; unsigned char nMask = nCryptMask;
for ( sal_Size n=0; n < nLen; n++, pTemp++ ) for ( sal_Size n=0; n < nLen; n++, pTemp++ )
...@@ -1682,7 +1682,7 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize, ...@@ -1682,7 +1682,7 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize,
bIsWritable = false; bIsWritable = false;
nEndOfData = bufSize; nEndOfData = bufSize;
bOwnsData = false; bOwnsData = false;
pBuf = (sal_uInt8 *) pBuffer; pBuf = static_cast<sal_uInt8 *>(pBuffer);
nResize = 0L; nResize = 0L;
nSize = bufSize; nSize = bufSize;
nPos = 0L; nPos = 0L;
...@@ -1750,7 +1750,7 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, ...@@ -1750,7 +1750,7 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
else else
pResult = pBuf; pResult = pBuf;
pBuf = (sal_uInt8 *) pNewBuf; pBuf = static_cast<sal_uInt8 *>(pNewBuf);
nPos = 0; nPos = 0;
nSize = nCount; nSize = nCount;
nResize = 0; nResize = 0;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <rtl/crc.h> #include <rtl/crc.h>
#include <osl/endian.h> #include <osl/endian.h>
#define PZSTREAM ((z_stream*) mpsC_Stream) #define PZSTREAM static_cast<z_stream*>(mpsC_Stream)
/* gzip flag byte */ /* gzip flag byte */
// GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ // GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
...@@ -57,7 +57,7 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize ) ...@@ -57,7 +57,7 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize )
ZCodec::~ZCodec() ZCodec::~ZCodec()
{ {
delete (z_stream*) mpsC_Stream; delete static_cast<z_stream*>(mpsC_Stream);
} }
void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib ) void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment