[Libreoffice-commits] core.git: compilerplugins/clang sw/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Jun 29 06:40:57 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx |    6 ++++++
 sw/source/core/fields/docufld.cxx      |    2 +-
 sw/source/core/fields/textapi.cxx      |    2 +-
 sw/source/core/inc/textapi.hxx         |    2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 35c165e46a1bc22bc4c5b51ec7b03216fa43ec64
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 28 13:48:17 2018 +0200

    loplugin:useuniqueptr in SwTextAPIObject
    
    Change-Id: Ied235aefe2cc2ce5e88487503c17e1a54d25ac52
    Reviewed-on: https://gerrit.libreoffice.org/56624
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index df6343f61578..d4262c1a33ee 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -62,6 +62,12 @@ public:
         // sometimes it owns, sometimes it doesn't
         if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx")
             return;
+        // SwDoc::m_PageDescs has weird handling
+        if (fn == SRCDIR "/sw/source/core/doc/docnew.cxx")
+            return;
+        // SwRedlineData::pNext and pExtraData have complex handling
+        if (fn == SRCDIR "/sw/source/core/doc/docredln.cxx")
+            return;
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index efc433cce0c7..c89f26f4b2e0 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1826,7 +1826,7 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText )
 
 sal_Int32 SwPostItField::GetNumberOfParagraphs() const
 {
-    return (mpText) ? mpText->Count() : 1;
+    return mpText ? mpText->Count() : 1;
 }
 
 bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx
index 05372f70faff..89c248eb06cb 100644
--- a/sw/source/core/fields/textapi.cxx
+++ b/sw/source/core/fields/textapi.cxx
@@ -61,7 +61,7 @@ SwTextAPIObject::SwTextAPIObject( SwTextAPIEditSource* p )
 SwTextAPIObject::~SwTextAPIObject() throw()
 {
     pSource->Dispose();
-    delete pSource;
+    pSource.reset();
 }
 
 struct SwTextAPIEditSource_Impl
diff --git a/sw/source/core/inc/textapi.hxx b/sw/source/core/inc/textapi.hxx
index 4b3fa15628f4..02a138fc764f 100644
--- a/sw/source/core/inc/textapi.hxx
+++ b/sw/source/core/inc/textapi.hxx
@@ -53,7 +53,7 @@ public:
 
 class SwTextAPIObject : public SvxUnoText
 {
-    SwTextAPIEditSource* pSource;
+    std::unique_ptr<SwTextAPIEditSource> pSource;
 public:
                         SwTextAPIObject( SwTextAPIEditSource* p);
     virtual             ~SwTextAPIObject() throw() override;


More information about the Libreoffice-commits mailing list