[Libreoffice-commits] core.git: writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jul 16 08:43:37 UTC 2018
writerfilter/source/rtftok/rtfdispatchvalue.cxx | 7 ++++---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 9 ++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit d41682505503819dab82ced563e4501133924f90
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 16 09:31:48 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 16 10:43:16 2018 +0200
coverity#1437962 and 1437961 and 1437955 and 1437951 resource leak
regression from
commit 0fb5ca6cc9cc55a4436a36c533461769b1fc8526
tdf#79877 perf loading docx file, writerfilter/ improvements
Change-Id: I76792bd635eacc60647a097e070ce7b963fd122f
Reviewed-on: https://gerrit.libreoffice.org/57478
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 14c7b93853bc..cf0b4f1f6b1c 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -114,7 +114,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
checkUnicode(/*bUnicode =*/nKeyword != RTF_U, /*bHex =*/true);
RTFSkipDestination aSkip(*this);
int nSprm = 0;
- auto pIntValue = new RTFValue(nParam);
+ tools::SvRef<RTFValue> pIntValue(new RTFValue(nParam));
// Trivial table sprms.
switch (nKeyword)
{
@@ -600,7 +600,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_SL:
{
// This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'.
- auto pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast);
+ tools::SvRef<RTFValue> pValue(
+ new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast));
if (nParam < 0)
{
pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact);
@@ -905,7 +906,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
OUString hRule("auto");
if (nParam < 0)
{
- auto pAbsValue = new RTFValue(-nParam);
+ tools::SvRef<RTFValue> pAbsValue(new RTFValue(-nParam));
std::swap(pIntValue, pAbsValue);
hRule = "exact";
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f669fd52eada..08e683b05921 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1064,10 +1064,10 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second);
}
}
- auto pAnchorWrapValue = new RTFValue(aAnchorWrapAttributes);
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
if (!aAnchorWrapAttributes.empty() && nWrap == -1)
- aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
+ aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare,
+ new RTFValue(aAnchorWrapAttributes));
// See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
RTFSprms aPoshAttributes;
@@ -1512,9 +1512,8 @@ void RTFDocumentImpl::prepareProperties(
NS_ooxml::LN_CT_TblWidth_w, pWValue);
}
- auto pRowValue = new RTFValue(1);
if (nCells > 0)
- rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, pRowValue);
+ rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, new RTFValue(1));
RTFValue::Pointer_t const pCellMar
= rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar);
@@ -1700,7 +1699,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
RTFSkipDestination aSkip(*this);
int nSprm = -1;
- auto pBoolValue = new RTFValue(int(!bParam || nParam != 0));
+ tools::SvRef<RTFValue> pBoolValue(new RTFValue(int(!bParam || nParam != 0)));
// Underline toggles.
switch (nKeyword)
More information about the Libreoffice-commits
mailing list