diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-11 15:56:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-12 10:31:25 +0100 |
commit | f147b160aef1735d34c488353a7d4b875788a7e1 (patch) | |
tree | ab3bd613cf016cde906b3fdcbaab4246ca699e1e /sc | |
parent | 718f540fb63af27c1336f89213444e9af753b8a9 (diff) |
clang-analyzer-deadcode.DeadStores
Change-Id: Ifa384933569b27d0d08eb479bb95b799163ae386
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88450
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/fillinfo.cxx | 37 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/crnrdlg.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 6 |
11 files changed, 25 insertions, 68 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 10e09421fa98..f00da7667514 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1748,7 +1748,7 @@ void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& r // Specified range not found. Bail out. return; - size_t nBlockEnd = nBlockStart + itBlk->size; + size_t nBlockEnd; size_t nOffsetInBlock = nRowPos - nBlockStart; nRowPos = static_cast<size_t>(nRow2); // End row position. diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 3a0db48fc0d7..395bb62149d4 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -722,11 +722,11 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData& if(bIsGrowing) // cell is growing larger { // To actually grow the image, we need to take the max - fWidthFactor = fHeightFactor = std::max(fWidthFactor, fHeightFactor); + fWidthFactor = std::max(fWidthFactor, fHeightFactor); } else if(bIsShrinking) // cell is growing smaller, take the min { - fWidthFactor = fHeightFactor = std::min(fWidthFactor, fHeightFactor); + fWidthFactor = std::min(fWidthFactor, fHeightFactor); } // We don't want the image to become larger than the current cell diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 747d69b91fbb..2f27bffb78ec 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -373,27 +373,6 @@ void ScDocument::FillInfo( bool bTabProtect = IsTabProtected(nTab); - // for block marks of merged cells - // with hidden first row/column - bool bPaintMarks = false; - SCCOL nBlockStartX = 0, nBlockEndX = 0; - SCROW nBlockEndY = 0, nBlockStartY = 0; - if (pMarkData && pMarkData->IsMarked()) - { - ScRange aTmpRange; - pMarkData->GetMarkArea(aTmpRange); - if ( nTab >= aTmpRange.aStart.Tab() && nTab <= aTmpRange.aEnd.Tab() ) - { - nBlockStartX = aTmpRange.aStart.Col(); - nBlockStartY = aTmpRange.aStart.Row(); - nBlockEndX = aTmpRange.aEnd.Col(); - nBlockEndY = aTmpRange.aEnd.Row(); - ExtendHidden( nBlockStartX, nBlockStartY, nBlockEndX, nBlockEndY, nTab ); //? needed ? - if (!pMarkData->IsMarkNegative()) - bPaintMarks = true; - } - } - // first only the entries for the entire column nArrRow=0; @@ -750,22 +729,6 @@ void ScDocument::FillInfo( pInfo->pShadowAttr = static_cast<const SvxShadowItem*>(pItem); if (pInfo->pShadowAttr != pDefShadow) bAnyShadow = true; - - // Block marks - again with the original merge values - - bool bCellMarked = false; - if (bPaintMarks) - bCellMarked = ( nStartX >= nBlockStartX - && nStartX <= nBlockEndX - && nStartY >= nBlockStartY - && nStartY <= nBlockEndY ); - if (pMarkData && pMarkData->IsMultiMarked() && !bCellMarked) - { - ScMarkArray aThisMarkArr(pMarkData->GetMarkArray( nStartX )); - SCSIZE nIndex; - if ( aThisMarkArr.Search( nStartY, nIndex ) ) - bCellMarked=aThisMarkArr.mvData[nIndex].bMarked; - } } } } diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 94c06efc7c8d..2c7b5b07a398 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1863,7 +1863,7 @@ void ScRange::ParseRows( const ScDocument* pDoc, { if( p[0] == ':') { - p = lcl_a1_get_row( pDoc, p+1, &aEnd, &ignored, nullptr); + lcl_a1_get_row( pDoc, p+1, &aEnd, &ignored, nullptr); } else { @@ -1880,7 +1880,7 @@ void ScRange::ParseRows( const ScDocument* pDoc, { if( p[1] == 'R' || p[1] == 'r' ) { - p = lcl_r1c1_get_row( p+1, rDetails, &aEnd, &ignored ); + lcl_r1c1_get_row( p+1, rDetails, &aEnd, &ignored ); } } else diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index b7e2a1f60f4b..8da7bbdd14b5 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4043,8 +4043,7 @@ void ScCompiler::AutoCorrectParsedSymbol() sal_Int32 nLen1 = aTmp1.getLength(); OUStringBuffer aSym; OUString aTmp2; - bool bLastAlp, bNextNum; - bLastAlp = bNextNum = true; + bool bLastAlp = true; sal_Int32 nStrip = 0; sal_Int32 nCount = nRefs; for ( sal_Int32 j=1; j<nCount; j++ ) @@ -4060,7 +4059,7 @@ void ScCompiler::AutoCorrectParsedSymbol() } if ( nLen2 ) { - bNextNum = CharClass::isAsciiNumeric( aTmp2 ); + bool bNextNum = CharClass::isAsciiNumeric( aTmp2 ); if ( bLastAlp == bNextNum && nStrip < 1 ) { // Must be alternating number/string, only diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 7716a973fd6e..7f65d634c3fe 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3454,7 +3454,7 @@ void ScInterpreter::ScMacro() { // array( cols ) one line, several columns pDimArray->GetDim32( 1, nCs, nCe ); nC = static_cast<SCSIZE>(nCe - nCs + 1); - nRs = nRe = 0; + nRs = 0; nR = 1; nColIdx = 0; nRowIdx = 1; diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index f0d865e239b5..bc362f89bd17 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2432,9 +2432,7 @@ Label_RetryWithNewSep: sal_Int32 nQuotes = 0; while (!rStream.eof() && aStr.getLength() < nArbitraryLineLengthLimit) { - const sal_Unicode *p, *pStart; - p = pStart = aStr.getStr(); - p += nLastOffset; + const sal_Unicode * p = aStr.getStr() + nLastOffset; while (*p) { if (nQuotes) diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 2ad2a0605f18..b5d64eedd903 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -366,7 +366,7 @@ void ScColRowNameRangesDlg::UpdateNames() OUString strDelim(" --- "); OUString aString = strDelim + ScResId( STR_COLUMN ) + strDelim; m_xLbRange->append(OUString::number(nEntryDataDelim), aString); - if ( (nCount = xColNameRanges->size()) > 0 ) + if ( xColNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xColNameRanges->CreateNameSortedArray( pDoc )); @@ -405,7 +405,7 @@ void ScColRowNameRangesDlg::UpdateNames() } aString = strDelim + ScResId( STR_ROW ) + strDelim; m_xLbRange->append(OUString::number(nEntryDataDelim), aString); - if ( (nCount = xRowNameRanges->size()) > 0 ) + if ( xRowNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xRowNameRanges->CreateNameSortedArray( pDoc )); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a28f9a2eabae..8195d4e8f3ec 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1756,7 +1756,6 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 aRange.aStart = ScAddress(nStartCol, nStartRow, nTab); aRange.aEnd = ScAddress(nEndCol, nEndRow, nTab); - pSelRange = &aRange; table::CellRangeAddress aRangeAddress( nTab, aRange.aStart.Col(), aRange.aStart.Row(), diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 3ed5a2a48208..a83db735127c 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1169,19 +1169,17 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION //In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable - if(eType == SvNumFormatType::ALL - || eType == SvNumFormatType::NUMBER - || eType == (SvNumFormatType::NUMBER | SvNumFormatType::DEFINED) - || eType == SvNumFormatType::PERCENT - || eType == (SvNumFormatType::PERCENT | SvNumFormatType::DEFINED) - || eType == SvNumFormatType::CURRENCY - || eType == (SvNumFormatType::CURRENCY | SvNumFormatType::DEFINED) - || eType == SvNumFormatType::SCIENTIFIC - || eType == (SvNumFormatType::SCIENTIFIC | SvNumFormatType::DEFINED) - || eType == SvNumFormatType::FRACTION - || eType == (SvNumFormatType::FRACTION | SvNumFormatType::DEFINED)) - eType = SvNumFormatType::ALL; - else + if(!(eType == SvNumFormatType::ALL + || eType == SvNumFormatType::NUMBER + || eType == (SvNumFormatType::NUMBER | SvNumFormatType::DEFINED) + || eType == SvNumFormatType::PERCENT + || eType == (SvNumFormatType::PERCENT | SvNumFormatType::DEFINED) + || eType == SvNumFormatType::CURRENCY + || eType == (SvNumFormatType::CURRENCY | SvNumFormatType::DEFINED) + || eType == SvNumFormatType::SCIENTIFIC + || eType == (SvNumFormatType::SCIENTIFIC | SvNumFormatType::DEFINED) + || eType == SvNumFormatType::FRACTION + || eType == (SvNumFormatType::FRACTION | SvNumFormatType::DEFINED))) pEntry = nullptr; if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && pEntry) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 7f38fe353561..c50c3c06df94 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2958,8 +2958,8 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ ) aRepeated.append(aCellStr); - nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated.makeStringAndClear(), - nNeededPixel, (nLeftM + nRightM ) ); + SetEngineTextAndGetWidth( rParam, aRepeated.makeStringAndClear(), + nNeededPixel, (nLeftM + nRightM ) ); nEngineHeight = rParam.mpEngine->GetTextHeight(); } @@ -2970,7 +2970,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) if ( rParam.mbCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) ) { - nEngineWidth = SetEngineTextAndGetWidth( rParam, "###", nNeededPixel, ( nLeftM + nRightM ) ); + SetEngineTextAndGetWidth( rParam, "###", nNeededPixel, ( nLeftM + nRightM ) ); // No clip marks if "###" doesn't fit (same as in DrawStrings) } |