From b4b7703e4335460cf48bfd6440f116359994c8ff Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 14 Oct 2015 02:51:05 +0200 Subject: cppcheck:variableScope Change-Id: I9b671637fbe0f32e695d22b74bfb40a39a9fe884 Reviewed-on: https://gerrit.libreoffice.org/19364 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sw/source/core/doc/doccomp.cxx | 2 +- sw/source/core/doc/docedt.cxx | 3 +- sw/source/core/layout/calcmove.cxx | 3 +- sw/source/core/layout/fly.cxx | 2 +- sw/source/core/layout/frmtool.cxx | 3 +- sw/source/core/table/swnewtable.cxx | 3 +- sw/source/core/text/txtdrop.cxx | 2 +- sw/source/core/txtnode/thints.cxx | 4 +- sw/source/filter/html/htmlatr.cxx | 2 +- sw/source/filter/html/swhtml.cxx | 3 +- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- sw/source/ui/index/cntex.cxx | 86 +++++++++++----------- sw/source/uibase/app/docst.cxx | 2 +- sw/source/uibase/sidebar/StylePresetsPanel.cxx | 3 +- testtools/source/bridgetest/bridgetest.cxx | 4 +- .../source/controls/controlmodelcontainerbase.cxx | 4 +- tools/source/generic/poly.cxx | 8 +- tools/source/rc/resmgr.cxx | 4 +- tubes/source/file-transfer-helper.c | 2 +- ucb/source/sorter/sortresult.cxx | 3 +- unotools/source/config/xmlaccelcfg.cxx | 3 +- vcl/qa/cppunit/timer.cxx | 6 +- vcl/source/control/spinfld.cxx | 3 +- vcl/source/filter/igif/gifread.cxx | 2 +- vcl/source/filter/sgfbram.cxx | 7 +- vcl/source/filter/sgvmain.cxx | 3 +- vcl/source/filter/sgvspln.cxx | 16 ++-- vcl/source/filter/wmf/winwmf.cxx | 5 +- vcl/source/gdi/dibtools.cxx | 22 ++---- vcl/source/gdi/gdimtf.cxx | 4 +- vcl/source/gdi/pdfwriter_impl.cxx | 20 +++-- vcl/source/gdi/pngwrite.cxx | 15 ++-- vcl/source/glyphs/graphite_layout.cxx | 3 +- vcl/source/outdev/textline.cxx | 12 ++- vcl/source/window/menu.cxx | 7 +- vcl/source/window/settings.cxx | 3 +- vcl/source/window/splitwin.cxx | 29 +++----- vcl/unx/generic/dtrans/X11_selection.cxx | 2 +- vcl/unx/generic/printer/printerinfomanager.cxx | 2 +- xmloff/source/style/TransGradientStyle.cxx | 27 +++---- 40 files changed, 150 insertions(+), 186 deletions(-) diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index db6e38184176..390f80a58e63 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1699,10 +1699,10 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo ) // combine consecutive if( pTmp->GetNext() != pInsRing ) { - const SwContentNode* pCNd; do { SwPosition& rSttEnd = *pTmp->End(), & rEndStt = *(pTmp->GetNext())->Start(); + const SwContentNode* pCNd; if( rSttEnd == rEndStt || (!rEndStt.nContent.GetIndex() && rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() && diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index c492c2ae85e0..111a5223a033 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -131,13 +131,12 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos, pPos->nContent == rEndNdIdx.GetNode().GetContentNode()->Len() )) ? 0 : 1; - const SwNodeIndex* pContentIdx; - for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n ) { pFormat = rFormats[n]; pAnchor = &pFormat->GetAnchor(); const SwPosition* pAPos = pAnchor->GetContentAnchor(); + const SwNodeIndex* pContentIdx; if (pAPos && ((FLY_AT_PARA == pAnchor->GetAnchorId()) || (FLY_AT_CHAR == pAnchor->GetAnchorId())) && diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 1ceaf5594a9d..78c96d14e590 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1093,7 +1093,6 @@ void SwContentFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/) // this flag is set. If it turns out that it // didn't keep it's promise, we can act in a // controlled fashion. - bool bMoveable; const bool bFly = IsInFly(); const bool bTab = IsInTab(); const bool bFootnote = IsInFootnote(); @@ -1197,6 +1196,8 @@ void SwContentFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/) SWRECTFN( this ) + bool bMoveable; + while ( !mbValidPos || !mbValidSize || !mbValidPrtArea ) { // - loop prevention diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 87c275d7fed4..2d854d6f1917 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1496,10 +1496,10 @@ void CalcContent( SwLayoutFrm *pLay, pTmpPrevFlowFrm->IsKeepFwdMoveAllowed(); // format floating screen objects anchored to the frame. - bool bRestartLayoutProcess = false; if ( !bPrevInvalid && pFrm->GetDrawObjs() && pLay->IsAnLower( pFrm ) ) { bool bAgain = false; + bool bRestartLayoutProcess = false; SwPageFrm* pPageFrm = pFrm->FindPageFrm(); size_t nCnt = pFrm->GetDrawObjs()->size(); size_t i = 0; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index bf38170751c8..073cdf67121e 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1248,8 +1248,6 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, SwPageFrm *pPage = pLay->FindPageFrm(); const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats(); SwFrm *pFrm = 0; - bool bBreakAfter = false; - SwActualSection *pActualSection = 0; SwLayHelper *pPageMaker; @@ -1260,6 +1258,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, { // Attention: the SwLayHelper class uses references to the content-, // page-, layout-frame etc. and may change them! + bool bBreakAfter = false; pPageMaker = new SwLayHelper( pDoc, pFrm, pPrv, pPage, pLay, pActualSection, bBreakAfter, nIndex, 0 == nEndIndex ); if( bStartPercent ) diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 2f7a9f8552c6..924546c61bdc 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -381,14 +381,13 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const SwTableLine* pLine = aLines[nRow]; OSL_ENSURE( pLine, "Missing table line" ); SwSelBoxes *pBoxes = new SwSelBoxes(); - long nLeft = 0; long nRight = 0; const size_t nCount = pLine->GetTabBoxes().size(); for( size_t nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; OSL_ENSURE( pBox, "Missing table box" ); - nLeft = nRight; + long nLeft = nRight; nRight += pBox->GetFrameFormat()->GetFrmSize().GetWidth(); long nRowSpan = pBox->getRowSpan(); if( nRight <= nMin ) diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 5fa21bf5f45b..553719acb6dc 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -678,7 +678,6 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf sal_Int32 nIdx = rInf.GetIdx(); OUString aStr(rInf.GetText().copy(nIdx, pCurrPart->GetLen())); - long nAscent = 0; long nDescent = 0; long nFactor = -1; @@ -707,6 +706,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf nTmpIdx = nIndex; long nWishedHeight = pDrop->GetDropHeight(); + long nAscent = 0; // find out biggest font size for initial scaling factor long nMaxFontHeight = 1; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 7e5098fa8209..5df015ffabd8 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3111,10 +3111,10 @@ bool SwpHints::TryInsertHint( { // search for a reference with the same name SwTextAttr* pTmpHt; - sal_Int32 *pTmpHtEnd; - sal_Int32 *pTmpHintEnd; for( size_t n = 0, nEnd = Count(); n < nEnd; ++n ) { + sal_Int32 *pTmpHtEnd; + sal_Int32 *pTmpHintEnd; if (RES_TXTATR_REFMARK == (pTmpHt = Get(n))->Which() && pHint->GetAttr() == pTmpHt->GetAttr() && 0 != ( pTmpHtEnd = pTmpHt->GetEnd() ) && diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 375e914eb6fd..055255f30eda 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -254,7 +254,6 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem pFormat->Which() == RES_CONDTXTFMTCOLL; const SwFormat *pReferenceFormat = 0; // Vergleichs-Format - bool bSetDefaults = true, bClearSame = true; if( nDeep != 0 ) { // Es ist eine HTML-Tag-Vorlage oder die Vorlage ist von einer @@ -307,6 +306,7 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem pItemSet->Set( pFormat->GetAttrSet() ); + bool bSetDefaults = true, bClearSame = true; if( pReferenceFormat ) SwHTMLWriter::SubtractItemSet( *pItemSet, pReferenceFormat->GetAttrSet(), bSetDefaults, bClearSame ); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6312eab62776..a964ca1dc961 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -3039,7 +3039,7 @@ bool SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, bool bInsert; sal_uInt16 nScriptItem = 0; - bool bScript = false, bFont = false; + bool bScript = false; // ein Bereich ?? if( !bChkEmpty || (RES_PARATR_BEGIN <= nWhich && bMoveBack) || RES_PAGEDESC == nWhich || RES_BREAK == nWhich || @@ -3050,6 +3050,7 @@ bool SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, // We do some optimization for script depenedent attributes here. if( *pEndIdx == pAttr->GetSttPara() ) { + bool bFont = false; lcl_swhtml_getItemInfo( *pAttr, bScript, bFont, nScriptItem ); } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8aba8533f343..c961698a0b18 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3198,7 +3198,6 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t long nPageSize = 0; const char* widthType = "dxa"; - bool bRelBoxSize = false; // If actual width of table is relative it should export is as "pct".` const SwTable *pTable = pTableTextNodeInfoInner->getTable(); @@ -3227,6 +3226,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } else { + bool bRelBoxSize = false; // Create the SwWriteTable instance to use col spans (and maybe other infos) GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize ); if(nPageSize == 0) diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx index f94e1e185053..886798756993 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -147,58 +147,58 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( if(!pExampleFrame || !pExampleFrame->IsInitialized()) return; - const char* IndexServiceNames[] = - { - "com.sun.star.text.DocumentIndex", - "com.sun.star.text.UserIndex", - "com.sun.star.text.ContentIndex", - "com.sun.star.text.IllustrationsIndex", - "com.sun.star.text.ObjectIndex", - "com.sun.star.text.TableIndex", - "com.sun.star.text.Bibliography" - }; - try { - OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] && + static const char* IndexServiceNames[] = + { + "com.sun.star.text.DocumentIndex", + "com.sun.star.text.UserIndex", + "com.sun.star.text.ContentIndex", + "com.sun.star.text.IllustrationsIndex", + "com.sun.star.text.ObjectIndex", + "com.sun.star.text.TableIndex", + "com.sun.star.text.Bibliography" + }; + + OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] && pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(), "Section not created"); uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel(); - bool bInitialCreate = true; - if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is()) - { - bInitialCreate = true; - if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is()) - throw uno::RuntimeException(); - uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor(); - xAnchor = xAnchor->getStart(); - uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor); + bool bInitialCreate = true; + if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is()) + { + bInitialCreate = true; + if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is()) + throw uno::RuntimeException(); + uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor(); + xAnchor = xAnchor->getStart(); + uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor); - uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY); + uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY); - OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[ + OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[ nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] )); - pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance( + pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance( sIndexTypeName), uno::UNO_QUERY); - uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY); - uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY); - xCrsr->getText()->insertTextContent(xRg, xContent, sal_False); - } - for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++) - { + uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY); + uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY); + xCrsr->getText()->insertTextContent(xRg, xContent, sal_False); + } + for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++) + { uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY); if(xSectPr.is()) { xSectPr->setPropertyValue(UNO_NAME_IS_VISIBLE, makeAny(i == nTOXIndex)); } - } - // set properties - uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY); - uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo(); - SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType); - sal_uInt16 nIdxOptions = rDesc.GetIndexOptions(); - if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT) - { + } + // set properties + uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY); + uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo(); + SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType); + sal_uInt16 nIdxOptions = rDesc.GetIndexOptions(); + if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT) + { //title if(rDesc.GetTitle()) lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle()); @@ -270,10 +270,10 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions )); lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions)); lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER & nOLEOptions)); - } - const SwForm* pForm = GetForm(eCurrentTOXType); - if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY) - { + } + const SwForm* pForm = GetForm(eCurrentTOXType); + if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY) + { lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated()); lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER)); const bool bUseCurrent = nCurrentLevel < pForm->GetFormMax(); @@ -358,7 +358,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( pPropValArr[2].Name = "Text"; pPropValArr[2].Value <<= OUString(aToken.sText); } - beans::PropertyValues* pValues = aSequPropVals.getArray(); + beans::PropertyValues* pValues = aSequPropVals.getArray(); pValues[nTokenIndex] = aPropVals; nTokenIndex++; diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index ffbd62695004..aa37cc213d06 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -272,7 +272,6 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pItem; - SwWrtShell* pActShell = 0; switch (nSlot) { case SID_STYLE_NEW: @@ -347,6 +346,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) OUString aParam; sal_uInt16 nFamily = SFX_STYLE_FAMILY_PARA; sal_uInt16 nMask = 0; + SwWrtShell* pActShell = 0; if( !pArgs ) { diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index da36ab5378a1..ab1ca1189c6c 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -48,12 +48,11 @@ namespace { void renderPreview(sfx2::StyleManager* pStyleManager, OutputDevice& aOutputDevice, OUString const & sName, sal_Int32 nHeight, Rectangle& aRect) { - sfx2::StylePreviewRenderer* pStylePreviewRenderer; - SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(sName, SFX_STYLE_FAMILY_PARA); if (pStyleSheet) { + sfx2::StylePreviewRenderer* pStylePreviewRenderer; pStylePreviewRenderer = pStyleManager->CreateStylePreviewRenderer(aOutputDevice, pStyleSheet, nHeight); pStylePreviewRenderer->recalculate(); pStylePreviewRenderer->render(aRect, sfx2::StylePreviewRenderer::RenderAlign::TOP); diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 570a6f64dca9..6eb89778ff92 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -653,8 +653,6 @@ static bool performTest( static_cast< sal_Int64 >(SAL_CONST_INT64(0x8000000000000000)), 1, SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF) }; sal_uInt64 _arUHyper[] = { 0, 1, SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF) }; - float _arFloat[] = { 1.1f, 2.2f, 3.3f }; - double _arDouble[] = { 1.11, 2.22, 3.33 }; OUString _arString[] = { OUString("String 1"), OUString("String 2"), @@ -691,6 +689,8 @@ static bool performTest( TestEnum_CHECK, STRING_TEST_CONSTANT, _arObj[2], Any(&_arObj[2], cppu::UnoType::get())); { + float _arFloat[] = { 1.1f, 2.2f, 3.3f }; + double _arDouble[] = { 1.11, 2.22, 3.33 }; Sequence arBool(_arBool, 3); Sequence arChar( _arChar, 3); Sequence arByte(_arByte, 3); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 526a47c2772b..6e26eb990ca6 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -952,7 +952,6 @@ void ControlModelContainerBase::implUpdateGroupStructure() Reference< XServiceInfo > xModelSI; // for checking for a radio button AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to - bool bIsRadioButton; // is it a radio button? #if OSL_DEBUG_LEVEL > 1 ::std::vector< OUString > aCurrentGroupLabels; @@ -962,7 +961,8 @@ void ControlModelContainerBase::implUpdateGroupStructure() { // we'll need this in every state xModelSI.set(*pControlModels, css::uno::UNO_QUERY); - bIsRadioButton = xModelSI.is() && xModelSI->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ); + // is it a radio button? + bool bIsRadioButton = xModelSI.is() && xModelSI->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ); switch ( eState ) { diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 727943dde023..f5cf0dfd46d0 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -637,7 +637,6 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin // Ceil number of points until divisible by four mpImplPolygon = new ImplPolygon( nPoints = (nPoints + 3) & ~3 ); - Point* pPt; sal_uInt16 i; sal_uInt16 nPoints2 = nPoints >> 1; sal_uInt16 nPoints4 = nPoints >> 2; @@ -649,7 +648,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin long nX = FRound( nRadX * cos( nAngle ) ); long nY = FRound( -nRadY * sin( nAngle ) ); - pPt = &(mpImplPolygon->mpPointAry[i]); + Point* pPt = &(mpImplPolygon->mpPointAry[i]); pPt->X() = nX + rCenter.X(); pPt->Y() = nY + rCenter.Y(); pPt = &(mpImplPolygon->mpPointAry[nPoints2-i-1]); @@ -750,7 +749,7 @@ Polygon::Polygon( const Point& rBezPt1, const Point& rCtrlPt1, const double fInc = 1.0 / ( nPoints - 1 ); double fK_1 = 0.0, fK1_1 = 1.0; - double fK_2, fK_3, fK1_2, fK1_3, fK12, fK21; + double fK_2, fK_3, fK1_2, fK1_3; const double fX0 = rBezPt1.X(); const double fY0 = rBezPt1.Y(); const double fX1 = 3.0 * rCtrlPt1.X(); @@ -768,7 +767,8 @@ Polygon::Polygon( const Point& rBezPt1, const Point& rCtrlPt1, fK_2 = fK_1, fK_3 = ( fK_2 *= fK_1 ), fK_3 *= fK_1; fK1_2 = fK1_1, fK1_3 = ( fK1_2 *= fK1_1 ), fK1_3 *= fK1_1; - fK12 = fK_1 * fK1_2, fK21 = fK_2 * fK1_1; + double fK12 = fK_1 * fK1_2; + double fK21 = fK_2 * fK1_1; rPt.X() = FRound( fK1_3 * fX0 + fK12 * fX1 + fK21 * fX2 + fK_3 * fX3 ); rPt.Y() = FRound( fK1_3 * fY0 + fK12 * fY1 + fK21 * fY2 + fK_3 * fY3 ); diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 33c1e087a271..e00315e881e9 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -750,11 +750,11 @@ static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack, sal_uInt32 nId ) { // Returns position of the resource if found or NULL otherwise - RSHEADER_TYPE* pTmp; // Pointer to child resource - RSHEADER_TYPE* pEnd; // Pointer to the end of this resource if ( pStack->pResource && pStack->pClassRes ) { + RSHEADER_TYPE* pTmp; // Pointer to child resource + RSHEADER_TYPE* pEnd; // Pointer to the end of this resource pTmp = reinterpret_cast (reinterpret_cast(pStack->pResource) + pStack->pResource->GetLocalOff()); pEnd = reinterpret_cast diff --git a/tubes/source/file-transfer-helper.c b/tubes/source/file-transfer-helper.c index 12a6c0940930..725ebad6c35b 100644 --- a/tubes/source/file-transfer-helper.c +++ b/tubes/source/file-transfer-helper.c @@ -629,11 +629,11 @@ tp_file_hash_to_g_checksum (TpFileHashType type) static void check_hash_incoming (EmpathyFTHandler *handler) { - HashingData *hash_data; EmpathyFTHandlerPriv *priv = handler->priv; if (!tp_str_empty (priv->content_hash)) { + HashingData *hash_data; hash_data = g_slice_new0 (HashingData); hash_data->total_bytes = priv->total_bytes; hash_data->handler = g_object_ref (handler); diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 8e9864b56f9d..bc0f7e066aa1 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -1701,13 +1701,12 @@ void SortedResultSet::ResortModified( EventList* pList ) sal_uInt32 i, j; sal_IntPtr nCompare, nCurPos, nNewPos; sal_IntPtr nStart, nEnd, nOffset, nVal; - SortListData *pData; ListAction *pAction; try { for ( i=0; i(maModList.GetObject( i )); + SortListData *pData = static_cast(maModList.GetObject( i )); nCompare = CompareImpl( mxOther, mxOriginal, pData->mnOldPos, pData->mnCurPos ); pData->mbModified = false; diff --git a/unotools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx index 8ee8953a0345..f84d93d5f24d 100644 --- a/unotools/source/config/xmlaccelcfg.cxx +++ b/unotools/source/config/xmlaccelcfg.cxx @@ -63,10 +63,9 @@ throw( SAXException, RuntimeException, std::exception ) OUString OReadAccelatorDocumentHandler::getErrorLineString() { - char buffer[32]; - if ( m_xLocator.is() ) { + char buffer[32]; return OUString::createFromAscii( buffer ); } else diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index 2e8ee3d0acc9..0bc86667f09d 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -209,7 +209,6 @@ void TimerTest::testAutoTimer() const double exp = (nDurationMs * nEventsCount); sal_Int32 nCount = 0; - double dur = 0; std::ostringstream msg; // Repeat when we have random latencies. @@ -224,7 +223,7 @@ void TimerTest::testAutoTimer() } const auto end = std::chrono::high_resolution_clock::now(); - dur = std::chrono::duration(end - start).count(); + double dur = std::chrono::duration(end - start).count(); msg << std::setprecision(2) << std::fixed << "periodic multi-timer - dur: " @@ -257,7 +256,6 @@ void TimerTest::testMultiAutoTimers() const double expX = (exp / nDurationMsX); const double expY = (exp / nDurationMsY); - double dur = 0; sal_Int32 nCountX = 0; sal_Int32 nCountY = 0; sal_Int32 nCount = 0; @@ -282,7 +280,7 @@ void TimerTest::testMultiAutoTimers() } const auto end = std::chrono::high_resolution_clock::now(); - dur = std::chrono::duration(end - start).count(); + double dur = std::chrono::duration(end - start).count(); msg << std::setprecision(2) << std::fixed << "periodic multi-timer - dur: " << dur << " (" << exp << ") ms, nCount: " << nCount diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 52dcdd0f4082..1eb0fa39bf8d 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -668,7 +668,6 @@ void SpinField::ImplCalcButtonAreas(OutputDevice* pDev, const Size& rOutSz, Rect long nBottom1 = aSize.Height()/2; long nBottom2 = aSize.Height()-1; long nTop2 = nBottom1; - long nTop1 = 0; if ( !(aSize.Height() & 0x01) ) nBottom1--; @@ -715,7 +714,7 @@ void SpinField::ImplCalcButtonAreas(OutputDevice* pDev, const Size& rOutSz, Rect { aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) ); - rSpinUpArea = Rectangle( aSize.Width(), nTop1, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 ); + rSpinUpArea = Rectangle( aSize.Width(), 0, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 ); rSpinDownArea = Rectangle( rSpinUpArea.Left(), nTop2, rSpinUpArea.Right(), nBottom2 ); } } diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 4032ebb6c5c0..be41ccebf5b6 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -218,13 +218,13 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount ) bool GIFReader::ReadExtension() { bool bRet = false; - bool bOverreadDataBlocks = false; // Extension-Label sal_uInt8 cFunction(0); rIStm.ReadUChar( cFunction ); if( NO_PENDING( rIStm ) ) { + bool bOverreadDataBlocks = false; sal_uInt8 cSize(0); // Block length rIStm.ReadUChar( cSize ); diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx index 86bacd124b19..c449afcc9eed 100644 --- a/vcl/source/filter/sgfbram.cxx +++ b/vcl/source/filter/sgfbram.cxx @@ -334,14 +334,15 @@ bool SgfBMapFilter(SvStream& rInp, SvStream& rOut) SgfHeader aHead; SgfEntry aEntr; sal_uLong nNext; - bool bRdFlag=false; // read graphics entry? bool bRet=false; // return value nFileStart=rInp.Tell(); ReadSgfHeader( rInp, aHead ); if (aHead.ChkMagic() && (aHead.Typ==SgfBitImag0 || aHead.Typ==SgfBitImag1 || - aHead.Typ==SgfBitImag2 || aHead.Typ==SgfBitImgMo)) { - nNext=aHead.GetOffset(); + aHead.Typ==SgfBitImag2 || aHead.Typ==SgfBitImgMo)) + { + bool bRdFlag = false; // read graphics entry? + nNext = aHead.GetOffset(); while (nNext && !bRdFlag && !rInp.GetError() && !rOut.GetError()) { rInp.Seek(nFileStart+nNext); ReadSgfEntry( rInp, aEntr ); diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx index 67c89f486102..4882248dbcac 100644 --- a/vcl/source/filter/sgvmain.cxx +++ b/vcl/source/filter/sgvmain.cxx @@ -638,7 +638,6 @@ void CircType::Draw(OutputDevice& rOut) void BmapType::Draw(OutputDevice& rOut) { //ifstream aInp; - unsigned char nSgfTyp; sal_uInt16 nVersion; OUString aStr( reinterpret_cast< char const * >(&Filename[ 1 ]), @@ -648,7 +647,7 @@ void BmapType::Draw(OutputDevice& rOut) SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::READ ); if ( pInp ) { - nSgfTyp=CheckSgfTyp( *pInp,nVersion); + unsigned char nSgfTyp = CheckSgfTyp( *pInp,nVersion); switch(nSgfTyp) { case SGF_BITIMAGE: { GraphicFilter aFlt; diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx index 1cfaa41f7a8d..58a7a3e25a7f 100644 --- a/vcl/source/filter/sgvspln.cxx +++ b/vcl/source/filter/sgvspln.cxx @@ -486,7 +486,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y, { // array dimensions should range from [0..n]! sal_uInt16 Error; sal_uInt16 i,im1,nm1; //integer - double hr,hl; + double hl; std::unique_ptr a; std::unique_ptr lowrow; std::unique_ptr ricol; @@ -506,6 +506,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y, c[1]=c[1]/(x[2]-x[0]); c[2]=-c[1]; } else { + double hr; for (i=1;i<=nm1;i++) { im1=i-1; hl=x[i]-x[im1]; @@ -550,8 +551,7 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, { sal_uInt16 Error; sal_uInt16 i; - double deltX,deltY,delt, - alphX = 0,alphY = 0, + double alphX = 0,alphY = 0, betX = 0,betY = 0; if (n<2) return 1; @@ -559,6 +559,7 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, if (!CondT) { T[0]=0.0; for (i=0;i=tv[i+1]; if (bEnd) t=tv[i+1]; dt1=t-tv[i]; dt2=dt1*dt1; dt3=dt2*dt1; diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index e4359eaf3da5..0cf9f569c265 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -370,12 +370,12 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) case W_META_POLYPOLYGON: { - bool bRecordOk = true; sal_uInt16 nPolyCount(0); // Number of polygons: pWMF->ReadUInt16( nPolyCount ); if (nPolyCount && pWMF->good()) { + bool bRecordOk = true; if (nPolyCount > pWMF->remainingSize() / sizeof(sal_uInt16)) { break; @@ -1323,12 +1323,11 @@ void WMFReader::ReadWMF() if ( ReadHeader( ) ) { - bool bEMFAvailable = false; - nPos = pWMF->Tell(); if( nEndPos - nStartPos ) { + bool bEMFAvailable = false; while( true ) { nCurrentAction++; diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index d90d7bf1c882..05bb8f2353b1 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -553,17 +553,15 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { case( 1 ): { - sal_uInt8* pTmp; - sal_uInt8 cTmp; - for( ; nCount--; nY += nI ) { + sal_uInt8* pTmp; if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) != nAlignedWidth) { return false; } - cTmp = *pTmp++; + sal_uInt8 cTmp = *pTmp++; for( long nX = 0L, nShift = 8L; nX < nWidth; nX++ ) { @@ -581,17 +579,15 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r case( 4 ): { - sal_uInt8* pTmp; - sal_uInt8 cTmp; - for( ; nCount--; nY += nI ) { + sal_uInt8* pTmp; if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) != nAlignedWidth) { return false; } - cTmp = *pTmp++; + sal_uInt8 cTmp = *pTmp++; for( long nX = 0L, nShift = 2L; nX < nWidth; nX++ ) { @@ -609,10 +605,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r case( 8 ): { - sal_uInt8* pTmp; - for( ; nCount--; nY += nI ) { + sal_uInt8* pTmp; if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) != nAlignedWidth) { @@ -639,10 +634,10 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r ColorMask aMask(aRedMask, aGreenMask, aBlueMask); BitmapColor aColor; - sal_uInt16* pTmp16; for( ; nCount--; nY += nI ) { + sal_uInt16* pTmp16; if (rIStm.Read( ( pTmp16 = reinterpret_cast(pBuf.get()) ), nAlignedWidth ) != nAlignedWidth) { @@ -661,10 +656,10 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r case( 24 ): { BitmapColor aPixelColor; - sal_uInt8* pTmp; for( ; nCount--; nY += nI ) { + sal_uInt8* pTmp; if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) != nAlignedWidth) { @@ -989,14 +984,13 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, bool bRLE4 ) sal_uLong nCount; sal_uLong nBufCount; std::unique_ptr pBuf(new sal_uInt8[ ( nWidth << 1 ) + 2 ]); - sal_uInt8* pTmp; sal_uInt8 cPix; sal_uInt8 cLast; bool bFound; for ( long nY = nHeight - 1L; nY >= 0L; nY-- ) { - pTmp = pBuf.get(); + sal_uInt8* pTmp = pBuf.get(); nX = nBufCount = 0UL; while( nX < nWidth ) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index bbdb4ebd2d07..c29554948454 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2754,7 +2754,6 @@ SvStream& ReadGDIMetaFile( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) { // new format VersionCompat* pCompat; - MetaAction* pAction; sal_uInt32 nStmCompressMode = 0; sal_uInt32 nCount = 0; @@ -2772,8 +2771,7 @@ SvStream& ReadGDIMetaFile( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); nAction++ ) { - pAction = MetaAction::ReadMetaAction( rIStm, &aReadData ); - + MetaAction* pAction = MetaAction::ReadMetaAction( rIStm, &aReadData ); if( pAction ) { if (pAction->GetType() == MetaActionType::COMMENT) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 95a46f925673..3b93fc77db15 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6570,8 +6570,7 @@ my_NSS_CMSAttributeArray_FindAttrByOidTag(NSSCMSAttribute **attrs, SECOidTag oid SECStatus my_NSS_CMSArray_Add(PLArenaPool *poolp, void ***array, void *obj) { - void **p; - int n; + int n = 0; void **dest; PORT_Assert(array != NULL); @@ -6579,16 +6578,15 @@ my_NSS_CMSArray_Add(PLArenaPool *poolp, void ***array, void *obj) return SECFailure; if (*array == NULL) { - dest = static_cast(PORT_ArenaAlloc(poolp, 2 * sizeof(void *))); - n = 0; + dest = static_cast(PORT_ArenaAlloc(poolp, 2 * sizeof(void *))); } else { - n = 0; p = *array; - while (*p++) - n++; - dest = static_cast(PORT_ArenaGrow (poolp, - *array, - (n + 1) * sizeof(void *), - (n + 2) * sizeof(void *))); + void **p = *array; + while (*p++) + n++; + dest = static_cast(PORT_ArenaGrow (poolp, + *array, + (n + 1) * sizeof(void *), + (n + 2) * sizeof(void *))); } if (dest == NULL) diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index d9336ce85a92..63a6565e862a 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -599,9 +599,6 @@ sal_uLong PNGWriterImpl::ImplGetFilter (sal_uLong nY, sal_uLong nXStart, sal_uLo pDest = mpDeflateInBuf; *pDest++ = 4; // filter type - sal_uLong na, nb, nc; - long np, npa, npb, npc; - sal_uInt8* p1 = mpCurrentScan + 1; // Current Pixel sal_uInt8* p2 = p1 - mnBBP; // left pixel sal_uInt8* p3 = mpPreviousScan; // upper pixel @@ -609,7 +606,8 @@ sal_uLong PNGWriterImpl::ImplGetFilter (sal_uLong nY, sal_uLong nXStart, sal_uLo while (pDest < mpDeflateInBuf + mnDeflateInSize) { - nb = *p3++; + sal_uLong nb = *p3++; + sal_uLong na, nc; if (p2 >= mpCurrentScan + 1) { na = *p2; @@ -620,11 +618,10 @@ sal_uLong PNGWriterImpl::ImplGetFilter (sal_uLong nY, sal_uLong nXStart, sal_uLo na = nc = 0; } - np = na + nb; - np -= nc; - npa = np - na; - npb = np - nb; - npc = np - nc; + long np = na + nb - nc; + long npa = np - na; + long npb = np - nb; + long npc = np - nc; if (npa < 0) npa =-npa; diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 876d52da118c..4a723a35287a 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -142,12 +142,11 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc while (baseSlot && gr_slot_attached_to(baseSlot) != NULL && !gr_slot_can_insert_before(baseSlot)) baseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot); assert(baseSlot); - float thisBoundary = 0.; float nextBoundary = gr_slot_origin_X(baseSlot); // now loop over bases for ( ; baseSlot; baseSlot = nextBaseSlot) { - thisBoundary = nextBoundary; + float thisBoundary = nextBoundary; int firstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot))) + mnSegCharOffset; nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot), bRtl); nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : gr_seg_advance_X(pSegment); diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index f83e28375b1d..19a2fac70aea 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -125,8 +125,6 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, long nDiffY = nHeight-1; long nCount = nWidth; long nOffY = -1; - long nFreq; - long i; long nPixWidth; long nPixHeight; bool bDrawPixAsRect; @@ -167,10 +165,10 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, else { nCurY += nDiffY; - nFreq = nCount / (nDiffX+nDiffY); + long nFreq = nCount / (nDiffX+nDiffY); while ( nFreq-- ) { - for( i = nDiffY; i; --i ) + for( long i = nDiffY; i; --i ) { ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation, mpGraphics, this, @@ -178,7 +176,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, nCurX++; nCurY += nOffY; } - for( i = nDiffX; i; --i ) + for( long i = nDiffX; i; --i ) { ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation, mpGraphics, this, @@ -190,7 +188,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, nFreq = nCount % (nDiffX+nDiffY); if ( nFreq ) { - for( i = nDiffY; i && nFreq; --i, --nFreq ) + for( long i = nDiffY; i && nFreq; --i, --nFreq ) { ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation, mpGraphics, this, @@ -199,7 +197,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, nCurY += nOffY; } - for( i = nDiffX; i && nFreq; --i, --nFreq ) + for( long i = nDiffX; i && nFreq; --i, --nFreq ) { ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation, mpGraphics, this, diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 34804c1a3555..4f63cb6120e2 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2607,13 +2607,10 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu ) bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent ) { - bool bDone = false; - const CommandModKeyData* pCData; - // No keyboard processing when system handles the menu or our menubar is invisible if( !IsDisplayable() || ( ImplGetSalMenu() && ImplGetSalMenu()->VisibleMenuBar() ) ) - return bDone; + return false; // check for enabled, if this method is called from another window... MenuBarWindow* pWin = static_cast(ImplGetWindow()); @@ -2621,7 +2618,7 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent ) { if (rCEvent.GetCommand() == CommandEventId::ModKeyChange) { - pCData = rCEvent.GetModKeyData (); + const CommandModKeyData* pCData = rCEvent.GetModKeyData (); if (pWin->nHighlightedItem == ITEMPOS_INVALID) { if (pCData && pCData->IsMod2()) diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx index 96ab2407085d..4e0e4ed86b71 100644 --- a/vcl/source/window/settings.cxx +++ b/vcl/source/window/settings.cxx @@ -241,13 +241,14 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl ) // (see above) then accept that if( !rSettings.GetStyleSettings().GetHighContrastMode() ) { - bool bTmp = false, bAutoHCMode = true; + bool bAutoHCMode = true; utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext( comphelper::getProcessComponentContext(), OUString("org.openoffice.Office.Common/Accessibility") ); // note: case sensitive ! if ( aNode.isValid() ) { ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("AutoDetectSystemHC") ); + bool bTmp = false; if( aValue >>= bTmp ) bAutoHCMode = bTmp; } diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 8e643d1db371..572a9a4b6966 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -475,16 +475,8 @@ static void ImplCalcSet( ImplSplitSet* pSet, sal_uInt16 nVisItems; sal_uInt16 nAbsItems; long nCalcSize; - long nSizeDelta; - long nSizeWinSize; - long nNewSizeWinSize; - long nTemp; - long nTempErr; - long nErrorSum; - long nCurSizeDelta; long nPos; long nMaxPos; - long* pSize; ImplSplitItems& pItems = pSet->mpItems; bool bEmpty; @@ -502,7 +494,6 @@ static void ImplCalcSet( ImplSplitSet* pSet, else nCalcSize = nSetWidth; nCalcSize -= (nVisItems-1)*pSet->mnSplitSize; - long nCurSize = 0; if ( pSet->mbCalcPix || (pSet->mnLastSize != nCalcSize) ) { long nPercentFactor = 10; @@ -510,6 +501,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, long nPercent = 0; long nRelPercent = 0; long nAbsSize = 0; + long nCurSize = 0; for ( i = 0; i < nItems; i++ ) { if ( !(pItems[i]->mnBits & SplitWindowItemFlags::Invisible) ) @@ -542,7 +534,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, } if ( !nPercent ) nPercent = 1; - nSizeDelta = nCalcSize-nAbsSize; + long nSizeDelta = nCalcSize-nAbsSize; for ( i = 0; i < nItems; i++ ) { if ( pItems[i]->mnBits & SplitWindowItemFlags::Invisible ) @@ -574,8 +566,8 @@ static void ImplCalcSet( ImplSplitSet* pSet, if ( nSizeDelta ) { nAbsItems = 0; - nSizeWinSize = 0; - nNewSizeWinSize = 0; + long nSizeWinSize = 0; + long nNewSizeWinSize = 0; // first resize absolute items relative for ( i = 0; i < nItems; i++ ) @@ -646,8 +638,8 @@ static void ImplCalcSet( ImplSplitSet* pSet, } // subtract size of individual items - nErrorSum = nSizeDelta % nCalcItems; - nCurSizeDelta = nSizeDelta / nCalcItems; + long nErrorSum = nSizeDelta % nCalcItems; + long nCurSizeDelta = nSizeDelta / nCalcItems; nMins = 0; for ( i = 0; i < nItems; i++ ) { @@ -655,7 +647,8 @@ static void ImplCalcSet( ImplSplitSet* pSet, nMins++; else if ( pItems[i]->mbSubSize ) { - pSize = &(pItems[i]->mnPixSize); + long* pSize = &(pItems[i]->mnPixSize); + long nTempErr; if ( nErrorSum ) { @@ -669,7 +662,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, if ( (*pSize+nCurSizeDelta+nTempErr) <= 0 ) { - nTemp = *pSize; + long nTemp = *pSize; if ( nTemp ) { *pSize -= nTemp; @@ -1468,7 +1461,6 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) // the size is determined according to MainSet if ( mnWinStyle & WB_SIZEABLE ) { - long nCurSize; long nCalcSize = 0; sal_uInt16 i; @@ -1484,6 +1476,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) { long nDelta = 0; Point aPos = GetPosPixel(); + long nCurSize; if ( mbHorz ) nCurSize = aNewSize.Height()-mnTopBorder-mnBottomBorder; @@ -1533,7 +1526,6 @@ void SplitWindow::ImplCalcLayout() // the size is determined according to MainSet if ( mnWinStyle & WB_SIZEABLE ) { - long nCurSize; long nCalcSize = 0; sal_uInt16 i; @@ -1547,6 +1539,7 @@ void SplitWindow::ImplCalcLayout() if ( i == mpMainSet->mpItems.size() ) { + long nCurSize; if ( mbHorz ) nCurSize = mnDY-mnTopBorder-mnBottomBorder; else diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 425cfc206ded..427cb67a2c02 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1222,7 +1222,6 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > bool bHaveUTF16 = false; Atom aUTF8Type = None; bool bHaveCompound = false; - bool bHaveText = false; Sequence< sal_Int8 > aAtoms; if( selection == m_nXdndSelection ) @@ -1303,6 +1302,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > aNativeTypes.resize( nAtoms ); DataFlavor* pFlavors = rTypes.getArray(); sal_Int32 nNativeTypesIndex = 0; + bool bHaveText = false; while( nAtoms-- ) { SAL_INFO_IF(*pAtoms && *pAtoms < 0x01000000, "vcl.unx.dtrans", diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index abc9cfdd14b0..9018b5152c66 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -1161,7 +1161,6 @@ void SystemQueueInfo::run() osl_setThreadName("LPR psp::SystemQueueInfo"); char pBuffer[1024]; - FILE *pPipe; std::list< OString > aLines; /* Discover which command we can use to get a list of all printer queues */ @@ -1174,6 +1173,7 @@ void SystemQueueInfo::run() fprintf( stderr, "trying print queue command \"%s\" ... ", aParms[i].pQueueCommand ); #endif aCmdLine.append( " 2>/dev/null" ); + FILE *pPipe; if( (pPipe = popen( aCmdLine.getStr(), "r" )) ) { while( fgets( pBuffer, 1024, pPipe ) ) diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index 7b1ca1515193..39b5713f5f13 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -93,20 +93,19 @@ bool XMLTransGradientStyleImport::importXML( aGradient.Angle = 0; aGradient.Border = 0; + static const SvXMLTokenMapEntry aTrGradientAttrTokenMap[] = { - static const SvXMLTokenMapEntry aTrGradientAttrTokenMap[] = -{ - { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_GRADIENT_NAME }, - { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_GRADIENT_DISPLAY_NAME }, - { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_GRADIENT_STYLE }, - { XML_NAMESPACE_DRAW, XML_CX, XML_TOK_GRADIENT_CX }, - { XML_NAMESPACE_DRAW, XML_CY, XML_TOK_GRADIENT_CY }, - { XML_NAMESPACE_DRAW, XML_START, XML_TOK_GRADIENT_START }, - { XML_NAMESPACE_DRAW, XML_END, XML_TOK_GRADIENT_END }, - { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE }, - { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER }, - XML_TOKEN_MAP_END -}; + { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_GRADIENT_NAME }, + { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_GRADIENT_DISPLAY_NAME }, + { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_GRADIENT_STYLE }, + { XML_NAMESPACE_DRAW, XML_CX, XML_TOK_GRADIENT_CX }, + { XML_NAMESPACE_DRAW, XML_CY, XML_TOK_GRADIENT_CY }, + { XML_NAMESPACE_DRAW, XML_START, XML_TOK_GRADIENT_START }, + { XML_NAMESPACE_DRAW, XML_END, XML_TOK_GRADIENT_END }, + { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE }, + { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER }, + XML_TOKEN_MAP_END + }; SvXMLTokenMap aTokenMap( aTrGradientAttrTokenMap ); SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap(); @@ -204,8 +203,6 @@ bool XMLTransGradientStyleImport::importXML( bRet = bHasName && bHasStyle; - } - return bRet; } -- cgit v1.2.3