[Libreoffice-commits] core.git: jvmfwk/source l10ntools/inc l10ntools/source linguistic/source oox/inc oox/source reportdesign/source sax/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jan 17 06:42:17 UTC 2017


 jvmfwk/source/elements.cxx                       |    1 -
 l10ntools/inc/export.hxx                         |    4 ++--
 l10ntools/inc/po.hxx                             |    2 +-
 l10ntools/source/merge.cxx                       |    1 -
 l10ntools/source/po.cxx                          |    1 -
 linguistic/source/misc.cxx                       |    7 +++----
 oox/inc/drawingml/chart/datasourcecontext.hxx    |    5 +++--
 oox/source/drawingml/chart/datasourcecontext.cxx |    7 +++----
 reportdesign/source/core/sdr/ModuleHelper.cxx    |    7 +++----
 sax/source/expatwrap/sax_expat.cxx               |   16 ++++------------
 sax/source/expatwrap/saxwriter.cxx               |   11 +++--------
 11 files changed, 22 insertions(+), 40 deletions(-)

New commits:
commit 90df5ee10727719aa1407ed4d1f06d7a790d6871
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 14:16:55 2017 +0200

    new loplugin: useuniqueptr: jvmfwk..sax
    
    Change-Id: I732e2e22c6f953f0982fbc8833453e7c23cf9d49
    Reviewed-on: https://gerrit.libreoffice.org/33166
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 452ae31..b5846f1 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -174,7 +174,6 @@ VersionInfo::VersionInfo(): arVersions(nullptr)
 
 VersionInfo::~VersionInfo()
 {
-    delete [] arVersions;
 }
 
 void VersionInfo::addExcludeVersion(const OUString& sVersion)
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 220259c..d04d85c 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -282,13 +282,13 @@ class MergeData
 public:
     OString sGID;
     OString sLID;
-    MergeEntrys* pMergeEntrys;
+    std::unique_ptr<MergeEntrys> pMergeEntrys;
 private:
     MergeDataHashMap::iterator m_aNextData;
 public:
     MergeData( const OString &rGID, const OString &rLID );
     ~MergeData();
-    MergeEntrys* GetMergeEntries() { return pMergeEntrys;}
+    MergeEntrys* GetMergeEntries() { return pMergeEntrys.get();}
 
 };
 
diff --git a/l10ntools/inc/po.hxx b/l10ntools/inc/po.hxx
index ce1443d..52c644f 100644
--- a/l10ntools/inc/po.hxx
+++ b/l10ntools/inc/po.hxx
@@ -78,7 +78,7 @@ class PoHeader
 {
 private:
 
-    GenPoEntry* m_pGenPo;
+    std::unique_ptr<GenPoEntry> m_pGenPo;
     bool m_bIsInitialized;
 
 public:
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 9d04e16..955fca6 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -207,7 +207,6 @@ MergeData::MergeData(const OString &rGID,
 
 MergeData::~MergeData()
 {
-    delete pMergeEntrys;
 }
 
 
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index 81ecdcd..87b78dd 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -419,7 +419,6 @@ PoHeader::PoHeader( const OString& rExtSrc )
 
 PoHeader::~PoHeader()
 {
-    delete m_pGenPo;
 }
 
 PoOfstream::PoOfstream()
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 6fe170c..4ceb55b 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -124,8 +124,8 @@ static inline sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 )
 class IntArray2D
 {
 private:
-    sal_Int32  *pData;
-    int         n1, n2;
+    std::unique_ptr<sal_Int32[]>  pData;
+    int                           n1, n2;
 
 public:
     IntArray2D( int nDim1, int nDim2 );
@@ -138,12 +138,11 @@ IntArray2D::IntArray2D( int nDim1, int nDim2 )
 {
     n1 = nDim1;
     n2 = nDim2;
-    pData = new sal_Int32[n1 * n2];
+    pData.reset( new sal_Int32[n1 * n2] );
 }
 
 IntArray2D::~IntArray2D()
 {
-    delete[] pData;
 }
 
 sal_Int32 & IntArray2D::Value( int i, int k  )
diff --git a/oox/inc/drawingml/chart/datasourcecontext.hxx b/oox/inc/drawingml/chart/datasourcecontext.hxx
index 5f4b7f7..2704ccf 100644
--- a/oox/inc/drawingml/chart/datasourcecontext.hxx
+++ b/oox/inc/drawingml/chart/datasourcecontext.hxx
@@ -45,11 +45,12 @@ public:
     virtual void        onCharacters( const OUString& rChars ) override;
 
 private:
-    SvNumberFormatter* getNumberFormatter();
+    SvNumberFormatter*  getNumberFormatter();
 
 private:
     sal_Int32           mnPtIndex;          /// Current data point index.
-    SvNumberFormatter*   mpNumberFormatter;
+    std::unique_ptr<SvNumberFormatter>
+                        mpNumberFormatter;
 };
 
 
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index f5854df..f54ba84 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -47,7 +47,6 @@ DoubleSequenceContext::DoubleSequenceContext( ContextHandler2Helper& rParent, Da
 
 DoubleSequenceContext::~DoubleSequenceContext()
 {
-    delete mpNumberFormatter;
 }
 
 ContextHandlerRef DoubleSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
@@ -157,10 +156,10 @@ SvNumberFormatter* DoubleSequenceContext::getNumberFormatter()
     {
         uno::Reference<uno::XComponentContext> rContext =
                                 this->getFilter().getComponentContext();
-        mpNumberFormatter =
-                new SvNumberFormatter(rContext, LANGUAGE_DONTKNOW);
+        mpNumberFormatter.reset(
+                new SvNumberFormatter(rContext, LANGUAGE_DONTKNOW) );
     }
-    return mpNumberFormatter;
+    return mpNumberFormatter.get();
 }
 
 
diff --git a/reportdesign/source/core/sdr/ModuleHelper.cxx b/reportdesign/source/core/sdr/ModuleHelper.cxx
index d17998f..ca6d5a0 100644
--- a/reportdesign/source/core/sdr/ModuleHelper.cxx
+++ b/reportdesign/source/core/sdr/ModuleHelper.cxx
@@ -43,7 +43,7 @@ namespace rptui
 */
 class OModuleImpl
 {
-    ResMgr* m_pResources;
+    std::unique_ptr<ResMgr> m_pResources;
 
 public:
     /// ctor
@@ -63,7 +63,6 @@ OModuleImpl::OModuleImpl()
 
 OModuleImpl::~OModuleImpl()
 {
-    delete m_pResources;
 }
 
 
@@ -74,9 +73,9 @@ ResMgr* OModuleImpl::getResManager()
     if (!m_pResources)
     {
         // create a manager with a fixed prefix
-        m_pResources = ResMgr::CreateResMgr("rptui");
+        m_pResources.reset( ResMgr::CreateResMgr("rptui") );
     }
-    return m_pResources;
+    return m_pResources.get();
 }
 
 
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index ba87c6f..9330749 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -105,7 +105,6 @@ class SaxExpatParser
 
 public:
     SaxExpatParser();
-    virtual ~SaxExpatParser() override;
 
     // css::lang::XInitialization:
     virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const& rArguments)
