[Libreoffice-commits] .: svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 14:56:04 PST 2012


 svx/source/dialog/hdft.cxx     |    2 +-
 svx/source/dialog/imapwnd.cxx  |    4 ++--
 svx/source/items/numfmtsh.cxx  |   16 +++++-----------
 svx/source/svdraw/svddrgmt.cxx |    7 +++----
 svx/source/svdraw/svdfmtf.cxx  |    4 ++--
 svx/source/svdraw/svdmrkv.cxx  |    2 +-
 6 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit d507c57a86cde92428aaa029053b27154373a4f3
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Dec 19 23:54:10 2012 +0100

    Some cppcheck cleaning
    
    Change-Id: I750058d7e25de26bf82e76ff09c69257ae09c5ba

diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 092955f..2883381 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -298,12 +298,12 @@ sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
         aSet.Put( *pBBSet );
     else
     {
-        const SfxItemSet* _pSet;
         const SfxPoolItem* pItem;
 
         if ( SFX_ITEM_SET ==
              GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
         {
+            const SfxItemSet* _pSet;
             _pSet = &( (SvxSetItem*)pItem )->GetItemSet();
 
             if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index dfbe83e..af7a206 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -547,12 +547,12 @@ sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
 
 void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
 {
-    SdrObject*          pSdrObj = NULL;
-    SdrPageView*        pPageView = NULL;
     Point               aPos = PixelToLogic( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
 
     if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
     {
+        SdrObject*          pSdrObj = NULL;
+        SdrPageView*        pPageView = NULL;
         if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
         {
             const IMapObject*   pIMapObj = GetIMapObj( pSdrObj );
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index d1c7b61..c167934 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1313,15 +1313,13 @@ void SvxNumberFormatShell::SetComment4Entry(short nEntry,String aEntStr)
 
 String SvxNumberFormatShell::GetComment4Entry(short nEntry)
 {
-    const SvNumberformat *pNumEntry;
-
     if(nEntry < 0)
         return String();
 
     if( static_cast<size_t>(nEntry) < aCurEntryList.size())
     {
         sal_uInt32  nMyNfEntry=aCurEntryList[nEntry];
-        pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+        const SvNumberformat *pNumEntry = pFormatter->GetEntry(nMyNfEntry);
         if(pNumEntry!=NULL)
             return pNumEntry->GetComment();
     }
@@ -1346,7 +1344,6 @@ String SvxNumberFormatShell::GetComment4Entry(short nEntry)
 
 short SvxNumberFormatShell::GetCategory4Entry(short nEntry)
 {
-    const SvNumberformat *pNumEntry;
     if(nEntry<0) return 0;
 
     if( static_cast<size_t>(nEntry) < aCurEntryList.size() )
@@ -1355,7 +1352,7 @@ short SvxNumberFormatShell::GetCategory4Entry(short nEntry)
 
         if(nMyNfEntry!=NUMBERFORMAT_ENTRY_NOT_FOUND)
         {
-            pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+            const SvNumberformat *pNumEntry = pFormatter->GetEntry(nMyNfEntry);
             sal_uInt16 nMyCat,nMyType;
             if(pNumEntry!=NULL)
             {
@@ -1392,13 +1389,12 @@ short SvxNumberFormatShell::GetCategory4Entry(short nEntry)
 
 bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
 {
-    const SvNumberformat *pNumEntry;
-    if(nEntry<0) return 0;
+    if(nEntry<0) return false;
 
     if( static_cast<size_t>(nEntry) < aCurEntryList.size())
     {
         sal_uInt32  nMyNfEntry=aCurEntryList[nEntry];
-        pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+        const SvNumberformat *pNumEntry = pFormatter->GetEntry(nMyNfEntry);
 
         if(pNumEntry!=NULL)
         {
@@ -1429,8 +1425,6 @@ bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
 
 String SvxNumberFormatShell::GetFormat4Entry(short nEntry)
 {
-    const SvNumberformat *pNumEntry;
-
     if(nEntry < 0)
         return String();
 
@@ -1442,7 +1436,7 @@ String SvxNumberFormatShell::GetFormat4Entry(short nEntry)
     else
     {
         sal_uInt32  nMyNfEntry=aCurEntryList[nEntry];
-        pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+        const SvNumberformat *pNumEntry = pFormatter->GetEntry(nMyNfEntry);
 
         if(pNumEntry!=NULL)
             return pNumEntry->GetFormatstring();
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 29603fd..b618ac1 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1248,14 +1248,14 @@ void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
 bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
 {
     Hide();
-    SdrUndoAction* pUndo = NULL;
-    SdrUndoAction* pUndo2 = NULL;
     std::vector< SdrUndoAction* > vConnectorUndoActions;
     bool bRet = false;
     SdrObject* pObj = GetDragObj();
 
     if(pObj)
     {
+        SdrUndoAction* pUndo = NULL;
+        SdrUndoAction* pUndo2 = NULL;
         const bool bUndo = getSdrDragView().IsUndoEnabled();
 
         if( bUndo )
@@ -2313,8 +2313,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
             nWink=nNeuWink;
             aFact=aNeuFact;
             double a=nWink*nPi180;
-            double nTan1=0.0;
-            nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
+            double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
             Hide();
             nTan=nTan1;
             DragStat().NextMove(rPnt);
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 1fd41d2..6e7b7f4 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -928,13 +928,13 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
 
 void ImpSdrGDIMetaFileImport::MapScaling()
 {
-    size_t i, nAnz = aTmpList.size();
+    size_t nAnz = aTmpList.size();
     const MapMode& rMap = aVD.GetMapMode();
     Point aMapOrg( rMap.GetOrigin() );
     sal_Bool bMov2 = aMapOrg.X() != 0 || aMapOrg.Y() != 0;
     if ( bMov2 )
     {
-        for ( i = nMapScalingOfs; i < nAnz; i++ )
+        for (size_t i = nMapScalingOfs; i < nAnz; i++ )
         {
             SdrObject* pObj = aTmpList[i];
             if ( bMov2 )
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index dcf57db..afeb453 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1427,7 +1427,6 @@ sal_Bool SdrMarkView::MarkObj(const Rectangle& rRect, sal_Bool bUnmark)
 {
     sal_Bool bFnd=sal_False;
     Rectangle aR(rRect);
-    SdrObject* pObj;
     SdrObjList* pObjList;
     BrkAction();
     SdrPageView* pPV = GetSdrPageView();
@@ -1437,6 +1436,7 @@ sal_Bool SdrMarkView::MarkObj(const Rectangle& rRect, sal_Bool bUnmark)
         pObjList=pPV->GetObjList();
         Rectangle aFrm1(aR);
         sal_uIntPtr nObjAnz=pObjList->GetObjCount();
+        SdrObject* pObj;
         for (sal_uIntPtr nO=0; nO<nObjAnz; nO++) {
             pObj=pObjList->GetObj(nO);
             Rectangle aRect(pObj->GetCurrentBoundRect());


More information about the Libreoffice-commits mailing list