[Libreoffice-commits] .: 7 commits - basic/source editeng/source svl/source svtools/source tools/inc tools/source vcl/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 18 19:55:58 PST 2012


 basic/source/sbx/sbxvalue.cxx        |   10 ++--
 editeng/source/items/bulitem.cxx     |    7 ++-
 editeng/source/items/frmitems.cxx    |    8 ++-
 svl/source/items/cintitem.cxx        |    8 +--
 svl/source/items/slstitm.cxx         |    6 +-
 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 +++++++---
 tools/inc/tools/stream.hxx           |   14 +++---
 tools/source/generic/fract.cxx       |   13 ++++-
 tools/source/generic/gen.cxx         |   25 +++++++++--
 tools/source/generic/poly.cxx        |   12 +++--
 tools/source/stream/stream.cxx       |   77 +++++++++++++++++++----------------
 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           |   17 +++++--
 vcl/source/gdi/region.cxx            |   20 +++++----
 20 files changed, 230 insertions(+), 129 deletions(-)

New commits:
commit db7fb9cdf22d2e36e19baa3e78bca159b3f62735
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 16:21:17 2012 +0000

    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>

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..7b8b682 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..6aaedd6 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..5a86218 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,12 @@ void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
 {
     COMPAT( rIStm );
 
+    //#fdo39428 SvStream no longer supports operator>>(long&)
     sal_uInt32 nTemp;
+    sal_Int32 nTemp2;
     rIStm >> maPos;
-    rIStm >> mnWidth;
+    rIStm >> nTemp2;
+    mnWidth = nTemp2;
     rIStm >> nTemp;
     meStrikeout = (FontStrikeout)nTemp;
     rIStm >> nTemp;
@@ -3016,7 +3020,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 +3029,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;
commit 33e318faeac6f2895952ec69a6e338e07fe5ff39
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 16:18:30 2012 +0000

    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)

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;
commit c6f2e3e46db30e0d7e4f53270ceda6d4b9c8f955
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 16:11:29 2012 +0000

    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)

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;
     }
 
commit 987eae381d5c276ce239482d1cb79ecf53c015d8
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 16:06:48 2012 +0000

    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)

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() );
commit 553b72ac78a4d1f8c7531748a903c4a52355f2cd
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 16:00:22 2012 +0000

    fdo#39428 Remove/audit SvStream operator>>/<<(long)
    
    Changed case SbxSALINT64: to use operator>>(sal_Int64)

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:
commit 2adad6a4b3e52b9d8365c4cb71525526b38035a9
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 15:32:38 2012 +0000

    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

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
commit 7b2a0e541567be9750dfc7d98374555967da3470
Author: Keith McRae <keithcoder at gmail.com>
Date:   Wed Jan 18 14:51:03 2012 +0000

    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

diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index e96f3e1..37b7c3f 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -338,9 +338,10 @@ public:
     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 );
@@ -351,9 +352,10 @@ public:
     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..6064a77 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -91,6 +91,25 @@ inline static void SwapUInt64( sal_uInt64& r )
         s.c[1] = SWAPLONG(s.c[1]);
         r = s.n;
     }
+
+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 )
     {
@@ -1067,7 +1086,6 @@ SvStream& SvStream::operator>>(sal_uInt32& r)
     return *this;
 }
 
-
 SvStream& SvStream::operator>>(sal_uInt64& r)
 {
     sal_uInt64 n = 0;
@@ -1081,47 +1099,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;
@@ -1249,32 +1261,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;
 }
 


More information about the Libreoffice-commits mailing list