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 /connectivity/source | |
parent | loplugin:constfields in oox (diff) | |
download | core-9ec8bf8f22fe74884185492ef2576ce79b41e4f1.tar.gz core-9ec8bf8f22fe74884185492ef2576ce79b41e4f1.zip |
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 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 2 |
2 files changed, 5 insertions, 6 deletions
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); |