[Libreoffice-commits] core.git: sw/source

Michael Weghorn m.weghorn at posteo.de
Sun Jan 18 23:15:14 PST 2015


 sw/source/ui/config/optload.cxx             |    3 +--
 sw/source/ui/fldui/changedb.cxx             |    3 +--
 sw/source/ui/fldui/flddok.cxx               |    4 ++--
 sw/source/ui/fldui/fldref.cxx               |    6 ++----
 sw/source/ui/frmdlg/column.cxx              |    3 +--
 sw/source/ui/frmdlg/cption.cxx              |    3 +--
 sw/source/ui/index/cnttab.cxx               |   12 ++++++++----
 sw/source/ui/misc/glossary.cxx              |    3 +--
 sw/source/uibase/app/appenv.cxx             |    6 ++++--
 sw/source/uibase/app/docsh2.cxx             |   10 ++++++----
 sw/source/uibase/config/uinums.cxx          |    6 ++++--
 sw/source/uibase/dochdl/swdtflvr.cxx        |    8 ++++----
 sw/source/uibase/docvw/PostItMgr.cxx        |    3 +--
 sw/source/uibase/frmdlg/colex.cxx           |    3 +--
 sw/source/uibase/misc/redlndlg.cxx          |    3 +--
 sw/source/uibase/shells/tabsh.cxx           |    3 +--
 sw/source/uibase/uiview/formatclipboard.cxx |    2 +-
 sw/source/uibase/uiview/pview.cxx           |    6 ++----
 sw/source/uibase/uiview/view.cxx            |    3 +--
 sw/source/uibase/uiview/viewtab.cxx         |    3 +--
 sw/source/uibase/uno/unotxdoc.cxx           |    2 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx           |    9 ++++++---
 22 files changed, 51 insertions(+), 53 deletions(-)

