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


Hello,

Here is a patch for some cppcheck cleaning on oox

In the file :
oox/source/drawingml/chart/objectformatter.cxx
in the line 930, there is this function
void EffectFormatter::convertFormatting( PropertySet& /*rPropSet*/, const ModelRef< Shape >& /*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ ) const
{
}
the declaration of this function is line 662 :
    /** Converts effect formatting to the passed property set. */
    void                convertFormatting(
                            PropertySet& rPropSet,
                            const ModelRef< Shape >& rxShapeProp,
                            sal_Int32 nSeriesIdx ) const;

Does this function do something or should it be implemented (or just simply remove it) ?

(LGPLv3+ / MPL)

Julien
commit 34dfec51637b484016c26e31a79dbf332d9c13db
Author: serval <serval2412@yahoo.fr>
Date:   Sun Jan 16 21:55:16 2011 +0100

    some cppcheck cleaning

diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx
index 08c219c..0fe680f 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -51,7 +51,7 @@ struct ContextInfo
     bool                mbTrimSpaces;       /// True = trims leading/trailing spaces from text 
data.
 
     explicit            ContextInfo();
-                        ContextInfo( sal_Int32 nElement ) : mnElement( nElement ) {}
+                        ContextInfo( sal_Int32 nElement ) : mnElement( nElement ), 
mbTrimSpaces(false) {}
 };
 
 ContextInfo::ContextInfo() :
diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx
index 4049396..0094f66 100644
--- a/oox/source/docprop/ooxmldocpropimport.cxx
+++ b/oox/source/docprop/ooxmldocpropimport.cxx
@@ -87,10 +87,10 @@ uno::Sequence< xml::sax::InputSource > OOXMLDocPropImportImpl::GetRelatedStreams
 
     uno::Sequence< uno::Sequence< beans::StringPair > > aPropsInfo = 
xRelation->getRelationshipsByType( aStreamType );
 
-    sal_Int32 nLength = 0;
     uno::Sequence< xml::sax::InputSource > aResult( aPropsInfo.getLength() );
     if ( aPropsInfo.getLength() )
     {
+        sal_Int32 nLength = 0;
         for ( sal_Int32 nInd = 0; nInd < aPropsInfo.getLength(); nInd++ )
             for ( sal_Int32 nEntryInd = 0; nEntryInd < aPropsInfo[nInd].getLength(); nEntryInd++ )
                 if ( aPropsInfo[nInd][nEntryInd].First.equals( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "Target" ) ) ) )
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index bbacd36..96784c4 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -662,7 +662,7 @@ public:
     void                convertFormatting(
                             PropertySet& rPropSet,
                             const ModelRef< Shape >& rxShapeProp,
-                            sal_Int32 nSeriesIdx );
+                            sal_Int32 nSeriesIdx ) const;
 };
 
 // ----------------------------------------------------------------------------
