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

Michael Weghorn m.weghorn at posteo.de
Sun Dec 21 02:37:21 PST 2014


 sc/source/filter/dif/difimp.cxx            |    3 +--
 sc/source/filter/rtf/rtfparse.cxx          |    3 +--
 sc/source/filter/xml/XMLExportIterator.cxx |    5 +++--
 sc/source/filter/xml/xmlexprt.cxx          |    5 ++---
 sc/source/filter/xml/xmlfonte.cxx          |    4 ++--
 sc/source/ui/dbgui/filtdlg.cxx             |    2 +-
 sc/source/ui/dbgui/foptmgr.cxx             |    3 +--
 sc/source/ui/dbgui/sfiltdlg.cxx            |    3 +--
 sc/source/ui/dbgui/tpsort.cxx              |    3 +--
 sc/source/ui/dbgui/tpsubt.cxx              |    4 +---
 sc/source/ui/docshell/docfunc.cxx          |   15 ++++++---------
 sc/source/ui/docshell/docsh4.cxx           |    4 ++--
 sc/source/ui/docshell/docsh8.cxx           |    4 ++--
 sc/source/ui/drawfunc/fuins2.cxx           |    3 +--
 sc/source/ui/drawfunc/fusel.cxx            |    2 +-
 sc/source/ui/miscdlgs/acredlin.cxx         |   15 ++++++---------
 sc/source/ui/optdlg/tpusrlst.cxx           |    2 +-
 sc/source/ui/pagedlg/areasdlg.cxx          |    3 +--
 sc/source/ui/unoobj/cellsuno.cxx           |    2 +-
 19 files changed, 35 insertions(+), 50 deletions(-)

New commits:
commit ea5effc3df7b89a9332ea5b1b1e6cd40bf37f081
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Sat Dec 20 16:48:11 2014 +0100

    fdo#39440 sc: reduce scope of local variables
    
    This addresses some cppcheck warnings.
    
    Change-Id: I2eaf9a6792ca2c06a005385ec45c08f1292cba23

diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index 59d8238..6d5be2a 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -61,7 +61,6 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc,
     bool        bOverflowWarn = false;
 
     OUString&   aData = aDifParser.aData;
-    bool        bData = false;
 
     rIn.Seek( 0 );
 
@@ -73,7 +72,7 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc,
 
         aPrgrsBar.Progress();
 
