extensions/source/scanner/sanedlg.cxx        |    3 +--
 filter/source/msfilter/svdfppt.cxx           |    3 +--
 sc/qa/extras/scpdfexport.cxx                 |    3 +--
 sc/source/filter/xcl97/XclImpChangeTrack.cxx |    3 +--
 sfx2/source/doc/oleprops.cxx                 |    3 +--
 sw/source/filter/ww8/ww8par4.cxx             |    6 ++----
 tools/source/stream/stream.cxx               |    6 +-----
 vcl/source/treelist/transfer.cxx             |    6 +++---
 8 files changed, 11 insertions(+), 22 deletions(-)

New commits:
commit 7af0f1514407660a43cde90320bbe00c36c3be28
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jun 19 13:52:40 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jun 19 18:13:52 2021 +0200

    use more TellEnd()
    
    which has the potential to be more efficient than STREAM_SEEK_TO_END
    
    Change-Id: I64d84632bc4751e07309332c9dff7a02bcd507fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117496
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/extensions/source/scanner/sanedlg.cxx 
b/extensions/source/scanner/sanedlg.cxx
index d13ebcc53da9..87c17e56fe78 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -871,8 +871,7 @@ void SaneDlg::AcquirePreview()
     else
     {
 #if OSL_DEBUG_LEVEL > 0
-        xTransporter->getStream().Seek( STREAM_SEEK_TO_END );
-        SAL_INFO("extensions.scanner", "Previewbitmapstream contains " << 
xTransporter->getStream().Tell() << "bytes");
+        SAL_INFO("extensions.scanner", "Previewbitmapstream contains " << 
xTransporter->getStream().TellEnd() << "bytes");
 #endif
         xTransporter->getStream().Seek( STREAM_SEEK_TO_BEGIN );
         mxPreview->SetBitmap(xTransporter->getStream());
diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index bcf243b3f920..df873c2bf122 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1318,8 +1318,7 @@ SdrPowerPointImport::SdrPowerPointImport( 
PowerPointImportParam& rParam, const O
 {
     if ( m_bOk )
     {
-        rStCtrl.Seek( STREAM_SEEK_TO_END );
-        nStreamLen = rStCtrl.Tell();
+        nStreamLen = rStCtrl.TellEnd();
 
         // try to allocate the UserEditAtom via CurrentUserAtom
         sal_uInt32 nCurrentUserEdit = rParam.aCurrentUserAtom.nCurrentUserEdit;
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index b98ee774b7ee..6dfa426fddc0 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -138,8 +138,7 @@ bool ScPDFExportTest::hasTextInPdf(const 
std::shared_ptr<utl::TempFile>& pPDFFil
     CPPUNIT_ASSERT(pStream);
 
     // get file size
-    pStream->Seek(STREAM_SEEK_TO_END);
-    const std::size_t nFileSize = pStream->Tell();
+    const std::size_t nFileSize = pStream->TellEnd();
     if (nFileSize == 0)
         return false;
 
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx 
b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index e3451aca4001..74b60da2208b 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -52,8 +52,7 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& 
rRoot, const XclImpStrea
     if( !xInStrm.is() )
         return;
 
-    xInStrm->Seek( STREAM_SEEK_TO_END );
-    sal_uInt64 const nStreamLen = xInStrm->Tell();
+    sal_uInt64 const nStreamLen = xInStrm->TellEnd();
     if( (xInStrm->GetErrorCode() == ERRCODE_NONE) && (nStreamLen != 
STREAM_SEEK_TO_END) )
     {
         xInStrm->Seek( STREAM_SEEK_TO_BEGIN );
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index ee1927522e05..6de4aace5c99 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -1018,8 +1018,7 @@ void SfxOleSection::ImplSave( SvStream& rStrm )
         SaveProperty( rStrm, *prop.second, nPropPosPos );
 
     // write section size (first field in section header)
-    rStrm.Seek( STREAM_SEEK_TO_END );
-    sal_uInt32 nSectSize = static_cast< sal_uInt32 >( rStrm.Tell() - 
mnStartPos );
+    sal_uInt32 nSectSize = static_cast< sal_uInt32 >( rStrm.TellEnd() - 
mnStartPos );
     rStrm.Seek( mnStartPos );
     rStrm.WriteUInt32( nSectSize );
 }
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 6c72ed5321eb..e7e559d586a4 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -84,9 +84,8 @@ static bool SwWw8ReadScaling(tools::Long& rX, tools::Long& 
rY, tools::SvRef<SotS
         StreamMode::STD_READ );
     SotStorageStream* pS = xSrc3.get();
     pS->SetEndian( SvStreamEndian::LITTLE );
-    pS->Seek( STREAM_SEEK_TO_END );
 
-    OSL_ENSURE( pS->Tell() >=  76, "+OLE-PIC-Stream is shorter than 76 Byte" );
+    OSL_ENSURE( pS->TellEnd() >=  76, "+OLE-PIC-Stream is shorter than 76 
Byte" );
 
     sal_Int32 nOrgWidth,
           nOrgHeight,
@@ -406,9 +405,8 @@ SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph,
         if (bOleOk)
         {
             sal_uLong nOldPos = m_pDataStream->Tell();
-            m_pDataStream->Seek(STREAM_SEEK_TO_END);
             SvStream *pTmpData = nullptr;
-            if (m_nObjLocFc < m_pDataStream->Tell())
+            if (m_nObjLocFc < m_pDataStream->TellEnd())
             {
                 pTmpData = m_pDataStream;
                 pTmpData->Seek( m_nObjLocFc );
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 7ea8b205ff5b..04ddd2cba111 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -254,11 +254,7 @@ ErrCode SvLockBytes::Stat(SvLockBytesStat * pStat) const
     }
 
     if (pStat)
-    {
-        sal_uInt64 const nPos = m_pStream->Tell();
-        pStat->nSize = m_pStream->Seek(STREAM_SEEK_TO_END);
-        m_pStream->Seek(nPos);
-    }
+        pStat->nSize = m_pStream->TellEnd();
     return ERRCODE_NONE;
 }
 
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index a917973e1122..e2d04e877198 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -740,7 +740,7 @@ bool TransferableHelper::SetGraphic( const Graphic& 
rGraphic )
         TypeSerializer aSerializer(aMemStm);
         aSerializer.writeGraphic(rGraphic);
 
-        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();
@@ -753,7 +753,7 @@ bool TransferableHelper::SetImageMap( const ImageMap& rIMap 
)
 
     aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
     rIMap.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();
 }
@@ -868,7 +868,7 @@ bool TransferableHelper::SetINetImage( const INetImage& 
rINtImg,
     aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
     rINtImg.Write( aMemStm, SotExchange::GetFormat( rFlavor ) );
 
-    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();
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to