[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source vcl/source xmlhelp/source

Caolán McNamara caolanm at redhat.com
Sat Feb 25 14:59:35 UTC 2017


 sw/inc/accmap.hxx                               |    7 ++++++-
 sw/source/core/access/accdoc.cxx                |    2 +-
 sw/source/core/access/accmap.cxx                |    4 +++-
 sw/source/core/unocore/unotext.cxx              |    2 +-
 sw/source/uibase/app/swdll.cxx                  |    7 ++++---
 sw/source/uibase/app/swdllimpl.hxx              |    3 +++
 vcl/source/gdi/svgdata.cxx                      |    6 ++----
 vcl/source/window/builder.cxx                   |    5 -----
 xmlhelp/source/cxxhelp/provider/inputstream.cxx |    5 ++---
 9 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 9bc5d4cdf010091406091875e6c45d975ebc9708
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 25 14:49:14 2017 +0000

    re org things a little to quieten coverity warnings
    
    Change-Id: I3bf0840f6428ee8cefd424a486cc2f5fcfda290f

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 05240c9..814b210 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -119,7 +119,10 @@ class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
 
     //mpSelectedFrameMap contains the old selected objects.
     SwAccessibleContextMap_Impl *mpSeletedFrameMap;
-    //IvalidateShapeInParaSelection() method is responsible for the updating the selected states of the objects.
+
+    OUString maDocName;
+
+    //InvalidateShapeInParaSelection() method is responsible for the updating the selected states of the objects.
     void InvalidateShapeInParaSelection();
 
     void InvalidateRelationSet_( const SwFrame* pFrame, bool bFrom );
@@ -261,6 +264,8 @@ public:
 
     void FireEvents();
 
+    const OUString& GetDocName() const { return maDocName; }
+
     // IAccessibleViewForwarder
 
     virtual Rectangle GetVisibleArea() const override;
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 9e5f0e0..94131d5 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -338,7 +338,7 @@ SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) :
     SwAccessibleDocumentBase( pInitMap ),
     maSelectionHelper( *this )
 {
-    SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+    SetName(pInitMap->GetDocName());
     vcl::Window *pWin = pInitMap->GetShell()->GetWin();
     if( pWin )
     {
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 3c48470..d47e20d 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -30,6 +30,7 @@
 #include <accmap.hxx>
 #include <acccontext.hxx>
 #include <accdoc.hxx>
+#include <access.hrc>
 #include <accpreview.hxx>
 #include <accpage.hxx>
 #include <accpara.hxx>
@@ -1641,7 +1642,8 @@ SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) :
     mpVSh( pSh ),
     mpPreview( nullptr ),
     mbShapeSelected( false ),
-    mpSeletedFrameMap(nullptr)
+    mpSeletedFrameMap(nullptr),
+    maDocName(SwAccessibleContext::GetResource(STR_ACCESS_DOC_NAME))
 {
     pSh->GetLayout()->AddAccessibleShell();
 }
diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx
index 609b4ad..549df9b 100644
--- a/sw/source/uibase/app/swdll.cxx
+++ b/sw/source/uibase/app/swdll.cxx
@@ -80,6 +80,7 @@ namespace SwGlobals
 }
 
 SwDLL::SwDLL()
