[Libreoffice-commits] .: oox/source

David Tardon dtardon at kemper.freedesktop.org
Mon Jan 17 00:27:11 PST 2011


 oox/source/core/contexthandler2.cxx       |    2 +-
 oox/source/docprop/ooxmldocpropimport.cxx |    2 +-
 oox/source/export/chartexport.cxx         |    4 ++--
 oox/source/export/drawingml.cxx           |   12 +++++-------
 oox/source/ppt/commontimenodecontext.cxx  |    8 +++-----
 oox/source/xls/worksheethelper.cxx        |    1 -
 6 files changed, 12 insertions(+), 17 deletions(-)

New commits:
commit 0f74716c839a2985b9a40396794ef8a67f8d4ed1
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon Jan 17 09:08:53 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/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;
 
 // ----------------------------------------------------------------------------
 


More information about the Libreoffice-commits mailing list