summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-06 10:12:29 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-10 12:23:42 +0100
commit065edb4c8e91170017df482843d0c3eb8d4db114 (patch)
tree1d030ec9868a56b375a563c9d6e6d81c6115d717 /writerfilter
parent0b34a5dd39e177ba99cd21b639d67ac8123b8458 (diff)
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643 Reviewed-on: https://gerrit.libreoffice.org/63235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx32
3 files changed, 12 insertions, 29 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 1567865c4412..46a875a9e8b9 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1506,9 +1506,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
{
uno::Reference< beans::XPropertySet > xDocProperties;
xDocProperties.set( rDM_Impl.GetTextDocument(), uno::UNO_QUERY_THROW );
- bool bSquaredPageMode = false;
- Insert( PROP_GRID_STANDARD_MODE, uno::makeAny( !bSquaredPageMode ) );
- xDocProperties->setPropertyValue( "DefaultPageMode", uno::makeAny( bSquaredPageMode ) );
+ Insert(PROP_GRID_STANDARD_MODE, uno::makeAny(true));
+ xDocProperties->setPropertyValue("DefaultPageMode", uno::makeAny(false));
}
catch ( const uno::Exception& )
{
@@ -1592,7 +1591,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
if (0 <= m_nPageNumber)
{
- sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
+ sal_Int16 nPageNumber = static_cast< sal_Int16 >(m_nPageNumber);
xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_NUMBER_OFFSET),
uno::makeAny(nPageNumber));
}
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 001e22bad455..833b38d16876 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -748,7 +748,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
case RTF_SECTUNLOCKED:
{
- auto pValue = new RTFValue(int(!nParam));
+ auto pValue = new RTFValue(0);
m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue);
}
break;
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 670410023dc2..9a7b980ba09d 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -476,19 +476,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
// The coordinates are in an (x,y) form.
aToken = aToken.copy(1, aToken.getLength() - 2);
sal_Int32 nI = 0;
- boost::optional<sal_Int32> oX;
- boost::optional<sal_Int32> oY;
- do
- {
- OUString aPoint = aToken.getToken(0, ',', nI);
- if (!oX)
- oX = aPoint.toInt32();
- else
- oY = aPoint.toInt32();
- } while (nI >= 0);
+ sal_Int32 nX = aToken.getToken(0, ',', nI).toInt32();
+ sal_Int32 nY = (nI >= 0) ? aToken.getToken(0, ',', nI).toInt32() : 0;
drawing::EnhancedCustomShapeParameterPair aPair;
- aPair.First.Value <<= *oX;
- aPair.Second.Value <<= *oY;
+ aPair.First.Value <<= nX;
+ aPair.Second.Value <<= nY;
aCoordinates.push_back(aPair);
}
} while (nCharIndex >= 0);
@@ -829,19 +821,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
// The coordinates are in an (x,y) form.
aToken = aToken.copy(1, aToken.getLength() - 2);
sal_Int32 nI = 0;
- boost::optional<sal_Int32> oX;
- boost::optional<sal_Int32> oY;
- do
- {
- OUString aPoint = aToken.getToken(0, ',', nI);
- if (!oX)
- oX = aPoint.toInt32();
- else
- oY = aPoint.toInt32();
- } while (nI >= 0);
+ sal_Int32 nX = aToken.getToken(0, ',', nI).toInt32();
+ sal_Int32 nY = (nI >= 0) ? aToken.getToken(0, ',', nI).toInt32() : 0;
RTFSprms aPathAttributes;
- aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, new RTFValue(*oX));
- aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, new RTFValue(*oY));
+ aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, new RTFValue(nX));
+ aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, new RTFValue(nY));
aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo,
new RTFValue(aPathAttributes), RTFOverwrite::NO_APPEND);
}