Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


Hello,

Here are 2 new patches for cppcheck cleaning in svx
Compiling was ok

Remarks :
I had this with the last "git version" of cppcheck :
1)
[./svdotxln.cxx:67]: (style) The class 'ImpSdrObjTextLink' does not have a constructor.
but we can read this on the file :
class ImpSdrObjTextLink: public ::sfx2::SvBaseLink
{
    SdrTextObj*                                 pSdrObj;

public:
    ImpSdrObjTextLink( SdrTextObj* pObj1 )
        : ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE ),
            pSdrObj( pObj1 )
    {}
...

It seems there is a constructor, doesn't it ? So either if it's a false positive and i do a tracker or it's ok and i would need some explanation (please ! :-) ).




2)
in view3d.cxx, I've got this :
[./view3d.cxx:299]: (style) Variable 'pM' is assigned a value that is never used but either pM should be used (and i don't know how) or pM is useless and this entire line too :
pM = GetSdrMarkByIndex(nObjs);

3)
Checking ./gridctrl.cxx...
[./gridctrl.cxx:3720]: (error) Possible null pointer dereference: pListeners - otherwise it is redundant to check if pListeners is null at line 3722
but I don't know what to do with this.

There are still some cppcheck in svx, i hope to correct all of them soon.

Julien
(LGPLv3+ / MPL)
commit 2c7fd1b55ec2c937308f4edc2ea2f996126a1c4c
Author: Julien Nabet <serval2412@yahoo.fr>
Date:   Thu Dec 30 00:18:04 2010 +0100

    cppcheck cleaning

diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 1ea7fb0..1984b65 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -82,6 +82,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel):
     nLineWidth(0),
     maLineJoin(basegfx::B2DLINEJOIN_NONE),
     maDash(XDASH_RECT, 0, 0, 0, 0, 0),
+    fScaleX(0.0),fScaleY(0.0),
     bFntDirty(TRUE),
     bLastObjWasPolyWithoutLine(FALSE),bNoLine(FALSE),bNoFill(FALSE),bLastObjWasLine(FALSE)
 {
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index e175402..ee5bcb0 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -387,6 +387,7 @@ public:
         nWdt(0),
         nStart(0),
         nEnd(0),
+        nWink(0),
         bRight(FALSE)
     {}
     void SetCreateParams(SdrDragStat& rStat);
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index a8fa0ee..61e084c 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -700,6 +700,7 @@ public:
 
     SdrOle2ObjImpl()
     : pGraphicObject( NULL )
+    , pLightClient ( NULL )
     // #107645#
     // init to start situation, loading did not fail
     , mbLoadingOLEObjectFailed( sal_False )
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 63e5219..06296ac 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -686,10 +686,7 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
 
             sal_Bool   bParallel = sal_True;
             Position3D aViewPoint( 3472, -3472, 25000 );
-            double             fOriginX = 0.50;
-            double             fOriginY = -0.50;
             double             fSkewAngle = -135;
-            double             fSkew = 50.0;
 
             pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
             sal_Int16 nProjectionMode = sal_Int16();
@@ -698,6 +695,7 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
 
             if( bParallel )
             {
+                double         fSkew = 50.0;
                 EnhancedCustomShapeParameterPair aSkewPropPair;
                 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew );
                 if( pAny && ( *pAny >>= aSkewPropPair ) )
@@ -712,6 +710,8 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
             }
             else
             {
+                double         fOriginX = 0.50;
+                double         fOriginY = -0.50;
                 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint );
                 if( pAny )
                     *pAny >>= aViewPoint;
commit 84dfdf5cb54f769cf616b213ba9fbca824b844dd
Author: Julien Nabet <serval2412@yahoo.fr>
Date:   Thu Dec 30 00:50:00 2010 +0100

    cppcheck cleaning in svx part 2

diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index d5d5d5c..5c23584 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -77,6 +77,8 @@ private:
 DialControlBmp::DialControlBmp( Window& rParent ) :
     VirtualDevice( rParent, 0, 0 ),
     mrParent( rParent ),