@@ -134,9 +133,7 @@ public: // XServiceInfo
     sal_Bool                     SAL_CALL supportsService(const OUString& ServiceName) throw (std::exception) override;
 
 private:
-
-    SaxExpatParser_Impl         *m_pImpl;
-
+    std::unique_ptr<SaxExpatParser_Impl>   m_pImpl;
 };
 
 
@@ -365,9 +362,9 @@ private:
 
 SaxExpatParser::SaxExpatParser(  )
 {
-    m_pImpl = new SaxExpatParser_Impl;
+    m_pImpl.reset( new SaxExpatParser_Impl );
 
-    LocatorImpl *pLoc = new LocatorImpl( m_pImpl );
+    LocatorImpl *pLoc = new LocatorImpl( m_pImpl.get() );
     m_pImpl->rDocumentLocator.set( pLoc );
 
     // Performance-improvement; handing out the same object with every call of
@@ -378,11 +375,6 @@ SaxExpatParser::SaxExpatParser(  )
     m_pImpl->bRTExceptionWasThrown = false;
 }
 
-SaxExpatParser::~SaxExpatParser()
-{
-    delete m_pImpl;
-}
-
 // css::lang::XInitialization:
 void SAL_CALL
 SaxExpatParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments)
@@ -440,7 +432,7 @@ void SaxExpatParser::parseStream(   const InputSource& structSource)
     }
 
     // set all necessary C-Callbacks
-    XML_SetUserData( entity.pParser , m_pImpl );
+    XML_SetUserData( entity.pParser, m_pImpl.get() );
     XML_SetElementHandler(  entity.pParser ,
                             call_callbackStartElement ,
                             call_callbackEndElement );
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 9074688..50deb1f 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -884,10 +884,6 @@ public:
         , m_nLevel(0)
     {
     }
-    virtual ~SAXWriter() override
-    {
-        delete m_pSaxWriterHelper;
-    }
 
 public: // XActiveDataSource
     virtual void SAL_CALL setOutputStream(const Reference< XOutputStream > & aStream)
@@ -901,8 +897,7 @@ public: // XActiveDataSource
             else
             {
                 m_out = aStream;
-                delete m_pSaxWriterHelper;
-                m_pSaxWriterHelper = new SaxWriterHelper(m_out);
+                m_pSaxWriterHelper.reset( new SaxWriterHelper(m_out) );
                 m_bDocStarted = false;
                 m_nLevel = 0;
                 m_bIsCDATA = false;
@@ -965,8 +960,8 @@ public: // XServiceInfo
 private:
     sal_Int32 getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurrence ) throw();
 
-    Reference< XOutputStream >  m_out;
-    SaxWriterHelper*            m_pSaxWriterHelper;
+    Reference< XOutputStream >        m_out;
+    std::unique_ptr<SaxWriterHelper>  m_pSaxWriterHelper;
 
     // Status information
     bool m_bDocStarted : 1;


More information about the Libreoffice-commits mailing list