Kaydet (Commit) 7eeabbca authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up C-style casts from pointers to void

Change-Id: I1d157bfc82f09f2438e59eca4fcd92931ca38723
üst 84676d50
...@@ -48,7 +48,7 @@ namespace ...@@ -48,7 +48,7 @@ namespace
const OUString &rStreamName, const OUString &rStreamName,
sal_uLong nSize ) sal_uLong nSize )
{ {
unsigned char *pData = (unsigned char*)malloc( nSize ); unsigned char *pData = static_cast<unsigned char*>(malloc( nSize ));
sal_uLong nReadableSize = 0; sal_uLong nReadableSize = 0;
if( !pData ) if( !pData )
return true; return true;
......
...@@ -64,7 +64,7 @@ void StgCache::SetToPage ( const rtl::Reference< StgPage >& rPage, short nOff, s ...@@ -64,7 +64,7 @@ void StgCache::SetToPage ( const rtl::Reference< StgPage >& rPage, short nOff, s
#ifdef OSL_BIGENDIAN #ifdef OSL_BIGENDIAN
nVal = OSL_SWAPDWORD(nVal); nVal = OSL_SWAPDWORD(nVal);
#endif #endif
((sal_Int32*) rPage->GetData() )[ nOff ] = nVal; static_cast<sal_Int32*>(rPage->GetData())[ nOff ] = nVal;
SetDirty( rPage ); SetDirty( rPage );
} }
} }
......
...@@ -119,7 +119,7 @@ inline sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage >& rPage, ...@@ -119,7 +119,7 @@ inline sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage >& rPage,
{ {
if( ( nOff >= (short) ( rPage->GetSize() / sizeof( sal_Int32 ) ) ) || nOff < 0 ) if( ( nOff >= (short) ( rPage->GetSize() / sizeof( sal_Int32 ) ) ) || nOff < 0 )
return -1; return -1;
sal_Int32 n = ((sal_Int32*) rPage->GetData() )[ nOff ]; sal_Int32 n = static_cast<sal_Int32*>(rPage->GetData())[ nOff ];
#ifdef OSL_BIGENDIAN #ifdef OSL_BIGENDIAN
return OSL_SWAPDWORD(n); return OSL_SWAPDWORD(n);
#else #else
......
...@@ -366,7 +366,7 @@ bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize ) ...@@ -366,7 +366,7 @@ bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
if ( nBufSize < 128 ) if ( nBufSize < 128 )
return false; return false;
SvMemoryStream r( (sal_Char*) pFrom, nBufSize, StreamMode::READ ); SvMemoryStream r( const_cast<void *>(pFrom), nBufSize, StreamMode::READ );
for( short i = 0; i < 32; i++ ) for( short i = 0; i < 32; i++ )
r.ReadUInt16( nName[ i ] ); // 00 name as WCHAR r.ReadUInt16( nName[ i ] ); // 00 name as WCHAR
r.ReadUInt16( nNameLen ) // 40 size of name in bytes including 00H r.ReadUInt16( nNameLen ) // 40 size of name in bytes including 00H
...@@ -412,7 +412,7 @@ bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize ) ...@@ -412,7 +412,7 @@ bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
void StgEntry::Store( void* pTo ) void StgEntry::Store( void* pTo )
{ {
SvMemoryStream r( (sal_Char *)pTo, 128, StreamMode::WRITE ); SvMemoryStream r( pTo, 128, StreamMode::WRITE );
for( short i = 0; i < 32; i++ ) for( short i = 0; i < 32; i++ )
r.WriteUInt16( nName[ i ] ); // 00 name as WCHAR r.WriteUInt16( nName[ i ] ); // 00 name as WCHAR
r.WriteUInt16( nNameLen ) // 40 size of name in bytes including 00H r.WriteUInt16( nNameLen ) // 40 size of name in bytes including 00H
......
...@@ -885,7 +885,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, bool bForce, bool bDirty ) ...@@ -885,7 +885,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, bool bForce, bool bDirty )
{ {
if( bDirty ) if( bDirty )
rIo.SetDirty( pPg ); rIo.SetDirty( pPg );
return ((sal_uInt8 *)pPg->GetData()) + nOffset; return static_cast<sal_uInt8 *>(pPg->GetData()) + nOffset;
} }
} }
return NULL; return NULL;
...@@ -912,7 +912,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -912,7 +912,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
if( nBytes ) if( nBytes )
{ {
short nRes; short nRes;
void *p = (sal_uInt8 *) pBuf + nDone; void *p = static_cast<sal_uInt8 *>(pBuf) + nDone;
if( nBytes == nPageSize ) if( nBytes == nPageSize )
{ {
pPg = rIo.Find( nPage ); pPg = rIo.Find( nPage );
...@@ -932,7 +932,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -932,7 +932,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
pPg = rIo.Get( nPage, false ); pPg = rIo.Get( nPage, false );
if( !pPg.is() ) if( !pPg.is() )
break; break;
memcpy( p, (sal_uInt8*)pPg->GetData() + nOffset, nBytes ); memcpy( p, static_cast<sal_uInt8*>(pPg->GetData()) + nOffset, nBytes );
nRes = nBytes; nRes = nBytes;
} }
nDone += nRes; nDone += nRes;
...@@ -971,7 +971,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -971,7 +971,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
if( nBytes ) if( nBytes )
{ {
short nRes; short nRes;
const void *p = (const sal_uInt8 *) pBuf + nDone; const void *p = static_cast<const sal_uInt8 *>(pBuf) + nDone;
if( nBytes == nPageSize ) if( nBytes == nPageSize )
{ {
pPg = rIo.Find( nPage ); pPg = rIo.Find( nPage );
...@@ -992,7 +992,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -992,7 +992,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
pPg = rIo.Get( nPage, false ); pPg = rIo.Get( nPage, false );
if( !pPg.is() ) if( !pPg.is() )
break; break;
memcpy( (sal_uInt8*)pPg->GetData() + nOffset, p, nBytes ); memcpy( static_cast<sal_uInt8*>(pPg->GetData()) + nOffset, p, nBytes );
rIo.SetDirty( pPg ); rIo.SetDirty( pPg );
nRes = nBytes; nRes = nBytes;
} }
...@@ -1063,7 +1063,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -1063,7 +1063,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
if( !pData || !pData->Pos2Page( nPage * nPageSize + nOffset ) ) if( !pData || !pData->Pos2Page( nPage * nPageSize + nOffset ) )
break; break;
// all reading through the stream // all reading through the stream
short nRes = (short) pData->Read( (sal_uInt8*)pBuf + nDone, nBytes ); short nRes = (short) pData->Read( static_cast<sal_uInt8*>(pBuf) + nDone, nBytes );
nDone = nDone + nRes; nDone = nDone + nRes;
nPos += nRes; nPos += nRes;
n -= nRes; n -= nRes;
...@@ -1106,7 +1106,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -1106,7 +1106,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
break; break;
if( !pData->Pos2Page( nDataPos ) ) if( !pData->Pos2Page( nDataPos ) )
break; break;
short nRes = (short) pData->Write( (sal_uInt8*)pBuf + nDone, nBytes ); short nRes = (short) pData->Write( static_cast<sal_uInt8 const *>(pBuf) + nDone, nBytes );
nDone = nDone + nRes; nDone = nDone + nRes;
nPos += nRes; nPos += nRes;
n -= nRes; n -= nRes;
...@@ -1265,7 +1265,7 @@ sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n ) ...@@ -1265,7 +1265,7 @@ sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n )
return n; return n;
} }
else else
return SvMemoryStream::GetData( (sal_Char *)pData, n ); return SvMemoryStream::GetData( pData, n );
} }
sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n ) sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n )
...@@ -1284,7 +1284,7 @@ sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n ) ...@@ -1284,7 +1284,7 @@ sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n )
SetError( pStrm->GetError() ); SetError( pStrm->GetError() );
} }
else else
nNew = SvMemoryStream::PutData( (sal_Char*)pData, n ); nNew = SvMemoryStream::PutData( pData, n );
return nNew; return nNew;
} }
......
...@@ -143,7 +143,7 @@ sal_uLong SotStorageStream::GetData( void* pData, sal_uLong nSize ) ...@@ -143,7 +143,7 @@ sal_uLong SotStorageStream::GetData( void* pData, sal_uLong nSize )
SetError( pOwnStm->GetError() ); SetError( pOwnStm->GetError() );
} }
else else
nRet = SvStream::GetData( (sal_Char *)pData, nSize ); nRet = SvStream::GetData( pData, nSize );
return nRet; return nRet;
} }
...@@ -158,7 +158,7 @@ sal_uLong SotStorageStream::PutData( const void* pData, sal_uLong nSize ) ...@@ -158,7 +158,7 @@ sal_uLong SotStorageStream::PutData( const void* pData, sal_uLong nSize )
SetError( pOwnStm->GetError() ); SetError( pOwnStm->GetError() );
} }
else else
nRet = SvStream::PutData( (sal_Char *)pData, nSize ); nRet = SvStream::PutData( pData, nSize );
return nRet; return nRet;
} }
......
...@@ -901,7 +901,7 @@ sal_uLong UCBStorageStream_Impl::GetData( void* pData, sal_uLong nSize ) ...@@ -901,7 +901,7 @@ sal_uLong UCBStorageStream_Impl::GetData( void* pData, sal_uLong nSize )
// copy this tail to the temporary stream // copy this tail to the temporary stream
sal_uLong aToRead = nSize - aResult; sal_uLong aToRead = nSize - aResult;
pData = (void*)( (char*)pData + aResult ); pData = (void*)( static_cast<char*>(pData) + aResult );
try try
{ {
......
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