[Libreoffice-commits] core.git: 2 commits - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 6 06:49:56 UTC 2018
sw/source/filter/ww8/ww8scan.cxx | 14 ++++----------
sw/source/filter/ww8/ww8scan.hxx | 4 ++--
2 files changed, 6 insertions(+), 12 deletions(-)
New commits:
commit 8d9aea221f4233e861343b48dab5d5d629b2f4d6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 3 16:25:28 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 6 08:49:38 2018 +0200
loplugin:useuniqueptr in WW8PLCFx_Book
Change-Id: I7e8848da73d40d1c1e57c6eee3f2339cc10a5309
Reviewed-on: https://gerrit.libreoffice.org/58574
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6c098ec88e59..98365bee136e 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4273,14 +4273,13 @@ WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTableSt, const WW8Fib& rFib)
if( !rFib.m_fcPlcfbkf || !rFib.m_lcbPlcfbkf || !rFib.m_fcPlcfbkl ||
!rFib.m_lcbPlcfbkl || !rFib.m_fcSttbfbkmk || !rFib.m_lcbSttbfbkmk )
{
- pBook[0] = pBook[1] = nullptr;
nIMax = 0;
}
else
{
- pBook[0] = new WW8PLCFspecial(pTableSt,rFib.m_fcPlcfbkf,rFib.m_lcbPlcfbkf,4);
+ pBook[0].reset( new WW8PLCFspecial(pTableSt,rFib.m_fcPlcfbkf,rFib.m_lcbPlcfbkf,4) );
- pBook[1] = new WW8PLCFspecial(pTableSt,rFib.m_fcPlcfbkl,rFib.m_lcbPlcfbkl,0);
+ pBook[1].reset( new WW8PLCFspecial(pTableSt,rFib.m_fcPlcfbkl,rFib.m_lcbPlcfbkl,0) );
rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(rFib.m_chseTables, rFib.m_lid);
@@ -4299,8 +4298,6 @@ WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTableSt, const WW8Fib& rFib)
WW8PLCFx_Book::~WW8PLCFx_Book()
{
- delete pBook[1];
- delete pBook[0];
}
sal_uInt32 WW8PLCFx_Book::GetIdx() const
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index ba0d110c944c..dddc26a508a4 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -750,7 +750,7 @@ enum eBookStatus { BOOK_NORMAL = 0, BOOK_IGNORE = 0x1, BOOK_FIELD = 0x2 };
class WW8PLCFx_Book : public WW8PLCFx
{
private:
- WW8PLCFspecial* pBook[2]; // Start and End Position
+ std::unique_ptr<WW8PLCFspecial> pBook[2]; // Start and End Position
std::vector<OUString> aBookNames; // Name
std::vector<eBookStatus> aStatus;
long nIMax; // Number of Booknotes
commit 078493d96bd19234d673099a9824375834990a97
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 3 16:16:07 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 6 08:49:34 2018 +0200
loplugin:useuniqueptr in WW8PLCFx_AtnBook
Change-Id: I2bff645db03d0962764df33c7a2af1dbbc44b954
Reviewed-on: https://gerrit.libreoffice.org/58573
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0a022fba94d2..6c098ec88e59 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4536,13 +4536,12 @@ WW8PLCFx_AtnBook::WW8PLCFx_AtnBook(SvStream* pTableSt, const WW8Fib& rFib)
{
if (!rFib.m_fcPlcfAtnbkf || !rFib.m_lcbPlcfAtnbkf || !rFib.m_fcPlcfAtnbkl || !rFib.m_lcbPlcfAtnbkl)
{
- m_pBook[0] = m_pBook[1] = nullptr;
nIMax = 0;
}
else
{
- m_pBook[0] = new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfAtnbkf, rFib.m_lcbPlcfAtnbkf, 4);
- m_pBook[1] = new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfAtnbkl, rFib.m_lcbPlcfAtnbkl, 0);
+ m_pBook[0].reset( new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfAtnbkf, rFib.m_lcbPlcfAtnbkf, 4) );
+ m_pBook[1].reset( new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfAtnbkl, rFib.m_lcbPlcfAtnbkl, 0) );
nIMax = m_pBook[0]->GetIMax();
if (m_pBook[1]->GetIMax() < nIMax)
@@ -4552,8 +4551,6 @@ WW8PLCFx_AtnBook::WW8PLCFx_AtnBook(SvStream* pTableSt, const WW8Fib& rFib)
WW8PLCFx_AtnBook::~WW8PLCFx_AtnBook()
{
- delete m_pBook[1];
- delete m_pBook[0];
}
sal_uInt32 WW8PLCFx_AtnBook::GetIdx() const
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 779828794cc8..ba0d110c944c 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -790,7 +790,7 @@ class WW8PLCFx_AtnBook : public WW8PLCFx
{
private:
/// Start and end positions.
- WW8PLCFspecial* m_pBook[2];
+ std::unique_ptr<WW8PLCFspecial> m_pBook[2];
/// Number of annotation marks
sal_Int32 nIMax;
bool m_bIsEnd;
More information about the Libreoffice-commits
mailing list