summaryrefslogtreecommitdiff
path: root/svx/source/items
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-03 15:43:04 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-03 20:47:58 +0100
commit49747ff2337fd1f4a3ee8e16d6328b8dacad99ec (patch)
tree110901102d4ae356b161434a4e4064a28a0a738a /svx/source/items
parent0981f1d8c8a8918b5f28bf5605023b07e73b0d44 (diff)
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I75082c85862b83ed2503900186ce9c70783e54db Reviewed-on: https://gerrit.libreoffice.org/62817 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source/items')
-rw-r--r--svx/source/items/customshapeitem.cxx46
1 files changed, 20 insertions, 26 deletions
diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index f19937113b82..fba55040dc37 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -178,25 +178,22 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName
pSeqAny = &aPropSeq[ nIndex ].Value;
}
- DBG_ASSERT( pSeqAny, "SdrCustomShapeGeometryItem::SetPropertyValue() - No Value??" );
-
- if( pSeqAny )
+ if (auto pSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny))
{
- if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
+ PropertyPairHashMap::iterator aHashIter(
+ aPropPairHashMap.find(PropertyPair(rSequenceName, rPropVal.Name)));
+ auto& rSeq = const_cast<css::uno::Sequence<css::beans::PropertyValue>&>(*pSecSequence);
+ if (aHashIter != aPropPairHashMap.end())
{
- PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropVal.Name ) ) );
- if ( aHashIter != aPropPairHashMap.end() )
- {
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence)[ (*aHashIter).second ].Value = rPropVal.Value;
- }
- else
- {
- sal_Int32 nCount = rSecSequence->getLength();
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence).realloc( nCount + 1 );
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence)[ nCount ] = rPropVal;
+ rSeq[(*aHashIter).second].Value = rPropVal.Value;
+ }
+ else
+ {
+ const sal_Int32 nCount = pSecSequence->getLength();
+ rSeq.realloc(nCount + 1);
+ rSeq[nCount] = rPropVal;
- aPropPairHashMap[ PropertyPair( rSequenceName, rPropVal.Name ) ] = nCount;
- }
+ aPropPairHashMap[PropertyPair(rSequenceName, rPropVal.Name)] = nCount;
}
}
}
@@ -209,18 +206,15 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName )
PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) );
if ( aHashIter != aPropHashMap.end() )
{
- css::uno::Any* pSeqAny = &aPropSeq[ (*aHashIter).second ].Value;
- if ( pSeqAny )
+ css::uno::Any& rSeqAny = aPropSeq[(*aHashIter).second].Value;
+ if (auto pSecSequence
+ = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(rSeqAny))
{
- if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
+ for (const auto& rPropVal : *pSecSequence)
{
- sal_Int32 i;
- for ( i = 0; i < rSecSequence->getLength(); i++ )
- {
- PropertyPairHashMap::iterator _aHashIter( aPropPairHashMap.find( PropertyPair( rPropName, (*rSecSequence)[ i ].Name ) ) );
- if ( _aHashIter != aPropPairHashMap.end() )
- aPropPairHashMap.erase( _aHashIter ); // removing property from pair hashmap
- }
+ auto _aHashIter(aPropPairHashMap.find(PropertyPair(rPropName, rPropVal.Name)));
+ if (_aHashIter != aPropPairHashMap.end())
+ aPropPairHashMap.erase(_aHashIter); // removing property from pair hashmap
}
}
sal_Int32 nLength = aPropSeq.getLength();