diff options
-rw-r--r-- | connectivity/source/drivers/dbase/DIndex.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DIndexes.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FTable.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DIndex.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DTable.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/file/FTable.hxx | 4 |
7 files changed, 13 insertions, 21 deletions
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index e07402af2198..9468c3d3ad25 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -310,11 +310,7 @@ void ODbaseIndex::Release(bool bSave) void ODbaseIndex::closeImpl() { - if(m_pFileStream) - { - delete m_pFileStream; - m_pFileStream = nullptr; - } + m_pFileStream.reset(); } ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, bool bLoad) diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index ee6a12f1906d..643c67eeee40 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -52,7 +52,7 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const OUString& _rName) } sdbcx::ObjectType xRet; - SvStream* pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE); + std::unique_ptr<SvStream> pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE); if(pFileStream) { pFileStream->SetEndian(SvStreamEndian::LITTLE); @@ -61,7 +61,7 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const OUString& _rName) pFileStream->Seek(0); ReadHeader(*pFileStream, aHeader); - delete pFileStream; + pFileStream.reset(); ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName); xRet = pIndex; diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 9bcec1816b39..87be422f133c 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -978,8 +978,7 @@ void ODbaseTable::FileClose() if (m_pMemoStream && m_pMemoStream->IsWritable()) m_pMemoStream->Flush(); - delete m_pMemoStream; - m_pMemoStream = nullptr; + m_pMemoStream.reset(); ODbaseTable_BASE::FileClose(); } @@ -1383,8 +1382,7 @@ bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile) (*m_pMemoStream).WriteUInt32( 1 ); // pointer to the first free block m_pMemoStream->Flush(); - delete m_pMemoStream; - m_pMemoStream = nullptr; + m_pMemoStream.reset(); return true; } diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 9ddadb19b86e..6358874f93f7 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -155,8 +155,7 @@ void OFileTable::FileClose() if (m_pFileStream && m_pFileStream->IsWritable()) m_pFileStream->Flush(); - delete m_pFileStream; - m_pFileStream = nullptr; + m_pFileStream.reset(); if (m_pBuffer) { @@ -191,13 +190,12 @@ void OFileTable::dropColumn(sal_Int32 /*_nPos*/) } -SvStream* OFileTable::createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode) +std::unique_ptr<SvStream> OFileTable::createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode) { - SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, bool(_eOpenMode & StreamMode::NOCREATE)); + std::unique_ptr<SvStream> pReturn(::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, bool(_eOpenMode & StreamMode::NOCREATE))); if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode())) { - delete pReturn; - pReturn = nullptr; + pReturn.reset(); } return pReturn; } diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index 6e4356c4c3ee..bcb273aec506 100644 --- a/connectivity/source/inc/dbase/DIndex.hxx +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -68,7 +68,7 @@ namespace connectivity }; private: - SvStream* m_pFileStream; // Stream to read/write the index + std::unique_ptr<SvStream> m_pFileStream; // Stream to read/write the index NDXHeader m_aHeader; std::vector<ONDXPage*> m_aCollector; // Pool of obsolete pages diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 962a66a48f63..1a1e45c64e99 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -107,7 +107,7 @@ namespace connectivity std::vector<sal_Int32> m_aRealFieldLengths; DBFHeader m_aHeader; DBFMemoHeader m_aMemoHeader; - SvStream* m_pMemoStream; + std::unique_ptr<SvStream> m_pMemoStream; rtl_TextEncoding m_eEncoding; void alterColumn(sal_Int32 index, diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx index a13437a052fd..3495c79c24c9 100644 --- a/connectivity/source/inc/file/FTable.hxx +++ b/connectivity/source/inc/file/FTable.hxx @@ -39,7 +39,7 @@ namespace connectivity { protected: OConnection* m_pConnection; - SvStream* m_pFileStream; + std::unique_ptr<SvStream> m_pFileStream; ::rtl::Reference<OSQLColumns> m_aColumns; sal_Int32 m_nFilePos; // current IResultSetHelper::Movement sal_uInt8* m_pBuffer; @@ -100,7 +100,7 @@ namespace connectivity // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified // (NULL or non-NULL is returned) - static SvStream* createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode); + static std::unique_ptr<SvStream> createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode); }; } } |