chart2/source/tools/AxisHelper.cxx                              |    3 +--
 include/vcl/test/GraphicsRenderTests.hxx                        |    7 +++++--
 sc/source/ui/view/tabvwsha.cxx                                  |    6 +++---
 sc/source/ui/view/tabvwshf.cxx                                  |    8 ++++----
 sd/source/console/PresenterScreen.cxx                           |    4 ++--
 sd/source/ui/func/futransf.cxx                                  |    8 ++++----
 sfx2/source/doc/objserv.cxx                                     |    6 +++---
 sfx2/source/view/viewfrm.cxx                                    |    3 ++-
 slideshow/source/engine/animationnodes/animationcommandnode.cxx |    4 ++--
 svl/source/passwordcontainer/passwordcontainer.hxx              |    8 ++++----
 sw/source/core/access/accmap.cxx                                |    4 ++--
 tools/source/fsys/urlobj.cxx                                    |    5 +++--
 vcl/backendtest/GraphicsRenderTests.cxx                         |   10 
++++++----
 writerfilter/inc/dmapper/resourcemodel.hxx                      |    6 +++---
 writerfilter/source/dmapper/LoggedResources.cxx                 |    6 +++---
 writerfilter/source/dmapper/LoggedResources.hxx                 |    6 +++---
 xmloff/source/draw/ximpcustomshape.cxx                          |    3 +--
 17 files changed, 51 insertions(+), 46 deletions(-)

New commits:
commit 03d7ff28b377d65cf266ff86292e581f48c98eee
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 21 20:39:31 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Dec 22 00:10:39 2023 +0100

    cid#1546500 COPY_INSTEAD_OF_MOVE
    
    and
    
    cid#1546492 COPY_INSTEAD_OF_MOVE
    cid#1546468 COPY_INSTEAD_OF_MOVE
    cid#1546431 COPY_INSTEAD_OF_MOVE
    cid#1546382 COPY_INSTEAD_OF_MOVE
    cid#1546350 COPY_INSTEAD_OF_MOVE
    cid#1546336 COPY_INSTEAD_OF_MOVE
    cid#1546314 COPY_INSTEAD_OF_MOVE
    cid#1546152 COPY_INSTEAD_OF_MOVE
    cid#1546094 COPY_INSTEAD_OF_MOVE
    cid#1546077 COPY_INSTEAD_OF_MOVE
    cid#1546047 COPY_INSTEAD_OF_MOVE
    cid#1545213 COPY_INSTEAD_OF_MOVE
    
    Change-Id: Ia51df9f9cbde755db4d2685e34f22676ed5eceff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161141
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/chart2/source/tools/AxisHelper.cxx 
b/chart2/source/tools/AxisHelper.cxx
index 899dfe24fa48..214031eb34b6 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -84,8 +84,7 @@ ScaleData AxisHelper::createDefaultScale()
 
 void AxisHelper::removeExplicitScaling( ScaleData& rScaleData )
 {
-    uno::Any aEmpty;
-    rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = aEmpty;
+    rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = uno::Any();
     rScaleData.Scaling = nullptr;
     ScaleData aDefaultScale( createDefaultScale() );
     rScaleData.IncrementData = aDefaultScale.IncrementData;
diff --git a/include/vcl/test/GraphicsRenderTests.hxx 
b/include/vcl/test/GraphicsRenderTests.hxx
index f931d947e26b..225a25cc6b66 100644
--- a/include/vcl/test/GraphicsRenderTests.hxx
+++ b/include/vcl/test/GraphicsRenderTests.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -154,7 +154,8 @@ class VCL_PLUGIN_PUBLIC GraphicsRenderTests
     void testDrawOpenBezierWithPolyLineB2D();
     static OUString returnTestStatus(vcl::test::TestResult const result);
     void runALLTests();
-    void appendTestResult(OUString aTestName, OUString aTestStatus, Bitmap 
aTestBitmap = Bitmap());
+    void appendTestResult(const OUString& rTestName, const OUString& 
rTestStatus,
+                          const Bitmap& rTestBitmap = Bitmap());
 
 public:
     std::vector<VclTestResult>& getTestResults();
@@ -166,3 +167,5 @@ public:
     {
     }
 };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index c332c9542a66..46baa40875fb 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -615,10 +615,10 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& 
