summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-10-11 18:49:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 07:56:42 +0200
commit9ec8bf8f22fe74884185492ef2576ce79b41e4f1 (patch)
tree0b162c71c51a55125a2ce6055632d4f96180f431
parenta84e3df74eecc8778e3d5be5dd80ad4ddb511edf (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>
-rw-r--r--basic/source/basmgr/basmgr.cxx6
-rw-r--r--basic/source/runtime/methods.cxx4
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx9
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx2
-rw-r--r--cui/source/dialogs/insdlg.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx4
-rw-r--r--editeng/source/editeng/eeobj.cxx8
-rw-r--r--embeddedobj/source/msole/graphconvert.cxx4
-rw-r--r--emfio/source/reader/mtftools.cxx2
-rw-r--r--emfio/source/reader/wmfreader.cxx2
-rw-r--r--extensions/source/scanner/sane.cxx3
-rw-r--r--extensions/source/scanner/scanunx.cxx10
-rw-r--r--filter/source/flash/swfwriter.cxx3
-rw-r--r--filter/source/flash/swfwriter1.cxx8
-rw-r--r--filter/source/flash/swfwriter2.cxx3
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx3
-rw-r--r--filter/source/msfilter/escherex.cxx9
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
-rw-r--r--filter/source/svg/svgfilter.cxx5
-rw-r--r--forms/source/component/DatabaseForm.cxx2
-rw-r--r--include/tools/stream.hxx1
-rw-r--r--lotuswordpro/source/filter/bencont.cxx14
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx5
-rw-r--r--sc/source/filter/excel/xiescher.cxx3
-rw-r--r--sc/source/filter/excel/xistream.cxx3
-rw-r--r--sc/source/filter/ftools/fprogressbar.cxx6
-rw-r--r--sc/source/filter/lotus/filter.cxx3
-rw-r--r--sc/source/ui/docshell/impex.cxx7
-rw-r--r--sc/source/ui/unoobj/confuno.cxx8
-rw-r--r--sc/source/ui/unoobj/exceldetect.cxx6
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx3
-rw-r--r--sd/source/filter/eppt/eppt.cxx3
-rw-r--r--sd/source/filter/eppt/epptso.cxx3
-rw-r--r--sd/source/filter/eppt/escherex.cxx3
-rw-r--r--sd/source/filter/ppt/pptatom.cxx5
-rw-r--r--sd/source/filter/ppt/propread.cxx5
-rw-r--r--sd/source/ui/app/sdxfer.cxx2
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx8
-rw-r--r--sfx2/source/bastyp/sfxhtml.cxx6
-rw-r--r--sfx2/source/doc/docinf.cxx9
-rw-r--r--sfx2/source/doc/graphhelp.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx15
-rw-r--r--sot/source/sdstor/stg.cxx6
-rw-r--r--sot/source/sdstor/stgcache.cxx6
-rw-r--r--sot/source/sdstor/stgdir.cxx4
-rw-r--r--sot/source/sdstor/stgstrms.cxx4
-rw-r--r--sot/source/sdstor/storage.cxx5
-rw-r--r--sot/source/sdstor/ucbstorage.cxx15
-rw-r--r--starmath/source/unomodel.cxx3
-rw-r--r--svtools/source/misc/embedtransfer.cxx4
-rw-r--r--svtools/source/misc/transfer.cxx10
-rw-r--r--svx/qa/unit/xoutdev.cxx4
-rw-r--r--svx/source/dialog/compressgraphicdialog.cxx6
-rw-r--r--svx/source/gallery2/codec.cxx3
-rw-r--r--svx/source/xml/xmlgrhlp.cxx9
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx3
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx32
-rw-r--r--sw/source/core/doc/swserv.cxx2
-rw-r--r--sw/source/filter/ascii/parasc.cxx4
-rw-r--r--sw/source/filter/html/htmlcss1.cxx3
-rw-r--r--sw/source/filter/html/htmlreqifreader.cxx3
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx18
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx10
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx8
-rw-r--r--sw/source/uibase/dbui/mailmergehelper.cxx3
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx3
-rw-r--r--unotools/source/streaming/streamwrap.cxx18
-rw-r--r--unotools/source/ucbhelper/xtempfile.cxx9
-rw-r--r--vcl/source/edit/textview.cxx3
-rw-r--r--vcl/source/filter/graphicfilter.cxx19
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx3
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx6
-rw-r--r--vcl/source/filter/jpeg/Exif.cxx3
-rw-r--r--vcl/source/filter/wmf/wmf.cxx3
-rw-r--r--vcl/source/gdi/gdimetafiletools.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx19
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx3
-rw-r--r--vcl/source/gdi/pngread.cxx5
-rw-r--r--vcl/source/graphic/UnoGraphicProvider.cxx3
-rw-r--r--vcl/unx/gtk/gtksalmenu.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx2
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper2.cxx4
84 files changed, 157 insertions, 341 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index c404b7b893c6..3dedac41d42a 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -654,7 +654,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBase
OUString aStorName( rStorage.GetName() );
// #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
- if ( !xManagerStream.is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
+ if ( !xManagerStream.is() || xManagerStream->GetError() || ( xManagerStream->TellEnd() == 0 ) )
{
ImpMgrNotLoaded( aStorName );
return;
@@ -746,7 +746,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
OUString aStorName( rStorage.GetName() );
DBG_ASSERT( aStorName.getLength(), "No Storage Name!" );
- if ( !xManagerStream.is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
+ if ( !xManagerStream.is() || xManagerStream->GetError() || ( xManagerStream->TellEnd() == 0 ) )
{
ImpMgrNotLoaded( aStorName );
return;
@@ -903,7 +903,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
else
{
bool bLoaded = false;
- if ( xBasicStream->Seek( STREAM_SEEK_TO_END ) != 0 )
+ if ( xBasicStream->TellEnd() != 0 )
{
if ( !pLibInfo->GetLib().is() )
{
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 1a17454e6a76..6225cb58e0f8 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3217,9 +3217,7 @@ void SbRtl_Lof(StarBASIC *, SbxArray & rPar, bool)
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
- sal_uInt64 const nOldPos = pSvStrm->Tell();
- sal_uInt64 const nLen = pSvStrm->Seek( STREAM_SEEK_TO_END );
- pSvStrm->Seek( nOldPos );
+ sal_uInt64 const nLen = pSvStrm->TellEnd();
rPar.Get(0)->PutLong( static_cast<sal_Int32>(nLen) );
}
}
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 9d06cb8628d4..858812193b8f 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -528,8 +528,7 @@ void ODbaseTable::construct()
if (m_pMemoStream)
{
// set the buffer exactly to the length of a record
- m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- nFileSize = m_pMemoStream->Tell();
+ nFileSize = m_pMemoStream->TellEnd();
m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN);
// Buffersize dependent on the file size
@@ -1018,7 +1017,7 @@ bool ODbaseTable::CreateImpl()
// Only if the file exists with length > 0 raise an error
std::unique_ptr<SvStream> pFileStream(createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
- if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END))
+ if (pFileStream && pFileStream->TellEnd())
return false;
}
}
@@ -2026,7 +2025,7 @@ void ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr
if (bAppend)
{
- sal_uInt64 const nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
+ sal_uInt64 const nStreamSize = m_pMemoStream->TellEnd();
// fill last block
rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
@@ -2090,7 +2089,7 @@ void ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr
// Write the new block number
if (bAppend)
{
- sal_uInt64 const nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
+ sal_uInt64 const nStreamSize = m_pMemoStream->TellEnd();
m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
// Write the new block number
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index e7f71d493988..73e262c98bb2 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -892,7 +892,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage&
// Page doesn't exist yet
std::size_t nSize = rPage.GetPagePos() + 1;
nSize *= DINDEX_PAGE_SIZE;
- if (nSize > rStream.Seek(STREAM_SEEK_TO_END))
+ if (nSize > rStream.TellEnd())
{
rStream.SetStreamSize(nSize);
rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 14b4fdd3f65f..32facb080e20 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -311,7 +311,7 @@ short SvInsertOleDlg::execute()
Image aImage = SvFileInformationManager::GetImage(aURL, true);
SvMemoryStream aTemp;
WriteDIBBitmapEx(aImage.GetBitmapEx(), aTemp);
- m_aIconMetaFile = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aTemp.GetData()), aTemp.Seek(STREAM_SEEK_TO_END));
+ m_aIconMetaFile = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aTemp.GetData()), aTemp.TellEnd());
m_aIconMediaType = "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"";
}
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 87c688d64082..3d956cfa5c93 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -349,7 +349,7 @@ namespace drawinglayer
SvMemoryStream aMemStm;
WriteSvtGraphicFill( aMemStm, *pSvtGraphicFill );
- mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.TellEnd()));
mnSvtGraphicFillCount++;
}
}
@@ -536,7 +536,7 @@ namespace drawinglayer
SvMemoryStream aMemStm;
WriteSvtGraphicStroke( aMemStm, *pSvtGraphicStroke );
- mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.TellEnd()));
mnSvtGraphicStrokeCount++;
}
}
diff --git a/editeng/source/editeng/eeobj.cxx b/editeng/source/editeng/eeobj.cxx
index ddac7cb5731b..3474bdc25be2 100644
--- a/editeng/source/editeng/eeobj.cxx
+++ b/editeng/source/editeng/eeobj.cxx
@@ -55,14 +55,10 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo
// 2) Don't have the old pool defaults and the StyleSheetPool here.
SvMemoryStream* pStream = (nT == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) ? &GetODFStream() : &GetRTFStream();
- pStream->Seek( STREAM_SEEK_TO_END );
- sal_Int32 nLen = pStream->Tell();
+ sal_Int32 nLen = pStream->TellEnd();
if (nLen < 0) { abort(); }
- pStream->Seek(0);
- uno::Sequence< sal_Int8 > aSeq( nLen );
- memcpy( aSeq.getArray(), pStream->GetData(), nLen );
- aAny <<= aSeq;
+ aAny <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >(pStream->GetData()), pStream->TellEnd() );
}
else
{
diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx
index 7905b786cef0..f5de2b35824d 100644
--- a/embeddedobj/source/msole/graphconvert.cxx
+++ b/embeddedobj/source/msole/graphconvert.cxx
@@ -56,7 +56,7 @@ bool ConvertBufferToFormat( void* pBuf,
if (rFilter.CanImportGraphic(OUString(), aMemoryStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat) == ERRCODE_NONE &&
rFilter.GetImportFormatMediaType(nRetFormat) == aMimeType)
{
- aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.Seek( STREAM_SEEK_TO_END ) );
+ aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.TellEnd() );
return true;
}
@@ -80,7 +80,7 @@ bool ConvertBufferToFormat( void* pBuf,
aOutMediaProperties[1].Value <<= aMimeType;
xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
- aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
+ aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.TellEnd() );
return true;
}
}
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 1b76907cd8ff..e5b8aa047d3e 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1333,7 +1333,7 @@ namespace emfio
mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0,
static_cast<const sal_uInt8*>(aMemStm.GetData()),
- aMemStm.Seek( STREAM_SEEK_TO_END ) ) );
+ aMemStm.TellEnd() ) );
mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_END" ) );
}
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index ec813e645447..875f29a77641 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -1376,7 +1376,7 @@ namespace emfio
SetWinExt( Size( 1, 1 ) );
SetDevExt( Size( 10000, 10000 ) );
- mnEndPos=mpInputStream->Seek( STREAM_SEEK_TO_END );
+ mnEndPos=mpInputStream->TellEnd();
mpInputStream->Seek( mnStartPos );
if ( ReadHeader( ) )
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index 824c0cdf6fc1..0c6b50bec05c 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -860,8 +860,7 @@ bool Sane::Start( BitmapTransporter& rBitmap )
bSuccess = false;
}
// get stream length
- aConverter.Seek( STREAM_SEEK_TO_END );
- int nPos = aConverter.Tell();
+ int nPos = aConverter.TellEnd();
aConverter.Seek( 2 );
aConverter.WriteUInt32( nPos+1 );
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 37b7b2999ac2..3225cab44b06 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -40,21 +40,20 @@ BitmapTransporter::~BitmapTransporter()
css::awt::Size BitmapTransporter::getSize()
{
osl::MutexGuard aGuard( m_aProtector );
- int nPreviousPos = m_aStream.Tell();
css::awt::Size aRet;
// ensure that there is at least a header
- m_aStream.Seek( STREAM_SEEK_TO_END );
- int nLen = m_aStream.Tell();
+ int nLen = m_aStream.TellEnd();
if( nLen > 15 )
{
+ int nPreviousPos = m_aStream.Tell();
m_aStream.Seek( 4 );
m_aStream.ReadInt32( aRet.Width ).ReadInt32( aRet.Height );
+ m_aStream.Seek( nPreviousPos );
}
else
aRet.Width = aRet.Height = 0;
- m_aStream.Seek( nPreviousPos );
return aRet;
}
@@ -66,8 +65,7 @@ Sequence< sal_Int8 > BitmapTransporter::getDIB()
int nPreviousPos = m_aStream.Tell();
// create return value
- m_aStream.Seek( STREAM_SEEK_TO_END );
- int nBytes = m_aStream.Tell();
+ int nBytes = m_aStream.TellEnd();
m_aStream.Seek( 0 );
Sequence< sal_Int8 > aValue( nBytes );
diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx
index 6e6ea996b82f..fc751f772728 100644
--- a/filter/source/flash/swfwriter.cxx
+++ b/filter/source/flash/swfwriter.cxx
@@ -98,8 +98,7 @@ static void ImplCopySvStreamToXOutputStream( SvStream& rIn, Reference< XOutputSt
{
sal_uInt32 nBufferSize = 64*1024;
- rIn.Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nSize = rIn.Tell();
+ sal_uInt32 nSize = rIn.TellEnd();
rIn.Seek( STREAM_SEEK_TO_BEGIN );
Sequence< sal_Int8 > aBuffer( std::min( nBufferSize, nSize ) );
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 77af4c859fa6..03042a9c86a2 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -773,7 +773,7 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali
aFilter.GetExportFormatNumberForShortName( JPG_SHORTNAME ), &aFilterData ) == ERRCODE_NONE )
{
pJpgData = static_cast<const sal_uInt8*>(aDstStm.GetData());
- nJpgDataLength = aDstStm.Seek( STREAM_SEEK_TO_END );
+ nJpgDataLength = aDstStm.TellEnd();
}
// AS: Ok, now go ahead and use whichever is smaller. If JPEG is smaller, then
@@ -998,12 +998,10 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal
}
}
- EncodingTableStream.Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nEncodingTableSize = EncodingTableStream.Tell();
+ sal_uInt32 nEncodingTableSize = EncodingTableStream.TellEnd();
EncodingTableStream.Seek( STREAM_SEEK_TO_BEGIN );
- ImageBitsStream.Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nImageBitsSize = ImageBitsStream.Tell();
+ sal_uInt32 nImageBitsSize = ImageBitsStream.TellEnd();
ImageBitsStream.Seek( STREAM_SEEK_TO_BEGIN );
// AS: If we need alpha support, use TAG_DEFINEBITSJPEG3.
diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx
index 2b7a4bbee717..325cddde4c99 100644
--- a/filter/source/flash/swfwriter2.cxx
+++ b/filter/source/flash/swfwriter2.cxx
@@ -129,8 +129,7 @@ Tag::Tag( sal_uInt8 nTagId )
void Tag::write( SvStream &out )
{
- Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nSz = Tell();
+ sal_uInt32 nSz = TellEnd();
Seek( STREAM_SEEK_TO_BEGIN );
if( mnTagId != 0xff )
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index f3ef15a9d06c..f20e899c0cc6 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -356,8 +356,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
if ( nErrCode == ERRCODE_NONE )
{
- rTargetStream.Seek( STREAM_SEEK_TO_END );
- nPSPosition = rTargetStream.Tell();
+ nPSPosition = rTargetStream.TellEnd();
rTargetStream.Seek( nStreamPosition + 20 );
rTargetStream.WriteUInt32( nPSPosition - 30 ); // size of tiff gfx
rTargetStream.Seek( nPSPosition );
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 8eea3a8585ea..53f66cea476b 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4226,8 +4226,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
if ( nErrCode == ERRCODE_NONE )
{
p_EscherBlibEntry->meBlibType = ( eGraphicType == GraphicType::Bitmap ) ? PNG : EMF;
- aStream.Seek( STREAM_SEEK_TO_END );
- p_EscherBlibEntry->mnSize = aStream.Tell();
+ p_EscherBlibEntry->mnSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
}
}
@@ -4293,8 +4292,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
SvMemoryStream aDestStrm;
aZCodec.Write( aDestStrm, pGraphicAry, p_EscherBlibEntry->mnSize );
aZCodec.EndCompression();
- aDestStrm.Seek( STREAM_SEEK_TO_END );
- p_EscherBlibEntry->mnSize = aDestStrm.Tell();
+ p_EscherBlibEntry->mnSize = aDestStrm.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const *>(aDestStrm.GetData());
if ( p_EscherBlibEntry->mnSize && pGraphicAry )
{
@@ -4961,8 +4959,7 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes )
if ( offset > nCurPos )
offset += nBytes;
}
- mpOutStrm->Seek( STREAM_SEEK_TO_END );
- nSource = mpOutStrm->Tell();
+ nSource = mpOutStrm->TellEnd();
nToCopy = nSource - nCurPos; // increase the size of the tream by nBytes
std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ 0x40000 ]); // 256KB Buffer
while ( nToCopy )
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b3a54e3c28fa..ef8ab1e9e7d7 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5915,8 +5915,7 @@ void SvxMSDffManager::GetCtrlData(sal_uInt32 nOffsDggL)
bool bOk;
GetDrawingGroupContainerData( rStCtrl, nLength );
- rStCtrl.Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nMaxStrPos = rStCtrl.Tell();
+ sal_uInt32 nMaxStrPos = rStCtrl.TellEnd();
nPos += nLength;
sal_uInt16 nDrawingContainerId = 1;
@@ -6531,8 +6530,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
{
if ( bZCodecCompression )
{
- xOut->Seek(STREAM_SEEK_TO_END);
- pDbgOut->WriteBytes(xOut->GetData(), xOut->Tell());
+ pDbgOut->WriteBytes(xOut->GetData(), xOut->TellEnd());
xOut->Seek(STREAM_SEEK_TO_BEGIN);
}
else
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 835e6e69bfd5..07aef15edba3 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -582,10 +582,7 @@ private:
return;
}
- const sal_uLong nStreamPos(aStream->Tell());
- aStream->Seek(STREAM_SEEK_TO_END);
- const sal_uLong nStreamLen(aStream->Tell() - nStreamPos);
- aStream->Seek(nStreamPos);
+ const sal_uLong nStreamLen(aStream->remainingSize());
if(aStream->GetError())
{
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 1ae254402117..ee43255d9e2b 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -507,7 +507,7 @@ Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XContr
aMemStream.Flush();
aMemStream.Seek( 0 );
void const * pData = aMemStream.GetData();
- sal_Int32 nLen = aMemStream.Seek(STREAM_SEEK_TO_END);
+ sal_Int32 nLen = aMemStream.TellEnd();
rContentType = aParent.GetContentType();
return Sequence<sal_Int8>(static_cast<sal_Int8 const *>(pData), nLen);
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 3793094155d6..dc2c926c371e 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -273,6 +273,7 @@ public:
sal_uInt64 Seek( sal_uInt64 nPos );
sal_uInt64 SeekRel( sal_Int64 nPos );
sal_uInt64 Tell() const { return m_nBufFilePos + m_nBufActualPos; }
+ sal_uInt64 TellEnd() { return Tell() + remainingSize(); }
// length between current (Tell()) pos and end of stream
virtual sal_uInt64 remainingSize();
void Flush();
diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
index cb2f97f9d924..06be40c8a614 100644
--- a/lotuswordpro/source/filter/bencont.cxx
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -246,16 +246,6 @@ LtcUtBenValueStream * LtcBenContainer::FindValueStreamWithPropertyName(const cha
return FindNextValueStreamWithPropertyName(sPropertyName);
}
-static sal_uInt64 GetSvStreamSize(SvStream * pStream)
-{
- sal_uInt64 nCurPos = pStream->Tell();
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 ulLength = pStream->Tell();
- pStream->Seek(nCurPos);
-
- return ulLength;
-}
-
namespace
{
void readDataInBlocks(SvStream& rSt, sal_uInt64 nDLen, std::vector<sal_uInt8>& rData)
@@ -303,12 +293,12 @@ std::vector<sal_uInt8> LtcBenContainer::GetGraphicData(const char *pObjectName)
sal_uInt64 nDLen = 0;
if (xD)
{
- nDLen = GetSvStreamSize(xD.get());
+ nDLen = xD->TellEnd();
}
sal_uInt64 nSLen = 0;
if (xS)
{
- nSLen = GetSvStreamSize(xS.get()) ;
+ nSLen = xS->TellEnd();
}
sal_uInt64 nLen = nDLen + nSLen;
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 2fc8d2ee3380..61f35d0879e4 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -384,10 +384,7 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
if (pMemGrafStream)
{
// read image data
- sal_uInt32 nPos = pGrafStream->Tell();
- pGrafStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nDataLen = pGrafStream->Tell();
- pGrafStream->Seek(nPos);
+ sal_uInt32 nDataLen = pGrafStream->TellEnd();
pGrafData = new sal_uInt8 [nDataLen];
pMemGrafStream->ReadBytes(pGrafData, nDataLen);
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index be28c903a7ca..be62186586ee 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3367,8 +3367,7 @@ void XclImpDffConverter::ProcessDrawing( const XclImpDrawObjVector& rDrawObjs )
void XclImpDffConverter::ProcessDrawing( SvStream& rDffStrm )
{
- rDffStrm.Seek( STREAM_SEEK_TO_END );
- if( rDffStrm.Tell() > 0 )
+ if( rDffStrm.TellEnd() > 0 )
{
rDffStrm.Seek( STREAM_SEEK_TO_BEGIN );
DffRecordHeader aHeader;
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index 2bf72262bfcf..790da0a05061 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -439,8 +439,7 @@ XclImpStream::XclImpStream( SvStream& rInStrm, const XclImpRoot& rRoot ) :
mbValidRec( false ),
mbValid( false )
{
- mrStrm.Seek( STREAM_SEEK_TO_END );
- mnStreamSize = mrStrm.Tell();
+ mnStreamSize = mrStrm.TellEnd();
mrStrm.Seek( STREAM_SEEK_TO_BEGIN );
}
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index 6278fbdbb979..77bc4cf2a331 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -228,11 +228,7 @@ void ScfStreamProgressBar::Progress()
void ScfStreamProgressBar::Init( SfxObjectShell* pDocShell, const OUString& rText )
{
- sal_uInt64 const nPos = mrStrm.Tell();
- mrStrm.Seek( STREAM_SEEK_TO_END );
- sal_uInt64 const nSize = mrStrm.Tell();
- mrStrm.Seek( nPos );
-
+ sal_uInt64 const nSize = mrStrm.TellEnd();
mxProgress.reset( new ScfSimpleProgressBar( nSize, pDocShell, rText ) );
Progress();
}
diff --git a/sc/source/filter/lotus/filter.cxx b/sc/source/filter/lotus/filter.cxx
index 16ab8fe57bf3..a43b4ee6a8ad 100644
--- a/sc/source/filter/lotus/filter.cxx
+++ b/sc/source/filter/lotus/filter.cxx
@@ -76,8 +76,7 @@ generate_Opcodes(LotusContext &rContext, SvStream& aStream,
}
// #i76299# seems that SvStream::IsEof() does not work correctly
- aStream.Seek( STREAM_SEEK_TO_END );
- sal_uInt64 const nStrmSize = aStream.Tell();
+ sal_uInt64 const nStrmSize = aStream.TellEnd();
aStream.Seek( STREAM_SEEK_TO_BEGIN );
while (!rContext.bEOF && aStream.good() && (aStream.Tell() < nStrmSize))
{
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 86e17e3b6e52..72107fdd3363 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -289,7 +289,7 @@ bool ScImportExport::ExportData( const OUString& rMimeType,
aStrm.WriteUChar( 0 );
rValue <<= css::uno::Sequence< sal_Int8 >(
static_cast<sal_Int8 const *>(aStrm.GetData()),
- aStrm.Seek( STREAM_SEEK_TO_END ) );
+ aStrm.TellEnd() );
return true;
}
return false;
@@ -339,8 +339,6 @@ bool ScImportExport::ExportString( OUString& rText, SotClipboardFormatId nFmt )
if( ExportStream( aStrm, OUString(), nFmt ) )
{
aStrm.WriteUInt16( 0 );
- aStrm.Seek( STREAM_SEEK_TO_END );
-
rText = OUString( static_cast<const sal_Unicode*>(aStrm.GetData()) );
return true;
}
@@ -366,8 +364,7 @@ bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, So
if( ExportStream( aStrm, OUString(), nFmt ) )
{
aStrm.WriteChar( 0 );
- aStrm.Seek( STREAM_SEEK_TO_END );
- if( aStrm.Tell() <= nSizeLimit )
+ if( aStrm.TellEnd() <= nSizeLimit )
{
rText = static_cast<const sal_Char*>(aStrm.GetData());
return true;
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index a7d6599aef6c..676ed2814ffc 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -503,12 +503,8 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
{
SvMemoryStream aStream;
pPrinter->Store( aStream );
- aStream.Seek ( STREAM_SEEK_TO_END );
- sal_uInt32 nSize = aStream.Tell();
- aStream.Seek ( STREAM_SEEK_TO_BEGIN );
- uno::Sequence < sal_Int8 > aSequence( nSize );
- aStream.ReadBytes(aSequence.getArray(), nSize);
- aRet <<= aSequence;
+ aRet <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aStream.GetData() ),
+ aStream.TellEnd() );
}
else
aRet <<= uno::Sequence<sal_Int8>();
diff --git a/sc/source/ui/unoobj/exceldetect.cxx b/sc/source/ui/unoobj/exceldetect.cxx
index 6d5ccd796ab6..9ab0890c977e 100644
--- a/sc/source/ui/unoobj/exceldetect.cxx
+++ b/sc/source/ui/unoobj/exceldetect.cxx
@@ -56,8 +56,7 @@ bool hasStream(const uno::Reference<io::XInputStream>& xInStream, const OUString
if (!pStream)
return false;
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 const nSize = pStream->Tell();
+ sal_uInt64 const nSize = pStream->TellEnd();
pStream->Seek(0);
if (!nSize)
@@ -94,8 +93,7 @@ bool isExcel40(const uno::Reference<io::XInputStream>& xInStream)
if (!pStream)
return false;
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 const nSize = pStream->Tell();
+ sal_uInt64 const nSize = pStream->TellEnd();
pStream->Seek(0);
if (nSize < 4)
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 251fda4e1549..23071a09ea7f 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -208,8 +208,7 @@ static bool lcl_MayBeDBase( SvStream& rStream )
// Empty dbf is >= 32*2+1 bytes in size.
const size_t nEmptyDbf = nHeaderBlockSize * 2 + 1;
- rStream.Seek(STREAM_SEEK_TO_END);
- sal_uLong nSize = rStream.Tell();
+ sal_uLong nSize = rStream.TellEnd();
if ( nSize < nEmptyDbf )
return false;
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
{
diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx
index 82b81e93b45d..e6b94f77bd71 100644
--- a/sfx2/source/bastyp/sfxhtml.cxx
+++ b/sfx2/source/bastyp/sfxhtml.cxx
@@ -242,11 +242,9 @@ bool SfxHTMLParser::FinishFileDownload( OUString& rStr )
if( pStream )
aStream.WriteStream( *pStream );
- aStream.Seek( STREAM_SEEK_TO_END );
- sal_uInt64 const nLen = aStream.Tell();
+ sal_uInt64 const nLen = aStream.TellEnd();
aStream.Seek( 0 );
- OString sBuffer = read_uInt8s_ToOString(aStream, nLen);
- rStr = OStringToOUString( sBuffer, RTL_TEXTENCODING_UTF8 );
+ rStr = read_uInt8s_ToOUString(aStream, nLen, RTL_TEXTENCODING_UTF8);
}
pDLMedium.reset();
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() );
}
}
}
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index bb74237bff5a..60147cd319ee 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -374,7 +374,7 @@ Storage::Storage( SvStream& r, bool bDirect )
if( r.GetError() == ERRCODE_NONE )
{
pIo->SetStrm( &r, false );
- sal_uInt64 nSize = r.Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 nSize = r.TellEnd();
r.Seek( 0 );
// Initializing is OK if the stream is empty
Init( nSize == 0 );
@@ -419,7 +419,7 @@ Storage::Storage( UCBStorageStream& rStrm, bool bDirect )
pIo->SetStrm( &rStrm );
- sal_uInt64 nSize = pStream->Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 nSize = pStream->TellEnd();
pStream->Seek( 0 );
// Initializing is OK if the stream is empty
Init( nSize == 0 );
@@ -444,7 +444,7 @@ void Storage::Init( bool bCreate )
OSL_ENSURE( pIo, "The pointer may not be empty at this point!" );
if( pIo->Good() && pIo->GetStrm() )
{
- sal_uInt64 nSize = pIo->GetStrm()->Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 nSize = pIo->GetStrm()->TellEnd();
pIo->GetStrm()->Seek( 0 );
if( nSize )
{
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index e21ac2335af0..532b74e3d501 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -111,10 +111,8 @@ void StgCache::SetPhysPageSize( short n )
if ( n >= 512 )
{
m_nPageSize = n;
- sal_uInt64 nPos = m_pStrm->Tell();
- sal_uInt64 nFileSize = m_pStrm->Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 nFileSize = m_pStrm->TellEnd();
m_nPages = lcl_GetPageCount( nFileSize, m_nPageSize );
- m_pStrm->Seek( nPos );
}
}
@@ -295,7 +293,7 @@ bool StgCache::Open( const OUString& rName, StreamMode nMode )
SetStrm( pFileStrm, true );
if( pFileStrm->IsOpen() )
{
- sal_uInt64 nFileSize = m_pStrm->Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 nFileSize = m_pStrm->TellEnd();
m_nPages = lcl_GetPageCount( nFileSize, m_nPageSize );
m_pStrm->Seek( 0 );
}
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 4fcb13b85ac8..da729a9031ef 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -738,9 +738,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
if( p )
{
SvStream *pUnderlyingStream = m_rIo.GetStrm();
- sal_uInt64 nCur = pUnderlyingStream->Tell();
- sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->Seek(STREAM_SEEK_TO_END);
- pUnderlyingStream->Seek(nCur);
+ sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->TellEnd();
bool bOk(false);
StgDirEntry* pCur = new StgDirEntry( p, STGENTRY_SIZE, nUnderlyingStreamSize, &bOk );
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index ae140fdb128a..35d99f27751f 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1212,9 +1212,7 @@ sal_uInt64 StgTmpStrm::GetSize() const
sal_uInt64 n;
if( m_pStrm )
{
- sal_uInt64 old = m_pStrm->Tell();
- n = m_pStrm->Seek( STREAM_SEEK_TO_END );
- m_pStrm->Seek( old );
+ n = m_pStrm->TellEnd();
}
else
n = nEndOfData;
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index cb484cca4215..829dd82cb4c8 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -177,10 +177,7 @@ void SotStorageStream::SetSize(sal_uInt64 const nNewSize)
sal_uInt32 SotStorageStream::GetSize() const
{
- sal_uInt64 nPos = Tell();
- const_cast<SotStorageStream *>(this)->Seek( STREAM_SEEK_TO_END );
- sal_uInt64 nSize = Tell();
- const_cast<SotStorageStream *>(this)->Seek( nPos );
+ sal_uInt64 nSize = const_cast<SotStorageStream*>(this)->TellEnd();
return nSize;
}
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index c5c8c13fb088..05027ed580b2 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -262,16 +262,11 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
::osl::MutexGuard aGuard( m_aMutex );
checkConnected();
- sal_uInt32 nCurrentPos = m_pSvStream->Tell();
checkError();
- m_pSvStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nEndPos = m_pSvStream->Tell();
- m_pSvStream->Seek(nCurrentPos);
+ sal_Int64 nEndPos = m_pSvStream->TellEnd();
- checkError();
-
- return static_cast<sal_Int64>(nEndPos);
+ return nEndPos;
}
@@ -2875,8 +2870,7 @@ bool UCBStorage::IsStorageFile( SvStream* pFile )
return false;
sal_uInt64 nPos = pFile->Tell();
- pFile->Seek( STREAM_SEEK_TO_END );
- if ( pFile->Tell() < 4 )
+ if ( pFile->TellEnd() < 4 )
return false;
pFile->Seek(0);
@@ -2905,8 +2899,7 @@ OUString UCBStorage::GetLinkedFile( SvStream &rStream )
{
OUString aString;
sal_uInt64 nPos = rStream.Tell();
- rStream.Seek( STREAM_SEEK_TO_END );
- if ( !rStream.Tell() )
+ if ( !rStream.TellEnd() )
return aString;
rStream.Seek(0);
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index e58f9d80b04d..b7ff3bd2206f 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -813,8 +813,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
{
SvMemoryStream aStream;
pPrinter->Store( aStream );
- aStream.Seek ( STREAM_SEEK_TO_END );
- sal_uInt32 nSize = aStream.Tell();
+ sal_uInt32 nSize = aStream.TellEnd();
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
Sequence < sal_Int8 > aSequence ( nSize );
aStream.ReadBytes(aSequence.getArray(), nSize);
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 );
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index c2f48fbbc5c6..90186df8e831 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -57,9 +57,7 @@ void XOutdevTest::testPdfGraphicExport()
// Assert that the output looks like a PDF.
SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
- pStream->Seek(STREAM_SEEK_TO_END);
- CPPUNIT_ASSERT(pStream->Tell() > 5);
- pStream->Seek(STREAM_SEEK_TO_BEGIN);
+ CPPUNIT_ASSERT(pStream->TellEnd() > 5);
sal_uInt8 sFirstBytes[5];
pStream->ReadBytes(sFirstBytes, 5);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('%'), sFirstBytes[0]);
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 3c68d0f1d5b1..8a39d7cf5635 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -191,8 +191,7 @@ void CompressGraphicsDialog::Update()
SvMemoryStream aMemStream;
aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
m_aGraphic.ExportNative(aMemStream);
- aMemStream.Seek( STREAM_SEEK_TO_END );
- sal_Int32 aNativeSize = aMemStream.Tell();
+ sal_Int32 aNativeSize = aMemStream.TellEnd();
OUString aNativeSizeString = SvxResId(STR_IMAGE_CAPACITY);
aNativeSizeString = aNativeSizeString.replaceAll("$(CAPACITY)", OUString::number(aNativeSize / 1024));
@@ -353,8 +352,7 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, CalculateClickHdl, weld::Button&, void
SvMemoryStream aMemStream;
aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
Compress( aMemStream );
- aMemStream.Seek( STREAM_SEEK_TO_END );
- aSize = aMemStream.Tell();
+ aSize = aMemStream.TellEnd();
}
if ( aSize > 0 )
diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx
index 0149b4de5e97..773b769a2678 100644
--- a/svx/source/gallery2/codec.cxx
+++ b/svx/source/gallery2/codec.cxx
@@ -61,8 +61,7 @@ void GalleryCodec::Write( SvStream& rStmToWrite )
{
sal_uInt32 nPos, nCompSize;
- rStmToWrite.Seek( STREAM_SEEK_TO_END );
- const sal_uInt32 nSize = rStmToWrite.Tell();
+ const sal_uInt32 nSize = rStmToWrite.TellEnd();
rStmToWrite.Seek( 0 );
rStm.WriteChar( 'S' ).WriteChar( 'V' ).WriteChar( 'R' ).WriteChar( 'L' ).WriteChar( 'E' ).WriteChar( '2' );
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index cb6eb4d80e3a..b45954fdbd0d 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -306,8 +306,7 @@ Graphic SvXMLGraphicOutputStream::GetGraphic()
sal_uInt8 sFirstBytes[ 2 ];
- mpOStm->Seek( STREAM_SEEK_TO_END );
- sal_uIntPtr nStreamLen = mpOStm->Tell();
+ sal_uIntPtr nStreamLen = mpOStm->TellEnd();
mpOStm->Seek( 0 );
if ( !nStreamLen )
@@ -316,8 +315,7 @@ Graphic SvXMLGraphicOutputStream::GetGraphic()
if ( pLockBytes )
pLockBytes->SetSynchronMode();
- mpOStm->Seek( STREAM_SEEK_TO_END );
- nStreamLen = mpOStm->Tell();
+ nStreamLen = mpOStm->TellEnd();
mpOStm->Seek( 0 );
}
if( nStreamLen >= 2 )
@@ -335,8 +333,7 @@ Graphic SvXMLGraphicOutputStream::GetGraphic()
if (aZCodec.EndCompression() && pDest )
{
- pDest->Seek( STREAM_SEEK_TO_END );
- sal_uIntPtr nStreamLen_ = pDest->Tell();
+ sal_uIntPtr nStreamLen_ = pDest->TellEnd();
if (nStreamLen_)
{
pDest->Seek(0);
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 718b73e3f412..640d7bb356f0 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -380,8 +380,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString, b
SAL_WARN("svx", "XOutBitmap::GraphicToBase64() invalid Graphic? error: " << nErr );
return false;
}
- aOStm.Seek(STREAM_SEEK_TO_END);
- css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.Tell() );
+ css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.TellEnd() );
OUStringBuffer aStrBuffer;
::comphelper::Base64::encode(aStrBuffer,aOStmSeq);
rOUString = aStrBuffer.makeStringAndClear();
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 861054868ec1..1c5effbac61b 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -356,9 +356,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aExpected("<reqif-xhtml:div><reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb"
"</reqif-xhtml:p>" SAL_NEWLINE_STRING);
@@ -444,9 +442,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml")
// "type" attribute was missing for the inner <object> element.
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1);
}
@@ -470,9 +466,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfPngImg, "reqif-png-img.xhtml")
// subset.
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:object") != -1);
@@ -487,9 +481,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfJpgImg, "reqif-jpg-img.xhtml")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
// This was image/jpeg, JPG was not converted to PNG in ReqIF mode.
CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1);
@@ -514,9 +506,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable2, "reqif-table2.odt")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
// This failed, <reqif-xhtml:td width="..."> was written.
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:td>") != -1);
@@ -526,9 +516,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfWellFormed, "reqif.odt")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
// This failed, <font face="..."> was written.
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:span style=\"font-family:") != -1);
@@ -540,9 +528,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfList, "reqif-list.xhtml")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
// This failed, <ul> was written.
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:ul>") != -1);
@@ -594,9 +580,7 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
- pStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt64 nLength = pStream->Tell();
- pStream->Seek(0);
+ sal_uInt64 nLength = pStream->TellEnd();
OString aStream(read_uInt8s_ToOString(*pStream, nLength));
// This failed, it was <li/>, i.e. list item was closed before content
// started.
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 8d00223b680f..288db677587c 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -97,7 +97,7 @@ bool SwServerObject::GetData( uno::Any & rData,
aMemStm.WriteChar( '\0' ); // append a zero char
rData <<= uno::Sequence< sal_Int8 >(
static_cast<sal_Int8 const *>(aMemStm.GetData()),
- aMemStm.Seek( STREAM_SEEK_TO_END ) );
+ aMemStm.Tell() );
bRet = true;
}
delete pPam;
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 183f32a148d3..a6b41a588aae 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -134,10 +134,8 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
// Calling the parser
ErrCode SwASCIIParser::CallParser()
{
- rInput.Seek(STREAM_SEEK_TO_END);
rInput.ResetError();
-
- nFileSize = rInput.Tell();
+ nFileSize = rInput.TellEnd();
rInput.Seek(STREAM_SEEK_TO_BEGIN);
rInput.ResetError();
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 316dc4516011..36bbdbafce18 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -1701,8 +1701,7 @@ bool SwHTMLParser::FileDownload( const OUString& rURL,
SvMemoryStream aStream;
aStream.WriteStream( *pStream );
- aStream.Seek( STREAM_SEEK_TO_END );
- rStr = OUString(static_cast<const sal_Char *>(aStream.GetData()), aStream.Tell(),
+ rStr = OUString(static_cast<const sal_Char *>(aStream.GetData()), aStream.TellEnd(),
GetSrcEncoding());
}
diff --git a/sw/source/filter/html/htmlreqifreader.cxx b/sw/source/filter/html/htmlreqifreader.cxx
index 3b5c2f65f4d9..cdc443f42cee 100644
--- a/sw/source/filter/html/htmlreqifreader.cxx
+++ b/sw/source/filter/html/htmlreqifreader.cxx
@@ -124,8 +124,7 @@ OString InsertOLE1Header(SvStream& rOle2, SvStream& rOle1)
rOle1.WriteUInt32(0);
// NativeDataSize
- rOle2.Seek(STREAM_SEEK_TO_END);
- rOle1.WriteUInt32(rOle2.Tell());
+ rOle1.WriteUInt32(rOle2.TellEnd());
// Write the actual native data.
rOle2.Seek(0);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index efbec3e6cf0a..05bcce08dfcf 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3829,8 +3829,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram
SvMemoryStream aStream;
if (GraphicConverter::Export(aStream, *pGraphic, ConvertDataFormat::PNG) != ERRCODE_NONE)
SAL_WARN("sw.rtf", "failed to export the graphic");
- aStream.Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nSize = aStream.Tell();
+ sal_uInt32 nSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType,
pGraphicAry, nSize, m_rExport));
@@ -3840,8 +3839,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram
SvMemoryStream aWmfStream;
if (GraphicConverter::Export(aWmfStream, *pGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
SAL_WARN("sw.rtf", "failed to export the graphic");
- aWmfStream.Seek(STREAM_SEEK_TO_END);
- nSize = aWmfStream.Tell();
+ nSize = aWmfStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aWmfStream.GetData());
m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType,
pGraphicAry, nSize, m_rExport));
@@ -3960,8 +3958,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
{
pBLIPType = (eGraphicType == GraphicType::Bitmap) ? OOO_STRING_SVTOOLS_RTF_PNGBLIP
: OOO_STRING_SVTOOLS_RTF_WMETAFILE;
- aStream.Seek(STREAM_SEEK_TO_END);
- nSize = aStream.Tell();
+ nSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
}
}
@@ -4079,8 +4076,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
if (GraphicConverter::Export(aStream, rGraphic, aConvertDestinationFormat) != ERRCODE_NONE)
SAL_WARN("sw.rtf", "failed to export the graphic");
pBLIPType = pConvertDestinationBLIPType;
- aStream.Seek(STREAM_SEEK_TO_END);
- nSize = aStream.Tell();
+ nSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize,
@@ -4098,8 +4094,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
SAL_WARN("sw.rtf", "failed to export the graphic");
pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
- aStream.Seek(STREAM_SEEK_TO_END);
- nSize = aStream.Tell();
+ nSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry,
@@ -4129,8 +4124,7 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic,
SvMemoryStream aStream;
if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::PNG) != ERRCODE_NONE)
SAL_WARN("sw.rtf", "failed to export the numbering picture bullet");
- aStream.Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nSize = aStream.Tell();
+ sal_uInt32 nSize = aStream.TellEnd();
pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
msfilter::rtfutil::WriteHex(pGraphicAry, nSize, &m_rExport.Strm());
m_rExport.Strm().WriteCharPtr("}}"); // pict, shppict
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 6d2ed207fff6..51ec0f3f638e 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -523,8 +523,7 @@ void RtfSdrExport::impl_writeGraphic()
// Export it to a stream.
SvMemoryStream aStream;
(void)GraphicConverter::Export(aStream, aGraphic, ConvertDataFormat::PNG);
- aStream.Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nSize = aStream.Tell();
+ sal_uInt32 nSize = aStream.TellEnd();
auto pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
Size aMapped(aGraphic.GetPrefSize());
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index c6dda312b4b1..ca6c7dc4db8f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3122,8 +3122,7 @@ namespace
ErrCode EncryptRC4(msfilter::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut)
{
- rIn.Seek(STREAM_SEEK_TO_END);
- sal_uLong nLen = rIn.Tell();
+ sal_uLong nLen = rIn.TellEnd();
rIn.Seek(0);
sal_uInt8 in[WW_BLOCKSIZE];
@@ -3793,8 +3792,7 @@ void WW8Export::RestoreMacroCmds()
if ( pStream && ERRCODE_NONE == pStream->GetError())
{
- pStream->Seek(STREAM_SEEK_TO_END);
- pFib->m_lcbCmds = pStream->Tell();
+ pFib->m_lcbCmds = pStream->TellEnd();
pStream->Seek(0);
std::unique_ptr<sal_uInt8[]> pBuffer( new sal_uInt8[pFib->m_lcbCmds] );
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 707953b16c5a..32638e8cd51e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1071,8 +1071,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
if (rSt.ReadBytes(aBuffer.data(), nBufferSize) == nBufferSize)
{
aMemStream.WriteBytes(aBuffer.data(), nBufferSize);
- aMemStream.Seek( STREAM_SEEK_TO_END );
- sal_uInt8 nStreamSize = aMemStream.Tell();
+ sal_uInt8 nStreamSize = aMemStream.TellEnd();
aMemStream.Seek( STREAM_SEEK_TO_BEGIN );
bool bRet = 4 <= nStreamSize;
if( bRet )
@@ -5466,8 +5465,7 @@ namespace
void DecryptRC4(msfilter::MSCodec97& rCtx, SvStream &rIn, SvStream &rOut)
{
- rIn.Seek(STREAM_SEEK_TO_END);
- const std::size_t nLen = rIn.Tell();
+ const std::size_t nLen = rIn.TellEnd();
rIn.Seek(0);
sal_uInt8 in[WW_BLOCKSIZE];
@@ -5484,9 +5482,7 @@ namespace
void DecryptXOR(msfilter::MSCodec_XorWord95 &rCtx, SvStream &rIn, SvStream &rOut)
{
std::size_t nSt = rIn.Tell();
- rIn.Seek(STREAM_SEEK_TO_END);
- std::size_t nLen = rIn.Tell();
- rIn.Seek(nSt);
+ std::size_t nLen = rIn.TellEnd();
rCtx.InitCipher();
rCtx.Skip(nSt);
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0200cc99e4b9..569912912c0d 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6264,9 +6264,7 @@ void WW8Fib::WriteHeader(SvStream& rStrm)
sal_uInt8 *pData = pDataPtr.get();
memset( pData, 0, nUnencryptedHdr );
- const sal_uInt64 nPos = rStrm.Tell();
- m_cbMac = rStrm.Seek( STREAM_SEEK_TO_END );
- rStrm.Seek(nPos);
+ m_cbMac = rStrm.TellEnd();
Set_UInt16( pData, m_wIdent );
Set_UInt16( pData, m_nFib );
@@ -6351,9 +6349,7 @@ void WW8Fib::Write(SvStream& rStrm)
sal_uInt8 *pData = pDataPtr.get();
memset( pData, 0, m_fcMin - nUnencryptedHdr );
- const sal_uInt64 nPos = rStrm.Tell();
- m_cbMac = rStrm.Seek( STREAM_SEEK_TO_END );
- rStrm.Seek(nPos);
+ m_cbMac = rStrm.TellEnd();
// ignore 2 longs, because they are unimportant
pData += 2 * sizeof( sal_Int32);
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx
index 9768744eeca6..c5ccb9a3c16d 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -694,8 +694,7 @@ uno::Any SwMailTransferable::getTransferData( const datatransfer::DataFlavor& /*
SvStream* pStream = aMedium.GetInStream();
if ( aMedium.GetErrorCode() == ERRCODE_NONE && pStream)
{
- pStream->Seek(STREAM_SEEK_TO_END);
- aData.realloc(pStream->Tell());
+ aData.realloc(pStream->TellEnd());
pStream->Seek(0);
sal_Int8 * pData = aData.getArray();
pStream->ReadBytes( pData, aData.getLength() );
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 12ac99b6fbcd..37caae8f406d 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -1021,8 +1021,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
{
SvMemoryStream aStream;
pPrinter->Store( aStream );
- aStream.Seek ( STREAM_SEEK_TO_END );
- sal_uInt32 nSize = aStream.Tell();
+ sal_uInt32 nSize = aStream.TellEnd();
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
Sequence < sal_Int8 > aSequence( nSize );
aStream.ReadBytes(aSequence.getArray(), nSize);
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
index bcc365d961b1..97d05180b020 100644
--- a/unotools/source/streaming/streamwrap.cxx
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -177,16 +177,11 @@ sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength( )
::osl::MutexGuard aGuard( m_aMutex );
checkConnected();
- sal_uInt32 nCurrentPos = m_pSvStream->Tell();
checkError();
- m_pSvStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nEndPos = m_pSvStream->Tell();
- m_pSvStream->Seek(nCurrentPos);
+ sal_Int64 nEndPos = m_pSvStream->TellEnd();
- checkError();
-
- return static_cast<sal_Int64>(nEndPos);
+ return nEndPos;
}
//= OOutputStreamWrapper
@@ -268,16 +263,11 @@ sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getPosition( )
sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getLength( )
{
- sal_uInt32 nCurrentPos = rStream.Tell();
checkError();
- rStream.Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nEndPos = rStream.Tell();
- rStream.Seek(nCurrentPos);
-
- checkError();
+ sal_Int64 nEndPos = rStream.TellEnd();
- return static_cast<sal_Int64>(nEndPos);
+ return nEndPos;
}
OStreamWrapper::~OStreamWrapper() = default;
diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx
index 5437044b8586..8bfe8b14a009 100644
--- a/unotools/source/ucbhelper/xtempfile.cxx
+++ b/unotools/source/ucbhelper/xtempfile.cxx
@@ -338,16 +338,11 @@ sal_Int64 SAL_CALL OTempFileService::getLength( )
::osl::MutexGuard aGuard( maMutex );
checkConnected();
- sal_uInt32 nCurrentPos = mpStream->Tell();
checkError();
- mpStream->Seek(STREAM_SEEK_TO_END);
- sal_uInt32 nEndPos = mpStream->Tell();
- mpStream->Seek(nCurrentPos);
+ sal_Int64 nEndPos = mpStream->TellEnd();
- checkError();
-
- return static_cast<sal_Int64>(nEndPos);
+ return nEndPos;
}
// XStream
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 5eb59e3eac9e..54757b008881 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -88,8 +88,7 @@ css::uno::Any TETextDataObject::getTransferData( const css::datatransfer::DataFl
}
else if ( nT == SotClipboardFormatId::HTML )
{
- GetHTMLStream().Seek( STREAM_SEEK_TO_END );
- sal_uLong nLen = GetHTMLStream().Tell();
+ sal_uLong nLen = GetHTMLStream().TellEnd();
GetHTMLStream().Seek(0);
css::uno::Sequence< sal_Int8 > aSeq( nLen );
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 6cd6043dba9e..6eaccfbc37ee 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -244,10 +244,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension,
sal_uInt8 sFirstBytes[ 256 ];
sal_uLong nFirstLong(0), nSecondLong(0);
sal_uLong nStreamPos = rStream.Tell();
-
- rStream.Seek( STREAM_SEEK_TO_END );
- sal_uLong nStreamLen = rStream.Tell() - nStreamPos;
- rStream.Seek( nStreamPos );
+ sal_uLong nStreamLen = rStream.remainingSize();
if ( !nStreamLen )
{
@@ -255,9 +252,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension,
if ( pLockBytes )
pLockBytes->SetSynchronMode();
- rStream.Seek( STREAM_SEEK_TO_END );
- nStreamLen = rStream.Tell() - nStreamPos;
- rStream.Seek( nStreamPos );
+ nStreamLen = rStream.remainingSize();
}
if (!nStreamLen)
@@ -1448,7 +1443,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream)
ErrCode nStatus = ImpTestOrFindFormat("", rIStream, nFormat);
rIStream.Seek(nStreamBegin);
- const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamBegin);
+ const sal_uInt32 nStreamLength(rIStream.remainingSize());
OUString aFilterName = pConfig->GetImportFilterName(nFormat);
OUString aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
@@ -1849,14 +1844,13 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVG ) )
{
const sal_uInt32 nStreamPosition(rIStream.Tell());
- const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition);
+ const sal_uInt32 nStreamLength(rIStream.remainingSize());
bool bOkay(false);
if(nStreamLength > 0)
{
std::vector<sal_uInt8> aTwoBytes(2);
- rIStream.Seek(nStreamPosition);
rIStream.ReadBytes(&aTwoBytes[0], 2);
rIStream.Seek(nStreamPosition);
@@ -1892,7 +1886,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
else
{
VectorGraphicDataArray aNewData(nStreamLength);
- rIStream.Seek(nStreamPosition);
rIStream.ReadBytes(aNewData.begin(), nStreamLength);
if(!rIStream.GetError())
@@ -1957,12 +1950,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
// Graphic that contains the original data and decomposes to
// primitives on demand
- const sal_uInt32 nStreamPosition(rIStream.Tell());
- const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition);
+ const sal_uInt32 nStreamLength(rIStream.remainingSize());
VectorGraphicDataArray aNewData(nStreamLength);
bool bOkay(false);
- rIStream.Seek(nStreamPosition);
rIStream.ReadBytes(aNewData.begin(), nStreamLength);
if (!rIStream.GetError())
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index c74bcbbade84..09cafdea9f45 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2638,8 +2638,7 @@ void PDFObjectElement::ParseStoredObjects()
return;
}
- aStream.Seek(STREAM_SEEK_TO_END);
- nLength = aStream.Tell();
+ nLength = aStream.TellEnd();
aStream.Seek(0);
std::vector<size_t> aObjNums;
std::vector<size_t> aOffsets;
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 0f14529eec5c..9815e89a1a2b 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -231,8 +231,7 @@ bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex,
if (!getCompatibleStream(rStream, aMemoryStream, nPos, nSize))
return false;
- aMemoryStream.Seek(STREAM_SEEK_TO_END);
- rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.Tell());
+ rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.TellEnd());
aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength());
@@ -267,8 +266,7 @@ size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& rBitmaps,
if (!getCompatibleStream(*xStream, aMemoryStream, STREAM_SEEK_TO_BEGIN, STREAM_SEEK_TO_END))
return 0;
- aMemoryStream.Seek(STREAM_SEEK_TO_END);
- rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.Tell());
+ rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.TellEnd());
aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength());
diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx
index c695a3a92983..725ebe1ae27e 100644
--- a/vcl/source/filter/jpeg/Exif.cxx
+++ b/vcl/source/filter/jpeg/Exif.cxx
@@ -87,8 +87,7 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue)
sal_uInt16 aMagic16;
sal_uInt16 aLength;
- rStream.Seek(STREAM_SEEK_TO_END);
- sal_uInt32 aSize = rStream.Tell();
+ sal_uInt32 aSize = rStream.TellEnd();
rStream.Seek(STREAM_SEEK_TO_BEGIN);
rStream.SetEndian( SvStreamEndian::BIG );
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index 4bc8d11a6a01..05939e734483 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -31,7 +31,7 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF )
// is nice enough to copy to an own MemStream to avoid that indirect
// parameter passing...)
const sal_uInt32 nStreamStart(rStream.Tell());
- const sal_uInt32 nStreamEnd(rStream.Seek(STREAM_SEEK_TO_END));
+ const sal_uInt32 nStreamEnd(rStream.TellEnd());
if (nStreamStart >= nStreamEnd)
{
@@ -41,7 +41,6 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF )
// Read binary data to mem array
const sal_uInt32 nStreamLength(nStreamEnd - nStreamStart);
VectorGraphicDataArray aNewData(nStreamLength);
- rStream.Seek(nStreamStart);
rStream.ReadBytes(aNewData.begin(), nStreamLength);
rStream.Seek(nStreamStart);
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 7420e65bcdce..1f9f610f14ef 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -238,7 +238,7 @@ namespace
"XPATHSTROKE_SEQ_BEGIN",
0,
static_cast< const sal_uInt8* >(aMemStm.GetData()),
- aMemStm.Seek(STREAM_SEEK_TO_END)));
+ aMemStm.TellEnd()));
}
void addSvtGraphicFill(const SvtGraphicFill &rFilling, GDIMetaFile& rTarget)
@@ -251,7 +251,7 @@ namespace
"XPATHFILL_SEQ_BEGIN",
0,
static_cast< const sal_uInt8* >(aMemStm.GetData()),
- aMemStm.Seek(STREAM_SEEK_TO_END)));
+ aMemStm.TellEnd()));
}
} // end of anonymous namespace
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 0a25d2fd8120..150a85877809 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2066,8 +2066,7 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream )
{
if (!g_bDebugDisableCompression)
{
- pStream->Seek( STREAM_SEEK_TO_END );
- sal_uLong nEndPos = pStream->Tell();
+ sal_uLong nEndPos = pStream->TellEnd();
pStream->Seek( STREAM_SEEK_TO_BEGIN );
ZCodec aCodec( 0x4000, 0x4000 );
SvMemoryStream aStream;
@@ -2758,8 +2757,7 @@ bool PDFWriterImpl::emitTilings()
tiling.m_aCellSize.setHeight( nH );
bool bDeflate = compressStream( tiling.m_pTilingStream.get() );
- tiling.m_pTilingStream->Seek( STREAM_SEEK_TO_END );
- sal_uInt64 const nTilingStreamSize = tiling.m_pTilingStream->Tell();
+ sal_uInt64 const nTilingStreamSize = tiling.m_pTilingStream->TellEnd();
tiling.m_pTilingStream->Seek( STREAM_SEEK_TO_BEGIN );
// write pattern object
@@ -4535,8 +4533,7 @@ bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDi
bool bDeflate = compressStream( pApppearanceStream );
- pApppearanceStream->Seek( STREAM_SEEK_TO_END );
- sal_Int64 nStreamLen = pApppearanceStream->Tell();
+ sal_Int64 nStreamLen = pApppearanceStream->TellEnd();
pApppearanceStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_Int32 nObject = createObject();
CHECK_RETURN( updateObject( nObject ) );
@@ -8524,8 +8521,7 @@ void PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
CHECK_RETURN2( updateObject( rObject.m_nObject ) );
bool bFlateFilter = compressStream( rObject.m_pContentStream.get() );
- rObject.m_pContentStream->Seek( STREAM_SEEK_TO_END );
- sal_uLong nSize = rObject.m_pContentStream->Tell();
+ sal_uLong nSize = rObject.m_pContentStream->TellEnd();
rObject.m_pContentStream->Seek( STREAM_SEEK_TO_BEGIN );
if (g_bDebugDisableCompression)
{
@@ -8609,8 +8605,7 @@ void PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
}
else
{
- rObject.m_pSoftMaskStream->Seek( STREAM_SEEK_TO_END );
- sal_Int32 nMaskSize = static_cast<sal_Int32>(rObject.m_pSoftMaskStream->Tell());
+ sal_Int32 nMaskSize = static_cast<sal_Int32>(rObject.m_pSoftMaskStream->TellEnd());
rObject.m_pSoftMaskStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_Int32 nMaskObject = createObject();
aLine.append( "/SMask<</Type/Mask/S/Luminosity/G " );
@@ -8882,9 +8877,7 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject )
CHECK_RETURN2( rObject.m_pStream );
CHECK_RETURN2( updateObject( rObject.m_nObject ) );
- sal_Int32 nLength = 0;
- rObject.m_pStream->Seek( STREAM_SEEK_TO_END );
- nLength = rObject.m_pStream->Tell();
+ sal_Int32 nLength = rObject.m_pStream->TellEnd();
rObject.m_pStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_Int32 nMaskObject = 0;
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index a4ce58af0e20..7636569fd8fb 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -181,8 +181,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aTemp.SetCompressMode( aTemp.GetCompressMode() | SvStreamCompressFlags::ZBITMAP );
aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
WriteDIBBitmapEx(aBitmapEx, aTemp); // is capable of zlib stream compression
- aTemp.Seek( STREAM_SEEK_TO_END );
- nZippedFileSize = aTemp.Tell();
+ nZippedFileSize = aTemp.TellEnd();
}
if ( aBitmapEx.IsTransparent() )
{
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index b1c1e28b8384..78e3a19c7381 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -229,10 +229,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
maChunkIter = maChunkSeq.begin();
// estimate PNG file size (to allow sanity checks)
- const std::size_t nStreamPos = mrPNGStream.Tell();
- mrPNGStream.Seek( STREAM_SEEK_TO_END );
- mnStreamSize = mrPNGStream.Tell();
- mrPNGStream.Seek( nStreamPos );
+ mnStreamSize = mrPNGStream.TellEnd();
// check the PNG header magic
sal_uInt32 nDummy = 0;
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 82823b8152b1..ef0fd14c0149 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -818,8 +818,7 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
rFilter.GetExportFormatNumberForShortName( OUString::createFromAscii( pFilterShortName ) ),
( aFilterDataSeq.getLength() ? &aFilterDataSeq : nullptr ) );
}
- aMemStrm.Seek( STREAM_SEEK_TO_END );
- pOStm->WriteBytes( aMemStrm.GetData(), aMemStrm.Tell() );
+ pOStm->WriteBytes( aMemStrm.GetData(), aMemStrm.TellEnd() );
}
}
}
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index aa2f0eeab396..e504e5d7aef0 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -988,7 +988,7 @@ void GtkSalMenu::NativeSetItemIcon( unsigned nSection, unsigned nItemPos, const
aWriter.Write(*pMemStm);
GBytes *pBytes = g_bytes_new_with_free_func(pMemStm->GetData(),
- pMemStm->Seek(STREAM_SEEK_TO_END),
+ pMemStm->TellEnd(),
DestroyMemoryStream,
pMemStm);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index dd69aad8ad98..4fa46987cb68 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1611,7 +1611,7 @@ namespace
{
GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()),
- xMemStm->Seek(STREAM_SEEK_TO_END), nullptr);
+ xMemStm->TellEnd(), nullptr);
gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
if (pixbuf)
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index 8d5a0d0d2513..bb281b10be88 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -58,9 +58,7 @@ uno::Reference< io::XInputStream > SAL_CALL UriBindingHelper::getUriBinding( con
else
{
SvFileStream* pStream = new SvFileStream( uri, StreamMode::READ );
- pStream->Seek( STREAM_SEEK_TO_END );
- sal_uLong nBytes = pStream->Tell();
- pStream->Seek( STREAM_SEEK_TO_BEGIN );
+ sal_uLong nBytes = pStream->TellEnd();
SvLockBytesRef xLockBytes = new SvLockBytes( pStream, true );
xInputStream = new utl::OInputStreamHelper( xLockBytes, nBytes );
}