[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 29 06:58:11 UTC 2019
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(-)
New commits:
commit 42f0286c0ec68dde36cf3cef15f8a6e2e7ec1830
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue May 28 22:15:27 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 29 08:57:17 2019 +0200
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 <vmiklos at collabora.com>
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<drawing::XS
if (!m_pBinaryData.get())
{
pStream = &aStream;
- int b = 0, count = 2;
+ int b = 0;
+ int count = 2;
// Feed the destination text to a stream.
OString aStr = OUStringToOString(m_aStates.top().getDestinationText().makeStringAndClear(),
@@ -1019,11 +1020,10 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
auto pGraphicValue = new RTFValue(aGraphicAttributes, aGraphicSprms);
// extent sprm
RTFSprms aExtentAttributes;
- int nXExt, nYExt;
- nXExt = (m_aStates.top().getPicture().nGoalWidth ? m_aStates.top().getPicture().nGoalWidth
- : m_aStates.top().getPicture().nWidth);
- nYExt = (m_aStates.top().getPicture().nGoalHeight ? m_aStates.top().getPicture().nGoalHeight
- : m_aStates.top().getPicture().nHeight);
+ int nXExt = (m_aStates.top().getPicture().nGoalWidth ? m_aStates.top().getPicture().nGoalWidth
+ : m_aStates.top().getPicture().nWidth);
+ int nYExt = (m_aStates.top().getPicture().nGoalHeight ? m_aStates.top().getPicture().nGoalHeight
+ : m_aStates.top().getPicture().nHeight);
if (m_aStates.top().getPicture().nScaleX != 100)
nXExt = (static_cast<long>(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<drawing::XShape> xShape(rDrawing.getShape());
- uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.getPropertySet());
+ const uno::Reference<drawing::XShape>& xShape(rDrawing.getShape());
+ const uno::Reference<beans::XPropertySet>& xPropertySet(rDrawing.getPropertySet());
uno::Reference<lang::XServiceInfo> 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<drawing::XShape>& o_xShape,
// first, find the shape type
int nType = -1;
- auto iter = std::find_if(
- rShape.getProperties().begin(), rShape.getProperties().end(),
- [](std::pair<OUString, OUString> aProperty) { return aProperty.first == "shapeType"; });
+ auto iter = std::find_if(rShape.getProperties().begin(), rShape.getProperties().end(),
+ [](const std::pair<OUString, OUString>& 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<sal_Int32> oGroupLeft, oGroupTop, oGroupRight, oGroupBottom;
- boost::optional<sal_Int32> oRelLeft, oRelTop, oRelRight, oRelBottom;
+ boost::optional<sal_Int32> oGroupLeft;
+ boost::optional<sal_Int32> oGroupTop;
+ boost::optional<sal_Int32> oGroupRight;
+ boost::optional<sal_Int32> oGroupBottom;
+ boost::optional<sal_Int32> oRelLeft;
+ boost::optional<sal_Int32> oRelTop;
+ boost::optional<sal_Int32> oRelRight;
+ boost::optional<sal_Int32> 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<sal_Int16> oRelativeWidth, oRelativeHeight;
+ boost::optional<sal_Int16> oRelativeWidth;
+ boost::optional<sal_Int16> 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;
More information about the Libreoffice-commits
mailing list