diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-18 11:03:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-20 11:02:45 +0000 |
commit | b0c0a074a2318a231f3f635784da494f1b713c53 (patch) | |
tree | 148eff548408d274d4208109d948e763c66e1b5d /sw/source | |
parent | 29a9f433c268414747d8ec7343fc2b5987971738 (diff) |
clang-tidy clang-analyzer-deadcode.DeadStores
suspect that some of these may reveal latent bugs....
Change-Id: I9de9aabbda9c8952715631577c29c1830df1eb71
Reviewed-on: https://gerrit.libreoffice.org/24200
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/tblcpy.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/swg/swblocks.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/text/itrcrsr.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndhints.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/html/htmlsect.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmltabw.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8TableInfo.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/index/swuiidxmrk.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 1 |
20 files changed, 7 insertions, 71 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index e137bc612541..24f5c67881f7 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -3466,20 +3466,11 @@ void SwCursorShell::GetSmartTagRect( const Point& rPt, SwRect& rSelectRect ) nullptr != (pSmartTagList = pNode->GetSmartTags()) && !pNode->IsInProtectSect() ) { - sal_Int32 nCurrent = aPos.nContent.GetIndex(); - sal_Int32 nBegin = nCurrent; + sal_Int32 nBegin = aPos.nContent.GetIndex(); sal_Int32 nLen = 1; if( pSmartTagList->InWrongWord( nBegin, nLen ) && !pNode->IsSymbol(nBegin) ) { - const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin ); - const SwWrongList* pSubList = pSmartTagList->SubList( nIndex ); - if ( pSubList ) - { - pSmartTagList = pSubList; - nCurrent = eTmpState.m_pSpecialPos->nCharOfst; - } - // get smarttag word OUString aText( pNode->GetText().copy(nBegin, nLen) ); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index ed6de582954b..685f2e58861a 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -815,8 +815,6 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc ); - SwTableBox *pSttBox = rSelBoxes[0]; - _FndLine *pFLine, *pInsFLine = nullptr; _FndBox aFndBox( nullptr, nullptr ); // Find all Boxes/Lines @@ -858,7 +856,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, // See if the Box count is high enough for the Lines SwTableLine* pLastLn = GetTabLines().back(); - pSttBox = pFLine->GetBoxes()[0]->GetBox(); + SwTableBox* pSttBox = pFLine->GetBoxes()[0]->GetBox(); const SwTableBoxes::size_type nSttBox = pFLine->GetLine()->GetTabBoxes().GetPos( pSttBox ); for( SwTableLines::size_type n = rCpyTable.GetTabLines().size() - nNewLns; n < rCpyTable.GetTabLines().size(); ++n ) @@ -902,7 +900,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, // We have enough rows, so check the Boxes per row pFLine = aFndBox.GetLines()[ nLn % nFndCnt ].get(); SwTableLine* pLine = pFLine->GetLine(); - pSttBox = pFLine->GetBoxes()[0]->GetBox(); + SwTableBox* pSttBox = pFLine->GetBoxes()[0]->GetBox(); const SwTableBoxes::size_type nSttBox = pLine->GetTabBoxes().GetPos( pSttBox ); if( nLn >= nFndCnt ) { diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 703a3de9e519..7495094ec898 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -332,10 +332,9 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) { - sal_uInt16 nIdx = USHRT_MAX; if( pImp && !pImp->bInPutMuchBlocks ) { - pImp->nCur = nIdx; + pImp->nCur = USHRT_MAX; OUString aNew; OUString aLong; if( s ) @@ -367,8 +366,6 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) } pImp->CloseFile(); pImp->Touch(); - if( !nErr ) - nIdx = pImp->GetIndex( aNew ); } } diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 4acbda965b09..62abb301f07f 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -784,8 +784,6 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, { // the recursion may have damaged our font size SetPropFont( nOldProp ); - if ( !nOldProp ) - nOldProp = 100; GetInfo().GetFont()->SetProportion( 100 ); if ( m_pCurr == &static_cast<SwMultiPortion*>(pPor)->GetRoot() ) @@ -1715,8 +1713,6 @@ sal_Int32 SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoint, if( bChgNodeInner && pTmp->Frame().IsInside( aTmpPoint ) && !( pTmp->IsProtected() ) ) { - nLength = static_cast<SwFlyCntPortion*>(pPor)-> - GetFlyCursorOfst( nX, aTmpPoint, pPos, pCMS ); // After a change of the frame, our font must be still // available for/in the OutputDevice. // For comparison: Paint and new SwFlyCntPortion ! diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index 3d355a0b2b3c..01e6f901cf1e 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -198,7 +198,6 @@ bool SwpHints::Check(bool bPortionsMerged) const // 3b) Stimmt die End-Sortierung? nIdx = *pHtEnd->GetAnyEnd(); CHECK_ERR( nIdx >= nLastEnd, "HintsCheck: ends are unsorted" ); - nLastEnd = nIdx; // 4b) IsLessEnd-Konsistenz if( pLastEnd ) diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index c2f4edd41b57..c6fe4d9d64bd 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -692,7 +692,6 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry nAttrEnd < nPaMEnd) { aCharStyles.realloc(0); - eNewState = PropertyState_AMBIGUOUS_VALUE; break; } else diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 1907c71adf7c..509c2e1be634 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -703,7 +703,6 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) } SwFormatCol aFormatCol; - nPrcWidth = 100; aFormatCol.Init( nCols, nGutter, USHRT_MAX ); aFrameItemSet.Put( aFormatCol ); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 4649e0015b92..6cdca0372e8a 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2121,8 +2121,6 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts, // Ausserdem noch die Hoehe merken if( nCellHeight && 1==nRowSpan ) { - if( nCellHeight < MINLAY ) - nCellHeight = MINLAY; (*m_pRows)[nCurRow]->SetHeight(static_cast<sal_uInt16>(aTwipSz.Height())); } @@ -2666,8 +2664,6 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, sal_uInt16 nWidth2, nDummy; pLayoutInfo->GetAvail( nCol, nColSpan, nWidth2, nDummy ); - nWidth2 = nWidth2 - pLayoutInfo->GetLeftCellSpace( nCol, nColSpan ); - nWidth2 = nWidth2 - pLayoutInfo->GetRightCellSpace( nCol, nColSpan ); nWidth2 = static_cast< sal_uInt16 >(((long)nWidth * nPrcWidth) / 100); SwHTMLParser::ResizeDrawObject( pObj, nWidth2 ); diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 1773f8d6b42a..9be83bfda4b0 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -569,17 +569,6 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, const OUString *pCaption, bool bTopCaption, sal_uInt16 nHSpace, sal_uInt16 nVSpace ) const { - // Wert fuer FRAME bestimmen - sal_uInt16 nFrameMask = 15; - if( !(aRows.front())->bTopBorder ) - nFrameMask &= ~1; - if( !(aRows.back())->bBottomBorder ) - nFrameMask &= ~2; - if( !(aCols.front())->bLeftBorder ) - nFrameMask &= ~4; - if( !(aCols.back())->bRightBorder ) - nFrameMask &= ~8; - // Wert fur RULES bestimmen bool bRowsHaveBorder = false; bool bRowsHaveBorderOnly = true; diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index cfc0fada5d4e..870077a2dcfd 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -1279,8 +1279,6 @@ WW8TableNodeInfo * WW8TableCellGrid::connectCells(RowEndInners_t &rLastRowEnds) pRow->setTableBoxVector(pTableBoxes); pRow->setWidths(pWidths); - nShadows = 0; - ++aTopsIt; nRow++; } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 39b787907e99..0ca94150f4e1 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1957,7 +1957,6 @@ void MSWordExportBase::NearestAnnotationMark( sal_Int32& rNearest, const sal_Int rNearest = nNext; else rNearest = std::min( rNearest, nNext ); - bHasAnnotationMark = true; } } } diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 9d79e9e9fe8f..96e9c497c96d 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -194,13 +194,13 @@ void SwIndexMarkPane::InitControls() // read keywords primary std::vector<OUString> aArr; - nCount = pSh->GetTOIKeys( TOI_PRIMARY, aArr ); + pSh->GetTOIKeys( TOI_PRIMARY, aArr ); std::sort(aArr.begin(), aArr.end()); for (std::vector<OUString>::iterator it = aArr.begin(); it != aArr.end(); ++it) m_pKey1DCB->InsertEntry( *it ); // read keywords secondary - nCount = pSh->GetTOIKeys( TOI_SECONDARY, aArr ); + pSh->GetTOIKeys( TOI_SECONDARY, aArr ); std::sort(aArr.begin(), aArr.end()); for (std::vector<OUString>::iterator it = aArr.begin(); it != aArr.end(); ++it) m_pKey2DCB->InsertEntry( *it ); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index bc9da29d82d6..52e9380c2b49 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -893,7 +893,6 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) { aItemPresentation = SW_RESSTR(STR_WESTERN_FONT) + aItemPresentation; bHasWesternFontPrefix = true; - bIsDefault = true; } // no break; default: diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 6f2bf1a6497b..d664004075d4 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1771,8 +1771,6 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { // it wasn't a storage, but maybe it's a useful stream } - - nFormat = nId; } if( pRead ) @@ -1801,7 +1799,7 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, } else { - if( rData.HasFormat( nFormat = SotClipboardFormatId::OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFormat, aObjDesc ) ) + if( rData.HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFormat, aObjDesc ) ) { xStrm = rData.GetInputStream(SotClipboardFormatId::EMBED_SOURCE_OLE, OUString()); if (!xStrm.is()) diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 0c8e6367f0d0..7ceaf547d2aa 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -191,7 +191,6 @@ static void lcl_Highlight(const OUString& rSource, TextPortions& aPortionList) aTextPortion.eType = eFoundType; aPortionList.push_back( aTextPortion ); nInsert++; - eFoundType = svtools::HTMLUNKNOWN; } } diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 38b413ad1770..5d0571f4b054 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1222,7 +1222,6 @@ bool SwFieldMgr::InsertField( SwSetExpField* pExpField = new SwSetExpField(pTyp, rData.m_sPar2, nFormatId); bExp = true; pField = pExpField; - nSubType = nsSwGetSetExpType::GSE_SEQ; break; } @@ -1649,7 +1648,6 @@ void SwFieldMgr::SetMacroPath(const OUString& rPath) sal_uLong SwFieldMgr::GetDefaultFormat(sal_uInt16 nTypeId, bool bIsText, SvNumberFormatter* pFormatter) { - double fValue; short nDefFormat; switch (nTypeId) @@ -1657,18 +1655,6 @@ sal_uLong SwFieldMgr::GetDefaultFormat(sal_uInt16 nTypeId, bool bIsText, SvNumbe case TYP_TIMEFLD: case TYP_DATEFLD: { - Date aDate( Date::SYSTEM ); - Date* pNullDate = pFormatter->GetNullDate(); - - fValue = aDate - *pNullDate; - - tools::Time aTime( tools::Time::SYSTEM ); - - sal_uLong nNumFormatTime = (sal_uLong)aTime.GetSec() + (sal_uLong)aTime.GetMin() * 60L + - (sal_uLong)aTime.GetHour() * 3600L; - - fValue += (double)nNumFormatTime / 86400.0; - nDefFormat = (nTypeId == TYP_DATEFLD) ? css::util::NumberFormat::DATE : css::util::NumberFormat::TIME; } break; @@ -1676,12 +1662,10 @@ sal_uLong SwFieldMgr::GetDefaultFormat(sal_uInt16 nTypeId, bool bIsText, SvNumbe default: if (bIsText) { - fValue = 0.0; nDefFormat = css::util::NumberFormat::TEXT; } else { - fValue = 0.0; nDefFormat = css::util::NumberFormat::ALL; } break; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index f6112005c3e0..c156d6e5bc47 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -754,7 +754,6 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) if( !pAdjust || IsInvalidItem( pAdjust )) { rSet.InvalidateItem( nSlotId ); - nSlotId = 0; } else { @@ -783,7 +782,6 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) if( !pLSpace || IsInvalidItem( pLSpace )) { rSet.InvalidateItem( nSlotId ); - nSlotId = 0; } else { diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 116d6644e3e4..f4428173b7f9 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1703,7 +1703,6 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) bDisable |= bHtmlMode; //no contour available whenn no wrap or wrap through is set bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT); - bSet = rWrap.IsContour(); if( !bDisable ) { int nSel = rSh.GetSelectionType(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index c848f3790f0b..624a13934810 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -300,7 +300,6 @@ void SwView::SelectShell() if ( !( m_nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL ) ) rDispatcher.Push( *m_pFormShell ); - eShellMode = SHELL_MODE_NAVIGATION; m_pShell = new SwNavigationShell( *this ); rDispatcher.Push( *m_pShell ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index bce3daf1d48a..8c61c21a2163 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2152,7 +2152,6 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe default: OSL_ENSURE( false, "unknown SlotId!" ); bInsert = true; - nSlotId = SID_INSERTDOC; break; } |