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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat May 29 08:08:40 UTC 2021


 sw/source/core/doc/docbasic.cxx    |    4 ++--
 sw/source/core/doc/doctxm.cxx      |    4 +++-
 sw/source/core/layout/paintfrm.cxx |   10 +++++-----
 3 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 14e52313e4d350d9960cdd972e87b7f206ee4e2d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 28 12:05:09 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 29 10:07:49 2021 +0200

    no need to allocate these on the heap
    
    Change-Id: Ie4077a86523d623e1913c4f97971ab81d04abd4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116368
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index 723cd0881f74..6bf54c6b6e5a 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -213,7 +213,7 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall
             }
             else if( EXTENDED_STYPE == rMacro.GetScriptType() )
             {
-                std::unique_ptr<Sequence<Any> > pUnoArgs(new Sequence<Any>());
+                Sequence<Any> aUnoArgs;
 
                 Any aRet;
                 Sequence< sal_Int16 > aOutArgsIndex;
@@ -222,7 +222,7 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall
                 SAL_INFO("sw", "SwDoc::CallEvent URL is " << rMacro.GetMacName() );
 
                 nRet += ERRCODE_NONE == mpDocShell->CallXScript(
-                    rMacro.GetMacName(), *pUnoArgs,aRet, aOutArgsIndex, aOutArgs) ? 1 : 0;
+                    rMacro.GetMacName(), aUnoArgs, aRet, aOutArgsIndex, aOutArgs) ? 1 : 0;
             }
             // JavaScript calls are ignored
         }
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 2c3ed6902f13..a8916a113a05 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1717,7 +1717,9 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
                                     const SwTOXInternational& rIntl )
 {
     // collect starts end ends of main entry character style
-    std::unique_ptr< std::vector<sal_uInt16> > xCharStyleIdx(pMainEntryNums ? new std::vector<sal_uInt16> : nullptr);
+    std::optional< std::vector<sal_uInt16> > xCharStyleIdx;
+    if (pMainEntryNums)
+        xCharStyleIdx.emplace();
 
     OUString sSrchStr
         = OUStringChar(C_NUM_REPL) + SwTOXMark::S_PAGE_DELI + OUStringChar(C_NUM_REPL);
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 646e4fe97995..e74de064a9b6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7560,11 +7560,11 @@ Graphic SwDrawFrameFormat::MakeGraphic( ImageMap* )
     if ( pMod )
     {
         SdrObject *pObj = FindSdrObject();
-        std::unique_ptr<SdrView> pView( new SdrView( *pMod ) );
-        SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0));
-        pView->MarkObj( pObj, pPgView );
-        aRet = pView->GetMarkedObjBitmapEx();
-        pView->HideSdrPage();
+        SdrView aView( *pMod );
+        SdrPageView *pPgView = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
+        aView.MarkObj( pObj, pPgView );
+        aRet = aView.GetMarkedObjBitmapEx();
+        aView.HideSdrPage();
     }
     return aRet;
 }


More information about the Libreoffice-commits mailing list