diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-10-11 18:49:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-15 07:56:42 +0200 |
commit | 9ec8bf8f22fe74884185492ef2576ce79b41e4f1 (patch) | |
tree | 0b162c71c51a55125a2ce6055632d4f96180f431 /sd | |
parent | a84e3df74eecc8778e3d5be5dd80ad4ddb511edf (diff) |
add SvStream::TellEnd
and simplify callsites to use it instead of the current
"seek to end, find pos, seek back to original pos"
pattern
Change-Id: Ib5828868f73c341891efc759af8bd4695ae2f33c
Reviewed-on: https://gerrit.libreoffice.org/61738
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/eppt.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/eppt/escherex.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptatom.cxx | 5 | ||||
-rw-r--r-- | sd/source/filter/ppt/propread.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/UnoDocumentSettings.cxx | 8 |
7 files changed, 8 insertions, 21 deletions
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 230797458c05..ca8ee466efae 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -1232,8 +1232,7 @@ void PPTWriter::ImplWriteVBA() { if ( mpVBA ) { - mpVBA->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nLen = mpVBA->Tell(); + sal_uInt32 nLen = mpVBA->TellEnd(); if ( nLen > 8 ) { nLen -= 8; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index f5df6e331b8a..bcda24246ef6 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -432,8 +432,7 @@ bool PPTWriter::ImplCloseDocument() } } - mpExEmbed->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nExEmbedSize = mpExEmbed->Tell(); + sal_uInt32 nExEmbedSize = mpExEmbed->TellEnd(); // nEnvironment : whole size of the environment container sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76 // 68 bytes per Fontenityatom and 8 Bytes per header diff --git a/sd/source/filter/eppt/escherex.cxx b/sd/source/filter/eppt/escherex.cxx index d0894bd02216..f0929c10da1d 100644 --- a/sd/source/filter/eppt/escherex.cxx +++ b/sd/source/filter/eppt/escherex.cxx @@ -249,8 +249,7 @@ sal_uInt32 PptEscherEx::EnterGroup( ::tools::Rectangle const * pBoundRect, SvMem } if ( pClientData ) { - pClientData->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nSize = pClientData->Tell(); + sal_uInt32 nSize = pClientData->TellEnd(); if ( nSize ) { mpOutStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf ) diff --git a/sd/source/filter/ppt/pptatom.cxx b/sd/source/filter/ppt/pptatom.cxx index 1a6bd6957305..90e61e738ffb 100644 --- a/sd/source/filter/ppt/pptatom.cxx +++ b/sd/source/filter/ppt/pptatom.cxx @@ -37,10 +37,7 @@ Atom::Atom( const DffRecordHeader& rRecordHeader, SvStream& rStream ) Atom* pLastAtom = nullptr; // retrieve file size (to allow sanity checks) - sal_uInt64 const nStreamPos = mrStream.Tell(); - mrStream.Seek( STREAM_SEEK_TO_END ); - sal_uInt64 const nStreamSize = mrStream.Tell(); - mrStream.Seek( nStreamPos ); + sal_uInt64 const nStreamSize = mrStream.TellEnd(); while( (mrStream.GetError() == ERRCODE_NONE ) && ( mrStream.Tell() < nStreamSize ) diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index 4c1248b08234..112d8a0befe8 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -195,10 +195,7 @@ PropItem& PropItem::operator=( PropItem& rPropItem ) delete[] static_cast<sal_uInt8*>(SwitchBuffer()); mnTextEnc = rPropItem.mnTextEnc; - sal_uInt32 nItemPos = rPropItem.Tell(); - rPropItem.Seek( STREAM_SEEK_TO_END ); - SvMemoryStream::WriteBytes(rPropItem.GetData(), rPropItem.Tell()); - rPropItem.Seek( nItemPos ); + SvMemoryStream::WriteBytes(rPropItem.GetData(), rPropItem.TellEnd()); } return *this; } diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 90d651c257b5..2a7dadaf9118 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -827,7 +827,7 @@ bool SdTransferable::SetTableRTF( SdDrawDocument* pModel ) { SvMemoryStream aMemStm( 65535, 65535 ); sdr::table::SdrTableObj::ExportAsRTF( aMemStm, *pTableObj ); - return SetAny( Any( Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) ) ) ); + return SetAny( Any( Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() ) ) ); } } } diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 5eec0ffda4c3..dbb565de0ec9 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -1199,12 +1199,8 @@ DocumentSettings::_getPropertyValues( { SvMemoryStream aStream; pTempPrinter->Store( aStream ); - aStream.Seek ( STREAM_SEEK_TO_END ); - sal_uInt32 nSize = aStream.Tell(); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - Sequence < sal_Int8 > aSequence ( nSize ); - memcpy ( aSequence.getArray(), aStream.GetData(), nSize ); - *pValue <<= aSequence; + *pValue <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aStream.GetData() ), + aStream.TellEnd() ); } else { |