diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-03 14:55:29 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-03 14:13:57 +0100 |
commit | 2a3f5d11522cd69f0ce221cde3a63b7e85e94b53 (patch) | |
tree | 51a9483a42769f64fff5b329af6604cdf5a5f7ff | |
parent | e73bf95c00168bbf7d312cd11c40d0581ebd928e (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I856345576ff5c10a41509a97ad4539272bd55568
Reviewed-on: https://gerrit.libreoffice.org/62803
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
20 files changed, 119 insertions, 188 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 119f7c6b41a3..3c8efde81a15 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -341,15 +341,12 @@ void ModulWindow::BasicExecute() ChooseMacro( uno::Reference< frame::XModel >() ); return; } - if ( pMethod ) - { - pMethod->SetDebugFlags( m_aStatus.nBasicFlags ); - BasicDLL::SetDebugMode( true ); - RunMethod( pMethod ); - BasicDLL::SetDebugMode( false ); - // if cancelled during Interactive=false - BasicDLL::EnableBreak( true ); - } + pMethod->SetDebugFlags(m_aStatus.nBasicFlags); + BasicDLL::SetDebugMode(true); + RunMethod(pMethod); + BasicDLL::SetDebugMode(false); + // if cancelled during Interactive=false + BasicDLL::EnableBreak(true); ClearStatus( BASWIN_RUNNINGBASIC ); } else diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 4dc3b0571851..a1ec27c3d636 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -148,13 +148,10 @@ void lcl_SeparateNameAndIndex( const OUString& rVName, OUString& rVar, OUString& if ( nIndexStart != -1 ) { sal_Int32 nIndexEnd = rVar.indexOf( ')', nIndexStart ); - if ( nIndexStart != -1 ) - { - rIndex = rVar.copy( nIndexStart+1, nIndexEnd-nIndexStart-1 ); - rVar = rVar.copy( 0, nIndexStart ); - rVar = comphelper::string::stripEnd(rVar, ' '); - rIndex = comphelper::string::strip(rIndex, ' '); - } + rIndex = rVar.copy(nIndexStart + 1, nIndexEnd - nIndexStart - 1); + rVar = rVar.copy(0, nIndexStart); + rVar = comphelper::string::stripEnd(rVar, ' '); + rIndex = comphelper::string::strip(rIndex, ' '); } if ( !rVar.isEmpty() ) @@ -2412,7 +2409,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) SbxDimArray* pOldArray = pItem->mpArray.get(); bool bArrayChanged = false; - if( pNewArray != nullptr && pOldArray != nullptr ) + if (pOldArray != nullptr) { // Compare Array dimensions to see if array has changed // Can be a copy, so comparing pointers does not work @@ -2439,27 +2436,21 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } } } - else if( pNewArray == nullptr || pOldArray == nullptr ) + else { bArrayChanged = true; } - if( pNewArray ) - { - implEnableChildren( pEntry, true ); - } + implEnableChildren(pEntry, true); // #i37227 Clear always and replace array if( pNewArray != pOldArray ) { pItem->clearWatchItem(); - if( pNewArray ) - { - implEnableChildren( pEntry, true ); + implEnableChildren(pEntry, true); - pItem->mpArray = pNewArray; - sal_uInt16 nDims = pNewArray->GetDims(); - pItem->nDimLevel = 0; - pItem->nDimCount = nDims; - } + pItem->mpArray = pNewArray; + sal_uInt16 nDims = pNewArray->GetDims(); + pItem->nDimLevel = 0; + pItem->nDimCount = nDims; } if( bArrayChanged && pOldArray != nullptr ) { diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index f4b26f260972..b263c88e7c44 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -260,11 +260,11 @@ namespace basegfx // against X-Axis, higher value if(aRetval.count() == 1) { - aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), true, !bInside, rRange.getMaxY(), bStroke); + aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), true, false, rRange.getMaxY(), bStroke); } else { - aRetval = clipPolyPolygonOnParallelAxis(aRetval, true, !bInside, rRange.getMaxY(), bStroke); + aRetval = clipPolyPolygonOnParallelAxis(aRetval, true, false, rRange.getMaxY(), bStroke); } if(aRetval.count()) @@ -272,11 +272,11 @@ namespace basegfx // against Y-Axis, higher value if(aRetval.count() == 1) { - aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), false, !bInside, rRange.getMaxX(), bStroke); + aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), false, false, rRange.getMaxX(), bStroke); } else { - aRetval = clipPolyPolygonOnParallelAxis(aRetval, false, !bInside, rRange.getMaxX(), bStroke); + aRetval = clipPolyPolygonOnParallelAxis(aRetval, false, false, rRange.getMaxX(), bStroke); } } } diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index b21cc823a4f5..c21b92db6b28 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -685,14 +685,10 @@ awt::Point SAL_CALL AccessibleBase::getLocationOnScreen() { CheckDisposeState(); - if( m_aAccInfo.m_pParent != nullptr ) + if (AccessibleBase* pParent = m_aAccInfo.m_pParent) { - AccessibleBase * pParent = m_aAccInfo.m_pParent; awt::Point aLocThisRel( getLocation()); - awt::Point aUpperLeft; - - if( pParent != nullptr ) - aUpperLeft = pParent->getLocationOnScreen(); + awt::Point aUpperLeft(pParent->getLocationOnScreen()); return awt::Point( aUpperLeft.X + aLocThisRel.X, aUpperLeft.Y + aLocThisRel.Y ); diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx index 6f1fc604bb49..cfef7f25baac 100644 --- a/chart2/source/model/template/BubbleDataInterpreter.cxx +++ b/chart2/source/model/template/BubbleDataInterpreter.cxx @@ -134,8 +134,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource( } if( aYValuesVector.size() > nN ) aNewData.push_back( aYValuesVector[nN] ); - if( aSizeValuesVector.size() > nN ) - aNewData.push_back( aSizeValuesVector[nN] ); + aNewData.push_back(aSizeValuesVector[nN]); Reference< XDataSeries > xSeries; if( nSeriesIndex < aSeriesToReUse.getLength()) diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 005d7c4afba8..02ea81e98232 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -542,10 +542,8 @@ void AreaChart::impl_createSeriesShapes() for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector ) { sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); - PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex )); - if(!pPosHelper) - pPosHelper = m_pMainPosHelper.get(); - PlotterBase::m_pPosHelper = pPosHelper; + PlottingPositionHelper& rPosHelper = getPlottingPositionHelper(nAttachedAxisIndex); + m_pPosHelper = &rPosHelper; createRegressionCurvesShapes( *pSeries, m_xErrorBarTarget, m_xRegressionCurveEquationTarget, m_pPosHelper->maySkipPointsInRegressionCalculation()); @@ -553,12 +551,13 @@ void AreaChart::impl_createSeriesShapes() pSeriesPoly = &pSeries->m_aPolyPolygonShape3D; if( m_bArea ) { - if( !impl_createArea( pSeries.get(), pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) ) + if (!impl_createArea(pSeries.get(), pSeriesPoly, + aPreviousSeriesPolyMap[nAttachedAxisIndex], &rPosHelper)) continue; } if( m_bLine ) { - if( !impl_createLine( pSeries.get(), pSeriesPoly, pPosHelper ) ) + if (!impl_createLine(pSeries.get(), pSeriesPoly, &rPosHelper)) continue; } aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly; @@ -677,10 +676,7 @@ void AreaChart::createShapes() if( rLogicYSumMap.find(nAttachedAxisIndex)==rLogicYSumMap.end() ) rLogicYSumMap[nAttachedAxisIndex]=0.0; - PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex )); - if(!pPosHelper) - pPosHelper = m_pMainPosHelper.get(); - PlotterBase::m_pPosHelper = pPosHelper; + m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex); double fAdd = pSeries->getYValue( nIndex ); if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) ) @@ -707,10 +703,8 @@ void AreaChart::createShapes() uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget); sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); - PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex )); - if(!pPosHelper) - pPosHelper = m_pMainPosHelper.get(); - PlotterBase::m_pPosHelper = pPosHelper; + PlottingPositionHelper& rPosHelper = getPlottingPositionHelper(nAttachedAxisIndex); + m_pPosHelper = &rPosHelper; if(m_nDimension==3) fLogicZ = nZ+0.5; @@ -735,7 +729,7 @@ void AreaChart::createShapes() fLogicY = fabs( fLogicY ); std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex]; - if( pPosHelper->isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0 ) + if (rPosHelper.isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0) { fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex]; } @@ -766,7 +760,7 @@ void AreaChart::createShapes() fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex]; rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY; - bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ ); + bool bIsVisible = rPosHelper.isLogicVisible(fLogicX, fLogicY, fLogicZ); //remind minimal and maximal x values for area 'grounding' points //only for filled area @@ -781,18 +775,20 @@ void AreaChart::createShapes() drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ ); drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition); - pPosHelper->doLogicScaling( aScaledLogicPosition ); + rPosHelper.doLogicScaling(aScaledLogicPosition); //transformation 3) -> 4) - drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) ); + drawing::Position3D aScenePosition( + rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false)); //better performance for big data FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] ); - pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution ); - if( !pSeries->isAttributedDataPoint(nIndex) - && - pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ - , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) ) + rPosHelper.setCoordinateSystemResolution(m_aCoordinateSystemResolution); + if (!pSeries->isAttributedDataPoint(nIndex) + && rPosHelper.isSameForGivenResolution( + aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ, + aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, + aScaledLogicPosition.PositionZ)) { ++nSkippedPoints; m_bPointsWereSkipped = true; @@ -859,31 +855,27 @@ void AreaChart::createShapes() { if(m_nDimension!=3) { - if( pSymbolProperties ) + if (pSymbolProperties->Style != SymbolStyle_NONE) { - if( pSymbolProperties->Style != SymbolStyle_NONE ) - { - aSymbolSize.DirectionX = pSymbolProperties->Size.Width; - aSymbolSize.DirectionY = pSymbolProperties->Size.Height; - } - - if( pSymbolProperties->Style == SymbolStyle_STANDARD ) - { - sal_Int32 nSymbol = pSymbolProperties->StandardSymbol; - m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes - , aScenePosition, aSymbolSize - , nSymbol - , pSymbolProperties->BorderColor - , pSymbolProperties->FillColor ); - } - else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC ) - { - m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes - , aScenePosition , aSymbolSize - , pSymbolProperties->Graphic ); - } - //@todo other symbol styles + aSymbolSize.DirectionX = pSymbolProperties->Size.Width; + aSymbolSize.DirectionY = pSymbolProperties->Size.Height; } + + if (pSymbolProperties->Style == SymbolStyle_STANDARD) + { + sal_Int32 nSymbol = pSymbolProperties->StandardSymbol; + m_pShapeFactory->createSymbol2D( + xPointGroupShape_Shapes, aScenePosition, aSymbolSize, + nSymbol, pSymbolProperties->BorderColor, + pSymbolProperties->FillColor); + } + else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC) + { + m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes, + aScenePosition, aSymbolSize, + pSymbolProperties->Graphic); + } + //@todo other symbol styles } } //create error bars @@ -901,7 +893,8 @@ void AreaChart::createShapes() , aScenePosition.PositionY , aScenePosition.PositionZ+getTransformedDepth() ); - sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() ); + sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( + nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY()); switch(nLabelPlacement) { diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index ee3b0cc38e3e..012d1301f49d 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -218,10 +218,9 @@ void BubbleChart::createShapes() uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries.get(), xSeriesTarget); sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); - PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex )); - if(!pPosHelper) - pPosHelper = m_pMainPosHelper; - PlotterBase::m_pPosHelper = pPosHelper; + PlottingPositionHelper& rPosHelper + = getPlottingPositionHelper(nAttachedAxisIndex); + m_pPosHelper = &rPosHelper; //collect data point information (logic coordinates, style ): double fLogicX = pSeries->getXValue(nIndex); @@ -238,22 +237,24 @@ void BubbleChart::createShapes() || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) continue; - bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ ); + bool bIsVisible = rPosHelper.isLogicVisible(fLogicX, fLogicY, fLogicZ); drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ ); drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition); - pPosHelper->doLogicScaling( aScaledLogicPosition ); + rPosHelper.doLogicScaling(aScaledLogicPosition); //transformation 3) -> 4) - drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) ); + drawing::Position3D aScenePosition( + rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false)); //better performance for big data FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] ); - pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution ); - if( !pSeries->isAttributedDataPoint(nIndex) - && - pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ - , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) ) + rPosHelper.setCoordinateSystemResolution(m_aCoordinateSystemResolution); + if (!pSeries->isAttributedDataPoint(nIndex) + && rPosHelper.isSameForGivenResolution( + aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ, + aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, + aScaledLogicPosition.PositionZ)) { nSkippedPoints++; m_bPointsWereSkipped = true; @@ -315,7 +316,8 @@ void BubbleChart::createShapes() , aScenePosition.PositionY , aScenePosition.PositionZ+getTransformedDepth() ); - sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() ); + sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( + nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY()); switch(nLabelPlacement) { diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 28494f7a46d3..56a439d48e37 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1434,9 +1434,9 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const std::shared_ptr<DrawModelWrap if(!pDrawModelWrapper) return nWritingMode; - const SfxPoolItem* pItem = &(pDrawModelWrapper->GetItemPool().GetDefaultItem( EE_PARA_WRITINGDIR )); - if( pItem ) - nWritingMode = static_cast< sal_Int16 >(static_cast< const SvxFrameDirectionItem * >( pItem )->GetValue()); + const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetDefaultItem(EE_PARA_WRITINGDIR); + nWritingMode + = static_cast<sal_Int16>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue()); return nWritingMode; } diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 8a107e891577..315fccb1c501 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -1474,24 +1474,21 @@ namespace // write number of entries if (write_sal_uInt32(aHandle, nSize)) { - if (bRetval) - { - // write placeholder for headers. Due to the fact that - // PackFileSize for newly added files gets set during - // writing the content entry, write headers after content - // is written. To do so, write placeholders here - sal_uInt32 nWriteSize(0); + // write placeholder for headers. Due to the fact that + // PackFileSize for newly added files gets set during + // writing the content entry, write headers after content + // is written. To do so, write placeholders here + sal_uInt32 nWriteSize(0); - nWriteSize += maPackedFileEntryVector.size() * PackedFileEntry::getEntrySize(); + nWriteSize += maPackedFileEntryVector.size() * PackedFileEntry::getEntrySize(); - aArray[0] = aArray[1] = aArray[2] = aArray[3] = 0; + aArray[0] = aArray[1] = aArray[2] = aArray[3] = 0; - for (sal_uInt32 a(0); bRetval && a < nWriteSize; a++) + for (sal_uInt32 a(0); bRetval && a < nWriteSize; a++) + { + if (osl_File_E_None != osl_writeFile(aHandle, static_cast<const void*>(aArray), 1, &nBaseWritten) || 1 != nBaseWritten) { - if (osl_File_E_None != osl_writeFile(aHandle, static_cast<const void*>(aArray), 1, &nBaseWritten) || 1 != nBaseWritten) - { - bRetval = false; - } + bRetval = false; } } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 496e5f1de0ac..afeafa35d8cf 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -854,23 +854,13 @@ void OAppDetailPageHelper::elementRemoved( ElementType _eType,const OUString& _r static_cast< OTableTreeListBox* >( pTreeView )->removedTable( _rName ); break; case E_QUERY: - if ( pTreeView ) - { - SvTreeListEntry* pEntry = lcl_findEntry_impl(*pTreeView,_rName,pTreeView->First()); - if ( pEntry ) - pTreeView->GetModel()->Remove(pEntry); - } + if (auto pEntry = lcl_findEntry_impl(*pTreeView, _rName, pTreeView->First())) + pTreeView->GetModel()->Remove(pEntry); break; case E_FORM: case E_REPORT: - { - if ( pTreeView ) - { - SvTreeListEntry* pEntry = lcl_findEntry(*pTreeView,_rName,pTreeView->First()); - if ( pEntry ) - pTreeView->GetModel()->Remove(pEntry); - } - } + if (auto pEntry = lcl_findEntry(*pTreeView, _rName, pTreeView->First())) + pTreeView->GetModel()->Remove(pEntry); break; default: OSL_FAIL("Invalid element type"); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index aa52b0e07e65..80630b4c4d90 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -3589,7 +3589,8 @@ void ChartExport::exportMarker(const Reference< chart2::XDataSeries >& xSeries) sal_Int32 nSymbol = aSymbol.StandardSymbol; // TODO: more properties support for marker - const char* pSymbolType = nullptr; + const char* pSymbolType; // no initialization here, to let compiler warn if we have a code path + // where it stays uninitialized switch( nSymbol ) { case 0: @@ -3631,12 +3632,7 @@ void ChartExport::exportMarker(const Reference< chart2::XDataSeries >& xSeries) pSymbolType = "none"; } - if( pSymbolType ) - { - pFS->singleElement( FSNS( XML_c, XML_symbol ), - XML_val, pSymbolType, - FSEND ); - } + pFS->singleElement(FSNS(XML_c, XML_symbol), XML_val, pSymbolType, FSEND); if (!bSkipFormatting) { diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index 3c9e17dba00e..29195f849eb5 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -71,8 +71,6 @@ void ByteGrabber::seek( sal_Int64 location ) sal_Int64 nLen = xSeek->getLength(); if ( location < 0 || location > nLen ) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); - if (location > nLen ) - location = nLen; xSeek->seek( location ); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 919533227a82..a3531af7249c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8417,8 +8417,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn else if ( pEntry->nWID == SC_WID_UNO_CODENAME ) { OUString aCodeName; - if ( pDocSh ) - pDocSh->GetDocument().GetCodeName( GetTab_Impl(), aCodeName ); + pDocSh->GetDocument().GetCodeName(GetTab_Impl(), aCodeName); rAny <<= aCodeName; } else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT) diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx index ac6568925cee..71eacdb5a087 100644 --- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx @@ -1066,11 +1066,8 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const bRet = true; - if (bRet) - { - aBitmap.AdaptBitCount(aOutBmp); - aBitmap = aOutBmp; - } + aBitmap.AdaptBitCount(aOutBmp); + aBitmap = aOutBmp; } } diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 13a133295b06..75aed6a48c8d 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -311,7 +311,6 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, ::basegfx::B2DRectangle const & rDestRect, ::basegfx::B2DHomMatrix const & rLocalTransform ) { - bool bCopyBack( false ); const Size aBmpSize( rBitmap.GetSizePixel() ); Bitmap aSrcBitmap( rBitmap.GetBitmap() ); Bitmap aSrcAlpha; @@ -455,8 +454,6 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, } } } - - bCopyBack = true; } else { @@ -466,10 +463,7 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, } } - if( bCopyBack ) - return BitmapEx( aDstBitmap, AlphaMask( aDstAlpha ) ); - else - return BitmapEx(); + return BitmapEx(aDstBitmap, AlphaMask(aDstAlpha)); } diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index 2de0da7b1a72..6e6d27ce7506 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -852,15 +852,7 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay ) bool Bitmap::GetSystemData( BitmapSystemData& rData ) const { - bool bRet = false; - if (mxSalBmp) - { - SalBitmap* pSalBitmap = mxSalBmp.get(); - if( pSalBitmap ) - bRet = pSalBitmap->GetSystemData( rData ); - } - - return bRet; + return mxSalBmp && mxSalBmp->GetSystemData(rData); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index fcd2bafbe7d8..8c6c061a2bc6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3811,10 +3811,6 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) Image* pImg = IsChecked() ? rCtrlData.mpDisclosureMinus.get() : rCtrlData.mpDisclosurePlus.get(); - SAL_WARN_IF(!pImg, "vcl", "no disclosure image"); - if (!pImg) - return; - DrawImageFlags nStyle = DrawImageFlags::NONE; if (!IsEnabled()) nStyle |= DrawImageFlags::Disable; @@ -3825,7 +3821,6 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) (aSize.Height() - aImgSize.Height()) / 2); aOff += aStateRect.TopLeft(); rRenderContext.DrawImage(aOff, *pImg, nStyle); - } void DisclosureButton::KeyInput( const KeyEvent& rKEvt ) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 5f233c13b862..fb4bb52ee719 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1641,8 +1641,7 @@ void Type1Emitter::updateLen( int nTellPos, size_t nLength) if (fseek( mpFileOut, nTellPos, SEEK_SET) != 0) return; fwrite(cData, 1, sizeof(cData), mpFileOut); - if( nCurrPos >= 0) - (void)fseek(mpFileOut, nCurrPos, SEEK_SET); + (void)fseek(mpFileOut, nCurrPos, SEEK_SET); } inline size_t Type1Emitter::emitRawData(const char* pData, size_t nLength) const diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 8e60d8a7bbfc..ef2f0569e580 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -821,20 +821,17 @@ bool ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.GetClicks() == 1 ) { - if ( bTracking ) - { - Point aPos = pBorderWindow->GetPosPixel(); - Size aSize = pBorderWindow->GetOutputSizePixel(); - maFrameData.mnTrackX = aPos.X(); - maFrameData.mnTrackY = aPos.Y(); - maFrameData.mnTrackWidth = aSize.Width(); - maFrameData.mnTrackHeight = aSize.Height(); - - if ( maFrameData.mnHitTest & BorderWindowHitTest::Title ) - nDragFullTest = DragFullOptions::WindowMove; - else - nDragFullTest = DragFullOptions::WindowSize; - } + Point aPos = pBorderWindow->GetPosPixel(); + Size aSize = pBorderWindow->GetOutputSizePixel(); + maFrameData.mnTrackX = aPos.X(); + maFrameData.mnTrackY = aPos.Y(); + maFrameData.mnTrackWidth = aSize.Width(); + maFrameData.mnTrackHeight = aSize.Height(); + + if (maFrameData.mnHitTest & BorderWindowHitTest::Title) + nDragFullTest = DragFullOptions::WindowMove; + else + nDragFullTest = DragFullOptions::WindowSize; } else { diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx index 6528249e0f2f..90714dea6339 100644 --- a/winaccessibility/source/service/AccObjectWinManager.cxx +++ b/winaccessibility/source/service/AccObjectWinManager.cxx @@ -182,8 +182,7 @@ bool AccObjectWinManager::NotifyAccEvent(XAccessible* pXAcc,short state) case UM_EVENT_STATE_FOCUSED: { UpdateAccFocus(pXAcc); - if( selfAccObj ) - selfAccObj->UpdateDefaultAction( ); + selfAccObj->UpdateDefaultAction( ); UpdateValue(pXAcc); NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID ); break; |