diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-10-12 21:44:46 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-13 06:22:33 +0000 |
commit | ed7361ef0bdb6bee4f47a8421221eb7824f02e38 (patch) | |
tree | b745a27d916bb923f01857148e16485ac319f288 | |
parent | 239c75ed63fb31cfef9cee13d8d58c4fe9e7a906 (diff) |
cppcheck:variableScope
Change-Id: I7cbd5a9e9bb5417f754d4e2445df309140fd40af
Reviewed-on: https://gerrit.libreoffice.org/19329
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
24 files changed, 76 insertions, 79 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 954da76c3e49..8ee420b4bcc0 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1926,11 +1926,11 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bManaged = false; // Get the pool item stored it by Conditional Format Manager Dialog. - const SfxPoolItem* pItem = nullptr; sal_uInt32 nItems(pTabViewShell->GetPool().GetItemCount2( SCITEM_STRING )); for( sal_uInt32 nIter = 0; nIter < nItems; ++nIter ) { - if( nullptr != (pItem = pTabViewShell->GetPool().GetItem2( SCITEM_STRING, nIter ) ) ) + const SfxPoolItem* pItem = pTabViewShell->GetPool().GetItem2( SCITEM_STRING, nIter ); + if( pItem != nullptr ) { if ( ScCondFormatDlg::ParseXmlString( static_cast<const SfxStringItem*>(pItem)->GetValue(), diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index eaa2eb67d65e..c2690f9bb8ae 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -4699,7 +4699,6 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) long nPosY = nRowPosY; - bool bVisChanged = false; //! rest from merged cells further up do not work! @@ -5084,7 +5083,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) } long nClipStartY = nStartY; - if (nArrY==0 || bVisChanged) + if (nArrY==0) { if ( nClipStartY < nRowPosY ) { diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 36b23114e1c5..b3068230e02d 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -3078,16 +3078,15 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, ATTR_PATTERN_START, ATTR_PATTERN_END )); - const SvxBorderLine* pBoxLine = NULL; SvxBorderLine aLine; - // here pBoxLine is used - if( pBorderAttr ) { + const SvxBorderLine* pBoxLine = NULL; SvxBoxItem aBoxItem( *static_cast<const SvxBoxItem*>(pBorderAttr) ); SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); + // here pBoxLine is used SET_LINE_ATTRIBUTES(Top,SvxBoxItemLine::TOP) SET_LINE_ATTRIBUTES(Bottom,SvxBoxItemLine::BOTTOM) SET_LINE_ATTRIBUTES(Left,SvxBoxItemLine::LEFT) diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx index 9161655f4c1a..fb19b1576ca3 100644 --- a/scaddins/source/analysis/bessel.cxx +++ b/scaddins/source/analysis/bessel.cxx @@ -333,7 +333,6 @@ double Bessely0( double fX ) throw( IllegalArgumentException, NoConvergenceExcep double u = alpha; double k = 1.0; - double m_bar = 0.0; double g_bar_delta_u = 0.0; double g_bar = -2.0 / fX; double delta_u = g_bar_delta_u / g_bar; @@ -341,13 +340,12 @@ double Bessely0( double fX ) throw( IllegalArgumentException, NoConvergenceExcep double f_bar = -1 * g; double sign_alpha = 1.0; - double km1mod2; bool bHasFound = false; k = k + 1; do { - km1mod2 = fmod(k-1.0,2.0); - m_bar=(2.0*km1mod2) * f_bar; + double km1mod2 = fmod(k-1.0, 2.0); + double m_bar = (2.0*km1mod2) * f_bar; if (km1mod2 == 0.0) alpha = 0.0; else @@ -387,7 +385,6 @@ double Bessely1( double fX ) throw( IllegalArgumentException, NoConvergenceExcep double f_bar = -1.0; double u = alpha; double k = 1.0; - double m_bar = 0.0; alpha = 1.0 - EulerGamma - log(fX/2.0); double g_bar_delta_u = -alpha; double g_bar = -2.0 / fX; @@ -396,15 +393,13 @@ double Bessely1( double fX ) throw( IllegalArgumentException, NoConvergenceExcep double g = -1.0/g_bar; f_bar = f_bar * g; double sign_alpha = -1.0; - double km1mod2; //will be (k-1) mod 2 - double q; // will be (k-1) div 2 bool bHasFound = false; k = k + 1.0; do { - km1mod2 = fmod(k-1.0,2.0); - m_bar=(2.0*km1mod2) * f_bar; - q = (k-1.0)/2.0; + double km1mod2 = fmod(k-1.0,2.0); + double m_bar = (2.0*km1mod2) * f_bar; + double q = (k-1.0)/2.0; if (km1mod2 == 0.0) // k is odd { alpha = sign_alpha * (1.0/q + 1.0/(q+1.0)); diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index b2f159bb9cfb..212a81a83972 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -209,7 +209,6 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE)); OUString aHelpFile; - SfxStyleSheetBase* pParent = NULL; SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE ); SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE ); @@ -312,7 +311,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool // if we created outline styles, we need to chain them if( bCreated ) { - pParent = NULL; + SfxStyleSheetBase* pParent = NULL; for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++) { OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) ); diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 8d9907e3c610..dffd6656ae1d 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -3358,15 +3358,15 @@ void AnimationImporter::dump( Any& rAny ) } else if( rAny >>= aEvent ) { - static const char* triggers[] = - { - "none","onbegin","onend","begin", - "end","onclick","ondoubleclick","onmouseenter", - "onmouseleave","onpptnext","onpptprev","onstopaudio" - }; - if( aEvent.Trigger != EventTrigger::NONE ) { + static const char* triggers[] = + { + "none","onbegin","onend","begin", + "end","onclick","ondoubleclick","onmouseenter", + "onmouseleave","onpptnext","onpptprev","onstopaudio" + }; + if( aEvent.Source.hasValue() ) { dump_target( aEvent.Source ); diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 163a9acf5e70..c2cf29a2491f 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -351,7 +351,6 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) First, insert pages */ std::vector<OUString> aBookmarkList = pDlg->GetList( 1 ); // pages bool bLink = pDlg->IsLink(); - bool bReplace = false; SdPage* pPage = NULL; ::sd::View* pView = mpViewShell ? mpViewShell->GetView() : NULL; @@ -394,6 +393,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) necessary. bNameOK is sal_False if the user has canceled. */ bNameOK = mpView->GetExchangeList( aExchangeList, aBookmarkList, 0 ); + bool bReplace = false; if( bNameOK ) bOK = mpDoc->InsertBookmarkAsPage( aBookmarkList, &aExchangeList, diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx index 8c0b708df55c..6216f82033bc 100644 --- a/sd/source/ui/func/fuoaprms.cxx +++ b/sd/source/ui/func/fuoaprms.cxx @@ -626,7 +626,6 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq ) pUndoGroup->SetComment(aComment); // for the path effect, remember some stuff - SdrObject* pRunningObj = NULL; SdrPathObj* pPath = NULL; if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET) { @@ -635,6 +634,7 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq ) SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj(); SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier(); SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier(); + SdrObject* pRunningObj = NULL; if (pObject1->GetObjInventor() == SdrInventor && ((eKind1 == OBJ_LINE) || // 2 point line diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 585454445d38..61f5b4b8fdc0 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -177,7 +177,6 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) ******************************************************************/ mpWindow->CaptureMouse(); pHdl = mpView->PickHandle(aMDPos); - SdrObject* pObj; SdrPageView* pPV; long nAngle0 = GetAngle(aMDPos - mpView->GetRef1()); @@ -239,6 +238,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) } else { + SdrObject* pObj; if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO)) { mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow); @@ -625,8 +625,6 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) // (and deselect others) as a preparation for showing the context // menu. const bool bSelectionOnly = rMEvt.IsRight(); - SdrObject* pObj; - SdrPageView* pPV; if (bHideAndAnimate) { @@ -682,6 +680,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) * If a user wants to click on an object in front of a marked * one, he releases the mouse button immediately **************************************************************/ + SdrPageView* pPV; + SdrObject* pObj; if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK)) { if (pPV->IsObjSelectable(pObj)) diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index b6a29ddfca84..6159c81cb5d5 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -582,8 +582,6 @@ void FuText::ImpSetAttributesFitCommon(SdrTextObj* pTxtObj) bool FuText::MouseButtonUp(const MouseEvent& rMEvt) { bool bReturn = false; - SdrObject* pObj; - SdrPageView* pPV; if (aDragTimer.IsActive()) { aDragTimer.Stop(); @@ -655,6 +653,8 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) /************************************************************* * From text mode, you don't want to rotate immediately. **************************************************************/ + SdrObject* pObj; + SdrPageView* pPV; if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK)) { if (pPV->IsObjSelectable(pObj)) diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 4f6610a7e16e..0e70f81abf5e 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -476,7 +476,6 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere sal_Int32* pConvertPos = new sal_Int32[nTextLen+2]; sal_Int32* pConvertPara = new sal_Int32[nTextLen+2]; - int ndbg = 0; const sal_Unicode* pText = aText.getStr(); sal_Int32* pPos = pConvertPos; @@ -494,6 +493,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere while(xParaEnum->hasMoreElements()) { + int ndbg = 0; uno::Reference< text::XTextContent > xParagraph( xParaEnum->nextElement(), uno::UNO_QUERY ); if( xParagraph.is() ) xEnumAccess.set(xParagraph, css::uno::UNO_QUERY); diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx index c6c55cdd4e14..99651942558e 100644 --- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx +++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx @@ -545,19 +545,19 @@ boost::shared_ptr<OGLTransitionImpl> makeIris() Primitive irisPart, part; int i, nSteps = 24, nParts = 7; - double t = 1.0/nSteps, cx, cy, lcx, lcy, lx = 1, ly = 0, x, y, cxo, cyo, lcxo, lcyo, of=2.2, f=1.42; + double t = 1.0/nSteps, lx = 1, ly = 0, of=2.2, f=1.42; for (i=1; i<=nSteps; i++) { - x = cos ((3*2*M_PI*t)/nParts); - y = -sin ((3*2*M_PI*t)/nParts); - cx = (f*x + 1)/2; - cy = (f*y + 1)/2; - lcx = (f*lx + 1)/2; - lcy = (f*ly + 1)/2; - cxo = (of*x + 1)/2; - cyo = (of*y + 1)/2; - lcxo = (of*lx + 1)/2; - lcyo = (of*ly + 1)/2; + double x = cos ((3*2*M_PI*t)/nParts); + double y = -sin ((3*2*M_PI*t)/nParts); + double cx = (f*x + 1)/2; + double cy = (f*y + 1)/2; + double lcx = (f*lx + 1)/2; + double lcy = (f*ly + 1)/2; + double cxo = (of*x + 1)/2; + double cyo = (of*y + 1)/2; + double lcxo = (of*lx + 1)/2; + double lcyo = (of*ly + 1)/2; irisPart.pushTriangle (glm::vec2 (lcx, lcy), glm::vec2 (lcxo, lcyo), glm::vec2 (cx, cy)); @@ -1192,14 +1192,14 @@ boost::shared_ptr<OGLTransitionImpl> makeDiamond() boost::shared_ptr<OGLTransitionImpl> makeVenetianBlinds( bool vertical, int parts ) { static double t30 = tan( M_PI/6.0 ); - double n, ln = 0; + double ln = 0; double p = 1.0/parts; Primitives_t aLeavingSlide; Primitives_t aEnteringSlide; for( int i=0; i<parts; i++ ) { Primitive Slide; - n = (i + 1)/(double)parts; + double n = (i + 1)/(double)parts; if( vertical ) { Slide.pushTriangle (glm::vec2 (ln,0), glm::vec2 (n,0), glm::vec2 (ln,1)); Slide.pushTriangle (glm::vec2 (n,0), glm::vec2 (ln,1), glm::vec2 (n,1)); diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 2a98b750e709..a90d020b7a97 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -481,9 +481,6 @@ namespace svgio } else // Outermost SVG element { - double fW = 0.0; // effective value depends on viewBox - double fH = 0.0; - // Svg defines that a negative value is an error and that 0.0 disables rendering // isPositive() not usable because it allows 0.0 in contrast to mathematical definition of 'positive' const bool bWidthInvalid(getWidth().isSet() && basegfx::fTools::lessOrEqual(getWidth().getNumber(), 0.0)); @@ -491,6 +488,8 @@ namespace svgio if(!bWidthInvalid && !bHeightInvalid) { basegfx::B2DRange aSvgCanvasRange; // effective value depends on viewBox + double fW = 0.0; // effective value depends on viewBox + double fH = 0.0; if(getViewBox()) { // SVG 1.1 defines in section 7.7 that a negative value for width or height @@ -740,13 +739,13 @@ namespace svgio { // If width or height is not provided, the default would be 100%, see SVG 1.1 section 5.1.2 // But here it cannot be resolved and no fallback exists. - // SVG 1.1 defines in section 5.1.2 that x,y has no meanig for the outermost SVG element. + // SVG 1.1 defines in section 5.1.2 that x,y has no meaning for the outermost SVG element. bool bWidthIsAbsolute(getWidth().isSet() && Unit_percent != getWidth().getUnit()); - double fW( bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : 0.0); bool bHeightIsAbsolute(getHeight().isSet() && Unit_percent != getHeight().getUnit()); - double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : 0.0); if (bWidthIsAbsolute && bHeightIsAbsolute) { + double fW( getWidth().solveNonPercentage(*this) ); + double fH( getHeight().solveNonPercentage(*this) ); return basegfx::B2DRange(0.0, 0.0, fW, fH); } else // no fallback exists @@ -754,7 +753,7 @@ namespace svgio return SvgNode::getCurrentViewPort(); } } -// ToDo: Is it possible to decompose and use the bounding box of the children, if even the +// TODO: Is it possible to decompose and use the bounding box of the children, if even the // outermost svg has no information to resolve percentage? Is it worth, how expensive is it? } diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 8950060e2908..5d77fe849291 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -2228,7 +2228,6 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) case css::util::NumberFormat::DATE: while (i < nAnzStrings) { - int nCalRet; switch (nTypeArray[i]) { case NF_SYMBOLTYPE_BLANK: @@ -2238,6 +2237,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) i++; break; case NF_SYMBOLTYPE_DEL: + int nCalRet; if (sStrArray[i] == sOldDateSep) { nTypeArray[i] = NF_SYMBOLTYPE_DATESEP; diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index c428286b1414..7a6eeefbfb66 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -484,8 +484,6 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM long nTickWidth; bool bNoTicks = false; - double nAcceptanceDelta = 0.0001; - Size aPixSize = rRenderContext.LogicToPixel(Size(nTick4, nTick4), maMapMode); if (mnUnitIndex == RULER_UNIT_CHAR) @@ -627,6 +625,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM // Tick4 - Output (Text) double aStep = (nTick / nTick4); double aRest = std::abs(aStep - std::floor(aStep)); + double nAcceptanceDelta = 0.0001; if (aRest < nAcceptanceDelta) { diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 7bd27f5863cd..c6eae94a354b 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -328,7 +328,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib const long aBitmapWidth = rBmpEx.GetSizePixel().Width(); const long aBitmapHeight = rBmpEx.GetSizePixel().Height(); - long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY, nTmp; + long nTmpX, nTmpY, nTmpFX, nTmpFY, nTmp; double fTmp; bool bHMirr( rAttributes.GetMirrorFlags() & BmpMirrorFlags::Horizontal ); @@ -646,12 +646,12 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { Scanline pLine0, pLine1, pLineW; - for( nY = 0; nY < aTargetHeight; nY++ ) + for( long nY = 0; nY < aTargetHeight; nY++ ) { nSinY = pSinY[ nY ], nCosY = pCosY[ nY ]; pLineW = pWriteAccess->GetScanline( nY ); - for( nX = 0; nX < aTargetWidth; nX++ ) + for( long nX = 0; nX < aTargetWidth; nX++ ) { nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; @@ -743,11 +743,11 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib const BitmapColor aTrans( pWriteAccess->GetBestMatchingColor( Color( COL_WHITE ) ) ); BitmapColor aAlphaVal( 0 ); - for( nY = 0; nY < aTargetHeight; nY++ ) + for( long nY = 0; nY < aTargetHeight; nY++ ) { nSinY = pSinY[ nY ], nCosY = pCosY[ nY ]; - for( nX = 0; nX < aTargetWidth; nX++ ) + for( long nX = 0; nX < aTargetWidth; nX++ ) { nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; @@ -806,20 +806,20 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib aTestB = pMAcc->GetBestMatchingColor( Color( COL_BLACK ) ); // create new horizontal mapping table - for( nX = 0UL; nX < aUnrotatedWidth; nX++ ) + for( long nX = 0UL; nX < aUnrotatedWidth; nX++ ) pMapLX[ nX ] = FRound( (double) pMapIX[ nX ] + pMapFX[ nX ] / 1048576.0 ); // create new vertical mapping table - for( nY = 0UL; nY < aUnrotatedHeight; nY++ ) + for( long nY = 0UL; nY < aUnrotatedHeight; nY++ ) pMapLY[ nY ] = FRound( (double) pMapIY[ nY ] + pMapFY[ nY ] / 1048576.0 ); // do mask rotation - for( nY = 0; nY < aTargetHeight; nY++ ) + for( long nY = 0; nY < aTargetHeight; nY++ ) { nSinY = pSinY[ nY ]; nCosY = pCosY[ nY ]; - for( nX = 0; nX < aTargetWidth; nX++ ) + for( long nX = 0; nX < aTargetWidth; nX++ ) { nUnRotX = ( pCosX[ nX ] - nSinY ) >> 8; nUnRotY = ( pSinX[ nX ] + nCosY ) >> 8; diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index 241688d79828..6aa1e30224dc 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -159,7 +159,7 @@ sal_Unicode SvParser::GetNextChar() bool bErr; if( bSwitchToUCS2 && 0 == rInput.Tell() ) { - unsigned char c1, c2; + unsigned char c1; bool bSeekBack = true; rInput.ReadUChar( c1 ); @@ -168,6 +168,7 @@ sal_Unicode SvParser::GetNextChar() { if( 0xff == c1 || 0xfe == c1 ) { + unsigned char c2; rInput.ReadUChar( c2 ); bErr = rInput.IsEof() || rInput.GetError(); if( !bErr ) @@ -188,6 +189,7 @@ sal_Unicode SvParser::GetNextChar() } else if( 0xef == c1 || 0xbb == c1 ) // check for UTF-8 BOM { + unsigned char c2; rInput.ReadUChar( c2 ); bErr = rInput.IsEof() || rInput.GetError(); if( !bErr ) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 529315ca6a47..5d4f77bc271e 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1694,12 +1694,11 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT } SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const { - bool bBack(nOptions & SdrSearchOptions::BACKWARD); - bool bBefMrk(nOptions & SdrSearchOptions::BEFOREMARK); SdrObject* pRet=NULL; rpRootObj=NULL; if (pOL!=NULL) { + bool bBack(nOptions & SdrSearchOptions::BACKWARD); bool bRemap(pOL->GetOwnerObj() && dynamic_cast< const E3dScene* >(pOL->GetOwnerObj()) != nullptr); E3dScene* pRemapScene = (bRemap ? static_cast<E3dScene*>(pOL->GetOwnerObj()) : 0L); @@ -1717,7 +1716,7 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT { pObj = pOL->GetObj(nObjNum); } - if (bBefMrk) + if (nOptions & SdrSearchOptions::BEFOREMARK) { if ((pMarkList)!=NULL) { diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 8d61f361ed7a..60548581110d 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1158,7 +1158,6 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() { while( aIter != aEndIter ) { - bool bMarked = false; SwAccessibleChild pFrm( (*aIter).first ); const SwFrameFormat *pFrameFormat = (*aIter).first ? ::FindFrameFormat( (*aIter).first ) : nullptr; @@ -1188,6 +1187,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() if( pPos->nNode.GetNode().GetTextNode() ) { int pIndex = pPos->nContent.GetIndex(); + bool bMarked = false; if( pCrsr != NULL ) { const SwTextNode* pNode = pPos->nNode.GetNode().GetTextNode(); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 5760d5cc27c4..34d6dfb6b1b4 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -372,11 +372,11 @@ bool SwCrsrShell::GotoTOXMarkBase() // for the actual index const SwTOXType* pType = aMarks[0]->GetTOXType(); SwIterator<SwTOXBase,SwTOXType> aIter( *pType ); - const SwSectionNode* pSectNd; const SwSectionFormat* pSectFormat; for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() ) { + const SwSectionNode* pSectNd; if( dynamic_cast<const SwTOXBaseSection*>( pTOX) != nullptr && 0 != ( pSectFormat = static_cast<SwTOXBaseSection*>(pTOX)->GetFormat() ) && 0 != ( pSectNd = pSectFormat->GetSectionNode() )) @@ -439,11 +439,12 @@ bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetContentNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) ); { - const SfxPoolItem* pItem; - const SwTableBox* pTBox; sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA ); for( n = 0; n < nMaxItems; ++n ) + { + const SwTableBox* pTBox; + const SfxPoolItem* pItem; if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2( RES_BOXATR_FORMULA, n ) ) && 0 != (pTBox = static_cast<const SwTableBoxFormula*>(pItem)->GetTableBox() ) && @@ -469,6 +470,7 @@ bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) } } } + } } if( bFnd ) diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index b75c504ed436..5025670e3b27 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -753,10 +753,10 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, bool bInReadOnly ) { SwContentNode * pNd = 0; - SwContentFrm* pFrm; if( ((*rPam.GetPoint()).*fnMove->fnCmpOp)( *rPam.GetMark() ) || ( *rPam.GetPoint() == *rPam.GetMark() && rbFirst ) ) { + SwContentFrm* pFrm; if( rbFirst ) { rbFirst = false; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index db5d75208bae..5383fe2af935 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1336,7 +1336,6 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const SwCrsrSaveState aSave( *this ); bool bRet = false; - bool bForward = true; DeleteMark(); const SwRootFrm* pLayout = pViewShell->GetLayout(); if( pPt && 0 != pLayout ) @@ -1372,6 +1371,7 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const } else { + bool bForward = true; sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary( pTextNd->GetText(), nPtPos, diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 21f852d44d8d..b7bdda2881c2 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3629,7 +3629,6 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) SwpHints* pHts; if( pTextNd && 0 != ( pHts = pTextNd->GetpSwpHints()) && pHts->Count() ) { - const sal_Int32 *pEndIdx; const sal_Int32 nMkCntPos = rPam.GetMark()->nContent.GetIndex(); for( size_t n = pHts->Count(); n; ) { @@ -3637,6 +3636,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) if( nMkCntPos > pAttr->GetStart() ) break; + const sal_Int32 *pEndIdx; if( nMkCntPos == pAttr->GetStart() && 0 != (pEndIdx = pAttr->End()) && *pEndIdx == pAttr->GetStart() ) diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index aefb35900958..5c148360981f 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -410,9 +410,10 @@ void DocumentFieldsManager::InsDeletedFieldType( SwFieldType& rFieldTyp ) const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); const OUString& rFieldNm = rFieldTyp.GetName(); - SwFieldType* pFnd; for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < nSize; ++i ) + { + SwFieldType* pFnd; if( nFieldWhich == (pFnd = (*mpFieldTypes)[i])->Which() && rSCmp.isEqual( rFieldNm, pFnd->GetName() ) ) { @@ -434,6 +435,7 @@ void DocumentFieldsManager::InsDeletedFieldType( SwFieldType& rFieldTyp ) } while( true ); break; } + } // not found, so insert and delete flag mpFieldTypes->insert( mpFieldTypes->begin() + nSize, &rFieldTyp ); @@ -1171,14 +1173,16 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp void DocumentFieldsManager::UpdateUsrFields() { SwCalc* pCalc = 0; - const SwFieldType* pFieldType; for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < mpFieldTypes->size(); ++i ) + { + const SwFieldType* pFieldType; if( RES_USERFLD == ( pFieldType = (*mpFieldTypes)[i] )->Which() ) { if( !pCalc ) pCalc = new SwCalc( m_rDoc ); const_cast<SwUserFieldType*>(static_cast<const SwUserFieldType*>(pFieldType))->GetValue( *pCalc ); } + } if( pCalc ) { |