diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-24 12:08:25 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-27 05:17:31 +0000 |
commit | cea4c1afdf4ae0cbda8ae531f2e26d911d0fd6e1 (patch) | |
tree | 5ad5d293e20d8da27a2918a6877c5377b10278ba /basic | |
parent | loplugin:singlevalfields in vcl(part2) (diff) | |
download | core-cea4c1afdf4ae0cbda8ae531f2e26d911d0fd6e1.tar.gz core-cea4c1afdf4ae0cbda8ae531f2e26d911d0fd6e1.zip |
loplugin:singlevalfields in basic and fix leak
And fix leak in BasicManagerImpl where it would never have freed
the streams.
Change-Id: I1e99c2c6a70a8cac27dd5c86a7042efc3de7a578
Reviewed-on: https://gerrit.libreoffice.org/26632
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/inc/sbprop.hxx | 1 | ||||
-rw-r--r-- | basic/qa/cppunit/basic_coverage.cxx | 4 | ||||
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 17 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 1 | ||||
-rw-r--r-- | basic/source/comp/scanner.cxx | 1 | ||||
-rw-r--r-- | basic/source/inc/scanner.hxx | 1 |
6 files changed, 5 insertions, 20 deletions
diff --git a/basic/inc/sbprop.hxx b/basic/inc/sbprop.hxx index 09138ae84163..fbeb1386d2f9 100644 --- a/basic/inc/sbprop.hxx +++ b/basic/inc/sbprop.hxx @@ -32,7 +32,6 @@ class BASIC_DLLPUBLIC SbProperty : public SbxProperty friend class SbModule; friend class SbProcedureProperty; SbModule* pMod; - bool bInvalid; BASIC_DLLPRIVATE SbProperty( const OUString&, SbxDataType, SbModule* ); virtual ~SbProperty(); public: diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx index 275fdb928e1d..39a8ebc5ba2b 100644 --- a/basic/qa/cppunit/basic_coverage.cxx +++ b/basic/qa/cppunit/basic_coverage.cxx @@ -21,7 +21,6 @@ class Coverage : public test::BootstrapFixture { private: int m_nb_tests_ok; - int m_nb_tests_skipped; OUString m_sCurrentTest; void process_directory(const OUString& sDirName); void run_test(const OUString& sFileName); @@ -48,13 +47,12 @@ public: Coverage::Coverage() : BootstrapFixture(true, false) , m_nb_tests_ok(0) - , m_nb_tests_skipped(0) { } Coverage::~Coverage() { - fprintf(stderr,"basic coverage Summary : skipped:%d pass:%d\n", m_nb_tests_skipped, m_nb_tests_ok ); + fprintf(stderr,"basic coverage Summary : pass:%d\n", m_nb_tests_ok ); } void Coverage::test_failed() diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 918d61d5e5be..aeba2e6d73b3 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -34,6 +34,7 @@ #include <unotools/intlwrapper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <o3tl/make_unique.hxx> #include <basic/sbuno.hxx> #include <basic/basmgr.hxx> @@ -107,16 +108,13 @@ struct BasicManagerImpl // Save stream data SvMemoryStream* mpManagerStream; - SvMemoryStream** mppLibStreams; - sal_Int32 mnLibStreamCount; + std::vector<std::unique_ptr<SvMemoryStream>> maLibStreams; std::vector<std::unique_ptr<BasicLibInfo>> aLibs; OUString aBasicLibPath; BasicManagerImpl() : mpManagerStream( nullptr ) - , mppLibStreams( nullptr ) - , mnLibStreamCount( 0 ) {} ~BasicManagerImpl(); }; @@ -124,12 +122,6 @@ struct BasicManagerImpl BasicManagerImpl::~BasicManagerImpl() { delete mpManagerStream; - if( mppLibStreams ) - { - for( sal_Int32 i = 0 ; i < mnLibStreamCount ; i++ ) - delete mppLibStreams[i]; - delete[] mppLibStreams; - } } @@ -539,13 +531,12 @@ BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, Star if( xBasicStorage.Is() && !xBasicStorage->GetError() ) { sal_uInt16 nLibs = GetLibCount(); - mpImpl->mppLibStreams = new SvMemoryStream*[ nLibs ]; for( sal_uInt16 nL = 0; nL < nLibs; nL++ ) { BasicLibInfo& rInfo = *mpImpl->aLibs[nL]; tools::SvRef<SotStorageStream> xBasicStream = xBasicStorage->OpenSotStream( rInfo.GetLibName(), eStreamReadMode ); - mpImpl->mppLibStreams[nL] = new SvMemoryStream(); - xBasicStream->ReadStream( *( mpImpl->mppLibStreams[nL] ) ); + mpImpl->maLibStreams.push_back(o3tl::make_unique<SvMemoryStream>()); + xBasicStream->ReadStream( *mpImpl->maLibStreams.back() ); } } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 7970f04b79b6..f36b9bfee42c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2719,7 +2719,6 @@ SbUserFormModule::Find( const OUString& rName, SbxClassType t ) SbProperty::SbProperty( const OUString& r, SbxDataType t, SbModule* p ) : SbxProperty( r, t ), pMod( p ) { - bInvalid = false; } SbProperty::~SbProperty() diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 6dfe2c589bbf..968458f696a8 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -31,7 +31,6 @@ SbiScanner::SbiScanner( const OUString& rBuf, StarBASIC* p ) : aBuf( rBuf ) eScanType = SbxVARIANT; nErrors = 0; nBufPos = 0; - nCurCol1 = 0; nSavedCol1 = 0; nColLock = 0; nLine = 0; diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx index d17337ea30c6..a7f1377d7bc1 100644 --- a/basic/source/inc/scanner.hxx +++ b/basic/source/inc/scanner.hxx @@ -45,7 +45,6 @@ protected: OUString aError; SbxDataType eScanType; double nVal; // numeric value - sal_Int32 nCurCol1; sal_Int32 nSavedCol1; sal_Int32 nCol; sal_Int32 nErrors; |