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 /svtools | |
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 'svtools')
-rw-r--r-- | svtools/source/misc/embedtransfer.cxx | 4 | ||||
-rw-r--r-- | svtools/source/misc/transfer.cxx | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 29e894c56bd1..a408c03771d6 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -127,7 +127,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo xStg->openStorageElement( aName, embed::ElementModes::READ )->copyToStorage( xStor ); } - const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); + const sal_uInt32 nLen = pStream->TellEnd(); css::uno::Sequence< sal_Int8 > aSeq( nLen ); pStream->Seek( STREAM_SEEK_TO_BEGIN ); @@ -159,7 +159,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo const_cast<GDIMetaFile*>(&aMetaFile)->Write( aMemStm ); uno::Any aAny; aAny <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); + aMemStm.TellEnd() ); SetAny( aAny ); bRet = true; } diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 5600107f8eb4..206c75ba48b9 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -332,7 +332,7 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co if( GraphicConverter::Export( aDstStm, aGraphic, ConvertDataFormat::EMF ) == ERRCODE_NONE ) { maAny <<= ( aSeq = Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aDstStm.GetData() ), - aDstStm.Seek( STREAM_SEEK_TO_END ) ) ); + aDstStm.TellEnd() ) ); bDone = true; } } @@ -362,7 +362,7 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co if ( ConvertGDIMetaFileToWMF( aMtf, aDstStm, nullptr, false ) ) { maAny <<= ( aSeq = Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aDstStm.GetData() ), - aDstStm.Seek( STREAM_SEEK_TO_END ) ) ); + aDstStm.TellEnd() ) ); bDone = true; } } @@ -676,7 +676,7 @@ bool TransferableHelper::SetBitmapEx( const BitmapEx& rBitmapEx, const DataFlavo WriteDIB(aBitmap, aMemStm, false, true); } - maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) ); + maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() ); } return maAny.hasValue(); @@ -690,7 +690,7 @@ bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf ) SvMemoryStream aMemStm( 65535, 65535 ); const_cast<GDIMetaFile&>(rMtf).Write( aMemStm ); - maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) ); + maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() ); } return maAny.hasValue(); @@ -849,7 +849,7 @@ bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, if( pUserObject && WriteObject( xStm, pUserObject, nUserObjectId, rFlavor ) ) { - const sal_uInt32 nLen = xStm->Seek( STREAM_SEEK_TO_END ); + const sal_uInt32 nLen = xStm->TellEnd(); Sequence< sal_Int8 > aSeq( nLen ); xStm->Seek( STREAM_SEEK_TO_BEGIN ); |