Hello all
Attached are the patch files relating to this issue. I've done make clean,
make check, and make dev-install without errors. Please excuse the bumbling
use of git, I'm on a steep learning curve :)
This code is released under LGPL3+/GPL3+/MPL license.
Kind regards
Keith
From fa4257356472f466673cd88cb2c4331386a30dda Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 14:51:03 +0000
Subject: [PATCH 1/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Removed declarations & definitions for operator<<(long),(int)&(short)
Removed declarations & definitions for operator>>(long),(int)&(short)
Added (where necessary) operator<< for sal_Int & sal_uInt types
Added (where necessary) operator>> for sal_Int & sal_uInt types
Added SwapInt64 function, basically a copy of SwapUInt64
---
tools/inc/tools/stream.hxx | 18 ++++++---
tools/source/stream/stream.cxx | 82 +++++++++++++++++++++++-----------------
2 files changed, 59 insertions(+), 41 deletions(-)
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index e96f3e1..0c7e13e 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -335,12 +335,15 @@ public:
{ eLineDelimiter = eLineEnd; }
LineEnd GetLineDelimiter() const { return eLineDelimiter; }
+ //fdo#39428 Remove SvStream operator>>(long&)
+ //operator>>(short) and operator>>(int) removed also
SvStream& operator>>( sal_uInt16& rUInt16 );
SvStream& operator>>( sal_uInt32& rUInt32 );
SvStream& operator>>( sal_uInt64& rUInt64 );
- SvStream& operator>>( long& rLong );
- SvStream& operator>>( short& rShort );
- SvStream& operator>>( int& rInt );
+ SvStream& operator>>( sal_Int16& rInt16 );
+ SvStream& operator>>( sal_Int32& rInt32 );
+ SvStream& operator>>( sal_Int64& rInt64 );
+
SvStream& operator>>( signed char& rChar );
SvStream& operator>>( char& rChar );
SvStream& operator>>( unsigned char& rChar );
@@ -348,12 +351,15 @@ public:
SvStream& operator>>( double& rDouble );
SvStream& operator>>( SvStream& rStream );
+ //fdo#39428 Remove SvStream operator<<(long)
+ //operator<<(short) and operator<<(int) removed also
SvStream& operator<<( sal_uInt16 nUInt16 );
SvStream& operator<<( sal_uInt32 nUInt32 );
SvStream& operator<<( sal_uInt64 nuInt64 );
- SvStream& operator<<( long nLong );
- SvStream& operator<<( short nShort );
- SvStream& operator<<( int nInt );
+ SvStream& operator<<( sal_Int16 nInt16 );
+ SvStream& operator<<( sal_Int32 nInt32 );
+ SvStream& operator<<( sal_Int64 nInt64 );
+
SvStream& operator<<( signed char nChar );
SvStream& operator<<( char nChar );
SvStream& operator<<( unsigned char nChar );
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 7a9bf0d..57c9172 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -91,6 +91,26 @@ inline static void SwapUInt64( sal_uInt64& r )
s.c[1] = SWAPLONG(s.c[1]);
r = s.n;
}
+
+//#fdo39428 Added for operator<<(sal_Int64)
+inline static void SwapInt64( sal_Int64& r )
+ {
+ union
+ {
+ sal_Int64 n;
+ sal_Int32 c[2];
+ } s;
+
+ s.n = r;
+ s.c[0] ^= s.c[1]; // swap the 32 bit words
+ s.c[1] ^= s.c[0];
+ s.c[0] ^= s.c[1];
+ // swap the bytes in the words
+ s.c[0] = SWAPLONG(s.c[0]);
+ s.c[1] = SWAPLONG(s.c[1]);
+ r = s.n;
+ }
+
#ifdef UNX
inline static void SwapFloat( float& r )
{
@@ -1041,6 +1061,8 @@ sal_Size SvStream::SeekRel( sal_sSize nPos )
|*
*************************************************************************/
+//fdo#39428 Remove SvStream operator>>(long&)
+//operator>>(short) and operator>>(int) removed also
SvStream& SvStream::operator>>(sal_uInt16& r)
{
sal_uInt16 n = 0;
@@ -1067,7 +1089,6 @@ SvStream& SvStream::operator>>(sal_uInt32& r)
return *this;
}
-
SvStream& SvStream::operator>>(sal_uInt64& r)
{
sal_uInt64 n = 0;
@@ -1081,47 +1102,41 @@ SvStream& SvStream::operator>>(sal_uInt64& r)
return *this;
}
-SvStream& SvStream::operator >>(long& r) //puke!, kill this
+
+SvStream& SvStream::operator>>(sal_Int16& r)
{
-#if(SAL_TYPES_SIZEOFLONG != 4)
- int n;
- *this >> n;
- if (good())
- r = n;
-#else
- long n = 0;
- READNUMBER_WITHOUT_SWAP(long, n)
+ sal_Int16 n = 0;
+ READNUMBER_WITHOUT_SWAP(sal_Int16, n)
if (good())
{
if (bSwap)
- SwapLong(n);
+ SwapShort(n);
r = n;
}
-#endif
return *this;
}
-SvStream& SvStream::operator>>(short& r)
+SvStream& SvStream::operator>>(sal_Int32& r)
{
- short n = 0;
- READNUMBER_WITHOUT_SWAP(short, n)
+ sal_Int32 n = 0;
+ READNUMBER_WITHOUT_SWAP(sal_Int32, n)
if (good())
{
- if(bSwap)
- SwapShort(n);
+ if (bSwap)
+ SwapLongInt(n);
r = n;
}
return *this;
}
-SvStream& SvStream::operator>>(int& r)
+SvStream& SvStream::operator>>(sal_Int64& r)
{
- int n = 0;
- READNUMBER_WITHOUT_SWAP(int, n)
+ sal_Int64 n = 0;
+ READNUMBER_WITHOUT_SWAP(sal_Int64, n)
if (good())
{
if (bSwap)
- SwapLongInt(n);
+ SwapInt64(n);
r = n;
}
return *this;
@@ -1225,6 +1240,8 @@ SvStream& SvStream::operator>> ( SvStream& rStream )
|*
*************************************************************************/
+//fdo#39428 Remove SvStream operator<<(long)
+//operator<<(short) and operator<<(int) removed also
SvStream& SvStream::operator<< ( sal_uInt16 v )
{
if( bSwap )
@@ -1249,32 +1266,27 @@ SvStream& SvStream::operator<< ( sal_uInt64 v )
return *this;
}
-SvStream& SvStream::operator<< ( long v )
+SvStream& SvStream::operator<< ( sal_Int16 v )
{
-#if(SAL_TYPES_SIZEOFLONG != 4)
- int tmp = v;
- *this << tmp;
-#else
if( bSwap )
- SwapLong(v);
- WRITENUMBER_WITHOUT_SWAP(long,v)
-#endif
+ SwapShort(v);
+ WRITENUMBER_WITHOUT_SWAP(sal_Int16,v)
return *this;
}
-SvStream& SvStream::operator<< ( short v )
+SvStream& SvStream::operator<< ( sal_Int32 v )
{
if( bSwap )
- SwapShort(v);
- WRITENUMBER_WITHOUT_SWAP(short,v)
+ SwapLongInt(v);
+ WRITENUMBER_WITHOUT_SWAP(sal_Int32,v)
return *this;
}
-SvStream& SvStream::operator<<( int v )
+SvStream& SvStream::operator<< ( sal_Int64 v )
{
if( bSwap )
- SwapLongInt( v );
- WRITENUMBER_WITHOUT_SWAP(int,v)
+ SwapInt64(v);
+ WRITENUMBER_WITHOUT_SWAP(sal_Int64,v)
return *this;
}
--
1.7.7
From b0a15d0383f9501fcf6fed372d5b92f7cc76eab4 Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 15:32:38 +0000
Subject: [PATCH 2/7] 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
---
tools/source/generic/fract.cxx | 13 +++++++++----
tools/source/generic/gen.cxx | 25 +++++++++++++++++++++----
tools/source/generic/poly.cxx | 12 ++++++++----
3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 2076761..7dc4b5b 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -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;
}
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index be16230..17316e2 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -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;
}
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 8c64a9f..3c86a7a 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -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
--
1.7.7
From 2ffd7f0432de9a252371063109d5911040554d7e Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 16:00:22 +0000
Subject: [PATCH 3/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Changed case SbxSALINT64: to use operator>>(sal_Int64)
---
basic/source/sbx/sbxvalue.cxx | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index e1aa67d..c6c95dc 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1500,12 +1500,12 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
}
break;
}
- case SbxSALUINT64:
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ //SvStream now has operator>>(sal_Int64&)
case SbxSALINT64:
- // Rather ugly use of the union here because we only
- // have a SvStream& SvStream::operator>>(sal_uInt64&) available to us
- // There is no SvStream::operator>>(sal_Int64&) due to conflict with
- // SvStream::operator>>(long&) ( at least on 64 bit linux )
+ r >> aData.nInt64;
+ break;
+ case SbxSALUINT64:
r >> aData.uInt64;
break;
case SbxCURRENCY:
--
1.7.7
From 3fbb039a65d753c940ef47cb437aef24c6db454d Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 16:06:48 +0000
Subject: [PATCH 4/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Replaced calls to operator<<(long) with sal::static_int_cast<sal_Int32>
Replaced calls to operator>>(long) with operator>>(sal_Int32)
---
editeng/source/items/bulitem.cxx | 7 +++++--
editeng/source/items/frmitems.cxx | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index b47a8e1..cbfc208 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -98,7 +98,8 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
if( nVer == 1 )
{
- long nHeight, nWidth;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nHeight(0), nWidth(0);
rStream >> nHeight; rStream >> nWidth; Size aSize( nWidth, nHeight );
aFont.SetSize( aSize );
}
@@ -153,7 +154,9 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
pGraphicObject = new GraphicObject( aBmp );
}
- rStrm >> nWidth;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nTmp(0);
+ rStrm >> nTmp; nWidth = nTmp;
rStrm >> nStart;
rStrm >> nJustify;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 7627b00..50484b8 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -353,8 +353,9 @@ SfxItemPresentation SvxSizeItem::GetPresentation
SvStream& SvxSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
{
- rStrm << aSize.Width();
- rStrm << aSize.Height();
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rStrm << sal::static_int_cast<sal_Int32>(aSize.Width());
+ rStrm << sal::static_int_cast<sal_Int32>(aSize.Height());
return rStrm;
}
@@ -378,7 +379,8 @@ bool SvxSizeItem::HasMetrics() const
SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const
{
- long nWidth, nHeight;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nWidth(0), nHeight(0);
rStrm >> nWidth >> nHeight;
SvxSizeItem* pAttr = new SvxSizeItem( Which() );
--
1.7.7
From d51ac0063c735f556983d06921914d550b5e9a4a Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 16:11:29 +0000
Subject: [PATCH 5/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Replaced calls to operator<<(long) with sal::static_int_cast<sal_Int32>
Replaced calls to operator>>(long) with operator>>(sal_Int32)
---
svl/source/items/cintitem.cxx | 8 ++++----
svl/source/items/slstitm.cxx | 6 ++++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx
index 065c0b0..2ae7c47 100644
--- a/svl/source/items/cintitem.cxx
+++ b/svl/source/items/cintitem.cxx
@@ -301,9 +301,8 @@ CntInt32Item::CntInt32Item(sal_uInt16 which, SvStream & rStream) :
SfxPoolItem(which)
{
DBG_CTOR(CntInt32Item, 0);
- long nTheValue = 0;
- rStream >> nTheValue;
- m_nValue = nTheValue;
+ //fdo#39428 SvStream no longer supports operator>>(long&)
+ rStream >> m_nValue;
}
//============================================================================
@@ -380,7 +379,8 @@ SfxPoolItem * CntInt32Item::Create(SvStream & rStream, sal_uInt16) const
SvStream & CntInt32Item::Store(SvStream &rStream, sal_uInt16) const
{
DBG_CHKTHIS(CntInt32Item, 0);
- rStream << long(m_nValue);
+ //fdo#39428 SvStream no longer supports operator<<(long)
+ rStream << m_nValue;
return rStream;
}
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index d3ea9dc..d3e41c8 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -89,7 +89,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
SfxPoolItem( which ),
pImp(NULL)
{
- long nEntryCount;
+ //fdo#39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nEntryCount;
rStream >> nEntryCount;
if( nEntryCount )
@@ -202,7 +203,8 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const
{
if( !pImp )
{
- rStream << 0L;
+ //fdo#39428 SvStream no longer supports operator<<(long)
+ rStream << (sal_Int32) 0;
return rStream;
}
--
1.7.7
From 74e20cf39b521255a20897b1f216b5df29f16363 Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 16:18:30 +0000
Subject: [PATCH 6/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Replaced calls to operator<<(long) with sal::static_int_cast<sal_Int32>
Replaced calls to operator>>(long) with operator>>(sal_Int32)
---
svtools/source/filter/wmf/enhwmf.cxx | 6 +++++-
svtools/source/filter/wmf/winwmf.cxx | 8 ++++++--
svtools/source/graphic/grfattr.cxx | 14 ++++++++++++--
svtools/source/misc/transfer.cxx | 24 ++++++++++++++++--------
4 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx
index db6a271..9664b09 100644
--- a/svtools/source/filter/wmf/enhwmf.cxx
+++ b/svtools/source/filter/wmf/enhwmf.cxx
@@ -698,8 +698,12 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
LineInfo aLineInfo;
sal_uInt32 nStyle;
Size aSize;
+ //#fdo39428 Remove SvStream operator>>(long&)
+ sal_Int32 nTmpW(0), nTmpH(0);
- *pWMF >> nStyle >> aSize.Width() >> aSize.Height();
+ *pWMF >> nStyle >> nTmpW >> nTmpH;
+ aSize.Width() = nTmpW;
+ aSize.Height() = nTmpH;
if ( aSize.Width() )
aLineInfo.SetWidth( aSize.Width() );
diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx
index 3b53cba..c6e76d7 100644
--- a/svtools/source/filter/wmf/winwmf.cxx
+++ b/svtools/source/filter/wmf/winwmf.cxx
@@ -908,9 +908,13 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
SvMemoryStream aMemoryStream( nEscLen );
aMemoryStream.Write( pData, nEscLen );
aMemoryStream.Seek( STREAM_SEEK_TO_BEGIN );
- aMemoryStream >> aPt.X()
- >> aPt.Y()
+ //#fdo39428 SvStream no longer supports
operator>>(long&)
+ sal_Int32 nTmpX(0), nTmpY(0);
+ aMemoryStream >> nTmpX
+ >> nTmpY
>> nStringLen;
+ aPt.X() = nTmpX;
+ aPt.Y() = nTmpY;
if ( ( static_cast< sal_uInt64 >( nStringLen ) *
sizeof( sal_Unicode ) ) < ( nEscLen - aMemoryStream.Tell() ) )
{
diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx
index 67495cf..c079f48 100644
--- a/svtools/source/graphic/grfattr.cxx
+++ b/svtools/source/graphic/grfattr.cxx
@@ -95,7 +95,13 @@ SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr )
if( aCompat.GetVersion() >= 2 )
{
- rIStm >> rAttr.mnLeftCrop >> rAttr.mnTopCrop >> rAttr.mnRightCrop >> rAttr.mnBottomCrop;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
+ rIStm >> nTmpL >> nTmpT >> nTmpR >> nTmpB;
+ rAttr.mnLeftCrop = nTmpL;
+ rAttr.mnTopCrop = nTmpT;
+ rAttr.mnRightCrop = nTmpR;
+ rAttr.mnBottomCrop = nTmpB;
}
return rIStm;
@@ -111,7 +117,11 @@ SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr )
rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10;
rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent <<
rAttr.mnBPercent;
rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
- rOStm << rAttr.mnLeftCrop << rAttr.mnTopCrop << rAttr.mnRightCrop << rAttr.mnBottomCrop;
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop)
+ << sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop)
+ << sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop)
+ << sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop);
return rOStm;
}
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 5fa1e5b..87b3164 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -88,16 +88,23 @@ using namespace ::com::sun::star::datatransfer::dnd;
SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc )
{
sal_uInt32 nSize, nViewAspect, nSig1, nSig2;
+ //#fdo39428 Remove SvStream operator>>(long&)
+ sal_Int32 nTmp(0);
rIStm >> nSize;
rIStm >> rObjDesc.maClassName;
rIStm >> nViewAspect;
- rIStm >> rObjDesc.maSize.Width();
- rIStm >> rObjDesc.maSize.Height();
- rIStm >> rObjDesc.maDragStartPos.X();
- rIStm >> rObjDesc.maDragStartPos.Y();
+ rIStm >> nTmp;
+ rObjDesc.maSize.Width() = nTmp;
+ rIStm >> nTmp;
+ rObjDesc.maSize.Height() = nTmp;
+ rIStm >> nTmp;
+ rObjDesc.maDragStartPos.X() = nTmp;
+ rIStm >> nTmp;
+ rObjDesc.maDragStartPos.Y() = nTmp;
rObjDesc.maTypeName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
rObjDesc.maDisplayName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
+
rIStm >> nSig1 >> nSig2;
rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( nViewAspect );
@@ -122,10 +129,11 @@ SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor&
rObjD
rOStm.SeekRel( 4 );
rOStm << rObjDesc.maClassName;
rOStm << nViewAspect;
- rOStm << rObjDesc.maSize.Width();
- rOStm << rObjDesc.maSize.Height();
- rOStm << rObjDesc.maDragStartPos.X();
- rOStm << rObjDesc.maDragStartPos.Y();
+ //#fdo39428 Remove SvStream operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Width());
+ rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Height());
+ rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.X());
+ rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.Y());
rOStm.WriteUniOrByteString( rObjDesc.maTypeName, osl_getThreadTextEncoding() );
rOStm.WriteUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() );
rOStm << nSig1 << nSig2;
--
1.7.7
From db4942e8731c3b60972639201cfc916e5cdd642e Mon Sep 17 00:00:00 2001
From: Keith McRae <keithcoder@gmail.com>
Date: Wed, 18 Jan 2012 16:21:17 +0000
Subject: [PATCH 7/7] fdo#39428 Remove/audit SvStream operator>>/<<(long)
Replaced calls to operator>>(long) with operator>>(sal_Int32)
Replaced calls to operator<<(long) with sal::static_int_cast<sal_Int32>
---
vcl/source/gdi/cvtsvm.cxx | 13 ++++++++---
vcl/source/gdi/hatch.cxx | 8 +++++-
vcl/source/gdi/impgraph.cxx | 44 +++++++++++++++++++++++-------------------
vcl/source/gdi/lineinfo.cxx | 25 +++++++++++++++--------
vcl/source/gdi/metaact.cxx | 16 +++++++++++---
vcl/source/gdi/region.cxx | 20 +++++++++++-------
6 files changed, 79 insertions(+), 47 deletions(-)
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 2026ceb..c8ad028 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -514,8 +514,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm.Read( (char*) &aCode, sizeof( aCode ) ); // Kennung
rIStm >> nSize; // Size
rIStm >> nVersion; // Version
- rIStm >> aPrefSz.Width(); // PrefSize.Width()
- rIStm >> aPrefSz.Height(); // PrefSize.Height()
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nTmp32(0);
+ rIStm >> nTmp32;
+ aPrefSz.Width() = nTmp32; // PrefSize.Width()
+ rIStm >> nTmp32;
+ aPrefSz.Height() = nTmp32; // PrefSize.Height()
// check header-magic and version
if( rIStm.GetError()
@@ -1290,7 +1294,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_TEXTLINE_COMMENT ):
{
Point aStartPt;
- long nWidth;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nWidth;
sal_uInt32 nStrikeout;
sal_uInt32 nUnderline;
sal_Int32 nFollowingActionCount;
@@ -2367,7 +2372,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
const MetaTextLineAction* pA = (MetaTextLineAction*) pAction;
const Point& rStartPt = pA->GetStartPoint();
- const long nWidth = pA->GetWidth();
+ const sal_Int32 nWidth = (sal_Int32) pA->GetWidth();
const FontStrikeout eStrikeout = pA->GetStrikeout();
const FontUnderline eUnderline = pA->GetUnderline();
sal_uLong nOldPos, nNewPos;
diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx
index 98d8ce3..a865ac2 100644
--- a/vcl/source/gdi/hatch.cxx
+++ b/vcl/source/gdi/hatch.cxx
@@ -184,9 +184,12 @@ SvStream& operator>>( SvStream& rIStm, ImplHatch& rImplHatch )
{
VersionCompat aCompat( rIStm, STREAM_READ );
sal_uInt16 nTmp16;
+ sal_Int32 nTmp32(0);
rIStm >> nTmp16; rImplHatch.meStyle = (HatchStyle) nTmp16;
- rIStm >> rImplHatch.maColor >> rImplHatch.mnDistance >> rImplHatch.mnAngle;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ rIStm >> rImplHatch.maColor >> nTmp32 >> rImplHatch.mnAngle;
+ rImplHatch.mnDistance = nTmp32;
return rIStm;
}
@@ -198,7 +201,8 @@ SvStream& operator<<( SvStream& rOStm, const ImplHatch& rImplHatch )
VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
rOStm << (sal_uInt16) rImplHatch.meStyle << rImplHatch.maColor;
- rOStm << rImplHatch.mnDistance << rImplHatch.mnAngle;
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(rImplHatch.mnDistance << rImplHatch.mnAngle);
return rOStm;
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index e709034..29a7e51 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -941,8 +941,9 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap )
const sal_uLong nStartPos = rIStm.Tell();
sal_uInt32 nId;
sal_uLong nHeaderLen;
- long nType;
- long nLen;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nType;
+ sal_Int32 nLen;
const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt();
sal_Bool bRet = sal_False;
@@ -976,9 +977,10 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap )
else
{
// read old style header
- long nWidth, nHeight;
- long nMapMode, nScaleNumX, nScaleDenomX;
- long nScaleNumY, nScaleDenomY, nOffsX, nOffsY;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nWidth, nHeight;
+ sal_Int32 nMapMode, nScaleNumX, nScaleDenomX;
+ sal_Int32 nScaleNumY, nScaleDenomY, nOffsX, nOffsY;
rIStm.SeekRel( -4L );
@@ -1185,11 +1187,12 @@ sal_Bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
// write new style header
VersionCompat* pCompat = new VersionCompat( rOStm, STREAM_WRITE, 1 );
- rOStm << (long) meType;
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(meType);
// data size is updated later
nDataFieldPos = rOStm.Tell();
- rOStm << (long) 0;
+ rOStm << (sal_Int32) 0;
rOStm << aSize;
rOStm << aMapMode;
@@ -1199,21 +1202,21 @@ sal_Bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
else
{
// write old style (<=4.0) header
- rOStm << (long) meType;
+ rOStm << (sal_Int32) meType;
// data size is updated later
nDataFieldPos = rOStm.Tell();
- rOStm << (long) 0;
-
- rOStm << (long) aSize.Width();
- rOStm << (long) aSize.Height();
- rOStm << (long) aMapMode.GetMapUnit();
- rOStm << (long) aMapMode.GetScaleX().GetNumerator();
- rOStm << (long) aMapMode.GetScaleX().GetDenominator();
- rOStm << (long) aMapMode.GetScaleY().GetNumerator();
- rOStm << (long) aMapMode.GetScaleY().GetDenominator();
- rOStm << (long) aMapMode.GetOrigin().X();
- rOStm << (long) aMapMode.GetOrigin().Y();
+ rOStm << (sal_Int32) 0;
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(aSize.Width());
+ rOStm << sal::static_int_cast<sal_Int32>(aSize.Height());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetMapUnit());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetScaleX().GetNumerator());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetScaleX().GetDenominator());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetScaleY().GetNumerator());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetScaleY().GetDenominator());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetOrigin().X());
+ rOStm << sal::static_int_cast<sal_Int32>(aMapMode.GetOrigin().Y());
}
// write data block
@@ -1228,7 +1231,8 @@ sal_Bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
{
const sal_uLong nStmPos2 = rOStm.Tell();
rOStm.Seek( nDataFieldPos );
- rOStm << (long) ( nStmPos2 - nDataStart );
+ //fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(( nStmPos2 - nDataStart ));
rOStm.Seek( nStmPos2 );
bRet = sal_True;
}
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 234f37a..3600d16 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -235,17 +235,23 @@ void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin)
SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
{
VersionCompat aCompat( rIStm, STREAM_READ );
- sal_uInt16 nTmp16;
+ sal_uInt16 nTmp16(0);
+ sal_Int32 nTmp32(0);
+ //#fdo39428 SvStream no longer supports operator>>(long&)
rIStm >> nTmp16; rImplLineInfo.meStyle = (LineStyle) nTmp16;
- rIStm >> rImplLineInfo.mnWidth;
+ rIStm >> nTmp32;
+ rImplLineInfo.mnWidth = nTmp32;
if( aCompat.GetVersion() >= 2 )
{
// version 2
- rIStm >> rImplLineInfo.mnDashCount >> rImplLineInfo.mnDashLen;
- rIStm >> rImplLineInfo.mnDotCount >> rImplLineInfo.mnDotLen;
- rIStm >> rImplLineInfo.mnDistance;
+ rIStm >> rImplLineInfo.mnDashCount >> nTmp32;
+ rImplLineInfo.mnDashLen = nTmp32;
+ rIStm >> rImplLineInfo.mnDotCount >> nTmp32;
+ rImplLineInfo.mnDotLen = nTmp32;
+ rIStm >> nTmp32;
+ rImplLineInfo.mnDistance = nTmp32;
}
if( aCompat.GetVersion() >= 3 )
@@ -263,13 +269,14 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
{
VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
+ //#fdo39428 SvStream no longer supports operator<<(long)
// version 1
- rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
+ rOStm << (sal_uInt16) rImplLineInfo.meStyle <<
sal::static_int_cast<sal_Int32>(rImplLineInfo.mnWidth);
// since version2
- rOStm << rImplLineInfo.mnDashCount << rImplLineInfo.mnDashLen;
- rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
- rOStm << rImplLineInfo.mnDistance;
+ rOStm << rImplLineInfo.mnDashCount << sal::static_int_cast<sal_Int32>(rImplLineInfo.mnDashLen);
+ rOStm << rImplLineInfo.mnDotCount << sal::static_int_cast<sal_Int32>(rImplLineInfo.mnDotLen);
+ rOStm << sal::static_int_cast<sal_Int32>(rImplLineInfo.mnDistance);
// since version3
rOStm << (sal_uInt16) rImplLineInfo.meLineJoin;
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 6589f50..98380e4 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1748,8 +1748,9 @@ void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 2, pData );
+ //#fdo39428 SvStream no longer supports operator<<(long)
rOStm << maPos;
- rOStm << mnWidth;
+ rOStm << sal::static_int_cast<sal_Int32>(mnWidth);
rOStm << static_cast<sal_uInt32>(meStrikeout);
rOStm << static_cast<sal_uInt32>(meUnderline);
// new in version 2
@@ -1762,9 +1763,11 @@ void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
COMPAT( rIStm );
+ //#fdo39428 SvStream no longer supports operator>>(long&)
sal_uInt32 nTemp;
rIStm >> maPos;
- rIStm >> mnWidth;
+ rIStm >> nTemp;
+ mnWidth = nTemp;
rIStm >> nTemp;
meStrikeout = (FontStrikeout)nTemp;
rIStm >> nTemp;
@@ -3016,7 +3019,8 @@ sal_Bool MetaMoveClipRegionAction::Compare( const MetaAction& rMetaAction )
cons
void MetaMoveClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 1, pData );
- rOStm << mnHorzMove << mnVertMove;
+ //#fdo39428 SvStream no longer supports operator<<(long)
+ rOStm << sal::static_int_cast<sal_Int32>(mnHorzMove) <<
sal::static_int_cast<sal_Int32>(mnVertMove);
}
// ------------------------------------------------------------------------
@@ -3024,7 +3028,11 @@ void MetaMoveClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData*
pData
void MetaMoveClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
COMPAT( rIStm );
- rIStm >> mnHorzMove >> mnVertMove;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nTmpHM(0), nTmpVM(0);
+ rIStm >> nTmpHM >> nTmpVM;
+ mnHorzMove = nTmpHM;
+ mnVertMove = nTmpVM;
}
// ========================================================================
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 71a4866..fa8ee5c 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -2587,8 +2587,9 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion )
// insert new band or new separation?
if ( (StreamEntryType)nTmp16 == STREAMENTRY_BANDHEADER )
{
- long nYTop;
- long nYBottom;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nYTop;
+ sal_Int32 nYBottom;
rIStrm >> nYTop;
rIStrm >> nYBottom;
@@ -2607,8 +2608,9 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion )
}
else
{
- long nXLeft;
- long nXRight;
+ //#fdo39428 SvStream no longer supports operator>>(long&)
+ sal_Int32 nXLeft;
+ sal_Int32 nXRight;
rIStrm >> nXLeft;
rIStrm >> nXRight;
@@ -2679,18 +2681,20 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion )
while ( pBand )
{
// put boundaries
+ //#fdo39428 SvStream no longer supports operator<<(long)
rOStrm << (sal_uInt16) STREAMENTRY_BANDHEADER;
- rOStrm << pBand->mnYTop;
- rOStrm << pBand->mnYBottom;
+ rOStrm << sal::static_int_cast<sal_Int32>(pBand->mnYTop);
+ rOStrm << sal::static_int_cast<sal_Int32>(pBand->mnYBottom);
// put separations of current band
ImplRegionBandSep* pSep = pBand->mpFirstSep;
while ( pSep )
{
// put separation
+ //#fdo39428 SvStream no longer supports operator<<(long)
rOStrm << (sal_uInt16) STREAMENTRY_SEPARATION;
- rOStrm << pSep->mnXLeft;
- rOStrm << pSep->mnXRight;
+ rOStrm << sal::static_int_cast<sal_Int32>(pSep->mnXLeft);
+ rOStrm << sal::static_int_cast<sal_Int32>(pSep->mnXRight);
// next separation from current band
pSep = pSep->mpNextSep;
--
1.7.7
Context
- [Libreoffice] [LibreOffice] #fdo39428 Remove/audit SvStream operator>>/<<(long) · Keith McRae
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.