diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-13 15:00:47 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-01-13 22:24:53 +0100 |
commit | ba2c3bb1e63b4cc40c4379dde314eb005f0c4c10 (patch) | |
tree | 05f763d057a2cbcc1f94d6b8dfd380764f75386a /lotuswordpro | |
parent | de1b926fa294273caefb29a507e117b8487e882b (diff) |
ofz#5288 Direct-leak
Change-Id: I4abbae86d888866e111f5d5deee3a596aeae4cb7
Reviewed-on: https://gerrit.libreoffice.org/47839
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 34 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.hxx | 6 |
2 files changed, 13 insertions, 27 deletions
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 17a418e6c9d6..0a3078cf697a 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -71,7 +71,6 @@ #include <xfilter/xfstylemanager.hxx> #include <xfilter/xftablestyle.hxx> -#include <xfilter/xftable.hxx> #include <xfilter/xfrow.hxx> #include <xfilter/xfrowstyle.hxx> #include <xfilter/xfcell.hxx> @@ -415,20 +414,7 @@ LwpTableLayout::LwpTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm , m_nRows(0) , m_nCols(0) , m_pDefaultCellLayout(nullptr) - , m_pColumns(nullptr) { - m_CellsMap.clear(); -} - -LwpTableLayout::~LwpTableLayout() -{ - m_CellsMap.clear(); - - if (m_pColumns) - { - delete [] m_pColumns; - m_pColumns = nullptr; - } } /** @@ -533,7 +519,7 @@ OUString LwpTableLayout::GetColumnWidth(sal_uInt16 nCol) return m_DefaultColumnStyleName; } - LwpColumnLayout * pCol = m_pColumns[nCol]; + LwpColumnLayout * pCol = m_aColumns[nCol]; if (pCol) { return pCol->GetStyleName(); @@ -553,12 +539,12 @@ void LwpTableLayout::RegisterColumns() sal_uInt16 nCols = m_nCols; - m_pColumns = new LwpColumnLayout *[nCols]; + m_aColumns.resize(nCols); std::unique_ptr<bool[]> pWidthCalculated( new bool[nCols] ); for(sal_uInt16 i=0;i<nCols; i++) { pWidthCalculated[i] = false; - m_pColumns[i] = nullptr; + m_aColumns[i] = nullptr; } double dDefaultColumn = pTable->GetWidth(); @@ -577,7 +563,7 @@ void LwpTableLayout::RegisterColumns() { throw std::range_error("corrupt LwpTableLayout"); } - m_pColumns[nColId] = pColumnLayout; + m_aColumns[nColId] = pColumnLayout; if (!pColumnLayout->IsJustifiable()) { pWidthCalculated[nColId] = true; @@ -593,10 +579,10 @@ void LwpTableLayout::RegisterColumns() if (nJustifiableColumn == 0 && nCols != 0) { nJustifiableColumn ++; - if (m_pColumns[nCols - 1]) + if (m_aColumns[nCols - 1]) { pWidthCalculated[nCols-1] = false; - dTableWidth += m_pColumns[nCols-1]->GetWidth(); + dTableWidth += m_aColumns[nCols-1]->GetWidth(); } else { @@ -620,18 +606,18 @@ void LwpTableLayout::RegisterColumns() sal_uInt16 i=0; for( i=0;i<nCols; i++) { - if(m_pColumns[i]) + if (m_aColumns[i]) { - m_pColumns[i]->SetFoundry(m_pFoundry); + m_aColumns[i]->SetFoundry(m_pFoundry); if(!pWidthCalculated[i]) { // justifiable ----register style with calculated value - m_pColumns[i]->SetStyleName(m_DefaultColumnStyleName); + m_aColumns[i]->SetStyleName(m_DefaultColumnStyleName); } else { // not justifiable ---- register style with original value - m_pColumns[i]->RegisterStyle(m_pColumns[i]->GetWidth()); + m_aColumns[i]->RegisterStyle(m_aColumns[i]->GetWidth()); } } } diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx index ef80dd5ac0e6..700c16647472 100644 --- a/lotuswordpro/source/filter/lwptablelayout.hxx +++ b/lotuswordpro/source/filter/lwptablelayout.hxx @@ -62,6 +62,7 @@ #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX #include "lwplayout.hxx" +#include <xfilter/xftable.hxx> #include <vector> #include <map> @@ -88,7 +89,6 @@ class LwpTableLayout: public LwpLayout { public: LwpTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm); - virtual ~LwpTableLayout() override; virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_TABLE_LAYOUT;} LwpObjectID& GetColumnLayoutHead(){return m_ColumnLayout;} void RegisterStyle() override; @@ -123,9 +123,9 @@ private: OUString m_DefaultRowStyleName; // wordpro cell map - std::vector<LwpCellLayout *> m_WordProCellsMap; + std::vector<LwpCellLayout*> m_WordProCellsMap; // column vector - LwpColumnLayout ** m_pColumns; + std::vector<LwpColumnLayout*> m_aColumns; public: void XFConvert(XFContentContainer* pCont) override; |