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 /sfx2/source/doc | |
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 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/docinf.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/graphhelp.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 15 |
3 files changed, 9 insertions, 17 deletions
diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index 37c20eaf0ebb..fa6595631acc 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -313,14 +313,7 @@ uno::Sequence<sal_Int8> convertMetaFile(GDIMetaFile const * i_pThumb) if (i_pThumb->CreateThumbnail(aBitmap)) { WriteDIB(aBitmap.GetBitmap(), aStream, false, false); - aStream.Seek(STREAM_SEEK_TO_END); - uno::Sequence<sal_Int8> aSeq(aStream.Tell()); - const sal_Int8* pBlob( - static_cast<const sal_Int8*>(aStream.GetData())); - for (sal_Int32 j = 0; j < aSeq.getLength(); ++j) { - aSeq[j] = pBlob[j]; - } - return aSeq; + return uno::Sequence<sal_Int8>(static_cast< const sal_Int8* >( aStream.GetData() ), aStream.TellEnd()); } } return uno::Sequence<sal_Int8>(); diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index c2bd23e05a76..e15df3ed4c9c 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -121,7 +121,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co pStream.Flush(); if ( !nFailed ) { - sal_Int32 nLength = pStream.Seek( STREAM_SEEK_TO_END ); + sal_Int32 nLength = pStream.TellEnd(); if ( nLength > 22 ) { HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22, diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d1629aff7e8d..e29eb13f37e1 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1919,9 +1919,8 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla aTmp.EnableKillingFile(); storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() ); SvStream* pStream = aTmp.GetStream( StreamMode::READ ); - const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); + const sal_uInt32 nLen = pStream->TellEnd(); Sequence< sal_Int8 > aSeq( nLen ); - pStream->Seek( STREAM_SEEK_TO_BEGIN ); pStream->ReadBytes(aSeq.getArray(), nLen); delete pStream; if( aSeq.getLength() ) @@ -1947,7 +1946,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla xMetaFile->Write( aMemStm ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); + aMemStm.TellEnd() ); } } else if ( aFlavor.MimeType == "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) @@ -1965,7 +1964,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla xMetaFile->Write( aMemStm ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); + aMemStm.TellEnd() ); } } else if ( aFlavor.MimeType == "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) @@ -1984,7 +1983,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla { xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); + xStream->TellEnd() ); } } } @@ -2020,7 +2019,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla { xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); + xStream->TellEnd() ); } } } @@ -2061,7 +2060,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla { xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); + xStream->TellEnd() ); } } } @@ -2083,7 +2082,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla { xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); + xStream->TellEnd() ); } } } |