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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 08:54:06 UTC 2018


 sw/source/core/text/txthyph.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 96ef1973d0309cc8a6aa9482f2fe35804f49c414
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 11:04:56 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 10:53:42 2018 +0200

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

diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index a59bd8a3cef8..cd8bc43f241a 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -264,7 +264,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         ( rInf.IsInterHyph() && InFieldGrp() ) )
         return false;
 
-    SwHyphPortion *pHyphPor;
+    std::unique_ptr<SwHyphPortion> pHyphPor;
     TextFrameIndex nPorEnd;
     SwTextSizeInfo aInf( rInf );
 
@@ -282,11 +282,11 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         // soft hyphen at alternative spelling position?
         if( rInf.GetText()[sal_Int32(rInf.GetSoftHyphPos())] == CHAR_SOFTHYPHEN )
         {
-            pHyphPor = new SwSoftHyphStrPortion( aAltText );
+            pHyphPor.reset(new SwSoftHyphStrPortion( aAltText ));
             nTmpLen = 1;
         }
         else {
-            pHyphPor = new SwHyphStrPortion( aAltText );
+            pHyphPor.reset(new SwHyphStrPortion( aAltText ));
         }
 
         // length of pHyphPor is adjusted
@@ -297,7 +297,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
     else
     {
         // second case: no alternative spelling
-        pHyphPor = new SwHyphPortion;
+        pHyphPor.reset(new SwHyphPortion);
         pHyphPor->SetLen(TextFrameIndex(1));
 
         static const void* nLastFontCacheId = nullptr;
@@ -331,7 +331,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         SetLen( aInf.GetLen() );
         CalcTextSize( aInf );
 
-        Insert( pHyphPor );
+        Insert( pHyphPor.get() );
 
         short nKern = rInf.GetFont()->CheckKerning();
         if( nKern )
@@ -341,7 +341,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
     }
 
     // last exit for the lost
-    delete pHyphPor;
+    pHyphPor.reset();
     BreakCut( rInf, rGuess );
     return false;
 }


More information about the Libreoffice-commits mailing list