@@ -927,7 +927,7 @@ EffectFormatter::EffectFormatter( ObjectFormatterData& rData, const AutoFormatEn
 {
 }
 
-void EffectFormatter::convertFormatting( PropertySet& /*rPropSet*/, const ModelRef< Shape >& 
/*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ )
+void EffectFormatter::convertFormatting( PropertySet& /*rPropSet*/, const ModelRef< Shape >& 
/*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ ) const
 {
 }
 
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index d5d3eab..e15a9a7 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1621,10 +1621,10 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, 
sal_
         {
             Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
                 xSource->getDataSequences());
-            sal_Int32 nMainSequenceIndex = -1;
-            sal_Int32 nSeriesLength = 0;
             // search for main sequence and create a series element
             {
+                sal_Int32 nMainSequenceIndex = -1;
+                sal_Int32 nSeriesLength = 0;
                 Reference< chart2::data::XDataSequence > xValuesSeq;
                 Reference< chart2::data::XDataSequence > xLabelSeq;
                 sal_Int32 nSeqIdx=0;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6900a1b..6878ac7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -134,7 +134,6 @@ void lcl_dump_pset(Reference< XPropertySet > rXPropSet)
         sal_Int32 intValue;
         bool boolValue;
     LineSpacing spacing;
-//         RectanglePoint pointValue;
 
         if( value >>= strValue )
             fprintf (stderr,"\"%s\"\n", USS( strValue ) );
@@ -145,11 +144,9 @@ void lcl_dump_pset(Reference< XPropertySet > rXPropSet)
     else if( value >>= spacing ) {
         fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
     }
-//         else if( value >>= pointValue )
-//             fprintf (stderr,"%d            (RectanglePoint)\n", pointValue);
         else
             fprintf (stderr,"???           <unhandled type>\n");
-    } catch(Exception e) {
+    } catch(const Exception &e) {
         fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
     }
     }
@@ -172,7 +169,7 @@ bool DrawingML::GetProperty( Reference< XPropertySet > rXPropSet, String aName )
         mAny = rXPropSet->getPropertyValue( aName );
         if ( mAny.hasValue() )
             bRetValue = true;
-    } catch( Exception& ) { /* printf ("exception when trying to get value of property: %s\n", 
ST(aName)); */ }
+    } catch( const Exception& ) { /* printf ("exception when trying to get value of property: 
%s\n", ST(aName)); */ }
 
     return bRetValue;
 }
@@ -187,7 +184,7 @@ bool DrawingML::GetPropertyAndState( Reference< XPropertySet > rXPropSet, Refere
             bRetValue = true;
             eState = rXPropState->getPropertyState( aName );
         }
-    } catch( Exception& ) { /* printf ("exception when trying to get value of property: %s\n", 
ST(aName)); */ }
+    } catch( const Exception& ) { /* printf ("exception when trying to get value of property: 
%s\n", ST(aName)); */ }
 
     return bRetValue;
 }
@@ -948,7 +945,8 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
             return;
         if( sText.getLength() < 1 )
             return;
-        } catch (Exception e) {
+        }
+        catch (const Exception &e) {
             return;
         }
     }
diff --git a/oox/source/ppt/commontimenodecontext.cxx b/oox/source/ppt/commontimenodecontext.cxx
index 3bfb4d8..d475825 100644
--- a/oox/source/ppt/commontimenodecontext.cxx
+++ b/oox/source/ppt/commontimenodecontext.cxx
@@ -520,11 +520,9 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 
nPresetId
 
         // ST_TLTimeNodePresetClassType
         nInt = xAttribs->getOptionalValueToken( XML_presetClass, 0 );
-        sal_Int16 nEffectPresetClass = 0;
-        sal_Int32 nPresetId = 0;
-        sal_Int32 nPresetSubType = 0;
         if( nInt != 0 )
         {
+            sal_Int16 nEffectPresetClass = 0;
             // TODO put that in a function
             switch( nInt )
             {
@@ -554,14 +552,14 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 
nPresetId
             aUserData[ CREATE_OUSTRING( "preset-class" ) ] = makeAny( nEffectPresetClass );
             if( attribs.hasAttribute( XML_presetID ) )
             {
-                nPresetId = attribs.getInteger( XML_presetID, 0 );
+                sal_Int32 nPresetId = attribs.getInteger( XML_presetID, 0 );
                 const preset_maping* p = gPresetMaping;
                 while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || 
(p->mnPresetId != nPresetId )) )
                     p++;
 
                 aUserData[ CREATE_OUSTRING( "preset-id" ) ]
                     = makeAny( OUString::createFromAscii( p->mpStrPresetId ) );
-                nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
+                sal_Int32 nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
                 if( nPresetSubType )
                 {
                     aUserData[ CREATE_OUSTRING( "preset-sub-type" ) ]
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index bc07762..0790b0b 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -162,7 +162,6 @@ struct ValueRangeComp
     inline bool         operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return 
rRange.mnLast < nValue; }
 };
 
-typedef ::std::vector< ValueRange > ValueRangeVector;
 
 // ----------------------------------------------------------------------------
 

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.