rReq, const OUString &rNam
     if (!rName.isEmpty())
         pDlg->SetCurPageId(rName);
 
-    auto pRequest = std::make_shared<SfxRequest>(rReq);
+    auto xRequest = std::make_shared<SfxRequest>(rReq);
     rReq.Ignore(); // the 'old' request is not relevant any more
 
-    pDlg->StartExecuteAsync([pDlg, pOldSet, pRequest, this](sal_Int32 nResult){
+    pDlg->StartExecuteAsync([pDlg, pOldSet, xRequest=std::move(xRequest), 
this](sal_Int32 nResult){
         bInFormatDialog = false;
 
         if ( nResult == RET_OK )
@@ -631,7 +631,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, 
const OUString &rNam
 
             ApplyAttributes(*pOutSet, *pOldSet);
 
-            pRequest->Done(*pOutSet);
+            xRequest->Done(*pOutSet);
         }
 
         pDlg->disposeOnce();
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 2ac3b93760a5..42d629508bc8 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -163,8 +163,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                         }
                     }
 
-                    std::shared_ptr<SfxRequest> pReq = 
std::make_shared<SfxRequest>(rReq);
-                    pDlg->StartExecuteAsync([this, pDlg, pReq](sal_Int32 
nResult){
+                    std::shared_ptr<SfxRequest> xReq = 
std::make_shared<SfxRequest>(rReq);
+                    pDlg->StartExecuteAsync([this, pDlg, xReq = 
std::move(xReq)](sal_Int32 nResult){
                         std::vector<OUString> sTables;
                         if (RET_OK == nResult)
                         {
@@ -172,11 +172,11 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                             for (auto a : aSelectedRows)
                             {
                                 OUString sTable = pDlg->GetEntry(a);
-                                pReq->AppendItem( SfxStringItem( 
FID_TABLE_SHOW, sTable ) );
+                                xReq->AppendItem( SfxStringItem( 
FID_TABLE_SHOW, sTable ) );
                                 sTables.push_back(sTable);
                             }
                             ShowTable( sTables );
-                            pReq->Done();
+                            xReq->Done();
                         }
                         pDlg->disposeOnce();
                     });
diff --git a/sd/source/console/PresenterScreen.cxx 
b/sd/source/console/PresenterScreen.cxx
index cd6c20d38cc5..690a07f8b67c 100644
--- a/sd/source/console/PresenterScreen.cxx
+++ b/sd/source/console/PresenterScreen.cxx
@@ -561,10 +561,10 @@ void PresenterScreen::RequestShutdownPresenterScreen()
         // asynchronously.  The view and pane factories can only by disposed
         // after that.  Therefore, set up a listener and wait for the
         // restoration.
-        rtl::Reference<PresenterScreen> pSelf (this);
+        rtl::Reference<PresenterScreen> xSelf(this);
         PresenterFrameworkObserver::RunOnUpdateEnd(
             xCC,
-            [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); });
+            [xSelf=std::move(xSelf)](bool){ return 
xSelf->ShutdownPresenterScreen(); });
         xCC->update();
     }
 }
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index 8c565a3b84e8..aef7157ce9bc 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -110,15 +110,15 @@ void FuTransform::DoExecute( SfxRequest& rReq )
 
     assert(pDlg && "there must be a dialog at this point");
 
-    auto pRequest = std::make_shared<SfxRequest>(rReq);
+    auto xRequest = std::make_shared<SfxRequest>(rReq);
     rReq.Ignore(); // the 'old' request is not relevant any more
 
