summaryrefslogtreecommitdiffstats
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
parenttdf#120703 PVS: V581 (diff)
downloadcore-49747ff2337fd1f4a3ee8e16d6328b8dacad99ec.tar.gz
core-49747ff2337fd1f4a3ee8e16d6328b8dacad99ec.zip
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>
-rw-r--r--canvas/source/directx/dx_bitmapcanvashelper.cxx12
-rw-r--r--cui/source/tabpages/connect.cxx119
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx8
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx26
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx3
-rw-r--r--sc/source/filter/excel/excform.cxx5
-rw-r--r--sc/source/ui/view/dbfunc3.cxx35
-rw-r--r--sd/source/ui/docshell/docshel4.cxx12
-rw-r--r--sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx5
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx15
-rw-r--r--svx/source/items/customshapeitem.cxx46
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx18
-rw-r--r--sw/source/core/draw/dview.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
-rw-r--r--vcl/source/gdi/dibtools.cxx9
15 files changed, 115 insertions, 230 deletions
diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx
index d05534bf4bc0..b6d08fbbf8df 100644
--- a/canvas/source/directx/dx_bitmapcanvashelper.cxx
+++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx
@@ -160,9 +160,6 @@ namespace dxcanvas
ENSURE_OR_THROW( mpTarget,
"::dxcanvas::BitmapCanvasHelper::getData(): disposed" );
- if( !mpTarget )
- return uno::Sequence< sal_Int8 >();
-
bitmapLayout = getMemoryLayout();
return mpTarget->getData(bitmapLayout,rect);
}
@@ -176,9 +173,6 @@ namespace dxcanvas
ENSURE_OR_THROW( mpTarget,
"::dxcanvas::BitmapCanvasHelper::setData(): disposed" );
- if( !mpTarget )
- return;
-
mpTarget->setData(data,bitmapLayout,rect);
}
@@ -191,9 +185,6 @@ namespace dxcanvas
ENSURE_OR_THROW( mpTarget,
"::dxcanvas::BitmapCanvasHelper::setPixel(): disposed" );
- if( !mpTarget )
- return;
-
mpTarget->setPixel(color,bitmapLayout,pos);
}
@@ -205,9 +196,6 @@ namespace dxcanvas
ENSURE_OR_THROW( mpTarget,
"::dxcanvas::BitmapCanvasHelper::getPixel(): disposed" );
- if( !mpTarget )
- return uno::Sequence< sal_Int8 >();
-
bitmapLayout = getMemoryLayout();
return mpTarget->getPixel(bitmapLayout,pos);
}
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index 7e9b9385f282..d71bc5623972 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -147,138 +147,84 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
// SdrEdgeNode1HorzDistItem
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1HORZDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrEdgeNode1HorzDistItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldHorz1, nValue, eUnit);
- }
- else
- m_xMtrFldHorz1->set_text("");
-
+ SetMetricValue(*m_xMtrFldHorz1, static_cast<const SdrEdgeNode1HorzDistItem*>(pItem)->GetValue(),
+ eUnit);
m_xMtrFldHorz1->save_value();
// SdrEdgeNode2HorzDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2HORZDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2HORZDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrEdgeNode2HorzDistItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldHorz2, nValue, eUnit);
- }
- else
- m_xMtrFldHorz2->set_text("");
-
+ SetMetricValue(*m_xMtrFldHorz2, static_cast<const SdrEdgeNode2HorzDistItem*>(pItem)->GetValue(),
+ eUnit);
m_xMtrFldHorz2->save_value();
// SdrEdgeNode1VertDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1VERTDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1VERTDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrEdgeNode1VertDistItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldVert1, nValue, eUnit);
- }
- else
- m_xMtrFldVert1->set_text("");
-
+ SetMetricValue(*m_xMtrFldVert1, static_cast<const SdrEdgeNode1VertDistItem*>(pItem)->GetValue(),
+ eUnit);
m_xMtrFldVert1->save_value();
// SdrEdgeNode2VertDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2VERTDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2VERTDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrEdgeNode2VertDistItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldVert2, nValue, eUnit);
- }
- else
- m_xMtrFldVert2->set_text("");
-
+ SetMetricValue(*m_xMtrFldVert2, static_cast<const SdrEdgeNode2VertDistItem*>(pItem)->GetValue(),
+ eUnit);
m_xMtrFldVert2->save_value();
// SdrEdgeLine1DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE1DELTA );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldLine1, nValue, eUnit);
- }
- else
- m_xMtrFldLine1->set_text("");
-
+ SetMetricValue(*m_xMtrFldLine1, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldLine1->save_value();
// SdrEdgeLine2DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE2DELTA );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldLine2, nValue, eUnit);
- }
- else
- m_xMtrFldLine2->set_text("");
-
+ SetMetricValue(*m_xMtrFldLine2, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldLine2->save_value();
// SdrEdgeLine3DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE3DELTA );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue(*m_xMtrFldLine3, nValue, eUnit);
- }
- else
- m_xMtrFldLine3->set_text("");
-
+ SetMetricValue(*m_xMtrFldLine3, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldLine3->save_value();
// SdrEdgeLineDeltaAnzItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINEDELTACOUNT );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINEDELTACOUNT );
- if( pItem )
+ switch (static_cast<const SdrEdgeLineDeltaCountItem*>(pItem)->GetValue())
{
- sal_uInt16 nValue = static_cast<const SdrEdgeLineDeltaCountItem*>( pItem )->GetValue();
- if( nValue <= 2 )
- {
- m_xFtLine3->set_sensitive(false);
- m_xMtrFldLine3->set_sensitive(false);
- m_xMtrFldLine3->set_text("");
- }
- if( nValue <= 1 )
- {
- m_xFtLine2->set_sensitive(false);
- m_xMtrFldLine2->set_sensitive(false);
- m_xMtrFldLine2->set_text("");
- }
- if( nValue == 0 )
- {
+ case 0:
m_xFtLine1->set_sensitive(false);
m_xMtrFldLine1->set_sensitive(false);
m_xMtrFldLine1->set_text("");
- }
+ SAL_FALLTHROUGH;
+ case 1:
+ m_xFtLine2->set_sensitive(false);
+ m_xMtrFldLine2->set_sensitive(false);
+ m_xMtrFldLine2->set_text("");
+ SAL_FALLTHROUGH;
+ case 2:
+ m_xFtLine3->set_sensitive(false);
+ m_xMtrFldLine3->set_sensitive(false);
+ m_xMtrFldLine3->set_text("");
+ break;
}
// SdrEdgeKindItem
pItem = GetItem( *rAttrs, SDRATTR_EDGEKIND );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
- if( pItem )
- {
- SdrEdgeKind nValue = static_cast<const SdrEdgeKindItem*>( pItem )->GetValue();
- m_xLbType->set_active(sal::static_int_cast<sal_uInt16>(nValue));
- }
- else
- m_xLbType->set_active(-1);
+ m_xLbType->set_active(
+ sal::static_int_cast<sal_uInt16>(static_cast<const SdrEdgeKindItem*>(pItem)->GetValue()));
m_xLbType->save_value();
}
@@ -465,15 +411,12 @@ void SvxConnectionPage::FillTypeLB()
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
- if( pItem )
+ const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>(pItem);
+ const sal_uInt16 nCount = pEdgeKindItem->GetValueCount();
+ for (sal_uInt16 i = 0; i < nCount; i++)
{
- const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>( pItem );
- sal_uInt16 nCount = pEdgeKindItem->GetValueCount();
- for( sal_uInt16 i = 0; i < nCount; i++ )
- {
- OUString aStr = pEdgeKindItem->GetValueTextByPos(i);
- m_xLbType->append_text(aStr);
- }
+ OUString aStr = pEdgeKindItem->GetValueTextByPos(i);
+ m_xLbType->append_text(aStr);
}
}
void SvxConnectionPage::PageCreated(const SfxAllItemSet& aSet)
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 2bca0c619984..dc110202eeba 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1969,8 +1969,7 @@ bool ODocumentDefinition::prepareClose()
// document has not yet been activated, i.e. has no UI, yet
return true;
- bool bCouldSuspend = xController->suspend( true );
- if ( !bCouldSuspend )
+ if (!xController->suspend(true))
// controller vetoed the closing
return false;
@@ -1984,9 +1983,8 @@ bool ODocumentDefinition::prepareClose()
}
if ( !save( true ) )
{
- if ( bCouldSuspend )
- // revert suspension
- xController->suspend( false );
+ // revert suspension
+ xController->suspend(false);
// saving failed or was cancelled
return false;
}
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 4f22d829ff10..5322308e5c83 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1085,9 +1085,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
m_bAdded = true;
}
- TOTypeInfoSP pFieldType;
- if( pFieldDescr )
- pFieldType = pFieldDescr->getTypeInfo();
+ TOTypeInfoSP pFieldType(pFieldDescr->getTypeInfo());
ActivateAggregate( tpColumnName );
ActivateAggregate( tpType );
@@ -1237,19 +1235,17 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
}
m_pPreviousType = pFieldType;
}
- if(pFieldDescr)
+
+ if (pFieldDescr->IsPrimaryKey())
{
- if(pFieldDescr->IsPrimaryKey())
- {
- DeactivateAggregate( tpRequired );
- }
- else if ( !pAutoIncrement && pFieldType.get() )
- {
- if ( pFieldType->bNullable )
- ActivateAggregate( tpRequired );
- else
- DeactivateAggregate( tpRequired );
- }
+ DeactivateAggregate(tpRequired);
+ }
+ else if (!pAutoIncrement && pFieldType.get())
+ {
+ if (pFieldType->bNullable)
+ ActivateAggregate(tpRequired);
+ else
+ DeactivateAggregate(tpRequired);
}
// Initialize Controls
if( pAutoIncrement )
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 9efd610349ac..fd743dfa85f7 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -340,8 +340,7 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView)
if ( m_pCurrentView )
m_aScrollWindow->setMarked(m_pCurrentView,false);
m_pCurrentView = &_rView;
- if ( m_pCurrentView )
- m_aScrollWindow->setMarked(m_pCurrentView,true);
+ m_aScrollWindow->setMarked(m_pCurrentView, true);
m_xReportComponent.clear();
DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED );
Broadcast( aHint );
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index de4f83c73121..ed4078f5fe25 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1600,11 +1600,12 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nCnt )
// [Parameter{;Parameter}]
if( nLast > nSkipEnd )
{
+ // nSkipEnd is either 0 or -1 => nLast >= 0
aPool << eParam[ nLast ];
for( nLauf = nLast - 1 ; nLauf > nSkipEnd ; nLauf-- )
{
- if( nLauf != -1 ) // skip this parameter
- aPool << ocSep << eParam[ nLauf ];
+ // nLauf > nSkipEnd => nLauf >= 0
+ aPool << ocSep << eParam[nLauf];
}
}
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 8baad38731e2..7ca42e09f0e2 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1697,29 +1697,26 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending
typedef std::unordered_map<OUString, sal_uInt16> UserSortMap;
UserSortMap aSubStrs;
sal_uInt16 nSubCount = 0;
- if (pUserListId)
+ ScUserList* pUserList = ScGlobal::GetUserList();
+ if (!pUserList)
+ return;
+
{
- ScUserList* pUserList = ScGlobal::GetUserList();
- if (!pUserList)
+ size_t n = pUserList->size();
+ if (!n || *pUserListId >= static_cast<sal_uInt16>(n))
return;
+ }
- {
- size_t n = pUserList->size();
- if (!n || *pUserListId >= static_cast<sal_uInt16>(n))
- return;
- }
-
- const ScUserListData& rData = (*pUserList)[*pUserListId];
- sal_uInt16 n = rData.GetSubCount();
- for (sal_uInt16 i = 0; i < n; ++i)
- {
- OUString aSub = rData.GetSubStr(i);
- if (!aMemberSet.count(aSub))
- // This string doesn't exist in the member name set. Don't add this.
- continue;
+ const ScUserListData& rData = (*pUserList)[*pUserListId];
+ sal_uInt16 n = rData.GetSubCount();
+ for (sal_uInt16 i = 0; i < n; ++i)
+ {
+ OUString aSub = rData.GetSubStr(i);
+ if (!aMemberSet.count(aSub))
+ // This string doesn't exist in the member name set. Don't add this.
+ continue;
- aSubStrs.emplace(aSub, nSubCount++);
- }
+ aSubStrs.emplace(aSub, nSubCount++);
}
// Rank all members.
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index fca227e683c7..672181e24fbb 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -568,17 +568,11 @@ bool DrawDocShell::Save()
bool DrawDocShell::SaveAs( SfxMedium& rMedium )
{
mpDoc->setDocAccTitle(OUString());
- SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
- if (pFrame1)
+ if (SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst(this))
{
- vcl::Window* pWindow = &pFrame1->GetWindow();
- if ( pWindow )
+ if (vcl::Window* pSysWin = pFrame1->GetWindow().GetSystemWindow())
{
- vcl::Window* pSysWin = pWindow->GetSystemWindow();
- if ( pSysWin )
- {
- pSysWin->SetAccessibleName(OUString());
- }
+ pSysWin->SetAccessibleName(OUString());
}
}
mpDoc->StopWorkStartupDelay();
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
index 6ff1bc115ac4..c9e4b8057cd8 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -182,9 +182,8 @@ void CurrentMasterPagesSelector::UpdateSelection()
else
{
SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
- SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
- if (pMasterPage != nullptr)
- aNames.insert (pMasterPage->GetName());
+ assert(dynamic_cast<SdPage*>(&rMasterPage));
+ aNames.insert(static_cast<SdPage&>(rMasterPage).GetName());
}
}
}
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index ae5cd6fdae37..80d25dc1f3de 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1280,15 +1280,12 @@ public:
{
mbHasOrientationWarningBeenShown = true;
// Show warning that the orientation could not be set.
- if (pViewShell)
- {
- std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::OkCancel,
- SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
- xWarn->set_default_response(RET_CANCEL);
- if (xWarn->run() != RET_OK)
- return;
- }
+ std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(
+ pViewShell->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::OkCancel,
+ SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
+ xWarn->set_default_response(RET_CANCEL);
+ if (xWarn->run() != RET_OK)
+ return;
}
}
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();
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 4e203e565108..be9f7610bee3 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -729,7 +729,8 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
bool bSaveInXMLImportFlag = m_rDoc.IsInXMLImport();
m_rDoc.SetInXMLImport( false );
// and then hide/display everything
- void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr;
+ void (SwRangeRedline::*pFnc)(sal_uInt16, size_t); // Allow compiler warn if use of
+ // uninitialized ptr is possible
RedlineFlags eShowMode = RedlineFlags::ShowMask & eMode;
if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
@@ -747,16 +748,13 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
- if (pFnc)
- {
- for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
- for (size_t i = 0; i < mpRedlineTable->size(); ++i)
- ((*mpRedlineTable)[i]->*pFnc)(nLoop, i);
+ for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
+ for (size_t i = 0; i < mpRedlineTable->size(); ++i)
+ ((*mpRedlineTable)[i]->*pFnc)(nLoop, i);
- //SwRangeRedline::MoveFromSection routinely changes
- //the keys that mpRedlineTable is sorted by
- mpRedlineTable->Resort();
- }
+ //SwRangeRedline::MoveFromSection routinely changes
+ //the keys that mpRedlineTable is sorted by
+ mpRedlineTable->Resort();
CheckAnchoredFlyConsistency(m_rDoc);
CHECK_REDLINE( *this )
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index e97a4a70954f..9cafe342e3a6 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -954,16 +954,9 @@ void SwDrawView::DeleteMarked()
pTmpRoot->StartAllAction();
pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
// replace marked <SwDrawVirtObj>-objects by its reference objects.
+ if (SdrPageView* pDrawPageView = m_rImp.GetPageView())
{
- SdrPageView* pDrawPageView = m_rImp.GetPageView();
- if ( pDrawPageView )
- {
- SdrMarkView* pMarkView = &(pDrawPageView->GetView());
- if ( pMarkView )
- {
- ReplaceMarkedDrawVirtObjs( *pMarkView );
- }
- }
+ ReplaceMarkedDrawVirtObjs(pDrawPageView->GetView());
}
// Check what textboxes have to be deleted afterwards.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 47022173a6ea..b691312b5794 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6178,7 +6178,7 @@ void DocxAttributeOutput::SectionType( sal_uInt8 nBreakCode )
/* break code: 0 No break, 1 New column
2 New page, 3 Even page, 4 Odd page
*/
- const char* pType = nullptr;
+ const char* pType;
switch ( nBreakCode )
{
case 1: pType = "nextColumn"; break;
@@ -6188,10 +6188,7 @@ void DocxAttributeOutput::SectionType( sal_uInt8 nBreakCode )
default: pType = "continuous"; break;
}
- if ( pType )
- m_pSerializer->singleElementNS( XML_w, XML_type,
- FSNS( XML_w, XML_val ), pType,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_type, FSNS(XML_w, XML_val), pType, FSEND);
}
void DocxAttributeOutput::TextVerticalAdjustment( const drawing::TextVerticalAdjust nVA )
@@ -6254,7 +6251,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc
void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
{
- const char *pFamily = nullptr;
+ const char* pFamily;
switch ( eFamily )
{
case FAMILY_ROMAN: pFamily = "roman"; break;
@@ -6265,15 +6262,12 @@ void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
default: pFamily = "auto"; break; // no font family
}
- if ( pFamily )
- m_pSerializer->singleElementNS( XML_w, XML_family,
- FSNS( XML_w, XML_val ), pFamily,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_family, FSNS(XML_w, XML_val), pFamily, FSEND);
}
void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
{
- const char *pPitch = nullptr;
+ const char* pPitch;
switch ( ePitch )
{
case PITCH_VARIABLE: pPitch = "variable"; break;
@@ -6281,10 +6275,7 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
default: pPitch = "default"; break; // no info about the pitch
}
- if ( pPitch )
- m_pSerializer->singleElementNS( XML_w, XML_pitch,
- FSNS( XML_w, XML_val ), pPitch,
- FSEND );
+ m_pSerializer->singleElementNS(XML_w, XML_pitch, FSNS(XML_w, XML_val), pPitch, FSEND);
}
void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch )
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index accae76a3726..b6ffa8fd9908 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -917,8 +917,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL
// (partially) check the image dimensions to avoid potential large bitmap allocation if the input is damaged
sal_uInt64 nMaxWidth = pIStm->remainingSize();
nMaxWidth *= 256; //assume generous compression ratio
- if (aHeader.nHeight != 0)
- nMaxWidth /= aHeader.nHeight;
+ nMaxWidth /= aHeader.nHeight;
if (nMaxWidth < static_cast<sal_uInt64>(aHeader.nWidth))
return false;
break;
@@ -929,8 +928,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL
return false;
sal_uInt64 nMaxWidth = pIStm->remainingSize();
nMaxWidth *= 512; //assume generous compression ratio
- if (aHeader.nHeight != 0)
- nMaxWidth /= aHeader.nHeight;
+ nMaxWidth /= aHeader.nHeight;
if (nMaxWidth < static_cast<sal_uInt64>(aHeader.nWidth))
return false;
break;
@@ -942,8 +940,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL
{
// (partially) check the image dimensions to avoid potential large bitmap allocation if the input is damaged
sal_uInt64 nMaxWidth = pIStm->remainingSize();
- if (aHeader.nHeight != 0)
- nMaxWidth /= aHeader.nHeight;
+ nMaxWidth /= aHeader.nHeight;
if (nMaxWidth < nAlignedWidth)
return false;
break;