+    mnCenterX(0),
+    mnCenterY(0),
     mbEnabled( true )
 {
     EnableRTL( FALSE );
@@ -266,6 +268,8 @@ DialControl_Impl::DialControl_Impl( Window& rParent ) :
     maBmpBuffered( rParent ),
     mpLinkField( 0 ),
     mnAngle( 0 ),
+    mnCenterX( 0 ),
+    mnCenterY( 0 ),
     mbNoRot( false )
 {
 }
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index be81e08..089bb4d 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -385,13 +385,13 @@ void SvxHFPage::Reset( const SfxItemSet& rSet )
     aCntSharedBox.SaveValue();
     RangeHdl( 0 );
 
-    USHORT nHtmlMode = 0;
     const SfxPoolItem* pItem = 0;
     SfxObjectShell* pShell;
     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
         ( 0 != (pShell = SfxObjectShell::Current()) &&
                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
     {
+        USHORT nHtmlMode = 0;
         nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
         if(nHtmlMode && HTMLMODE_ON)
         {
diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx
index 8fc0b57..9a6e33f 100644
--- a/svx/source/dialog/hyprlink.cxx
+++ b/svx/source/dialog/hyprlink.cxx
@@ -809,6 +809,7 @@ void SvxHyperlinkDlg::SetImages()
 HyperCombo::HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId ) :
         ComboBox( (Window *)pDialog, rResId )
 {
+    nRatio = 0;
     pDlg = pDialog;
 
     nMaxWidth = GetSizePixel().Width();
diff --git a/svx/source/dialog/imapimp.hxx b/svx/source/dialog/imapimp.hxx
index 4887298..51ebf40 100644
--- a/svx/source/dialog/imapimp.hxx
+++ b/svx/source/dialog/imapimp.hxx
@@ -50,7 +50,7 @@ public:
     void*                      pUpdateEditingObject;
     BOOL                       bExecState;
 
-                    IMapOwnData( SvxIMapDlg* pIMapDlg ) : pIMap        ( pIMapDlg ) {}
+                    IMapOwnData( SvxIMapDlg* pIMapDlg ) : pIMap        ( pIMapDlg ), 
pUpdateEditingObject( NULL )  {}
 };
 
 
diff --git a/svx/source/dialog/simptabl.cxx b/svx/source/dialog/simptabl.cxx
index d1b37a9..30d2c42 100644
--- a/svx/source/dialog/simptabl.cxx
+++ b/svx/source/dialog/simptabl.cxx
@@ -226,7 +226,6 @@ void SvxSimpleTable::Paint( const Rectangle& rRect )
     SvHeaderTabListBox::Paint(rRect );
 
     USHORT nPrivTabCount = TabCount();
-    USHORT nPos = 0;
     USHORT nNewSize = ( nPrivTabCount > 0 ) ? (USHORT)GetTab(0) : 0;
 
     long nOffset=-GetXOffset();
@@ -240,6 +239,7 @@ void SvxSimpleTable::Paint( const Rectangle& rRect )
         if(nPrivTabCount>aHeaderBar.GetItemCount())
                 nPrivTabCount=aHeaderBar.GetItemCount();
 
+        USHORT nPos = 0;
         for(USHORT i=1;i<nPrivTabCount;i++)
         {
             nNewSize = static_cast< USHORT >( GetTab(i) ) - nPos;
@@ -442,15 +442,14 @@ void SvxSimpleTable::HBarEndDrag()
 {
     HideTracking();
     USHORT nPrivTabCount=TabCount();
-    USHORT nPos=0;
-    USHORT nNewSize=0;
 
     if(nPrivTabCount)
     {
         if(nPrivTabCount>aHeaderBar.GetItemCount())
                 nPrivTabCount=aHeaderBar.GetItemCount();
 
-        //for(USHORT i=1;i<=nPrivTabCount;i++)
+        USHORT nPos=0;
+        USHORT nNewSize=0;
         for(USHORT i=1;i<nPrivTabCount;i++)
         {
             nNewSize = static_cast< USHORT >( aHeaderBar.GetItemSize(i) ) + nPos;
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 6440fc5..bc3534b 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -2186,16 +2186,14 @@ ADD_DEBUG_TEXT("lLastLMargin: ", 
String::CreateFromInt32(pRuler_Imp->lLastLMargi
                 //This includes the left border when the table is not limited
                 //to a lower frame border.
                 int nLimit;
-                long lLeft;
                 if(GetDragType()==RULER_TYPE_BORDER)
                 {
                     nLimit=nIdx+1;
-                    lLeft=(pBorders[nIdx].nPos+=lDiff);
+                    pBorders[nIdx].nPos+=lDiff;
                 }
                 else
                 {
                     nLimit=0;
-                    lLeft=pRuler_Imp->lLastLMargin+lDiff;
                 }
                 //in vertical tables the left borders have to be moved
                 if(bHorz)

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.