summaryrefslogtreecommitdiff
path: root/basic
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 /basic
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>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basmgr.cxx6
-rw-r--r--basic/source/runtime/methods.cxx4
2 files changed, 4 insertions, 6 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) );
}
}