summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-06-30 21:18:45 +0200
committerMichael Stahl <mstahl@redhat.com>2013-07-02 16:30:01 +0200
commit3835dee3c777bf10693903cb0866d22fab3794ea (patch)
tree0c990ad869ad007dd6ad3ea93a7ac6e9c91f68c8
parentee5ed806e2cf5780f90d52a2fc83055f497139b7 (diff)
SvStream: remove the error prone operator<</>>(sal_Int64)
As the recent regression after merging AOO patch adding code serializing "long" variables has shown, this overload (which was added in 7b2a0e541567be9750dfc7d98374555967da3470) is a bad idea. In a unxlngx build, nm finds uses of the symbols _ZN8SvStreamrsERl and _ZN8SvStreamlsEl in these files: - sbxvalue.cxx: this appears to be a legitimate use with sal_Int64 - dateitem.cxx: this was accidentally changed by commit 9830fd36dbdb72c79703b0c61efc027fba793c5a - atrfrm.cxx: this was added for Table Autoformat enhancement in 7e8c0bd73ee59ff3041e55268c77203373962e51, which is after the sal_Int64 operators were added, so the file format is now platform dependent Change-Id: I78352b5429b53612c4831cdb81b587b5de5180a9
-rw-r--r--basic/source/sbx/sbxvalue.cxx3
-rw-r--r--include/tools/stream.hxx6
-rw-r--r--svl/source/items/dateitem.cxx2
-rw-r--r--sw/source/core/layout/atrfrm.cxx24
-rw-r--r--tools/source/stream/stream.cxx4
5 files changed, 27 insertions, 12 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index f0ea5d13d0f3..3efbdabbb375 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1449,9 +1449,8 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
break;
}
//#fdo39428 SvStream no longer supports operator>>(long&)
- //SvStream now has operator>>(sal_Int64&)
case SbxSALINT64:
- r >> aData.nInt64;
+ r.ReadInt64(aData.nInt64);
break;
case SbxSALUINT64:
r >> aData.uInt64;
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 3d9f36323920..8aed53c1fd15 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -304,7 +304,8 @@ public:
SvStream& operator>>( sal_uInt64& rUInt64 );
SvStream& operator>>( sal_Int16& rInt16 );
SvStream& operator>>( sal_Int32& rInt32 );
- SvStream& operator>>( sal_Int64& rInt64 );
+ SvStream& operator>>( sal_Int64& rInt64 ) SAL_DELETED_FUNCTION;
+ SvStream& ReadInt64(sal_Int64 & rInt64);
SvStream& operator>>( signed char& rChar );
SvStream& operator>>( char& rChar );
@@ -318,7 +319,8 @@ public:
SvStream& operator<<( sal_uInt64 nuInt64 );
SvStream& operator<<( sal_Int16 nInt16 );
SvStream& operator<<( sal_Int32 nInt32 );
- SvStream& operator<<( sal_Int64 nInt64 );
+ SvStream& operator<<( sal_Int64 nInt64 ) SAL_DELETED_FUNCTION;
+ SvStream& WriteInt64(sal_Int64 nInt64);
SvStream& operator<<( bool b )
{ return operator<<(static_cast< sal_Bool >(b)); }
diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx
index 54e942e3757f..67ebba630cc9 100644
--- a/svl/source/items/dateitem.cxx
+++ b/svl/source/items/dateitem.cxx
@@ -102,7 +102,7 @@ SvStream& SfxDateTimeItem::Store( SvStream& rStream, sal_uInt16 ) const
{
DBG_CHKTHIS(SfxDateTimeItem, 0);
rStream << aDateTime.GetDate();
- rStream << aDateTime.GetTime();
+ rStream << static_cast<sal_Int32>(aDateTime.GetTime());
return rStream;
}
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 63ae22ee6d02..7677accdfa81 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1170,16 +1170,30 @@ bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SvStream& SwFmtVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) const
{
- rStream << nYPos << eOrient << eRelation;
+#if SAL_TYPES_SIZEOFLONG == 8
+ rStream.WriteInt64(nYPos);
+#else
+ rStream << static_cast<sal_Int32>(nYPos);
+#endif
+ rStream << eOrient << eRelation;
return rStream;
}
SfxPoolItem* SwFmtVertOrient::Create(SvStream &rStream, sal_uInt16 /*itemVersion*/) const
{
- SwTwips yPos;
- sal_Int16 orient;
- sal_Int16 relation;
- rStream >> yPos >> orient >> relation;
+ SwTwips yPos(0);
+ sal_Int16 orient(0);
+ sal_Int16 relation(0);
+ // compatibility hack for Table Auto Format: SwTwips is "long" :(
+ // (this means that the file format is platform dependent)
+#if SAL_TYPES_SIZEOFLONG == 8
+ rStream.ReadInt64(yPos);
+#else
+ sal_Int32 n;
+ rStream >> n;
+ yPos = n;
+#endif
+ rStream >> orient >> relation;
return new SwFmtVertOrient(yPos, orient, relation);
}
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index ede47ed28dd7..a3053a9fc907 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -954,7 +954,7 @@ SvStream& SvStream::operator>>(sal_Int32& r)
return *this;
}
-SvStream& SvStream::operator>>(sal_Int64& r)
+SvStream& SvStream::ReadInt64(sal_Int64& r)
{
sal_Int64 n = 0;
READNUMBER_WITHOUT_SWAP(sal_Int64, n)
@@ -1099,7 +1099,7 @@ SvStream& SvStream::operator<< ( sal_Int32 v )
return *this;
}
-SvStream& SvStream::operator<< ( sal_Int64 v )
+SvStream& SvStream::WriteInt64 (sal_Int64 v)
{
if( bSwap )
SwapInt64(v);