summaryrefslogtreecommitdiffstats
path: root/lotuswordpro
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-06 09:46:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-06 09:22:46 +0000
commitaa09b0c27a6d925da428d6267daadc7338829869 (patch)
treeb0fa576ff64820061d9fb876bebacd23e58ddc56 /lotuswordpro
parentloplugin:singlevalfields (diff)
downloadcore-aa09b0c27a6d925da428d6267daadc7338829869.tar.gz
core-aa09b0c27a6d925da428d6267daadc7338829869.zip
loplugin:useuniqueptr extend to catch more localvar cases
i.e. where the code looks like { foo * p = new foo; ... delete p; return ...; } Change-Id: Id5f2e55d0363fc62c72535a23faeaaf1f0ac6aee Reviewed-on: https://gerrit.libreoffice.org/36190 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpnumericfmt.cxx6
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx12
2 files changed, 7 insertions, 11 deletions
diff --git a/lotuswordpro/source/filter/lwpnumericfmt.cxx b/lotuswordpro/source/filter/lwpnumericfmt.cxx
index 54a186fd1676..9653b095b77e 100644
--- a/lotuswordpro/source/filter/lwpnumericfmt.cxx
+++ b/lotuswordpro/source/filter/lwpnumericfmt.cxx
@@ -374,7 +374,7 @@ OUString LwpNumericFormat::reencode(const OUString& sCode)
sal_uInt16 nLen = sCode.getLength();
bool bFound = false;
sal_uInt16 i;
- sal_Unicode *pBuff = new sal_Unicode[sCode.getLength()];
+ std::unique_ptr<sal_Unicode[]> pBuff( new sal_Unicode[sCode.getLength()] );
for (i=0; i< sCode.getLength() - 1; i++)
{
@@ -392,12 +392,10 @@ OUString LwpNumericFormat::reencode(const OUString& sCode)
{
pBuff[j] = pString[j+1];
}
- OUString sRet(pBuff, nLen - 1);
- delete [] pBuff;
+ OUString sRet(pBuff.get(), nLen - 1);
return sRet;
}
- delete [] pBuff;
return sCode;
}
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index dc0c56b523be..ad7b987ad7ec 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -844,13 +844,13 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
{
sal_uInt16 nContentRow;
sal_uInt8 nCol = static_cast<sal_uInt8>(GetTable()->GetColumn());
- XFTable* pTmpTable = new XFTable;
+ rtl::Reference<XFTable> pTmpTable( new XFTable );
XFRow* pXFRow;
- ConvertTable(pTmpTable,nStartHeadRow,nEndHeadRow,0,nCol);
+ ConvertTable(pTmpTable.get(),nStartHeadRow,nEndHeadRow,0,nCol);
sal_uInt16 nRowNum = pTmpTable->GetRowCount();
- sal_uInt8* CellMark = new sal_uInt8[nRowNum];
+ std::unique_ptr<sal_uInt8[]> CellMark( new sal_uInt8[nRowNum] );
if (nRowNum == 1)
{
@@ -862,11 +862,11 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
else
{
sal_uInt8 nFirstColSpann = 1;
- const bool bFindFlag = FindSplitColMark(pTmpTable,CellMark,nFirstColSpann);
+ const bool bFindFlag = FindSplitColMark(pTmpTable.get(),CellMark.get(),nFirstColSpann);
if (bFindFlag)//split to 2 cells
{
- SplitRowToCells(pTmpTable,pXFTable,nFirstColSpann,CellMark);
+ SplitRowToCells(pTmpTable.get(),pXFTable,nFirstColSpann,CellMark.get());
nContentRow = nEndHeadRow;
}
else//can not split,the first row will be the heading row,the rest will be content row
@@ -877,8 +877,6 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
nContentRow = m_RowsMap[0]->GetCurMaxSpannedRows(0,nCol);
}
}
- delete pTmpTable;
- delete [] CellMark;
return nContentRow;
}