diff options
author | Noel Grandin <noel@peralex.com> | 2014-01-08 08:48:26 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-01-10 13:26:24 +0000 |
commit | b69864f3f8c9be2e1f28f4b422074d2040b084a0 (patch) | |
tree | 93d51bc91257472198beffccb92188ceee61667d /svl | |
parent | de84529b55f5b295b089043a7119d6b0d8b92408 (diff) |
re-write SvStream operator<< to non-overloaded methods
This is the actual re-write.
Use a clang rewriter to rewrite SvStream::operator<< to methods
like WriteuInt32.
Note that the rewriter is not perfect, and I hand-tweaked the output.
In particular, I had to adjust places doing things like
(*this) << 1;
Change-Id: I5923eda3f4ebaa8b452b6ef109e726e116235a2a
Reviewed-on: https://gerrit.libreoffice.org/7342
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/filerec/filerec.cxx | 36 | ||||
-rw-r--r-- | svl/source/items/cenumitm.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/cintitem.cxx | 8 | ||||
-rw-r--r-- | svl/source/items/flagitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/intitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/itemset.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/lckbitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/macitem.cxx | 8 | ||||
-rw-r--r-- | svl/source/items/rngitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/slstitm.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/visitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/numhead.cxx | 10 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 32 |
13 files changed, 62 insertions, 58 deletions
diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index 697c5229e910..a38a3466a282 100644 --- a/svl/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -41,14 +41,18 @@ um Calls zu sparen. */ -#define SFX_REC_MINI_HEADER(nPreTag,nStartPos,nEndPos) \ - ( sal_uInt32(nPreTag) | \ - sal_uInt32(nEndPos-nStartPos-SFX_REC_HEADERSIZE_MINI) << 8 ) +static void lclWriteMiniHeader(SvStream *p, sal_uInt32 nPreTag, sal_uInt32 nStartPos, sal_uInt32 nEndPos) +{ + (*p) << ( sal_uInt32(nPreTag) | + sal_uInt32(nEndPos-nStartPos-SFX_REC_HEADERSIZE_MINI) << 8 ); +} -#define SFX_REC_HEADER(nRecType,nContentTag,nContentVer) \ - ( sal_uInt32(nRecType) | \ - ( sal_uInt32(nContentVer) << 8 ) | \ - ( sal_uInt32(nContentTag) << 16 ) ) +static void lclWriteHeader(SvStream *p, sal_uInt32 nRecType, sal_uInt32 nContentTag, sal_uInt32 nContentVer) +{ + (*p) << ( sal_uInt32(nRecType) | + ( sal_uInt32(nContentVer) << 8 ) | + ( sal_uInt32(nContentTag) << 16 ) ); +} #define SFX_REC_CONTENT_HEADER(nContentVer,n1StStartPos,nCurStartPos) \ ( sal_uInt32(nContentVer) | \ @@ -94,7 +98,7 @@ sal_uInt32 SfxMiniRecordWriter::Close // Header an den Anfang des Records schreiben sal_uInt32 nEndPos = _pStream->Tell(); _pStream->Seek( _nStartPos ); - *_pStream << SFX_REC_MINI_HEADER( _nPreTag, _nStartPos, nEndPos ); + lclWriteMiniHeader(_pStream, _nPreTag, _nStartPos, nEndPos ); // je nachdem ans Ende des Records seeken oder hinter Header bleiben if ( bSeekToEndOfRec ) @@ -241,7 +245,7 @@ SfxSingleRecordWriter::SfxSingleRecordWriter : SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT ) { // Erweiterten Header hiner den des SfxMiniRec schreiben - *pStream << SFX_REC_HEADER(nRecordType, nContentTag, nContentVer); + lclWriteHeader(pStream, nRecordType, nContentTag, nContentVer); } @@ -376,8 +380,8 @@ sal_uInt32 SfxMultiFixRecordWriter::Close( bool bSeekToEndOfRec ) sal_uInt32 nEndPos = SfxSingleRecordWriter::Close( sal_False ); // gegen"uber SfxSingleRecord erweiterten Header schreiben - *_pStream << _nContentCount; - *_pStream << _nContentSize; + _pStream->WriteUInt16( _nContentCount ); + _pStream->WriteUInt32( _nContentSize ); // je nachdem ans Ende des Records seeken oder hinter Header bleiben if ( bSeekToEndOfRec ) @@ -500,18 +504,18 @@ sal_uInt32 SfxMultiVarRecordWriter::Close( bool bSeekToEndOfRec ) sal_uInt32 nContentOfsPos = _pStream->Tell(); //! darf man das so einr"ucken? for ( sal_uInt16 n = 0; n < _nContentCount; ++n ) - *_pStream << _aContentOfs[n]; + _pStream->WriteUInt32( _aContentOfs[n] ); // SfxMultiFixRecordWriter::Close() "uberspringen! sal_uInt32 nEndPos = SfxSingleRecordWriter::Close( sal_False ); // eigenen Header schreiben - *_pStream << _nContentCount; + _pStream->WriteUInt16( _nContentCount ); if ( SFX_REC_TYPE_VARSIZE_RELOC == _nPreTag || SFX_REC_TYPE_MIXTAGS_RELOC == _nPreTag ) - *_pStream << static_cast<sal_uInt32>(nContentOfsPos - ( _pStream->Tell() + sizeof(sal_uInt32) )); + _pStream->WriteUInt32( static_cast<sal_uInt32>(nContentOfsPos - ( _pStream->Tell() + sizeof(sal_uInt32) )) ); else - *_pStream << nContentOfsPos; + _pStream->WriteUInt32( nContentOfsPos ); // ans Ende des Records seeken bzw. am Ende des Headers bleiben if ( bSeekToEndOfRec ) @@ -545,7 +549,7 @@ void SfxMultiMixRecordWriter::NewContent // Tag vor den Content schreiben, Version und Startposition merken _nContentStartPos = _pStream->Tell(); ++_nContentCount; - *_pStream << nContentTag; + _pStream->WriteUInt16( nContentTag ); _nContentVer = nContentVer; } diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 9e11d7102860..1fb59d5363ee 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -136,7 +136,7 @@ TYPEINIT1(SfxEnumItem, SfxEnumItemInterface) // virtual SvStream & SfxEnumItem::Store(SvStream & rStream, sal_uInt16) const { - rStream << m_nValue; + rStream.WriteUInt16( m_nValue ); return rStream; } @@ -229,7 +229,7 @@ SfxPoolItem * SfxBoolItem::Create(SvStream & rStream, sal_uInt16) const // virtual SvStream & SfxBoolItem::Store(SvStream & rStream, sal_uInt16) const { - rStream << static_cast<sal_Bool>(m_bValue); // not bool for serialization! + rStream.WriteUChar( static_cast<sal_Bool>(m_bValue) ); // not bool for serialization! return rStream; } diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx index c8b35b97bdc6..5cdf1fb45c2e 100644 --- a/svl/source/items/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -96,7 +96,7 @@ SfxPoolItem * CntByteItem::Create(SvStream & rStream, sal_uInt16) const SvStream & CntByteItem::Store(SvStream & rStream, sal_uInt16) const { DBG_CHKTHIS(CntByteItem, 0); - rStream << short(m_nValue); + rStream.WriteInt16( short(m_nValue) ); return rStream; } @@ -215,7 +215,7 @@ SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, sal_uInt16) const SvStream & CntUInt16Item::Store(SvStream &rStream, sal_uInt16) const { DBG_CHKTHIS(CntUInt16Item, 0); - rStream << sal_uInt16(m_nValue); + rStream.WriteUInt16( sal_uInt16(m_nValue) ); return rStream; } @@ -331,7 +331,7 @@ SvStream & CntInt32Item::Store(SvStream &rStream, sal_uInt16) const { DBG_CHKTHIS(CntInt32Item, 0); //fdo#39428 SvStream no longer supports operator<<(long) - rStream << m_nValue; + rStream.WriteInt32( m_nValue ); return rStream; } @@ -451,7 +451,7 @@ SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, sal_uInt16) const SvStream & CntUInt32Item::Store(SvStream &rStream, sal_uInt16) const { DBG_CHKTHIS(CntUInt32Item, 0); - rStream << static_cast<sal_uInt32>(m_nValue); + rStream.WriteUInt32( static_cast<sal_uInt32>(m_nValue) ); return rStream; } diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index cf9c5a5f3b71..1e5253aeeebe 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -62,7 +62,7 @@ SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) : SvStream& SfxFlagItem::Store(SvStream &rStream, sal_uInt16) const { DBG_CHKTHIS(SfxFlagItem, 0); - rStream << nVal; + rStream.WriteUInt16( nVal ); return rStream; } diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index b8cd293f108b..bd4e4af7bf1f 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -122,7 +122,7 @@ SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, sal_uInt16) const SvStream & SfxInt16Item::Store(SvStream & rStream, sal_uInt16) const { DBG_CHKTHIS(SfxInt16Item, 0); - rStream << short(m_nValue); + rStream.WriteInt16( short(m_nValue) ); return rStream; } diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index f275a55d529b..761d781b5a2e 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -1512,7 +1512,7 @@ SvStream &SfxItemSet::Store // Position des Counts merken, um ggf. zu korrigieren sal_uLong nCountPos = rStream.Tell(); - rStream << _nCount; + rStream.WriteUInt16( _nCount ); // wenn nichts zu speichern ist, auch keinen ItemIter aufsetzen! if ( _nCount ) @@ -1540,7 +1540,7 @@ SvStream &SfxItemSet::Store // tats"achlichen Count im Stream ablegen sal_uLong nPos = rStream.Tell(); rStream.Seek( nCountPos ); - rStream << nWrittenCount; + rStream.WriteUInt16( nWrittenCount ); rStream.Seek( nPos ); } } diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index f5cc1fa36b45..1563c375f9f8 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -105,8 +105,8 @@ SvStream& SfxLockBytesItem::Store(SvStream &rStream, sal_uInt16 ) const sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END ); aLockBytesStream.Seek( 0L ); - rStream << nSize; - rStream << aLockBytesStream; + rStream.WriteUInt32( nSize ); + rStream.WriteStream( aLockBytesStream ); return rStream; } diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 9f17f125a479..a84ca7afa7b3 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -132,20 +132,20 @@ SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const : SVX_MACROTBL_AKTVERSION; if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStream << nVersion; + rStream.WriteUInt16( nVersion ); - rStream << (sal_uInt16)aSvxMacroTable.size(); + rStream.WriteUInt16( (sal_uInt16)aSvxMacroTable.size() ); SvxMacroTable::const_iterator it = aSvxMacroTable.begin(); while( it != aSvxMacroTable.end() && rStream.GetError() == SVSTREAM_OK ) { const SvxMacro& rMac = it->second; - rStream << it->first; + rStream.WriteUInt16( it->first ); SfxPoolItem::writeByteString(rStream, rMac.GetLibName()); SfxPoolItem::writeByteString(rStream, rMac.GetMacName()); if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStream << (sal_uInt16)rMac.GetScriptType(); + rStream.WriteUInt16( (sal_uInt16)rMac.GetScriptType() ); ++it; } return rStream; diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index efc4d8134075..0fd983300d47 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -107,8 +107,8 @@ SfxPoolItem* SfxRangeItem::Create(SvStream &rStream, sal_uInt16) const SvStream& SfxRangeItem::Store(SvStream &rStream, sal_uInt16) const { - rStream << nFrom; - rStream << nTo; + rStream.WriteUInt16( nFrom ); + rStream.WriteUInt16( nTo ); return rStream; } diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 5b8ec5a16ac3..7b6e9a094329 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -181,14 +181,14 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const if( !pImp ) { //fdo#39428 SvStream no longer supports operator<<(long) - rStream << (sal_Int32) 0; + rStream.WriteInt32( (sal_Int32) 0 ); return rStream; } DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); sal_uInt32 nCount = pImp->aList.size(); - rStream << nCount; + rStream.WriteUInt32( nCount ); for( sal_uInt32 i=0; i < nCount; i++ ) writeByteString(rStream, pImp->aList[i]); diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index 140a8b22a5e5..bcfceffdaa0d 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -94,7 +94,7 @@ SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, sal_uInt16) const SvStream & SfxVisibilityItem::Store(SvStream & rStream, sal_uInt16) const { DBG_CHKTHIS(SfxVisibilityItem, 0); - rStream << m_nValue.bVisible; + rStream.WriteUChar( m_nValue.bVisible ); return rStream; } diff --git a/svl/source/numbers/numhead.cxx b/svl/source/numbers/numhead.cxx index 2d318461cc79..d14b17427e70 100644 --- a/svl/source/numbers/numhead.cxx +++ b/svl/source/numbers/numhead.cxx @@ -106,7 +106,7 @@ ImpSvNumMultipleWriteHeader::ImpSvNumMultipleWriteHeader(SvStream& rNewStream, aMemStream( 4096, 4096 ) { nDataSize = nDefault; - rStream << nDataSize; + rStream.WriteUInt32( nDataSize ); nDataPos = rStream.Tell(); nEntryStart = nDataPos; @@ -118,8 +118,8 @@ ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader() { sal_uLong nDataEnd = rStream.Tell(); - rStream << (sal_uInt16) SV_NUMID_SIZES; - rStream << static_cast<sal_uInt32>(aMemStream.Tell()); + rStream.WriteUInt16( (sal_uInt16) SV_NUMID_SIZES ); + rStream.WriteUInt32( static_cast<sal_uInt32>(aMemStream.Tell()) ); rStream.Write( aMemStream.GetData(), aMemStream.Tell() ); if ( nDataEnd - nDataPos != nDataSize ) // Hit Default? @@ -127,7 +127,7 @@ ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader() nDataSize = nDataEnd - nDataPos; sal_uLong nPos = rStream.Tell(); rStream.Seek(nDataPos-sizeof(sal_uInt32)); - rStream << nDataSize; // Add size at the start + rStream.WriteUInt32( nDataSize ); // Add size at the start rStream.Seek(nPos); } } @@ -137,7 +137,7 @@ ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader() void ImpSvNumMultipleWriteHeader::EndEntry() { sal_uLong nPos = rStream.Tell(); - aMemStream << static_cast<sal_uInt32>(nPos - nEntryStart); + aMemStream.WriteUInt32( static_cast<sal_uInt32>(nPos - nEntryStart) ); } //#pragma SEG_FUNCDEF(numhead_0e) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 6e111e5c47d0..d6cca2fee76d 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -155,26 +155,26 @@ void ImpSvNumberformatInfo::Save(SvStream& rStream, sal_uInt16 nAnz) const { // The fight with versions before SV_NUMBERFORMATTER_VERSION_NEW_CURR case NF_SYMBOLTYPE_CURRENCY : - rStream << short( NF_SYMBOLTYPE_STRING ); + rStream.WriteInt16( short( NF_SYMBOLTYPE_STRING ) ); break; case NF_SYMBOLTYPE_CURRDEL : case NF_SYMBOLTYPE_CURREXT : - rStream << short(0); // will be ignored (hopefully ...) + rStream.WriteInt16( short(0) ); // will be ignored (hopefully ...) break; default: if ( nType > NF_KEY_LASTKEYWORD_SO5 ) { - rStream << short( NF_SYMBOLTYPE_STRING ); // all new keywords are string + rStream.WriteInt16( short( NF_SYMBOLTYPE_STRING ) ); // all new keywords are string } else { - rStream << nType; + rStream.WriteInt16( nType ); } } } - rStream << eScannedType << sal_Bool(bThousand) << nThousand - << nCntPre << nCntPost << nCntExp; + rStream.WriteInt16( eScannedType ).WriteUChar( sal_Bool(bThousand) ).WriteUInt16( nThousand ) + .WriteUInt16( nCntPre ).WriteUInt16( nCntPost ).WriteUInt16( nCntExp ); } void ImpSvNumberformatInfo::Load(SvStream& rStream, sal_uInt16 nAnz) @@ -443,7 +443,7 @@ void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ) void ImpSvNumFor::Save(SvStream& rStream) const { - rStream << nAnzStrings; + rStream.WriteUInt16( nAnzStrings ); aI.Save(rStream, nAnzStrings); rStream.WriteUniOrByteString( sColorName, rStream.GetStreamCharSet() ); } @@ -510,7 +510,7 @@ void ImpSvNumFor::SaveNewCurrencyMap( SvStream& rStream ) const break; } } - rStream << nCnt; + rStream.WriteUInt16( nCnt ); for ( j=0; j<nAnzStrings; j++ ) { switch ( aI.nTypeArray[j] ) @@ -518,7 +518,7 @@ void ImpSvNumFor::SaveNewCurrencyMap( SvStream& rStream ) const case NF_SYMBOLTYPE_CURRENCY : case NF_SYMBOLTYPE_CURRDEL : case NF_SYMBOLTYPE_CURREXT : - rStream << j << aI.nTypeArray[j]; + rStream.WriteUInt16( j ).WriteInt16( aI.nTypeArray[j] ); break; } } @@ -1971,18 +1971,18 @@ void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr rHdr.StartEntry(); rStream.WriteUniOrByteString( aFormatstring, rStream.GetStreamCharSet() ); - rStream << eType << fLimit1 << fLimit2 << (sal_uInt16) eOp1 << (sal_uInt16) eOp2 - << sal_Bool(bOldStandard) << sal_Bool(bIsUsed); + rStream.WriteInt16( eType ).WriteDouble( fLimit1 ).WriteDouble( fLimit2 ).WriteUInt16( (sal_uInt16) eOp1 ).WriteUInt16( (sal_uInt16) eOp2 ) + .WriteUChar( sal_Bool(bOldStandard) ).WriteUChar( sal_Bool(bIsUsed) ); for (sal_uInt16 i = 0; i < 4; i++) { NumFor[i].Save(rStream); } // As of SV_NUMBERFORMATTER_VERSION_NEWSTANDARD rStream.WriteUniOrByteString( aComment.makeStringAndClear(), rStream.GetStreamCharSet() ); - rStream << nNewStandardDefined; + rStream.WriteUInt16( nNewStandardDefined ); // As of SV_NUMBERFORMATTER_VERSION_NEW_CURR - rStream << nNewCurrencyVersionId; - rStream << sal_Bool(bNewCurrency); + rStream.WriteUInt16( nNewCurrencyVersionId ); + rStream.WriteUChar( sal_Bool(bNewCurrency) ); if ( bNewCurrency ) { for ( sal_uInt16 j=0; j<4; j++ ) @@ -1994,8 +1994,8 @@ void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr // the real standard flag to load with versions >638 if different if ( bStandard != bOldStandard ) { - rStream << nNewStandardFlagVersionId; - rStream << (sal_Bool)bStandard; + rStream.WriteUInt16( nNewStandardFlagVersionId ); + rStream.WriteUChar( (sal_Bool)bStandard ); } rHdr.EndEntry(); |