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

Caolán McNamara caolanm at redhat.com
Sat May 6 13:56:10 UTC 2017


 sw/inc/docary.hxx              |    2 +-
 sw/source/core/doc/docfmt.cxx  |    8 ++++----
 sw/source/core/undo/unattr.cxx |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit b6a927b93c25503f5c8ae2f69a0c2f5b575b4c0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 6 14:46:52 2017 +0100

    coverity#1405890 Unchecked dynamic_cast
    
    Change-Id: Ib17e612d8d9b9e9fb712f3fdb4dba24d583a6dba

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index a63bb34cc307..de663f105075 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -260,7 +260,7 @@ public:
 
     /// fast check if given format is contained here
     /// @precond pFormat must not have been deleted
-    bool ContainsFormat(SwFrameFormat const* pFormat) const;
+    bool ContainsFormat(SwFrameFormat const& rFormat) const;
     /// not so fast check that given format is still alive (i.e. contained here)
     bool IsAlive(SwFrameFormat const*) const;
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 544c30eaad55..d140bc6dc402 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -711,7 +711,7 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
     else
     {
         // The format has to be in the one or the other, we'll see in which one.
-        if (mpFrameFormatTable->ContainsFormat(pFormat))
+        if (mpFrameFormatTable->ContainsFormat(*pFormat))
         {
             if (bBroadcast)
                 BroadcastStyleOperation(pFormat->GetName(),
@@ -730,7 +730,7 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
         }
         else
         {
-            bool contains = GetSpzFrameFormats()->ContainsFormat(pFormat);
+            bool contains = GetSpzFrameFormats()->ContainsFormat(*pFormat);
             OSL_ENSURE( contains, "FrameFormat not found." );
             if( contains )
             {
@@ -2116,9 +2116,9 @@ void SwFrameFormats::erase( const_iterator const& position )
     m_PosIndex.erase( begin() + (position - begin()) );
 }
 
-bool SwFrameFormats::ContainsFormat(const SwFrameFormat *const x) const
+bool SwFrameFormats::ContainsFormat(const SwFrameFormat& x) const
 {
-    return (x->m_ffList == this);
+    return (x.m_ffList == this);
 }
 
 bool SwFrameFormats::IsAlive(SwFrameFormat const*const p) const
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 8a0d68d15fc9..e0503c7a4840 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -133,7 +133,7 @@ void SwUndoFormatAttr::Init()
         SaveFlyAnchor( m_bSaveDrawPt );
     } else if ( RES_FRMFMT == m_nFormatWhich ) {
         SwDoc* pDoc = m_pFormat->GetDoc();
-        if (pDoc->GetTableFrameFormats()->ContainsFormat(dynamic_cast<SwFrameFormat*>(m_pFormat)))
+        if (pDoc->GetTableFrameFormats()->ContainsFormat(dynamic_cast<const SwFrameFormat&>(*m_pFormat)))
         {
             // Table Format: save table position, table formats are volatile!
             SwTable * pTable = SwIterator<SwTable,SwFormat>( *m_pFormat ).First();


More information about the Libreoffice-commits mailing list