+    : m_pAutoCorrCfg(nullptr)
 {
     if ( SfxApplication::GetModule(SfxToolsModule::Writer) )    // Module already active
         return;
@@ -146,16 +147,16 @@ SwDLL::SwDLL()
         SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
         const SvxAutoCorrect* pOld = rACfg.GetAutoCorrect();
         rACfg.SetAutoCorrect(new SwAutoCorrect( *pOld ));
+        m_pAutoCorrCfg = &rACfg;
     }
 }
 
 SwDLL::~SwDLL()
 {
-    if (!utl::ConfigManager::IsAvoidConfig())
+    if (m_pAutoCorrCfg)
     {
         // fdo#86494 SwAutoCorrect must be deleted before FinitCore
-        SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
-        rACfg.SetAutoCorrect(nullptr); // delete SwAutoCorrect before exit handlers
+        m_pAutoCorrCfg->SetAutoCorrect(nullptr); // delete SwAutoCorrect before exit handlers
     }
 
     // Pool has to be deleted before statics are
diff --git a/sw/source/uibase/app/swdllimpl.hxx b/sw/source/uibase/app/swdllimpl.hxx
index 57a34be..8f6707f 100644
--- a/sw/source/uibase/app/swdllimpl.hxx
+++ b/sw/source/uibase/app/swdllimpl.hxx
@@ -16,6 +16,8 @@
 
 namespace sw { class Filters; }
 
+class SvxAutoCorrCfg;
+
 class SwDLL
 {
 public:
@@ -33,6 +35,7 @@ private:
     SwDLL& operator=(SwDLL const&) = delete;
 
     std::unique_ptr< sw::Filters > filters_;
+    SvxAutoCorrCfg *m_pAutoCorrCfg;
 };
 
 #endif
diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx
index 155844f..27abb60d 100644
--- a/vcl/source/gdi/svgdata.cxx
+++ b/vcl/source/gdi/svgdata.cxx
@@ -44,10 +44,9 @@ BitmapEx convertPrimitive2DSequenceToBitmapEx(
     {
         // create replacement graphic from maSequence
         // create XPrimitive2DRenderer
-        uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
-
         try
         {
+            uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
             const uno::Reference< graphic::XPrimitive2DRenderer > xPrimitive2DRenderer = graphic::Primitive2DTools::create(xContext);
 
             uno::Sequence< beans::PropertyValue > aViewParameters;
@@ -125,10 +124,9 @@ void SvgData::ensureSequenceAndRange()
         if(myInputStream.is())
         {
             // create SVG interpreter
-            uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
-
             try
             {
+                uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
                 const uno::Reference< graphic::XSvgParser > xSvgParser = graphic::SvgTools::create(xContext);
 
                 maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath));
diff --git a/xmlhelp/source/cxxhelp/provider/inputstream.cxx b/xmlhelp/source/cxxhelp/provider/inputstream.cxx
index fd6a278..31067b4 100644
--- a/xmlhelp/source/cxxhelp/provider/inputstream.cxx
+++ b/xmlhelp/source/cxxhelp/provider/inputstream.cxx
@@ -37,13 +37,12 @@ XInputStream_impl::XInputStream_impl( const OUString& aUncPath )
     m_bIsOpen = ( osl::FileBase::E_None == m_aFile.open( osl_File_OpenFlag_Read ) );
 }
 
-
 XInputStream_impl::~XInputStream_impl()
 {
-    closeInput();
+    if (m_bIsOpen)
+        m_aFile.close();
 }
 
-
 uno::Any SAL_CALL
 XInputStream_impl::queryInterface( const uno::Type& rType )
 {
commit 2a0ad98ba798a280de649e17fb7212f6b4077917
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 25 12:19:40 2017 +0000

    coverity#1371301 Missing move assignment operator
    
    and
    
    coverity#1371215 Missing move assignment operator
    
    Change-Id: Ib595dbab2525ac63d1e4174835876c08adba7a64

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 78cce48..b3e7704 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1357,7 +1357,7 @@ SwXText::insertTextPortion(
         SwUnoCursorHelper::DocInsertStringSplitCR(
             *m_pImpl->m_pDoc, rCursor, rText, false);
         SwUnoCursorHelper::SelectPam(rCursor, true);
-        rCursor.GetPoint()->nNode = SwNodeIndex(nodeIndex, +1);
+        rCursor.GetPoint()->nNode.Assign(nodeIndex.GetNode(), +1);
         rCursor.GetPoint()->nContent = nContentPos;
     }
 
commit 4aedd51afe0804dc1cbf6cff245aab2a34e04035
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 25 12:08:48 2017 +0000

    coverity#1401470 'Constant' variable guards dead code
    
    Change-Id: Id153577c0f8e3c3c396ad8fa0f657e9df1ab8166

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 82e42da..f5f0f7b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2594,8 +2594,6 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read
     if (!sCustomProperty.isEmpty())
         aProperties[OString("customproperty")] = sCustomProperty;
 
-    bool bInserted = false;
-
     while(true)
     {
         xmlreader::XmlReader::Result res = reader.nextItem(
@@ -2632,9 +2630,6 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read
             break;
     }
 
-    if (bInserted)
-        return;
-
     insertMenuObject(pParent, pSubMenu, sClass, sID, aProperties, aAccelerators);
 }
 


More information about the Libreoffice-commits mailing list