[Libreoffice-commits] core.git: 2 commits - connectivity/source dbaccess/source filter/qa filter/source

Caolán McNamara caolanm at redhat.com
Mon Jul 20 02:29:08 PDT 2015


 connectivity/source/commontools/RowFunctionParser.cxx       |    2 
 dbaccess/source/ext/macromigration/macromigrationwizard.cxx |    2 
 dbaccess/source/ext/macromigration/migrationengine.cxx      |    8 +-
 dbaccess/source/ext/macromigration/migrationerror.hxx       |    2 
 dbaccess/source/ext/macromigration/progressmixer.cxx        |    4 -
 dbaccess/source/ext/macromigration/progressmixer.hxx        |    2 
 dbaccess/source/ext/macromigration/rangeprogressbar.hxx     |    2 
 dbaccess/source/filter/xml/dbloader2.cxx                    |    4 -
 dbaccess/source/filter/xml/xmlAutoStyle.hxx                 |    2 
 dbaccess/source/filter/xml/xmlExport.cxx                    |    2 
 dbaccess/source/filter/xml/xmlfilter.hxx                    |    2 
 dbaccess/source/sdbtools/connection/connectiondependent.hxx |    4 -
 dbaccess/source/sdbtools/connection/connectiontools.hxx     |    2 
 dbaccess/source/ui/app/AppController.cxx                    |    4 -
 filter/qa/cppunit/data/tiff/fail/hang-6.tiff                |binary
 filter/source/graphicfilter/itiff/ccidecom.cxx              |   39 ++++++------
 16 files changed, 43 insertions(+), 38 deletions(-)

New commits:
commit c02e79874951ba86d926186e284612806d8bc0a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 20 10:06:59 2015 +0100

    ensure loop ends eventually
    
    Change-Id: I318385286fcc27ffb2d938237d83e793564d2525

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-6.tiff b/filter/qa/cppunit/data/tiff/fail/hang-6.tiff
new file mode 100644
index 0000000..4e6cc0e
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-6.tiff differ
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 2f76777..4a49f73 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -886,36 +886,41 @@ void CCIDecompressor::FillBits(sal_uInt8 * pTarget, sal_uInt16 nTargetBits,
     }
 }
 
