From 42f0286c0ec68dde36cf3cef15f8a6e2e7ec1830 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 28 May 2019 22:15:27 +0200 Subject: writerfilter: various small cleanups Some parameters were passed by value for no reason, it's always a good idea to declare a variable at the point where we can also initialize it, etc. Change-Id: Ia07bbef7826132fa0326445b89fcaf48dd38b11b Reviewed-on: https://gerrit.libreoffice.org/73125 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 19 ++++++++++--------- writerfilter/source/rtftok/rtfsdrimport.cxx | 20 ++++++++++++++------ writerfilter/source/rtftok/rtftokenizer.cxx | 3 ++- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index c2c139744ccb..b6d8290283cc 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -846,7 +846,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference(m_aStates.top().getPicture().nScaleX) * (nXExt @@ -2477,7 +2477,8 @@ RTFError RTFDocumentImpl::popState() aState.getCurrentEncoding()); // decode hex dump OStringBuffer aBuf; - int b = 0, count = 2; + int b = 0; + int count = 2; for (int i = 0; i < aStr.getLength(); ++i) { char ch = aStr[i]; @@ -2745,8 +2746,8 @@ RTFError RTFDocumentImpl::popState() if (m_aStates.top().getDrawingObject().getShape().is()) { RTFDrawingObject& rDrawing = m_aStates.top().getDrawingObject(); - uno::Reference xShape(rDrawing.getShape()); - uno::Reference xPropertySet(rDrawing.getPropertySet()); + const uno::Reference& xShape(rDrawing.getShape()); + const uno::Reference& xPropertySet(rDrawing.getPropertySet()); uno::Reference xServiceInfo(xShape, uno::UNO_QUERY); bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame"); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 8c8aeb8c6405..b9e227439f4b 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -283,9 +283,10 @@ int RTFSdrImport::initShape(uno::Reference& o_xShape, // first, find the shape type int nType = -1; - auto iter = std::find_if( - rShape.getProperties().begin(), rShape.getProperties().end(), - [](std::pair aProperty) { return aProperty.first == "shapeType"; }); + auto iter = std::find_if(rShape.getProperties().begin(), rShape.getProperties().end(), + [](const std::pair& rProperty) { + return rProperty.first == "shapeType"; + }); if (iter == rShape.getProperties().end()) { @@ -368,8 +369,14 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap uno::Any aLineWidth = uno::makeAny(sal_Int32(26)); text::WritingMode eWritingMode = text::WritingMode_LR_TB; // Groupshape support - boost::optional oGroupLeft, oGroupTop, oGroupRight, oGroupBottom; - boost::optional oRelLeft, oRelTop, oRelRight, oRelBottom; + boost::optional oGroupLeft; + boost::optional oGroupTop; + boost::optional oGroupRight; + boost::optional oGroupBottom; + boost::optional oRelLeft; + boost::optional oRelTop; + boost::optional oRelRight; + boost::optional oRelBottom; // Importing these are not trivial, let the VML import do the hard work. oox::vml::FillModel aFillModel; // Gradient. @@ -377,7 +384,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap bool bOpaque = true; - boost::optional oRelativeWidth, oRelativeHeight; + boost::optional oRelativeWidth; + boost::optional oRelativeHeight; sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; boost::logic::tribool obRelFlipV(boost::logic::indeterminate); diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index b2a1fea346e5..03d5d0d3e56a 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -66,7 +66,8 @@ RTFError RTFTokenizer::resolveParse() char ch; RTFError ret; // for hex chars - int b = 0, count = 2; + int b = 0; + int count = 2; std::size_t nPercentSize = 0; sal_uInt64 nLastPos = 0; -- cgit v1.2.3