fdo#39428 Remove/audit SvStream operator>>/<<(long)

Replaced calls to operator<<(long) with sal::static_int_cast<sal_Int32>
Replaced calls to operator>>(long) to use sal_Int32
This commit is contained in:
Keith McRae 2012-01-18 15:32:38 +00:00 committed by Kohei Yoshida
parent 7b2a0e5415
commit 2adad6a4b3
3 changed files with 38 additions and 12 deletions

View file

@ -612,8 +612,12 @@ bool operator > ( const Fraction& rVal1, const Fraction& rVal2 )
*************************************************************************/
SvStream& operator >> ( SvStream& rIStream, Fraction& rFract )
{
rIStream >> rFract.nNumerator;
rIStream >> rFract.nDenominator;
//fdo#39428 SvStream no longer supports operator>>(long&)
sal_Int32 nTmp(0);
rIStream >> nTmp;
rFract.nNumerator = nTmp;
rIStream >> nTmp;
rFract.nDenominator = nTmp;
return rIStream;
}
@ -624,8 +628,9 @@ SvStream& operator >> ( SvStream& rIStream, Fraction& rFract )
*************************************************************************/
SvStream& operator << ( SvStream& rOStream, const Fraction& rFract )
{
rOStream << rFract.nNumerator;
rOStream << rFract.nDenominator;
//fdo#39428 SvStream no longer supports operator<<(long)
rOStream << sal::static_int_cast<sal_Int32>(rFract.nNumerator);
rOStream << sal::static_int_cast<sal_Int32>(rFract.nDenominator);
return rOStream;
}

View file

@ -36,7 +36,11 @@ SvStream& operator>>( SvStream& rIStream, Pair& rPair )
{
DBG_ASSERTWARNING( rIStream.GetVersion(), "Pair::>> - Solar-Version not set on rIStream" );
rIStream >> rPair.nA >> rPair.nB;
//39428 SvStream no longer supports operator>>(long&)
sal_Int32 nTmpA(0), nTmpB(0);
rIStream >> nTmpA >> nTmpB;
rPair.nA = nTmpA;
rPair.nB = nTmpB;
return rIStream;
}
@ -47,7 +51,8 @@ SvStream& operator<<( SvStream& rOStream, const Pair& rPair )
{
DBG_ASSERTWARNING( rOStream.GetVersion(), "Pair::<< - Solar-Version not set on rOStream" );
rOStream << rPair.nA << rPair.nB;
//39428 SvStream no longer supports operator<<(long)
rOStream << sal::static_int_cast<sal_Int32>(rPair.nA) << sal::static_int_cast<sal_Int32>(rPair.nB);
return rOStream;
}
@ -227,7 +232,15 @@ SvStream& operator>>( SvStream& rIStream, Rectangle& rRect )
{
DBG_ASSERTWARNING( rIStream.GetVersion(), "Rectangle::>> - Solar-Version not set on rIStream" );
rIStream >> rRect.nLeft >> rRect.nTop >> rRect.nRight >> rRect.nBottom;
//fdo#39428 SvStream no longer supports operator>>(long&)
sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
rIStream >> nTmpL >> nTmpT >> nTmpR >> nTmpB;
rRect.nLeft = nTmpL;
rRect.nTop = nTmpT;
rRect.nRight = nTmpR;
rRect.nBottom = nTmpB;
return rIStream;
}
@ -238,7 +251,11 @@ SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect )
{
DBG_ASSERTWARNING( rOStream.GetVersion(), "Rectangle::<< - Solar-Version not set on rOStream" );
rOStream << rRect.nLeft << rRect.nTop << rRect.nRight << rRect.nBottom;
//fdo#39428 SvStream no longer supports operator<<(long)
rOStream << sal::static_int_cast<sal_Int32>(rRect.nLeft)
<< sal::static_int_cast<sal_Int32>(rRect.nTop)
<< sal::static_int_cast<sal_Int32>(rRect.nRight)
<< sal::static_int_cast<sal_Int32>(rRect.nBottom);
return rOStream;
}

View file

@ -1701,8 +1701,11 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
{
for( i = 0; i < nPoints; i++ )
{
rIStream >> rPoly.mpImplPolygon->mpPointAry[i].X()
>> rPoly.mpImplPolygon->mpPointAry[i].Y();
//fdo#39428 SvStream no longer supports operator>>(long&)
sal_Int32 nTmpX(0), nTmpY(0);
rIStream >> nTmpX >> nTmpY;
rPoly.mpImplPolygon->mpPointAry[i].X() = nTmpX;
rPoly.mpImplPolygon->mpPointAry[i].Y() = nTmpY;
}
}
else
@ -1739,8 +1742,9 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
{
for( i = 0; i < nPoints; i++ )
{
rOStream << rPoly.mpImplPolygon->mpPointAry[i].X()
<< rPoly.mpImplPolygon->mpPointAry[i].Y();
//fdo#39428 SvStream no longer supports operator<<(long)
rOStream << sal::static_int_cast<sal_Int32>( rPoly.mpImplPolygon->mpPointAry[i].X() )
<< sal::static_int_cast<sal_Int32>( rPoly.mpImplPolygon->mpPointAry[i].Y() );
}
}
else