-
 sal_uInt16 CCIDecompressor::CountBits(const sal_uInt8 * pData, sal_uInt16 nDataSizeBits,
                                   sal_uInt16 nBitPos, sal_uInt8 nBlackOrWhite)
 {
-    sal_uInt16 nPos,nLo;
-    sal_uInt8 nData;
-
     // here the number of bits belonging together is being counted
     // which all have the color nBlackOrWhite (0xff oder 0x00)
     // from the position nBitPos on
-
-    nPos=nBitPos;
-    for (;;) {
-        if (nPos>=nDataSizeBits) {
+    sal_uInt16 nPos = nBitPos;
+    for (;;)
+    {
+        if (nPos>=nDataSizeBits)
+        {
             nPos=nDataSizeBits;
             break;
         }
-        nData=pData[nPos>>3];
-        nLo=nPos & 7;
-        if ( nLo==0 && nData==nBlackOrWhite) nPos+=8;
-        else {
-            if ( ((nData^nBlackOrWhite) & (0x80 >> nLo))!=0) break;
-            nPos++;
+        sal_uInt8 nData = pData[nPos>>3];
+        sal_uInt16 nLo = nPos & 7;
+        if (nLo==0 && nData==nBlackOrWhite)
+        {
+            //fail on overflow attempt
+            if (nPos > SAL_MAX_UINT16-8)
+                return 0;
+            nPos+=8;
+        }
+        else
+        {
+            if ( ((nData^nBlackOrWhite) & (0x80 >> nLo))!=0)
+                break;
+            ++nPos;
         }
     }
-    if (nPos<=nBitPos) return 0;
-    else return nPos-nBitPos;
+    if (nPos<=nBitPos)
+        return 0;
+    return nPos-nBitPos;
 }
 
-
 void CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTargetBits)
 {
     sal_uInt16 nCode,nCodeBits,nDataBits,nTgtFreeByteBits;
commit ff3a3bfd4bbd2fdabea887e1739faacd79aefa64
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 20 10:07:53 2015 +0100

    cppcheck: noExplicitConstructor
    
    Change-Id: Ib9373a5a75eea998a86156ff742e7950369ddc88

diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index 5abaaaa..7efeb9c 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -228,7 +228,7 @@ class UnaryFunctionExpression : public ExpressionNode
     ExpressionNodeSharedPtr mpArg;
 
 public:
-    UnaryFunctionExpression( const ExpressionNodeSharedPtr& rArg ) :
+    explicit UnaryFunctionExpression( const ExpressionNodeSharedPtr& rArg ) :
         mpArg( rArg )
     {
     }
diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
index 740a337..a8c3018 100644
--- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
@@ -60,7 +60,7 @@ namespace dbmm
                 ,public MacroMigrationModuleClient
     {
     public:
-        MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext );
+        explicit MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext );
 
         // XTypeProvider
         virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index ae23ee3..bbd8287 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -430,7 +430,7 @@ namespace dbmm
     class DrawPageIterator
     {
     public:
-        DrawPageIterator( const Reference< XModel >& _rxDocument )
+        explicit DrawPageIterator( const Reference< XModel >& _rxDocument )
             :m_xDocument( _rxDocument )
             ,m_nPageCount( 0 )
             ,m_nCurrentPage( 0 )
@@ -518,7 +518,7 @@ namespace dbmm
     class FormComponentIterator
     {
     public:
-        FormComponentIterator( const Reference< XIndexAccess >& _rxContainer )
+        explicit FormComponentIterator( const Reference< XIndexAccess >& _rxContainer )
             :m_xContainer( _rxContainer )
             ,m_xEventManager( _rxContainer, UNO_QUERY_THROW )
             ,m_nElementCount( _rxContainer->getCount() )
@@ -557,7 +557,7 @@ namespace dbmm
     class ScriptsStorage
     {
     public:
-        ScriptsStorage( MigrationLog& _rLogger );
+        explicit ScriptsStorage( MigrationLog& _rLogger );
         ScriptsStorage( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger );
         ~ScriptsStorage();
 
@@ -770,7 +770,7 @@ namespace dbmm
     class PhaseGuard
     {
     public:
-        PhaseGuard( ProgressMixer& _rMixer )
+        explicit PhaseGuard( ProgressMixer& _rMixer )
             :m_rMixer( _rMixer )
         {
         }
diff --git a/dbaccess/source/ext/macromigration/migrationerror.hxx b/dbaccess/source/ext/macromigration/migrationerror.hxx
index e5067ec..2cf1454 100644
--- a/dbaccess/source/ext/macromigration/migrationerror.hxx
+++ b/dbaccess/source/ext/macromigration/migrationerror.hxx
@@ -65,7 +65,7 @@ namespace dbmm
         ::std::vector< OUString >    aErrorDetails;
         const ::com::sun::star::uno::Any    aCaughtException;
 
-        MigrationError(
+        explicit MigrationError(
                 const MigrationErrorType _eType )
             :eType( _eType )
         {
diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx
index d75da51..40030fe 100644
--- a/dbaccess/source/ext/macromigration/progressmixer.cxx
+++ b/dbaccess/source/ext/macromigration/progressmixer.cxx
@@ -49,7 +49,7 @@ namespace dbmm
         {
         }
 
-        PhaseData( const PhaseWeight _nWeight )
+        explicit PhaseData( const PhaseWeight _nWeight )
             :nWeight( _nWeight )
             ,nRange(100)
             ,nGlobalStart(0)
@@ -69,7 +69,7 @@ namespace dbmm
         double              nOverallStretch;
         IProgressConsumer&  rConsumer;
 
-        ProgressMixer_Data( IProgressConsumer& _rConsumer )
+        explicit ProgressMixer_Data( IProgressConsumer& _rConsumer )
             :aPhases()
             ,pCurrentPhase( aPhases.end() )
             ,nWeightSum( 0 )
diff --git a/dbaccess/source/ext/macromigration/progressmixer.hxx b/dbaccess/source/ext/macromigration/progressmixer.hxx
index d20b633..2b2b97c 100644
--- a/dbaccess/source/ext/macromigration/progressmixer.hxx
+++ b/dbaccess/source/ext/macromigration/progressmixer.hxx
@@ -50,7 +50,7 @@ namespace dbmm
     class ProgressMixer
     {
     public:
-        ProgressMixer( IProgressConsumer& _rConsumer );
+        explicit ProgressMixer( IProgressConsumer& _rConsumer );
         ~ProgressMixer();
 
         /** registers a phase of the process, which has the given weight
diff --git a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
index 7b5a1a0..d0039eb 100644
--- a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
+++ b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
@@ -31,7 +31,7 @@ namespace dbmm
     class RangeProgressBar
     {
     public:
-        RangeProgressBar(ProgressBar *pBar = NULL)
+        explicit RangeProgressBar(ProgressBar *pBar = NULL)
             : m_pBar(pBar)
             , m_nRange(0)
         {
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 45aa339..426bf709 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -97,7 +97,7 @@ class DBTypeDetection : public ::cppu::WeakImplHelper< XExtendedFilterDetection,
     const Reference< XComponentContext >  m_aContext;
 
 public:
-    DBTypeDetection(const Reference< XComponentContext >&);
+    explicit DBTypeDetection(const Reference< XComponentContext >&);
 
     // XServiceInfo
     OUString                        SAL_CALL getImplementationName() throw(std::exception  ) SAL_OVERRIDE;
@@ -233,7 +233,7 @@ private:
 
     DECL_LINK( OnStartTableWizard, void* );
 public:
-    DBContentLoader(const Reference< XComponentContext >&);
+    explicit DBContentLoader(const Reference< XComponentContext >&);
     virtual ~DBContentLoader();
 
     // XServiceInfo
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.hxx b/dbaccess/source/filter/xml/xmlAutoStyle.hxx
index b891377..e4c2fd3 100644
--- a/dbaccess/source/filter/xml/xmlAutoStyle.hxx
+++ b/dbaccess/source/filter/xml/xmlAutoStyle.hxx
@@ -40,7 +40,7 @@ namespace dbaxml
                 ) const SAL_OVERRIDE;
 
     public:
-        OXMLAutoStylePoolP(ODBExport& rXMLExport);
+        explicit OXMLAutoStylePoolP(ODBExport& rXMLExport);
         virtual ~OXMLAutoStylePoolP();
     };
 } // dbaxml
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 652ef86..811a700 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -167,7 +167,7 @@ namespace dbaxml
     class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper
     {
     public:
-        OSpecialHandleXMLExportPropertyMapper(const rtl::Reference< XMLPropertySetMapper >& rMapper) : SvXMLExportPropertyMapper(rMapper )
+        explicit OSpecialHandleXMLExportPropertyMapper(const rtl::Reference< XMLPropertySetMapper >& rMapper) : SvXMLExportPropertyMapper(rMapper )
         {
         }
         /** this method is called for every item that has the
diff --git a/dbaccess/source/filter/xml/xmlfilter.hxx b/dbaccess/source/filter/xml/xmlfilter.hxx
index 7a8bfac..e383a00 100644
--- a/dbaccess/source/filter/xml/xmlfilter.hxx
+++ b/dbaccess/source/filter/xml/xmlfilter.hxx
@@ -106,7 +106,7 @@ protected:
     virtual ~ODBFilter()  throw();
 public:
 
-    ODBFilter( const Reference< XComponentContext >& _rxContext );
+    explicit ODBFilter( const Reference< XComponentContext >& _rxContext );
 
     // XFilter
     virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/dbaccess/source/sdbtools/connection/connectiondependent.hxx b/dbaccess/source/sdbtools/connection/connectiondependent.hxx
index e9f0639..a696db4 100644
--- a/dbaccess/source/sdbtools/connection/connectiondependent.hxx
+++ b/dbaccess/source/sdbtools/connection/connectiondependent.hxx
@@ -59,7 +59,7 @@ namespace sdbtools
         class EntryGuard;
 
     protected:
-        ConnectionDependentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rContext )
+        explicit ConnectionDependentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rContext )
             :m_aContext( _rContext )
         {
         }
@@ -117,7 +117,7 @@ namespace sdbtools
         ConnectionDependentComponent&   m_rComponent;
 
     public:
-        EntryGuard( ConnectionDependentComponent& _rComponent )
+        explicit EntryGuard( ConnectionDependentComponent& _rComponent )
             :m_aMutexGuard( _rComponent.getMutex( ConnectionDependentComponent::GuardAccess() ) )
             ,m_rComponent( _rComponent )
         {
diff --git a/dbaccess/source/sdbtools/connection/connectiontools.hxx b/dbaccess/source/sdbtools/connection/connectiontools.hxx
index 658d2fb..6326347 100644
--- a/dbaccess/source/sdbtools/connection/connectiontools.hxx
+++ b/dbaccess/source/sdbtools/connection/connectiontools.hxx
@@ -53,7 +53,7 @@ namespace sdbtools
             @param _rxContext
                 the context of the component
         */
-        ConnectionTools( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rContext );
+        explicit ConnectionTools( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rContext );
 
         // XConnectionTools
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableName > SAL_CALL createTableName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 99234fa..38abcab 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -188,7 +188,7 @@ Reference< XInterface > SAL_CALL OApplicationController::Create(const Reference<
 struct XContainerFunctor : public ::std::unary_function< OApplicationController::TContainerVector::value_type , bool>
 {
     Reference<XContainerListener> m_xContainerListener;
-    XContainerFunctor( const Reference<XContainerListener>& _xContainerListener)
+    explicit XContainerFunctor( const Reference<XContainerListener>& _xContainerListener)
         : m_xContainerListener(_xContainerListener){}
 
     bool operator() (const OApplicationController::TContainerVector::value_type& lhs) const
@@ -267,7 +267,7 @@ public:
 class SelectionGuard : public ::boost::noncopyable
 {
 public:
-    SelectionGuard( SelectionNotifier& _rNotifier )
+    explicit SelectionGuard( SelectionNotifier& _rNotifier )
         :m_rNotifier( _rNotifier )
     {
         m_rNotifier.enterSelection( SelectionNotifier::SelectionGuardAccess() );


More information about the Libreoffice-commits mailing list