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