-        bData = !aData.isEmpty();
+        const bool bData = !aData.isEmpty();
 
         switch( eTopic )
         {
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index 87716da..ef818ce 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -266,7 +266,6 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
 
 void ScRTFParser::ProcToken( ImportInfo* pInfo )
 {
-    ScEEParseEntry* pE;
     switch ( pInfo->nToken )
     {
         case RTF_TROWD:         // denotes table row defauls, before RTF_CELLX
@@ -351,7 +350,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
             {   // Assign current Twips to MergeCell
                 if ( !maList.empty() )
                 {
-                    pE = maList.back();
+                    ScEEParseEntry* pE = maList.back();
                     pE->nTwips = pActDefault->nTwips;
                 }
                 // Adjust selection of free-flying pActEntry
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index 9f9307e..f08e4dd 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -653,8 +653,6 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::Cel
     rMyCell.bIsMatrixCovered = false;
     rMyCell.bIsMatrixBase = false;
 
-    bool bIsMatrixBase = false;
-
     switch (rMyCell.maBaseCell.meType)
     {
         case CELLTYPE_VALUE:
@@ -672,11 +670,14 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::Cel
     }
 
     if (rMyCell.maBaseCell.meType == CELLTYPE_FORMULA)
+    {
+        bool bIsMatrixBase = false;
         if (rExport.IsMatrix(rMyCell.maCellAddress, rMyCell.aMatrixRange, bIsMatrixBase))
         {
             rMyCell.bIsMatrixBase = bIsMatrixBase;
             rMyCell.bIsMatrixCovered = !bIsMatrixBase;
         }
+    }
 }
 
 void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell)
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index f468fca..d731f23 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -937,7 +937,6 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, const table::CellRangeAd
     sal_Int32 nPrevColumn(0);
     bool bPrevIsVisible (true);
     bool bWasHeader (false);
-    bool bIsHeader (false);
     bool bIsClosed (true);
     sal_Int32 nPrevIndex (-1);
     sal_Int32 nColumn;
@@ -947,7 +946,7 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, const table::CellRangeAd
         bool bIsVisible(true);
         nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumn, bIsVisible);
 
-        bIsHeader = bHasColumnHeader && (aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= aColumnHeaderRange.EndColumn);
+        const bool bIsHeader = bHasColumnHeader && (aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= aColumnHeaderRange.EndColumn);
         if (bIsHeader != bWasHeader)
         {
             if (bIsHeader)
@@ -4975,10 +4974,10 @@ XMLNumberFormatAttributesExportHelper* ScXMLExport::GetNumberFormatAttributesExp
 
 void ScXMLExport::CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib)
 {
-    const SfxPoolItem* pItem;
     sal_uInt32 nItems(pPool->GetItemCount2( nAttrib ));
     for( sal_uInt32 i = 0; i < nItems; ++i )
     {
+        const SfxPoolItem* pItem;
         if( 0 != (pItem = pPool->GetItem2( nAttrib, i ) ) )
         {
             const SvXMLAttrContainerItem *pUnknown(static_cast<const SvXMLAttrContainerItem *>(pItem));
diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx
index 8e514e6..a618ff3 100644
--- a/sc/source/filter/xml/xmlfonte.cxx
+++ b/sc/source/filter/xml/xmlfonte.cxx
@@ -45,9 +45,9 @@ public:
 
 void ScXMLFontAutoStylePool_Impl::AddFontItems(sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const bool bExportDefaults)
 {
-    const SfxPoolItem* pItem;
     for( sal_uInt16 i=0; i < nIdCount; ++i )
     {
+        const SfxPoolItem* pItem;
         sal_uInt16 nWhichId(pWhichIds[i]);
         if (bExportDefaults && (0 != (pItem = &pItemPool->GetDefaultItem(nWhichId))))
         {
@@ -107,9 +107,9 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP,
                 {
                     sal_uInt16 nPageWhichId(aPageWhichIds[j]);
                     sal_uInt32 nPageHFItems(rPagePool.GetItemCount2(nPageWhichId));
-                    const ScPageHFItem* pPageItem;
                     for (sal_uInt32 k = 0; k < nPageHFItems; ++k)
                     {
+                        const ScPageHFItem* pPageItem;
                         if (0 != (pPageItem = static_cast<const ScPageHFItem*>(rPagePool.GetItem2(nPageWhichId, k))))
                         {
                             const EditTextObject* pLeftArea(pPageItem->GetLeftArea());
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index f2776ed..d98b3e2 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -1074,10 +1074,10 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
         ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
         bool bDoThis = (pLbField->GetSelectEntryPos() != 0);
         rEntry.bDoQuery = bDoThis;
-        bool bByEmptyOrNotByEmpty = false;
 
         if ( rEntry.bDoQuery || maRefreshExceptQuery[nQE] )
         {
+            bool bByEmptyOrNotByEmpty = false;
             if ( aStrEmpty.equals(aStrVal) )
             {
                 bByEmptyOrNotByEmpty = true;
diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx
index 4ae721f..e1f6f26 100644
--- a/sc/source/ui/dbgui/foptmgr.cxx
+++ b/sc/source/ui/dbgui/foptmgr.cxx
@@ -235,14 +235,13 @@ IMPL_LINK( ScFilterOptionsMgr, EdAreaModifyHdl, Edit*, pEd )
 
         if ( SCA_VALID == (nResult & SCA_VALID) )
         {
-            OUString* pStr    = NULL;
             bool    bFound  = false;
             sal_uInt16  i       = 0;
             sal_uInt16  nCount  = pLbCopyArea->GetEntryCount();
 
             for ( i=2; i<nCount && !bFound; i++ )
             {
-                pStr = (OUString*)pLbCopyArea->GetEntryData( i );
+                OUString* pStr = (OUString*)pLbCopyArea->GetEntryData( i );
                 bFound = (theCurPosStr == *pStr);
             }
 
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index d39e7c4..c889b72 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -431,14 +431,13 @@ IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, formula::RefEdit*, pEd )
 
             if ( SCA_VALID == (nResult & SCA_VALID) )
             {
-                OUString* pStr    = NULL;
                 bool    bFound  = false;
                 sal_uInt16  i       = 0;
                 sal_uInt16  nCount  = pLbFilterArea->GetEntryCount();
 
                 for ( i=1; i<nCount && !bFound; i++ )
                 {
-                    pStr = (OUString*)pLbFilterArea->GetEntryData( i );
+                    OUString* pStr = (OUString*)pLbFilterArea->GetEntryData( i );
                     bFound = (theCurAreaStr == *pStr);
                 }
 
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index b6e3a52..55557b2 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -884,14 +884,13 @@ void ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd )
 
         if ( SCA_VALID == (nResult & SCA_VALID) )
         {
-            OUString* pStr    = NULL;
             bool    bFound  = false;
             sal_uInt16  i       = 0;
             sal_uInt16  nCount  = m_pLbOutPos->GetEntryCount();
 
             for ( i=2; i<nCount && !bFound; i++ )
             {
-                pStr = (OUString*)m_pLbOutPos->GetEntryData( i );
+                OUString* pStr = (OUString*)m_pLbOutPos->GetEntryData( i );
                 bFound = (theCurPosStr == *pStr);
             }
 
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 6febc35..12aac8f 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -71,11 +71,9 @@ ScTpSubTotalGroup::~ScTpSubTotalGroup()
 
     if ( nCount > 0 )
     {
-        sal_uInt16* pData = NULL;
-
         for ( sal_uLong i=0; i<nCount; i++ )
         {
-            pData = (sal_uInt16*)(mpLbColumns->GetEntryData( i ));
+            sal_uInt16* pData = (sal_uInt16*)(mpLbColumns->GetEntryData( i ));
             OSL_ENSURE( pData, "EntryData not found" );
 
             delete pData;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ae2d64c..22b804d1 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1813,11 +1813,10 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
             ScDocAttrIterator aTestIter( &rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
             ScRange aExtendRange( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
             const ScPatternAttr* pPattern = NULL;
-            const ScMergeAttr* pMergeFlag = NULL;
             const ScMergeFlagAttr* pMergeFlagAttr = NULL;
             while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
             {
-                pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem(ATTR_MERGE) );
+                const ScMergeAttr* pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem(ATTR_MERGE) );
                 pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) );
                 sal_Int16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
                 if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
@@ -1939,14 +1938,12 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
 
     if ( bSuccess )
     {
-        SCTAB* pTabs      = NULL;
-        SCTAB* pScenarios = NULL;
         SCTAB  nUndoPos  = 0;
 
         if ( bRecord )
         {
-            pTabs       = new SCTAB[nSelCount];
-            pScenarios  = new SCTAB[nSelCount];
+            SCTAB* pTabs       = new SCTAB[nSelCount];
+            SCTAB* pScenarios  = new SCTAB[nSelCount];
             nUndoPos    = 0;
             itr = aMark.begin();
             for (; itr != itrEnd && *itr < nTabCount; ++itr)
@@ -2225,11 +2222,10 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
             ScDocAttrIterator aTestIter( &rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
             ScRange aExtendRange( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
             const ScPatternAttr* pPattern = NULL;
-            const ScMergeAttr* pMergeFlag = NULL;
             const ScMergeFlagAttr* pMergeFlagAttr = NULL;
             while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
             {
-                pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) );
+                const ScMergeAttr* pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) );
                 pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem( ATTR_MERGE_FLAG ) );
                 sal_Int16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
                 if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
@@ -5051,7 +5047,6 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
     ScDocument& rDoc = rDocShell.GetDocument();
     const bool bRecord = rDoc.IsUndoEnabled();
     SCTAB nTab = rStartPos.Tab();
-    ScDocument* pUndoDoc = NULL;
 
     //local names have higher priority than global names
     ScRangeName* pLocalList = rDoc.GetRangeName(nTab);
@@ -5082,6 +5077,8 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
         ScEditableTester aTester( &rDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
         if (aTester.IsEditable())
         {
+            ScDocument* pUndoDoc = NULL;
+
             if (bRecord)
             {
                 pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 948e170..d808c22 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1467,8 +1467,6 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi )
 {
     ScDocShellModificator aModificator( *this );
 
-    bool bWarn = false;
-
     SCTAB nTabCount = aDocument.GetTableCount();
     SCTAB nUseTab = MAXTAB+1;
     for (SCTAB nTab=0; nTab<nTabCount && nUseTab>MAXTAB; nTab++)
@@ -1479,6 +1477,8 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi )
 
     if (ValidTab(nUseTab))      // nicht verwendet -> nichts zu tun
     {
+        bool bWarn = false;
+
         ScPrintFunc aPrintFunc( this, GetPrinter(), nUseTab );  //! ohne CountPages auskommen
         if (!aPrintFunc.UpdatePages())                          //  setzt Umbrueche auf allen Tabs
             bWarn = true;
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index ef8e78b..e8e5f46 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -300,8 +300,6 @@ sal_uLong ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncodi
 #else
 
     sal_uLong nErr = eERR_OK;
-    long i;
-    long nColCount = 0;
 
     // Try to get the Text Encoding from the driver
     if( eCharSet == RTL_TEXTENCODING_IBM_850 )
@@ -309,6 +307,8 @@ sal_uLong ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncodi
 
     try
     {
+        long i;
+        long nColCount = 0;
         OUString aTabName;
         uno::Reference<sdbc::XDriverManager2> xDrvMan;
         uno::Reference<sdbc::XConnection> xConnection;
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 4e88e59..0956311 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -582,10 +582,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV
 
             if ( rScDoc.InsertTab( nNewTab, aTabName ) )
             {
-                bool bAppend = true;
-
                 if (bUndo)
                 {
+                    bool bAppend = true;
                     pScDocSh->GetUndoManager()->AddUndoAction(
                         new ScUndoInsertTab( pScDocSh, nNewTab,
                                              bAppend, aTabName ) );
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 4d7fe59..5fb7688 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -380,7 +380,6 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     bool bOle = pViewShell && pViewShell->GetViewFrame()->GetFrame().IsInPlace();
 
     SdrObject* pObj = NULL;
-    SdrPageView* pPV = NULL;
     if (aDragTimer.IsActive() )
     {
         aDragTimer.Stop();
@@ -435,6 +434,7 @@ 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 = NULL;
                 if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_BEFOREMARK))
                 {
                     pView->UnmarkAllObj();
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 30831f5..d1e792e 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -1245,12 +1245,11 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvTreeListEntr
 {
     ScChangeTrack* pChanges=pDoc->GetChangeTrack();
     bool bTheTestFlag = true;
-    SvTreeListEntry* pEntry=NULL;
     ScChangeActionMap::iterator itChangeAction;
 
     for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); ++itChangeAction )
     {
-        pEntry=InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, true );
+        SvTreeListEntry* pEntry=InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, true );
 
         if(pEntry!=NULL)
         {
@@ -1343,7 +1342,6 @@ bool ScAcceptChgDlg::Expand(
 IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
 {
     ScChangeTrack* pChanges=pDoc->GetChangeTrack();
-    ScChangeAction* pScChangeAction=NULL;
     SetPointer(Pointer(POINTER_WAIT));
     if(pTable!=NULL && pChanges!=NULL)
     {
@@ -1351,6 +1349,8 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
         SvTreeListEntry* pEntry=pTheView->GetHdlEntry();
         if(pEntry!=NULL)
         {
+            ScChangeAction* pScChangeAction=NULL;
+
             ScRedlinData *pEntryData=(ScRedlinData *)(pEntry->GetUserData());
             if(pEntryData!=NULL)
                 pScChangeAction=(ScChangeAction*) pEntryData->pData;
@@ -1411,7 +1411,6 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartActio
     if(pChanges!=NULL)
     {
         SvTreeListEntry* pParent=NULL;
-        const ScChangeAction* pScChangeAction=NULL;
         bAcceptEnableFlag=true;
         bRejectEnableFlag=true;
         SetPointer(Pointer(POINTER_WAIT));
@@ -1426,7 +1425,7 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartActio
 
         for(sal_uLong i=nStartAction;i<=nEndAction;i++)
         {
-            pScChangeAction=pChanges->GetAction(i);
+            const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
             if(pScChangeAction==NULL) continue;
 
             switch(pScChangeAction->GetState())
@@ -1503,13 +1502,12 @@ void ScAcceptChgDlg::RemoveEntrys(sal_uLong nStartAction,sal_uLong nEndAction)
     if(nAction>=nStartAction && nAction<=nEndAction)
         pTheView->SetCurEntry(pTheView->GetModel()->GetEntry(0));
 
-    bool bRemove = false;
 
     // MUST do it backwards, don't delete parents before children and GPF
     pEntry=pTheView->Last();
     while(pEntry!=NULL)
     {
-        bRemove=false;
+        bool bRemove = false;
         pEntryData=(ScRedlinData *)(pEntry->GetUserData());
         if(pEntryData!=NULL)
         {
@@ -1535,14 +1533,13 @@ void ScAcceptChgDlg::UpdateEntrys(ScChangeTrack* pChgTrack, sal_uLong nStartActi
 
     sal_uLong nPos=TREELIST_APPEND;
 
-    bool bRemove = false;
 
     SvTreeListEntry* pEntry=pTheView->First();
     SvTreeListEntry* pNextEntry = (pEntry ? pTheView->NextSibling(pEntry) : NULL);
     SvTreeListEntry* pLastEntry=NULL;
     while(pEntry!=NULL)
     {
-        bRemove=false;
+        bool bRemove = false;
         ScRedlinData *pEntryData=(ScRedlinData *)(pEntry->GetUserData());
         if(pEntryData!=NULL)
         {
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 57fc148..dcc38d3 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -340,7 +340,6 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
     SCCOL   nEndCol         = rEndPos.Col();
     SCROW   nEndRow         = rEndPos.Row();
     sal_uInt16  nCellDir        = SCRET_COLS;
-    bool    bValueIgnored   = false;
 
     if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) )
     {
@@ -353,6 +352,7 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
 
     if ( nCellDir != RET_CANCEL )
     {
+        bool bValueIgnored = false;
         OUString  aStrList;
         OUString  aStrField;
 
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 3bfa3e6..e28f022 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -586,12 +586,11 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyHdl, formula::RefEdit*, pEd )
     if ( (nEntryCount > nFirstCustomPos) && !aStrEd.isEmpty() )
     {
         bool    bFound  = false;
-        OUString* pSymbol = NULL;
         sal_uInt16 i;
 
         for ( i=nFirstCustomPos; i<nEntryCount && !bFound; i++ )
         {
-            pSymbol = (OUString*)pLb->GetEntryData( i );
+            OUString* pSymbol = (OUString*)pLb->GetEntryData( i );
             bFound  = ( (*pSymbol)  ==aStrEd || (*pSymbol) == aEdUpper );
         }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index d5c1e83..e005375 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7350,10 +7350,10 @@ void SAL_CALL ScTableSheetObj::setPrintAreas(
                                                 throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    ScPrintRangeSaver* pOldRanges = NULL;
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
     {
+        ScPrintRangeSaver* pOldRanges = NULL;
         ScDocument& rDoc = pDocSh->GetDocument();
         SCTAB nTab = GetTab_Impl();
 


More information about the Libreoffice-commits mailing list