Kaydet (Commit) 2850b4dc authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some more loplugin:cstylecast: tools

Change-Id: I2b540c4c0c34823143e13d16559dac7458a38933
üst 17fe7fc5
...@@ -55,25 +55,25 @@ inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0] ...@@ -55,25 +55,25 @@ inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0]
+ ((sal_uInt32)p[3] << 24); } + ((sal_uInt32)p[3] << 24); }
#if defined OSL_LITENDIAN #if defined OSL_LITENDIAN
inline double SVBT64ToDouble( const SVBT64 p ) { double n; inline double SVBT64ToDouble( const SVBT64 p ) { double n;
((sal_uInt8*)&n)[0] = p[0]; reinterpret_cast<sal_uInt8*>(&n)[0] = p[0];
((sal_uInt8*)&n)[1] = p[1]; reinterpret_cast<sal_uInt8*>(&n)[1] = p[1];
((sal_uInt8*)&n)[2] = p[2]; reinterpret_cast<sal_uInt8*>(&n)[2] = p[2];
((sal_uInt8*)&n)[3] = p[3]; reinterpret_cast<sal_uInt8*>(&n)[3] = p[3];
((sal_uInt8*)&n)[4] = p[4]; reinterpret_cast<sal_uInt8*>(&n)[4] = p[4];
((sal_uInt8*)&n)[5] = p[5]; reinterpret_cast<sal_uInt8*>(&n)[5] = p[5];
((sal_uInt8*)&n)[6] = p[6]; reinterpret_cast<sal_uInt8*>(&n)[6] = p[6];
((sal_uInt8*)&n)[7] = p[7]; reinterpret_cast<sal_uInt8*>(&n)[7] = p[7];
return n; } return n; }
#else #else
inline double SVBT64ToDouble( const SVBT64 p ) { double n; inline double SVBT64ToDouble( const SVBT64 p ) { double n;
((sal_uInt8*)&n)[0] = p[7]; reinterpret_cast<sal_uInt8*>(&n)[0] = p[7];
((sal_uInt8*)&n)[1] = p[6]; reinterpret_cast<sal_uInt8*>(&n)[1] = p[6];
((sal_uInt8*)&n)[2] = p[5]; reinterpret_cast<sal_uInt8*>(&n)[2] = p[5];
((sal_uInt8*)&n)[3] = p[4]; reinterpret_cast<sal_uInt8*>(&n)[3] = p[4];
((sal_uInt8*)&n)[4] = p[3]; reinterpret_cast<sal_uInt8*>(&n)[4] = p[3];
((sal_uInt8*)&n)[5] = p[2]; reinterpret_cast<sal_uInt8*>(&n)[5] = p[2];
((sal_uInt8*)&n)[6] = p[1]; reinterpret_cast<sal_uInt8*>(&n)[6] = p[1];
((sal_uInt8*)&n)[7] = p[0]; reinterpret_cast<sal_uInt8*>(&n)[7] = p[0];
return n; } return n; }
#endif #endif
...@@ -84,23 +84,23 @@ inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (sal_uInt8) ...@@ -84,23 +84,23 @@ inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (sal_uInt8)
p[2] = (sal_uInt8)(n >> 16); p[2] = (sal_uInt8)(n >> 16);
p[3] = (sal_uInt8)(n >> 24); } p[3] = (sal_uInt8)(n >> 24); }
#if defined OSL_LITENDIAN #if defined OSL_LITENDIAN
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[0]; inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[0];
p[1] = ((sal_uInt8*)&n)[1]; p[1] = reinterpret_cast<sal_uInt8*>(&n)[1];
p[2] = ((sal_uInt8*)&n)[2]; p[2] = reinterpret_cast<sal_uInt8*>(&n)[2];
p[3] = ((sal_uInt8*)&n)[3]; p[3] = reinterpret_cast<sal_uInt8*>(&n)[3];
p[4] = ((sal_uInt8*)&n)[4]; p[4] = reinterpret_cast<sal_uInt8*>(&n)[4];
p[5] = ((sal_uInt8*)&n)[5]; p[5] = reinterpret_cast<sal_uInt8*>(&n)[5];
p[6] = ((sal_uInt8*)&n)[6]; p[6] = reinterpret_cast<sal_uInt8*>(&n)[6];
p[7] = ((sal_uInt8*)&n)[7]; } p[7] = reinterpret_cast<sal_uInt8*>(&n)[7]; }
#else #else
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7]; inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[7];
p[1] = ((sal_uInt8*)&n)[6]; p[1] = reinterpret_cast<sal_uInt8*>(&n)[6];
p[2] = ((sal_uInt8*)&n)[5]; p[2] = reinterpret_cast<sal_uInt8*>(&n)[5];
p[3] = ((sal_uInt8*)&n)[4]; p[3] = reinterpret_cast<sal_uInt8*>(&n)[4];
p[4] = ((sal_uInt8*)&n)[3]; p[4] = reinterpret_cast<sal_uInt8*>(&n)[3];
p[5] = ((sal_uInt8*)&n)[2]; p[5] = reinterpret_cast<sal_uInt8*>(&n)[2];
p[6] = ((sal_uInt8*)&n)[1]; p[6] = reinterpret_cast<sal_uInt8*>(&n)[1];
p[7] = ((sal_uInt8*)&n)[0]; } p[7] = reinterpret_cast<sal_uInt8*>(&n)[0]; }
#endif #endif
#endif #endif
......
...@@ -61,7 +61,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) ...@@ -61,7 +61,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags )
{ {
if ( nInitSize ) if ( nInitSize )
{ {
mpPointAry = (Point*)new char[(sal_uIntPtr)nInitSize*sizeof(Point)]; mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)nInitSize*sizeof(Point)]);
memset( mpPointAry, 0, (sal_uIntPtr)nInitSize*sizeof(Point) ); memset( mpPointAry, 0, (sal_uIntPtr)nInitSize*sizeof(Point) );
} }
else else
...@@ -83,7 +83,7 @@ ImplPolygon::ImplPolygon( const ImplPolygon& rImpPoly ) ...@@ -83,7 +83,7 @@ ImplPolygon::ImplPolygon( const ImplPolygon& rImpPoly )
{ {
if ( rImpPoly.mnPoints ) if ( rImpPoly.mnPoints )
{ {
mpPointAry = (Point*)new char[(sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point)]; mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point)]);
memcpy( mpPointAry, rImpPoly.mpPointAry, (sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point) ); memcpy( mpPointAry, rImpPoly.mpPointAry, (sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point) );
if( rImpPoly.mpFlagAry ) if( rImpPoly.mpFlagAry )
...@@ -108,7 +108,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, const Point* pInitAry, const sal ...@@ -108,7 +108,7 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, const Point* pInitAry, const sal
{ {
if ( nInitSize ) if ( nInitSize )
{ {
mpPointAry = (Point*)new char[(sal_uIntPtr)nInitSize*sizeof(Point)]; mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)nInitSize*sizeof(Point)]);
memcpy( mpPointAry, pInitAry, (sal_uIntPtr)nInitSize*sizeof( Point ) ); memcpy( mpPointAry, pInitAry, (sal_uIntPtr)nInitSize*sizeof( Point ) );
if( pInitFlags ) if( pInitFlags )
...@@ -133,7 +133,7 @@ ImplPolygon::~ImplPolygon() ...@@ -133,7 +133,7 @@ ImplPolygon::~ImplPolygon()
{ {
if ( mpPointAry ) if ( mpPointAry )
{ {
delete[] (char*) mpPointAry; delete[] reinterpret_cast<char*>(mpPointAry);
} }
if( mpFlagAry ) if( mpFlagAry )
...@@ -149,7 +149,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) ...@@ -149,7 +149,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize )
if ( nNewSize ) if ( nNewSize )
{ {
pNewAry = (Point*)new char[(sal_uIntPtr)nNewSize*sizeof(Point)]; pNewAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)nNewSize*sizeof(Point)]);
if ( bResize ) if ( bResize )
{ {
...@@ -172,7 +172,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) ...@@ -172,7 +172,7 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize )
pNewAry = NULL; pNewAry = NULL;
if ( mpPointAry ) if ( mpPointAry )
delete[] (char*) mpPointAry; delete[] reinterpret_cast<char*>(mpPointAry);
// ggf. FlagArray beruecksichtigen // ggf. FlagArray beruecksichtigen
if( mpFlagAry ) if( mpFlagAry )
...@@ -236,7 +236,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI ...@@ -236,7 +236,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
const sal_uInt16 nSecPos = nPos + nSpace; const sal_uInt16 nSecPos = nPos + nSpace;
const sal_uInt16 nRest = mnPoints - nPos; const sal_uInt16 nRest = mnPoints - nPos;
Point* pNewAry = (Point*) new char[ (sal_uIntPtr) nNewSize * sizeof( Point ) ]; Point* pNewAry = reinterpret_cast<Point*>(new char[ (sal_uIntPtr) nNewSize * sizeof( Point ) ]);
memcpy( pNewAry, mpPointAry, nPos * sizeof( Point ) ); memcpy( pNewAry, mpPointAry, nPos * sizeof( Point ) );
...@@ -246,7 +246,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI ...@@ -246,7 +246,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
memset( pNewAry + nPos, 0, nSpaceSize ); memset( pNewAry + nPos, 0, nSpaceSize );
memcpy( pNewAry + nSecPos, mpPointAry + nPos, nRest * sizeof( Point ) ); memcpy( pNewAry + nSecPos, mpPointAry + nPos, nRest * sizeof( Point ) );
delete[] (char*) mpPointAry; delete[] reinterpret_cast<char*>(mpPointAry);
// consider FlagArray // consider FlagArray
if( mpFlagAry ) if( mpFlagAry )
......
...@@ -65,8 +65,8 @@ OUString ResId::toString() const ...@@ -65,8 +65,8 @@ OUString ResId::toString() const
// String loading // String loading
RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass(); RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
sal_Int32 nStringLen = rtl_str_getLength( (char*)(pResHdr+1) ); sal_Int32 nStringLen = rtl_str_getLength( reinterpret_cast<char*>(pResHdr+1) );
OUString sRet((const char*)(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8); OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
sal_uInt32 nSize = sizeof( RSHEADER_TYPE ) sal_uInt32 nSize = sizeof( RSHEADER_TYPE )
+ sal::static_int_cast< sal_uInt32 >(nStringLen) + 1; + sal::static_int_cast< sal_uInt32 >(nStringLen) + 1;
......
...@@ -755,15 +755,15 @@ static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack, ...@@ -755,15 +755,15 @@ static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack,
if ( pStack->pResource && pStack->pClassRes ) if ( pStack->pResource && pStack->pClassRes )
{ {
pTmp = (RSHEADER_TYPE*) pTmp = reinterpret_cast<RSHEADER_TYPE*>
((sal_uInt8*)pStack->pResource + pStack->pResource->GetLocalOff()); (reinterpret_cast<sal_uInt8*>(pStack->pResource) + pStack->pResource->GetLocalOff());
pEnd = (RSHEADER_TYPE*) pEnd = reinterpret_cast<RSHEADER_TYPE*>
((sal_uInt8*)pStack->pResource + pStack->pResource->GetGlobOff()); (reinterpret_cast<sal_uInt8*>(pStack->pResource) + pStack->pResource->GetGlobOff());
while ( pTmp != pEnd ) while ( pTmp != pEnd )
{ {
if ( pTmp->GetRT() == nRTType && pTmp->GetId() == nId ) if ( pTmp->GetRT() == nRTType && pTmp->GetId() == nId )
return pTmp; return pTmp;
pTmp = (RSHEADER_TYPE*)((sal_uInt8*)pTmp + pTmp->GetGlobOff()); pTmp = reinterpret_cast<RSHEADER_TYPE*>(reinterpret_cast<sal_uInt8*>(pTmp) + pTmp->GetGlobOff());
} }
} }
...@@ -1113,7 +1113,7 @@ void ResMgr::PopContext( const Resource* pResObj ) ...@@ -1113,7 +1113,7 @@ void ResMgr::PopContext( const Resource* pResObj )
#ifdef DBG_UTIL #ifdef DBG_UTIL
if ( DbgIsResource() && !(pTop->Flags & RC_NOTFOUND) ) if ( DbgIsResource() && !(pTop->Flags & RC_NOTFOUND) )
{ {
void* pRes = (sal_uInt8*)pTop->pResource + void* pRes = reinterpret_cast<sal_uInt8*>(pTop->pResource) +
pTop->pResource->GetLocalOff(); pTop->pResource->GetLocalOff();
if ( pTop->pClassRes != pRes ) if ( pTop->pClassRes != pRes )
...@@ -1215,13 +1215,13 @@ sal_uInt32 ResMgr::GetByteString( OString& rStr, const sal_uInt8* pStr ) ...@@ -1215,13 +1215,13 @@ sal_uInt32 ResMgr::GetByteString( OString& rStr, const sal_uInt8* pStr )
{ {
sal_uInt32 nLen=0; sal_uInt32 nLen=0;
sal_uInt32 nRet = GetStringSize( pStr, nLen ); sal_uInt32 nRet = GetStringSize( pStr, nLen );
rStr = OString( (const sal_Char*)pStr, nLen ); rStr = OString( reinterpret_cast<const char*>(pStr), nLen );
return nRet; return nRet;
} }
sal_uInt32 ResMgr::GetStringSize( const sal_uInt8* pStr, sal_uInt32& nLen ) sal_uInt32 ResMgr::GetStringSize( const sal_uInt8* pStr, sal_uInt32& nLen )
{ {
nLen = static_cast< sal_uInt32 >( strlen( (const char*)pStr ) ); nLen = static_cast< sal_uInt32 >( strlen( reinterpret_cast<const char*>(pStr) ) );
return GetStringSize( nLen ); return GetStringSize( nLen );
} }
...@@ -1257,7 +1257,7 @@ void* ResMgr::Increment( sal_uInt32 nSize ) ...@@ -1257,7 +1257,7 @@ void* ResMgr::Increment( sal_uInt32 nSize )
sal_uInt32 nLocalOff = pRes->GetLocalOff(); sal_uInt32 nLocalOff = pRes->GetLocalOff();
if ( (pRes->GetGlobOff() == nLocalOff) && if ( (pRes->GetGlobOff() == nLocalOff) &&
(((char*)pRes + nLocalOff) == rStack.pClassRes) && ((reinterpret_cast<char*>(pRes) + nLocalOff) == rStack.pClassRes) &&
(rStack.Flags & RC_AUTORELEASE)) (rStack.Flags & RC_AUTORELEASE))
{ {
PopContext( rStack.pResObj ); PopContext( rStack.pResObj );
...@@ -1608,7 +1608,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId ) ...@@ -1608,7 +1608,7 @@ OUString SimpleResMgr::ReadString( sal_uInt32 nId )
} }
// sal_uIntPtr nLen = pResHeader->GetLocalOff() - sizeof(RSHEADER_TYPE); // sal_uIntPtr nLen = pResHeader->GetLocalOff() - sizeof(RSHEADER_TYPE);
ResMgr::GetString( sReturn, (const sal_uInt8*)(pResHeader+1) ); ResMgr::GetString( sReturn, reinterpret_cast<sal_uInt8*>(pResHeader+1) );
// not necessary with the current implementation which holds the string table permanently, but to be sure .... // not necessary with the current implementation which holds the string table permanently, but to be sure ....
// note: pFallback cannot be NULL here and is either the fallback or m_pResImpl // note: pFallback cannot be NULL here and is either the fallback or m_pResImpl
......
...@@ -319,14 +319,14 @@ sal_uInt16 ErrorHandler::HandleError_Impl( ...@@ -319,14 +319,14 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
delete pInfo; delete pInfo;
if(!pData->bIsWindowDsp) if(!pData->bIsWindowDsp)
{ {
(*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction); (*reinterpret_cast<BasicDisplayErrorFunc*>(pData->pDsp))(aErr,aAction);
return 0; return 0;
} }
else else
{ {
if (nFlags != USHRT_MAX) if (nFlags != USHRT_MAX)
nErrFlags = nFlags; nErrFlags = nFlags;
return (*(WindowDisplayErrorFunc*)pData->pDsp)( return (*reinterpret_cast<WindowDisplayErrorFunc*>(pData->pDsp))(
pParent, nErrFlags, aErr, aAction); pParent, nErrFlags, aErr, aAction);
} }
} }
......
...@@ -117,7 +117,7 @@ SvStream& WriteSvGlobalName( SvStream& rOStr, const SvGlobalName & rObj ) ...@@ -117,7 +117,7 @@ SvStream& WriteSvGlobalName( SvStream& rOStr, const SvGlobalName & rObj )
rOStr.WriteUInt32( rObj.pImp->szData.Data1 ); rOStr.WriteUInt32( rObj.pImp->szData.Data1 );
rOStr.WriteUInt16( rObj.pImp->szData.Data2 ); rOStr.WriteUInt16( rObj.pImp->szData.Data2 );
rOStr.WriteUInt16( rObj.pImp->szData.Data3 ); rOStr.WriteUInt16( rObj.pImp->szData.Data3 );
rOStr.Write( (sal_Char *)&rObj.pImp->szData.Data4, 8 ); rOStr.Write( &rObj.pImp->szData.Data4, 8 );
return rOStr; return rOStr;
} }
...@@ -127,7 +127,7 @@ SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj ) ...@@ -127,7 +127,7 @@ SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj )
rStr.ReadUInt32( rObj.pImp->szData.Data1 ); rStr.ReadUInt32( rObj.pImp->szData.Data1 );
rStr.ReadUInt16( rObj.pImp->szData.Data2 ); rStr.ReadUInt16( rObj.pImp->szData.Data2 );
rStr.ReadUInt16( rObj.pImp->szData.Data3 ); rStr.ReadUInt16( rObj.pImp->szData.Data3 );
rStr.Read( (sal_Char *)&rObj.pImp->szData.Data4, 8 ); rStr.Read( &rObj.pImp->szData.Data4, 8 );
return rStr; return rStr;
} }
......
...@@ -134,14 +134,14 @@ inline static void SwapDouble( double& r ) ...@@ -134,14 +134,14 @@ inline static void SwapDouble( double& r )
if( bIoRead && sizeof(datatype)<=nBufFree) \ if( bIoRead && sizeof(datatype)<=nBufFree) \
{ \ { \
for (std::size_t i = 0; i < sizeof(datatype); i++) \ for (std::size_t i = 0; i < sizeof(datatype); i++) \
((char *)&value)[i] = pBufPos[i]; \ reinterpret_cast<char *>(&value)[i] = pBufPos[i]; \
nBufActualPos += sizeof(datatype); \ nBufActualPos += sizeof(datatype); \
pBufPos += sizeof(datatype); \ pBufPos += sizeof(datatype); \
nBufFree -= sizeof(datatype); \ nBufFree -= sizeof(datatype); \
} \ } \
else \ else \
{ \ { \
Read( (char*)&value, sizeof(datatype) ); \ Read( &value, sizeof(datatype) ); \
} \ } \
...@@ -149,7 +149,7 @@ inline static void SwapDouble( double& r ) ...@@ -149,7 +149,7 @@ inline static void SwapDouble( double& r )
if( bIoWrite && sizeof(datatype) <= nBufFree) \ if( bIoWrite && sizeof(datatype) <= nBufFree) \
{ \ { \
for (std::size_t i = 0; i < sizeof(datatype); i++) \ for (std::size_t i = 0; i < sizeof(datatype); i++) \
pBufPos[i] = ((char *)&value)[i]; \ pBufPos[i] = reinterpret_cast<char const *>(&value)[i]; \
nBufFree -= sizeof(datatype); \ nBufFree -= sizeof(datatype); \
nBufActualPos += sizeof(datatype); \ nBufActualPos += sizeof(datatype); \
if( nBufActualPos > nBufActualLen ) \ if( nBufActualPos > nBufActualLen ) \
...@@ -159,7 +159,7 @@ inline static void SwapDouble( double& r ) ...@@ -159,7 +159,7 @@ inline static void SwapDouble( double& r )
} \ } \
else \ else \
{ \ { \
Write( (char*)&value, sizeof(datatype) ); \ Write( &value, sizeof(datatype) ); \
} \ } \
// class SvLockBytes // class SvLockBytes
...@@ -605,7 +605,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ...@@ -605,7 +605,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
while( !bEnd && !GetError() ) // Don't test for EOF as we while( !bEnd && !GetError() ) // Don't test for EOF as we
// are reading block-wise! // are reading block-wise!
{ {
sal_uInt16 nLen = (sal_uInt16)Read( (char*)buf, sizeof(buf)-sizeof(sal_Unicode) ); sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-sizeof(sal_Unicode) );
nLen /= sizeof(sal_Unicode); nLen /= sizeof(sal_Unicode);
if ( !nLen ) if ( !nLen )
{ {
...@@ -664,7 +664,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ...@@ -664,7 +664,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
if ( bEnd && (c=='\r' || c=='\n') ) // special treatment for DOS files if ( bEnd && (c=='\r' || c=='\n') ) // special treatment for DOS files
{ {
sal_Unicode cTemp; sal_Unicode cTemp;
Read( (char*)&cTemp, sizeof(cTemp) ); Read( &cTemp, sizeof(cTemp) );
if ( bSwap ) if ( bSwap )
SwapUShort( cTemp ); SwapUShort( cTemp );
if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
...@@ -733,7 +733,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, ...@@ -733,7 +733,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr,
DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "write_uInt16s_FromOUString: swapping sizeof(sal_Unicode) not implemented" ); DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "write_uInt16s_FromOUString: swapping sizeof(sal_Unicode) not implemented" );
sal_Size nWritten; sal_Size nWritten;
if (!rStrm.IsEndianSwap()) if (!rStrm.IsEndianSwap())
nWritten = rStrm.Write( (char*)rStr.getStr(), nUnits * sizeof(sal_Unicode) ); nWritten = rStrm.Write( rStr.getStr(), nUnits * sizeof(sal_Unicode) );
else else
{ {
sal_Size nLen = nUnits; sal_Size nLen = nUnits;
...@@ -747,7 +747,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, ...@@ -747,7 +747,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr,
SwapUShort( *p ); SwapUShort( *p );
p++; p++;
} }
nWritten = rStrm.Write( (char*)pTmp, nLen * sizeof(sal_Unicode) ); nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) );
if ( pTmp != aBuf ) if ( pTmp != aBuf )
delete [] pTmp; delete [] pTmp;
} }
...@@ -968,7 +968,7 @@ SvStream& SvStream::ReadSChar( signed char& r ) ...@@ -968,7 +968,7 @@ SvStream& SvStream::ReadSChar( signed char& r )
nBufFree -= sizeof(signed char); nBufFree -= sizeof(signed char);
} }
else else
Read( (char*)&r, sizeof(signed char) ); Read( &r, sizeof(signed char) );
return *this; return *this;
} }
...@@ -1000,7 +1000,7 @@ SvStream& SvStream::ReadUChar( unsigned char& r ) ...@@ -1000,7 +1000,7 @@ SvStream& SvStream::ReadUChar( unsigned char& r )
nBufFree -= sizeof(char); nBufFree -= sizeof(char);
} }
else else
Read( (char*)&r, sizeof(char) ); Read( &r, sizeof(char) );
return *this; return *this;
} }
...@@ -1135,7 +1135,7 @@ SvStream& SvStream::WriteSChar( signed char v ) ...@@ -1135,7 +1135,7 @@ SvStream& SvStream::WriteSChar( signed char v )
bIsDirty = true; bIsDirty = true;
} }
else else
Write( (char*)&v, sizeof(signed char) ); Write( &v, sizeof(signed char) );
return *this; return *this;
} }
...@@ -1173,7 +1173,7 @@ SvStream& SvStream::WriteUChar( unsigned char v ) ...@@ -1173,7 +1173,7 @@ SvStream& SvStream::WriteUChar( unsigned char v )
bIsDirty = true; bIsDirty = true;
} }
else else
Write( (char*)&v, sizeof(char) ); Write( &v, sizeof(char) );
return *this; return *this;
} }
...@@ -1550,7 +1550,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) ...@@ -1550,7 +1550,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
pTemp[n] = aCh; pTemp[n] = aCh;
} }
// ************************* // *************************
nCount += PutData( (char*)pTemp, nBufCount ); nCount += PutData( pTemp, nBufCount );
pDataPtr += nBufCount; pDataPtr += nBufCount;
} }
while ( nLen ); while ( nLen );
......
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