-    pDlg->StartExecuteAsync([bWelded, pDlg, pRequest, this](sal_Int32 nResult){
+    pDlg->StartExecuteAsync([bWelded, pDlg, xRequest=std::move(xRequest), 
this](sal_Int32 nResult){
         if (nResult == RET_OK)
         {
-            pRequest->Done(*(pDlg->GetOutputItemSet()));
+            xRequest->Done(*(pDlg->GetOutputItemSet()));
             // Page margin is already calculated at this point.
-            setUndo(mpView, pRequest->GetArgs(), false);
+            setUndo(mpView, xRequest->GetArgs(), false);
         }
 
         // deferred until the dialog ends
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index fedbfb205d92..8340e4808fb8 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -712,10 +712,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 if (!rReq.IsSynchronCall())
                 {
-                    std::shared_ptr<SfxRequest> pReq = 
std::make_shared<SfxRequest>(rReq);
-                    SfxTabDialogController::runAsync(xDlg, [pReq, 
aFunc](sal_Int32 nResult)
+                    std::shared_ptr<SfxRequest> xReq = 
std::make_shared<SfxRequest>(rReq);
+                    SfxTabDialogController::runAsync(xDlg, 
[xReq=std::move(xReq), aFunc](sal_Int32 nResult)
                     {
-                        aFunc(nResult, *pReq);
+                        aFunc(nResult, *xReq);
                     });
                     rReq.Ignore();
                 }
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx 
b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
index df70cb1ab37c..3c3a61450ba9 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -198,9 +198,9 @@ void AnimationCommandNode::activate_st()
     }
 
     // deactivate ASAP:
-    auto self(getSelf());
+    std::shared_ptr<BaseNode> self(getSelf());
     scheduleDeactivationEvent(
-        makeEvent( [self] () { self->deactivate(); },
+        makeEvent( [self=std::move(self)] () { self->deactivate(); },
                    "AnimationCommandNode::deactivate" ) );
 }
 
diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx 
b/svl/source/passwordcontainer/passwordcontainer.hxx
index 80fae574f175..81190f689f91 100644
--- a/svl/source/passwordcontainer/passwordcontainer.hxx
+++ b/svl/source/passwordcontainer/passwordcontainer.hxx
@@ -58,12 +58,12 @@ class NamePasswordRecord
     OUString                    m_aPersistentPassword;
     OUString                    m_aPersistentIV;
 
-    void InitArrays( bool bHasMemoryList, ::std::vector< OUString >&& 
aMemoryList,
+    void InitArrays( bool bHasMemoryList, const std::vector<OUString>& 
rMemoryList,
                      bool bHasPersistentList, const OUString& aPersistentList, 
const OUString& aPersistentIV )
     {
         m_bHasMemoryPasswords = bHasMemoryList;
         if ( bHasMemoryList )
-            m_aMemoryPasswords = aMemoryList;
+            m_aMemoryPasswords = rMemoryList;
 
         m_bHasPersistentPassword = bHasPersistentList;
         if ( bHasPersistentList )
@@ -96,7 +96,7 @@ public:
         , m_bHasMemoryPasswords( false )
         , m_bHasPersistentPassword( false )
     {
-        InitArrays( aRecord.m_bHasMemoryPasswords, 
std::vector(aRecord.m_aMemoryPasswords),
+        InitArrays( aRecord.m_bHasMemoryPasswords, aRecord.m_aMemoryPasswords,
                     aRecord.m_bHasPersistentPassword, 
aRecord.m_aPersistentPassword, aRecord.m_aPersistentIV );
     }
 
@@ -109,7 +109,7 @@ public:
             m_aMemoryPasswords.clear();
             m_aPersistentPassword.clear();
             m_aPersistentIV.clear();
-            InitArrays( aRecord.m_bHasMemoryPasswords, 
std::vector(aRecord.m_aMemoryPasswords),
+            InitArrays( aRecord.m_bHasMemoryPasswords, 
aRecord.m_aMemoryPasswords,
                         aRecord.m_bHasPersistentPassword, 
aRecord.m_aPersistentPassword, aRecord.m_aPersistentIV );
         }
         return *this;
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index f0193175972d..bbb88a10a59b 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1942,9 +1942,9 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
             {
                 ::accessibility::ShapeTypeHandler& rShapeTypeHandler =
                             ::accessibility::ShapeTypeHandler::Instance();
-                uno::Reference < XAccessible > xParent( pParentImpl );
+
                 ::accessibility::AccessibleShapeInfo aShapeInfo(
-                        xShape, xParent, this );
+                        xShape, uno::Reference<XAccessible>(pParentImpl), this 
);
 
                 pAcc = rShapeTypeHandler.CreateAccessibleObject(
                             aShapeInfo, mpShapeMap->GetInfo() );
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 18ee57b18ee4..b1e3073f39b4 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -4876,8 +4876,9 @@ void INetURLObject::SetExtension(std::u16string_view 
rTheExtension)
 OUString INetURLObject::CutExtension()
 {
     OUString aTheExtension(getExtension(LAST_SEGMENT, false));
-    return removeExtension(LAST_SEGMENT, false)
-        ? aTheExtension : OUString();
+    if (removeExtension(LAST_SEGMENT, false))
+        return aTheExtension;
+    return OUString();
 }
 
 bool INetURLObject::IsExoticProtocol() const
diff --git a/vcl/backendtest/GraphicsRenderTests.cxx 
b/vcl/backendtest/GraphicsRenderTests.cxx
index 962c60f94e17..575a863e04e4 100644
--- a/vcl/backendtest/GraphicsRenderTests.cxx
+++ b/vcl/backendtest/GraphicsRenderTests.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -2482,10 +2482,10 @@ void GraphicsRenderTests::runALLTests()
     testDrawOpenBezierWithPolyLineB2D();
 }
 
-void GraphicsRenderTests::appendTestResult(OUString aTestName, OUString 
aTestStatus,
-                                           Bitmap aTestBitmap)
+void GraphicsRenderTests::appendTestResult(const OUString& rTestName, const 
OUString& rTestStatus,
+                                           const Bitmap& rTestBitmap)
 {
-    m_aTestResult.push_back(VclTestResult(aTestName, aTestStatus, 
aTestBitmap));
+    m_aTestResult.push_back(VclTestResult(rTestName, rTestStatus, 
rTestBitmap));
 }
 
 std::vector<VclTestResult>& GraphicsRenderTests::getTestResults() { return 
m_aTestResult; }
@@ -2593,3 +2593,5 @@ void GraphicsRenderTests::run(bool storeResultBitmap)
     }
     logFile.WriteOString(OUStringToOString(writeResult, 
RTL_TEXTENCODING_UTF8));
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/writerfilter/inc/dmapper/resourcemodel.hxx 
b/writerfilter/inc/dmapper/resourcemodel.hxx
index 695c6c9420d7..b983dec88f78 100644
--- a/writerfilter/inc/dmapper/resourcemodel.hxx
+++ b/writerfilter/inc/dmapper/resourcemodel.hxx
@@ -282,7 +282,7 @@ public:
 
        @param ref    reference to the properties
      */
-    virtual void props(writerfilter::Reference<Properties>::Pointer_t ref) = 0;
+    virtual void props(const writerfilter::Reference<Properties>::Pointer_t& 
ref) = 0;
 
     /**
        Receives table.
@@ -290,7 +290,7 @@ public:
        @param name     name of the table
        @param ref      reference to the table
      */
-    virtual void table(Id name, writerfilter::Reference<Table>::Pointer_t ref) 
= 0;
+    virtual void table(Id name, const 
writerfilter::Reference<Table>::Pointer_t& ref) = 0;
 
     /**
         Receives a substream.
@@ -298,7 +298,7 @@ public:
         @param name    name of the substream
         @param ref     reference to the substream
     */
-    virtual void substream(Id name, writerfilter::Reference<Stream>::Pointer_t 
ref) = 0;
+    virtual void substream(Id name, const 
writerfilter::Reference<Stream>::Pointer_t& ref) = 0;
 
     /**
        Debugging: Receives information about current point in stream.
diff --git a/writerfilter/source/dmapper/LoggedResources.cxx 
b/writerfilter/source/dmapper/LoggedResources.cxx
index 739b2f4dc08d..05ebcd057532 100644
--- a/writerfilter/source/dmapper/LoggedResources.cxx
+++ b/writerfilter/source/dmapper/LoggedResources.cxx
@@ -235,7 +235,7 @@ void LoggedStream::positivePercentage(const OUString& rText)
 #endif
 }
 
-void LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
+void LoggedStream::props(const writerfilter::Reference<Properties>::Pointer_t& 
ref)
 {
 #ifdef DBG_UTIL
     mHelper.startElement("props");
@@ -248,7 +248,7 @@ void 
LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
 #endif
 }
 
-void LoggedStream::table(Id name, writerfilter::Reference<Table>::Pointer_t 
ref)
+void LoggedStream::table(Id name, const 
writerfilter::Reference<Table>::Pointer_t& ref)
 {
 #ifdef DBG_UTIL
     mHelper.startElement("table");
@@ -262,7 +262,7 @@ void LoggedStream::table(Id name, 
writerfilter::Reference<Table>::Pointer_t ref)
 #endif
 }
 
-void LoggedStream::substream(Id name, 
writerfilter::Reference<Stream>::Pointer_t ref)
+void LoggedStream::substream(Id name, const 
writerfilter::Reference<Stream>::Pointer_t& ref)
 {
 #ifdef DBG_UTIL
     mHelper.startElement("substream");
diff --git a/writerfilter/source/dmapper/LoggedResources.hxx 
b/writerfilter/source/dmapper/LoggedResources.hxx
index b729f861373c..0b41a22f43df 100644
--- a/writerfilter/source/dmapper/LoggedResources.hxx
+++ b/writerfilter/source/dmapper/LoggedResources.hxx
@@ -67,9 +67,9 @@ public:
     void positionOffset(const OUString& rText, bool bVertical) override;
     void align(const OUString& rText, bool bVertical) override;
     void positivePercentage(const OUString& rText) override;
-    void props(writerfilter::Reference<Properties>::Pointer_t ref) override;
-    void table(Id name, writerfilter::Reference<Table>::Pointer_t ref) 
override;
-    void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) 
override;
+    void props(const writerfilter::Reference<Properties>::Pointer_t& ref) 
override;
+    void table(Id name, const writerfilter::Reference<Table>::Pointer_t& ref) 
override;
+    void substream(Id name, const writerfilter::Reference<Stream>::Pointer_t& 
ref) override;
     void info(const std::string& info) override;
     void startGlossaryEntry() override;
     void endGlossaryEntry() override;
diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index 56b9fd4cc47e..aafb580df656 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1250,10 +1250,9 @@ void 
XMLEnhancedCustomShapeContext::endFastElement(sal_Int32 )
                         EquationHashMap::iterator aHashIter( aH.find( 
aEquationName ) );
                         if ( aHashIter != aH.end() )
                             nIndex = (*aHashIter).second;
-                        OUString aNew = rEquation.subView( 0, nIndexOf + 1 ) +
+                        rEquation = rEquation.subView( 0, nIndexOf + 1 ) +
                             OUString::number( nIndex ) +
                             rEquation.subView( nIndexOf + 
aEquationName.getLength() + 1 );
-                        rEquation = aNew;
                     }
                     nIndexOf++;
                 }
commit 557579ec55fdeb6d1f1c4395080f72c803630567
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 21 20:20:29 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Dec 22 00:10:28 2023 +0100

    cid#1559856 Dereference after null check
    
    we check for a null pOldSh earlier, so logically we need to check
    here too, or drop the other null check
    
    Change-Id: I8a9110a9d1ee753f523101862fa62e20760bdb1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161140
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 32fe7cdc5efe..e82a4b0ed3d2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2548,7 +2548,8 @@ bool SfxViewFrame::SwitchToViewShell_Impl
         // save the view data of the old view, so it can be restored later on 
(when needed)
         SaveCurrentViewData_Impl( nViewId );
 
-        pOldSh->SetDying();
+        if (pOldSh)
+            pOldSh->SetDying();
 
         // create and load new ViewShell
         SfxViewShell* pNewSh = LoadViewIntoFrame_Impl(

Reply via email to