New commits:
commit 54defd1bd3359c95e45891c7294847d0cebca753
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Fri Jan 16 22:59:20 2015 +0100

    fdo#39440 sw: reduce scope of local variables
    
    This addresses some cppcheck warnings.
    
    Change-Id: I0de4e6278fb564c299722a9e23eb67d0999c4e31
    Reviewed-on: https://gerrit.libreoffice.org/13966
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index b9cb029..e7dd53b 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -456,10 +456,9 @@ SwCaptionOptPage::SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet
     sal_uInt16 nSelFmt = SVX_NUM_ARABIC;
     if (pSh)
     {
-        SwFieldType* pFldType;
         for ( sal_uInt16 i = pMgr->GetFldTypeCount(); i; )
         {
-            pFldType = pMgr->GetFldType(USHRT_MAX, --i);
+            SwFieldType* pFldType = pMgr->GetFldType(USHRT_MAX, --i);
             if (pFldType->GetName().equals(m_pCategoryBox->GetText()))
             {
                 nSelFmt = (sal_uInt16)static_cast<SwSetExpFieldType*>(pFldType)->GetSeqFormat();
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
index c76c889..9e917d4 100644
--- a/sw/source/ui/fldui/changedb.cxx
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -219,12 +219,11 @@ IMPL_LINK_NOARG(SwChangeDBDlg, ButtonHdl)
 
 IMPL_LINK_NOARG(SwChangeDBDlg, TreeSelectHdl)
 {
-    bool bEnable = false;
-
     SvTreeListEntry* pEntry = m_pAvailDBTLB->GetCurEntry();
 
     if (pEntry)
     {
+        bool bEnable = false;
         if (m_pAvailDBTLB->GetParent(pEntry))
             bEnable = true;
         m_pDefineBT->Enable( bEnable );
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index b69efd9..db9632e 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -198,10 +198,10 @@ IMPL_LINK_NOARG(SwFldDokPage, TypeHdl)
         m_pTypeLB->SelectEntryPos(0);
     }
 
-    size_t nCount;
-
     if (nOld != GetTypeSel())
     {
+        size_t nCount;
+
         m_pDateFT->Hide();
         m_pTimeFT->Hide();
 
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 4be5ad3..605e2a3 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -522,10 +522,9 @@ void SwFldRefPage::UpdateSubType()
             const IDocumentOutlineNodes* pIDoc( pSh->getIDocumentOutlineNodesAccess() );
             pIDoc->getOutlineNodes( maOutlineNodes );
             bool bCertainTxtNodeSelected( false );
-            SvTreeListEntry* pEntry = 0;
             for ( size_t nOutlIdx = 0; nOutlIdx < maOutlineNodes.size(); ++nOutlIdx )
             {
-                pEntry = m_pSelectionToolTipLB->InsertEntry(
+                SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
                                 pIDoc->getOutlineText( nOutlIdx, true, true, false ) );
                 pEntry->SetUserData( reinterpret_cast<void*>(nOutlIdx) );
                 if ( ( IsFldEdit() &&
@@ -550,10 +549,9 @@ void SwFldRefPage::UpdateSubType()
             const IDocumentListItems* pIDoc( pSh->getIDocumentListItemsAccess() );
             pIDoc->getNumItems( maNumItems );
             bool bCertainTxtNodeSelected( false );
-            SvTreeListEntry* pEntry = 0;
             for ( size_t nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
             {
-                pEntry = m_pSelectionToolTipLB->InsertEntry(
+                SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
                             pIDoc->getListItemText( *maNumItems[nNumItemIdx], true, true ) );
                 pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
                 if ( ( IsFldEdit() &&
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index dd32134..8839e65 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -518,11 +518,10 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet)
 
     // Fill the color listbox
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
-    const SfxPoolItem*  pItem       = NULL;
     XColorListRef pColorList;
     if ( pDocSh )
     {
-        pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+        const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
         if ( pItem != NULL )
             pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
     }
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index ac174be..2f9bac8 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -204,10 +204,9 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
     // aFormatBox
     sal_uInt16 nSelFmt = SVX_NUM_ARABIC;
     nCount = pMgr->GetFldTypeCount();
-    SwFieldType* pFldType;
     for ( sal_uInt16 i = nCount; i; )
     {
-        pFldType = pMgr->GetFldType(USHRT_MAX, --i);
+        SwFieldType* pFldType = pMgr->GetFldType(USHRT_MAX, --i);
         if( pFldType->GetName().equals(m_pCategoryBox->GetText()) )
         {
             nSelFmt = (sal_uInt16)static_cast<SwSetExpFieldType*>(pFldType)->GetSeqFormat();
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 6ee410e..b1db99a 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1381,11 +1381,13 @@ IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox)
     void* pUserData;
     if( 0 != (pUserData = m_pSortAlgorithmLB->GetEntryData( m_pSortAlgorithmLB->GetSelectEntryPos())) )
         sOldString = *(OUString*)pUserData;
-    void* pDel;
     sal_Int32 nEnd = m_pSortAlgorithmLB->GetEntryCount();
     for( sal_Int32 n = 0; n < nEnd; ++n )
-        if( 0 != ( pDel = m_pSortAlgorithmLB->GetEntryData( n )) )
+    {
+        void* pDel = m_pSortAlgorithmLB->GetEntryData( n );
+        if( 0 != pDel )
             delete (OUString*)pDel;
+    }
     m_pSortAlgorithmLB->Clear();
 
     nEnd = aSeq.getLength();
@@ -3564,13 +3566,15 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
     }
 
     // initialise templates
-    const SwTxtFmtColl *pColl;
     SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell();
     const sal_uInt16 nSz = rSh.GetTxtFmtCollCount();
 
     for( sal_uInt16 i = 0; i < nSz; ++i )
-        if( !(pColl = &rSh.GetTxtFmtColl( i ))->IsDefault() )
+    {
+        const SwTxtFmtColl *pColl = &rSh.GetTxtFmtColl( i );
+        if( !pColl->IsDefault() )
             m_pParaLayLB->InsertEntry( pColl->GetName() );
+    }
 
     // query pool collections and set them for the directory
     for( sal_uInt16 i = 0; i < m_pCurrentForm->GetFormMax(); ++i )
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index db61233..be9ddf8 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -958,7 +958,6 @@ TriState SwGlTreeListBox::NotifyCopyingOrMoving(
     SvTreeListEntry* pSrcParent = GetParent(pEntry);
     SvTreeListEntry* pDestParent =
         GetParent(pTarget) ? GetParent(pTarget) : pTarget;
-    bool bRet = false;
     if(pDestParent != pSrcParent)
     {
         SwGlossaryDlg* pDlg = static_cast<SwGlossaryDlg*>(GetParentDialog());
@@ -978,7 +977,7 @@ TriState SwGlTreeListBox::NotifyCopyingOrMoving(
             + OUStringLiteral1<GLOS_DELIM>()
             + OUString::number(pDestData->nPathIdx);
 
-        bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup,  sShortName,
+        const bool bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup,  sShortName,
                         sDestName, sTitle, bIsMove );
         if(bRet)
         {
diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx
index 3f0e173..feca3d5 100644
--- a/sw/source/uibase/app/appenv.cxx
+++ b/sw/source/uibase/app/appenv.cxx
@@ -135,10 +135,12 @@ OUString InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const OUString& r
 static void lcl_CopyCollAttr(SwWrtShell* pOldSh, SwWrtShell* pNewSh, sal_uInt16 nCollId)
 {
     sal_uInt16 nCollCnt = pOldSh->GetTxtFmtCollCount();
-    SwTxtFmtColl* pColl;
     for( sal_uInt16 nCnt = 0; nCnt < nCollCnt; ++nCnt )
-        if(nCollId == (pColl = &pOldSh->GetTxtFmtColl(nCnt))->GetPoolFmtId())
+    {
+        SwTxtFmtColl* pColl = &pOldSh->GetTxtFmtColl(nCnt);
+        if(nCollId == pColl->GetPoolFmtId())
             pNewSh->GetTxtCollFromPool(nCollId)->SetFmtAttr(pColl->GetAttrSet());
+    }
 }
 
 void SwModule::InsertEnv( SfxRequest& rReq )
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 85d77e7..9deec3e 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -868,9 +868,10 @@ void SwDocShell::Execute(SfxRequest& rReq)
                     if ( pTemplItem )
                         aTemplateName = pTemplItem->GetValue();
                 }
-                bool bError = false;
                 if ( aFileName.isEmpty() )
                 {
+                    bool bError = false;
+
                     FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, 0 );
 
                     const sal_Int16 nControlIds[] = {
@@ -953,13 +954,14 @@ void SwDocShell::Execute(SfxRequest& rReq)
                         const SwOutlineNodes& rOutlNds = mpDoc->GetNodes().GetOutLineNds();
                         if( !rOutlNds.empty() )
                         {
-                            int nLevel;
                             for(sal_uInt16 n = 0; n < rOutlNds.size(); ++n )
-                                if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 &&
-                                    ! bOutline[nLevel-1] )
+                            {
+                                const int nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel();
+                                if( nLevel > 0 && ! bOutline[nLevel-1] )
                                 {
                                     bOutline[nLevel-1] = true;
                                 }
+                            }
                         }
 
                         const sal_uInt16 nStyleCount = mpDoc->GetTxtFmtColls()->size();
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 2dae040..fa79923 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -164,14 +164,16 @@ void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const
     // #i89178#
     rChg = SwNumRule( maName, numfunc::GetDefaultPositionAndSpaceMode() );
     rChg.SetAutoRule( false );
-    _SwNumFmtGlobal* pFmt;
     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
-        if( 0 != ( pFmt = aFmts[ n ] ) )
+    {
+        _SwNumFmtGlobal* pFmt = aFmts[ n ];
+        if( 0 != pFmt)
         {
             SwNumFmt aNew;
             pFmt->ChgNumFmt( rSh, aNew );
             rChg.Set( n, aNew );
         }
+    }
 }
 
 void SwNumRulesWithName::GetNumFmt(
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 08a025b..845ea02 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2647,12 +2647,12 @@ bool SwTransferable::_PasteDBData( TransferableDataHelper& rData,
         bool bHaveColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR | CTF_CONTROL_EXCHANGE);
         if ( SOT_FORMATSTR_ID_XFORMS == nFmt )
         {
-            SdrObject* pObj;
             rSh.MakeDrawView();
             FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
             if(pFmView) {
                 const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
-                if(0 != (pObj = pFmView->CreateXFormsControl(rDesc)))
+                SdrObject* pObj = pFmView->CreateXFormsControl(rDesc);
+                if(0 != pObj)
                 {
                     rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
                 }
@@ -2703,12 +2703,12 @@ bool SwTransferable::_PasteDBData( TransferableDataHelper& rData,
         }
         else
         {
-            SdrObject* pObj;
             rSh.MakeDrawView();
             FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
             if (pFmView && bHaveColumnDescriptor)
             {
-                if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) )
+                SdrObject* pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) );
+                if ( 0 != pObj)
                     rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
             }
         }
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index b97b186..397def2 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1020,7 +1020,6 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,cons
     //start the real layout so nothing overlaps anymore
     if (aVisiblePostItList.size()>1)
     {
-        long lSpaceUsed = 0;
         int loop = 0;
         bool bDone = false;
         // if no window is moved anymore we are finished
@@ -1028,7 +1027,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,cons
         {
             loop++;
             bDone = true;
-            lSpaceUsed = lTopBorder + GetSpaceBetween();
+            long lSpaceUsed = lTopBorder + GetSpaceBetween();
             for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
             {
                 SwSidebarWin_iterator aNextPostIt = i;
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index 8943c09..8903831 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -298,11 +298,10 @@ void SwColExample::DrawPage( const Point& rOrg,
                 }
             }
 
-            int nDist;
             for( i = 0; i < nColumnCount -  1; i++)
             {
                 int nGutter = pColMgr->GetGutterWidth(i);
-                nDist = pColMgr->GetColWidth( i ) + nGutter;
+                int nDist = pColMgr->GetColWidth( i ) + nGutter;
                 nDist -= (i == 0) ?
                     nGutter/2 :
                         0;
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index fe613d4..0f2d72a 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -709,7 +709,6 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
     if (nEnd == USHRT_MAX)
         return;     // no redlines in the document
 
-    RedlinData *pData;
     SvTreeListEntry *pParent;
     SwRedlineDataParent* pRedlineParent;
     const SwRangeRedline* pCurrRedline;
@@ -739,7 +738,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
         pRedlineParent->sComment = sComment.replace('\n', ' ');
         aRedlineParents.insert(aRedlineParents.begin() + i, pRedlineParent);
 
-        pData = new RedlinData;
+        RedlinData *pData = new RedlinData;
         pData->pData = pRedlineParent;
         pData->bDisabled = false;
 
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 3267c5b..ecb1dbc 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -353,7 +353,6 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
 
     SwTabCols aTabCols;
     bool bTabCols = false;
-    bool bSingleLine = false;
     SwTableRep* pRep = 0;
     SwFrmFmt *pFmt = rSh.GetTableFmt();
     SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
@@ -431,7 +430,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
     if(bTabCols)
     {
         rSh.GetTabCols( aTabCols );
-        bSingleLine = pRep->FillTabCols( aTabCols );
+        bool bSingleLine = pRep->FillTabCols( aTabCols );
         rSh.SetTabCols( aTabCols, bSingleLine );
     }
 
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index 31adc5a..60aba41 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -360,9 +360,9 @@ void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bP
         SdrView* pDrawView = rWrtShell.GetDrawView();
         if(pDrawView)
         {
-            bool bOnlyHardAttr = true;
             if( pDrawView->AreObjectsMarked() )
             {
+                bool bOnlyHardAttr = true;
                 pItemSet_TxtAttr = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) );
                 //remove attributes defining the type/data of custom shapes
                 pItemSet_TxtAttr->ClearItem(SDRATTR_CUSTOMSHAPE_ENGINE);
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 4ca5825..2cc610f 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1599,16 +1599,14 @@ void SwPagePreview::ScrollViewSzChg()
         const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
         const Size& rPreviewSize =
                 GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
-        long nVisWidth = 0;
-        long nThumb   = 0;
         Range aRange(0,0);
 
         if(rDocRect.GetWidth() < rPreviewSize.Width())
         {
             bShowHScrollbar = true;
 
-            nVisWidth = rDocRect.GetWidth();
-            nThumb = rDocRect.Left();
+            long nVisWidth = rDocRect.GetWidth();
+            long nThumb = rDocRect.Left();
             aRange = Range(0, rPreviewSize.Width());
 
             pHScrollbar->SetRange( aRange );
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 9838bc9..f6a8512 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -270,10 +270,9 @@ void SwView::SelectShell()
             if ( nId )
                 pBarCfg->SetTopToolbar( m_nSelectionType, nId );
 
-            SfxShell *pSfxShell;
             for ( sal_uInt16 i = 0; true; ++i )
             {
-                pSfxShell = rDispatcher.GetShell( i );
+                SfxShell *pSfxShell = rDispatcher.GetShell( i );
                 if  (  pSfxShell->ISA( SwBaseShell )
                     || pSfxShell->ISA( SwDrawTextShell )
                     || pSfxShell->ISA( svx::ExtrusionBar )
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 0d75a1a..76b386a 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1838,13 +1838,12 @@ void SwView::StateTabWin(SfxItemSet& rSet)
                     // The entire frame width - The difference is twice the distance to the edge.
                     const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width();
                     int nWidth = 0,
-                        nStart = 0,
                         nEnd = 0;
                     aRectangle.Left() = 0;
                     for ( sal_uInt16 i = 0; i < nCount; ++i )
                     {
                         const SwColumn* pCol = &rCols[i];
-                        nStart = pCol->GetLeft() + nWidth;
+                        const int nStart = pCol->GetLeft() + nWidth;
                         if(i == nNum - 2)
                             aRectangle.Left() = nStart;
                         nWidth += pCols->CalcColWidth( i, nTotalWidth );
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e3d57dd..08fd4a4 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2408,9 +2408,9 @@ SwDoc * SwXTextDocument::GetRenderDoc(
             // this part should only be called when a temporary document needs to be created,
             // for example for PDF export or printing of (multi-)selection only.
 
-            bool bIsSwSrcView = false;
             if (!rpView)
             {
+                bool bIsSwSrcView = false;
                 (void) bIsPDFExport;
                 // aside from maybe PDF export the view should always have been provided!
                 OSL_ENSURE( bIsPDFExport, "view is missing, guessing one..." );
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 34e11b3..e84ef800 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1482,11 +1482,13 @@ SwCharFmt *SwWrtShell::GetCharStyle(const OUString &rFmtName, GetStyle eCreate )
 
 SwFrmFmt *SwWrtShell::GetTblStyle(const OUString &rFmtName)
 {
-    SwFrmFmt *pFmt = 0;
     for( size_t i = GetTblFrmFmtCount(); i; )
-        if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() &&
+    {
+        SwFrmFmt *pFmt = &GetTblFrmFmt( --i );
+        if( !pFmt->IsDefault() &&
             pFmt->GetName() == rFmtName && IsUsed( *pFmt ) )
             return pFmt;
+    }
     return 0;
 }
 
@@ -1754,11 +1756,12 @@ void SwWrtShell::ChangeHeaderOrFooter(
     for( sal_uInt16 nFrom = 0, nTo = GetPageDescCnt();
             nFrom < nTo; ++nFrom )
     {
-        bool bChgd = false;
         SwPageDesc aDesc( GetPageDesc( nFrom ));
         OUString sTmp(aDesc.GetName());
         if( rStyleName.isEmpty() || rStyleName == sTmp )
         {
+            bool bChgd = false;
+
             if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
                 ( (bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
                   (!bHeader && aDesc.GetMaster().GetFooter().IsActive()) ) )


More information about the Libreoffice-commits mailing list