[Libreoffice-commits] core.git: sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Thu Feb 27 08:10:00 PST 2014
sw/inc/redline.hxx | 38 ++++++++++++---------------
sw/source/core/doc/docredln.cxx | 33 ++++-------------------
sw/source/filter/ww8/docxattributeoutput.cxx | 6 ++--
3 files changed, 27 insertions(+), 50 deletions(-)
New commits:
commit f3307b030635651a01941e76b2011f5c51ed1b84
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 27 14:57:39 2014 +0000
coverity#1187644 confused copy ctors, leaks, etc.
also
coverity#1187861 Uninitialized pointer field
coverity#1187862 Uninitialized pointer field
Change-Id: Ibc420b8ef2d6db58b1b23a85a4029182a05b5f44
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 9bd90c9..09df1f9 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -299,11 +299,9 @@ public:
};
/// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete)
-class SW_DLLPUBLIC SwExtraRedline
+class SW_DLLPUBLIC SwExtraRedline : private boost::noncopyable
{
public:
- SwExtraRedline( );
- SwExtraRedline( const SwExtraRedline& );
virtual ~SwExtraRedline();
};
@@ -311,48 +309,46 @@ public:
class SW_DLLPUBLIC SwTableRowRedline : public SwExtraRedline
{
private:
- SwRedlineData* pRedlineData;
- const SwTableLine* pTableLine;
+ SwRedlineData m_aRedlineData;
+ const SwTableLine& m_rTableLine;
public:
- SwTableRowRedline( const SwRedlineData& rData, SwTableLine& aTableLine );
- SwTableRowRedline( const SwTableRowRedline& );
+ SwTableRowRedline(const SwRedlineData& rData, const SwTableLine& rTableLine);
virtual ~SwTableRowRedline();
/** ExtraData gets copied, the pointer is therefor not taken over by
* the RedLineObject.*/
void SetExtraData( const SwRedlineExtraData* pData )
- { pRedlineData->SetExtraData( pData ); }
+ { m_aRedlineData.SetExtraData( pData ); }
const SwRedlineExtraData* GetExtraData() const
- { return pRedlineData->GetExtraData(); }
- const SwTableLine* GetTableLine() const
- { return pTableLine; }
+ { return m_aRedlineData.GetExtraData(); }
+ const SwTableLine& GetTableLine() const
+ { return m_rTableLine; }
const SwRedlineData& GetRedlineData() const
- { return *pRedlineData; }
+ { return m_aRedlineData; }
};
/// Redline that holds information about a table-cell that had some change
class SW_DLLPUBLIC SwTableCellRedline : public SwExtraRedline
{
private:
- SwRedlineData* pRedlineData;
- const SwTableBox* pTableBox;
+ SwRedlineData m_aRedlineData;
+ const SwTableBox& m_rTableBox;
public:
- SwTableCellRedline( const SwRedlineData& rData, SwTableBox& aTableBox );
- SwTableCellRedline( const SwTableCellRedline& );
+ SwTableCellRedline(const SwRedlineData& rData, const SwTableBox& rTableBox);
virtual ~SwTableCellRedline();
/** ExtraData gets copied, the pointer is therefor not taken over by
* the RedLineObject.*/
void SetExtraData( const SwRedlineExtraData* pData )
- { pRedlineData->SetExtraData( pData ); }
+ { m_aRedlineData.SetExtraData( pData ); }
const SwRedlineExtraData* GetExtraData() const
- { return pRedlineData->GetExtraData(); }
- const SwTableBox* GetTableBox() const
- { return pTableBox; }
+ { return m_aRedlineData.GetExtraData(); }
+ const SwTableBox& GetTableBox() const
+ { return m_rTableBox; }
const SwRedlineData& GetRedlineData() const
- { return *pRedlineData; }
+ { return m_aRedlineData; }
};
class SW_DLLPUBLIC SwRedlineHint : public SfxHint
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 10df07a..3ea13c0 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -3981,29 +3981,14 @@ void SwExtraRedlineTbl::DeleteAndDestroyAll()
DeleteAndDestroy(0, m_aExtraRedlines.size());
}
-SwExtraRedline::SwExtraRedline( )
-{
-}
-
-SwExtraRedline::SwExtraRedline( const SwExtraRedline& rCpy )
-{
- (void)rCpy;
-}
-
SwExtraRedline::~SwExtraRedline()
{
}
-SwTableRowRedline::SwTableRowRedline( const SwRedlineData& rData, SwTableLine& aTableLine )
-: pRedlineData( new SwRedlineData( rData ))
+SwTableRowRedline::SwTableRowRedline(const SwRedlineData& rData, const SwTableLine& rTableLine)
+ : m_aRedlineData(rData)
+ , m_rTableLine(rTableLine)
{
- pTableLine = &aTableLine;
-}
-
-SwTableRowRedline::SwTableRowRedline( const SwTableRowRedline& rCpy )
-: SwExtraRedline( rCpy )
-{
- pTableLine = rCpy.pTableLine;
}
SwTableRowRedline::~SwTableRowRedline()
@@ -4055,16 +4040,10 @@ bool SwDoc::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool bCallDelete
return ( 0 != pNewRedl ) || bMerged;
}
-SwTableCellRedline::SwTableCellRedline( const SwRedlineData& rData, SwTableBox& aTableBox )
-: pRedlineData( new SwRedlineData( rData ))
-{
- pTableBox = &aTableBox;
-}
-
-SwTableCellRedline::SwTableCellRedline( const SwTableCellRedline& rCpy )
-: SwExtraRedline( rCpy )
+SwTableCellRedline::SwTableCellRedline(const SwRedlineData& rData, const SwTableBox& rTableBox)
+ : m_aRedlineData(rData)
+ , m_rTableBox(rTableBox)
{
- pTableBox = rCpy.pTableBox;
}
SwTableCellRedline::~SwTableCellRedline()
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 57d4f7f..664d644 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2642,7 +2642,8 @@ void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t
{
SwExtraRedline* pExtraRedline = aExtraRedlineTbl.GetRedline(nCurRedlinePos);
const SwTableRowRedline* pTableRowRedline = dynamic_cast<const SwTableRowRedline*>(pExtraRedline);
- if (pTableRowRedline && pTableRowRedline->GetTableLine() == pTabLine)
+ const SwTableLine *pRedTabLine = pTableRowRedline ? &pTableRowRedline->GetTableLine() : NULL;
+ if (pRedTabLine == pTabLine)
{
// Redline for this table row
const SwRedlineData& aRedlineData = pTableRowRedline->GetRedlineData();
@@ -2687,7 +2688,8 @@ void DocxAttributeOutput::TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_
{
SwExtraRedline* pExtraRedline = aExtraRedlineTbl.GetRedline(nCurRedlinePos);
const SwTableCellRedline* pTableCellRedline = dynamic_cast<const SwTableCellRedline*>(pExtraRedline);
- if (pTableCellRedline && pTableCellRedline->GetTableBox() == pTabBox)
+ const SwTableBox *pRedTabBox = pTableCellRedline ? &pTableCellRedline->GetTableBox() : NULL;
+ if (pRedTabBox == pTabBox)
{
// Redline for this table cell
const SwRedlineData& aRedlineData = pTableCellRedline->GetRedlineData();
More information about the Libreoffice-commits
mailing list