[Libreoffice-commits] core.git: 2 commits - filter/qa filter/source stoc/source stoc/test store/source svgio/source svl/source svtools/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Wed Jul 15 12:04:04 PDT 2015


 filter/qa/cppunit/data/met/fail/hang-1.met      |binary
 filter/source/graphicfilter/ios2met/ios2met.cxx |   12 +++++++++---
 stoc/source/security/file_policy.cxx            |    2 +-
 stoc/source/security/permissions.h              |    4 ++--
 stoc/source/servicemanager/servicemanager.cxx   |   14 +++++++-------
 stoc/test/testintrosp.cxx                       |    4 ++--
 store/source/store.cxx                          |    2 +-
 svgio/source/svguno/xsvgparser.cxx              |    2 +-
 svl/source/fsstor/oinputstreamcontainer.hxx     |    2 +-
 svl/source/fsstor/ostreamcontainer.hxx          |    2 +-
 svl/source/items/itemprop.cxx                   |    2 +-
 svtools/source/contnr/treelist.cxx              |    2 +-
 sw/source/core/unocore/unoobj2.cxx              |    2 +-
 sw/source/uibase/dbui/dbmgr.cxx                 |    2 +-
 vcl/source/control/combobox.cxx                 |    2 +-
 15 files changed, 30 insertions(+), 24 deletions(-)

New commits:
commit d6790de07ff225f9e5b58152d01719e5fbe9e6cd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 15 17:32:31 2015 +0100

    cppcheck: noExplicitConstructor
    
    Change-Id: Id438b987f72ae57bd4fa882e01fba17d3fa5b95b

diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 3dc06e8..920e464 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -71,7 +71,7 @@ protected:
     virtual void SAL_CALL disposing() SAL_OVERRIDE;
 
 public:
-    FilePolicy( Reference< XComponentContext > const & xComponentContext );
+    explicit FilePolicy( Reference< XComponentContext > const & xComponentContext );
     virtual ~FilePolicy();
 
     // XPolicy impl
diff --git a/stoc/source/security/permissions.h b/stoc/source/security/permissions.h
index ee40365..b5fbd37 100644
--- a/stoc/source/security/permissions.h
+++ b/stoc/source/security/permissions.h
@@ -51,7 +51,7 @@ public:
 class AllPermission : public Permission
 {
 public:
-    inline AllPermission(
+    explicit AllPermission(
         ::rtl::Reference< Permission > const & next = ::rtl::Reference< Permission >() )
         : Permission( ALL, next )
         {}
@@ -70,7 +70,7 @@ public:
     inline PermissionCollection( PermissionCollection const & collection )
         : m_head( collection.m_head )
         {}
-    inline PermissionCollection( ::rtl::Reference< Permission > const & single )
+    explicit PermissionCollection( ::rtl::Reference< Permission > const & single )
         : m_head( single )
         {}
     PermissionCollection(
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 8a85e15..b206d22 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -154,7 +154,7 @@ typedef std::unordered_set
 class ServiceEnumeration_Impl : public WeakImplHelper1< XEnumeration >
 {
 public:
-    ServiceEnumeration_Impl( const Sequence< Reference<XInterface > > & rFactories )
+    explicit ServiceEnumeration_Impl( const Sequence< Reference<XInterface > > & rFactories )
         : aFactories( rFactories )
         , nIt( 0 )
         {}
@@ -195,7 +195,7 @@ class PropertySetInfo_Impl : public WeakImplHelper1< beans::XPropertySetInfo >
     Sequence< beans::Property > m_properties;
 
 public:
-    inline PropertySetInfo_Impl( Sequence< beans::Property > const & properties )
+    explicit PropertySetInfo_Impl( Sequence< beans::Property > const & properties )
         : m_properties( properties )
         {}
 
@@ -246,7 +246,7 @@ sal_Bool PropertySetInfo_Impl::hasPropertyByName( OUString const & name )
 class ImplementationEnumeration_Impl : public WeakImplHelper1< XEnumeration >
 {
 public:
-    ImplementationEnumeration_Impl( const HashSet_Ref & rImplementationMap )
+    explicit ImplementationEnumeration_Impl( const HashSet_Ref & rImplementationMap )
         : aImplementationMap( rImplementationMap )
         , aIt( aImplementationMap.begin() )
         {}
@@ -320,7 +320,7 @@ private:
     WeakReference<XSet > xSMgr;
 
 public:
-    OServiceManager_Listener( const Reference<XSet > & rSMgr )
+    explicit OServiceManager_Listener( const Reference<XSet > & rSMgr )
         : xSMgr( rSMgr )
         {}
 
@@ -369,7 +369,7 @@ class OServiceManager
     , public t_OServiceManager_impl
 {
 public:
-    OServiceManager( Reference< XComponentContext > const & xContext );
+    explicit OServiceManager( Reference< XComponentContext > const & xContext );
     virtual ~OServiceManager();
 
     // XInitialization
@@ -512,7 +512,7 @@ protected:
     virtual void SAL_CALL disposing() SAL_OVERRIDE;
 
 public:
-    OServiceManagerWrapper(
+    explicit OServiceManagerWrapper(
         Reference< XComponentContext > const & xContext );
     virtual ~OServiceManagerWrapper();
 
@@ -1308,7 +1308,7 @@ void OServiceManager::remove( const Any & Element )
 class ORegistryServiceManager : public OServiceManager
 {
 public:
-    ORegistryServiceManager( Reference< XComponentContext > const & xContext );
+    explicit ORegistryServiceManager( Reference< XComponentContext > const & xContext );
     virtual ~ORegistryServiceManager();
 
     // XInitialization
diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx
index 43ea55c..2843169 100644
--- a/stoc/test/testintrosp.cxx
+++ b/stoc/test/testintrosp.cxx
@@ -183,7 +183,7 @@ class ImplPropertySetInfo : public ImplPropertySetInfoHelper
       Reference< XMultiServiceFactory > mxMgr;
 
 public:
-    ImplPropertySetInfo( const Reference< XMultiServiceFactory > & xMgr )
+    explicit ImplPropertySetInfo( const Reference< XMultiServiceFactory > & xMgr )
         : mxMgr( xMgr ) {}
 
     // Methods of XPropertySetInfo
@@ -303,7 +303,7 @@ class ImplIntroTest : public ImplIntroTestHelper
     void Init();
 
 public:
-    ImplIntroTest( const Reference< XMultiServiceFactory > & xMgr )
+    explicit ImplIntroTest( const Reference< XMultiServiceFactory > & xMgr )
         : mxMgr( xMgr )
     {
         Init();
diff --git a/store/source/store.cxx b/store/source/store.cxx
index 22fc68f..04b9cc1 100644
--- a/store/source/store.cxx
+++ b/store/source/store.cxx
@@ -41,7 +41,7 @@ template<class store_handle_type>
 class OStoreHandle : public rtl::Reference<store_handle_type>
 {
 public:
-    OStoreHandle (store_handle_type * pHandle)
+    explicit OStoreHandle (store_handle_type * pHandle)
         : rtl::Reference<store_handle_type> (pHandle)
     {}
 
diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx
index 29ece61..ce2e0a8 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -46,7 +46,7 @@ namespace svgio
 
         protected:
         public:
-            XSvgParser(
+            explicit XSvgParser(
                 uno::Reference< uno::XComponentContext > const & context);
             virtual ~XSvgParser();
 
diff --git a/svl/source/fsstor/oinputstreamcontainer.hxx b/svl/source/fsstor/oinputstreamcontainer.hxx
index a5ad6f9..1510387 100644
--- a/svl/source/fsstor/oinputstreamcontainer.hxx
+++ b/svl/source/fsstor/oinputstreamcontainer.hxx
@@ -46,7 +46,7 @@ class OFSInputStreamContainer : public cppu::WeakImplHelper2 < ::com::sun::star:
     ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
 
 public:
-    OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream );
+    explicit OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream );
 
     virtual ~OFSInputStreamContainer();
 
diff --git a/svl/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx
index f998664..f6d7c2e 100644
--- a/svl/source/fsstor/ostreamcontainer.hxx
+++ b/svl/source/fsstor/ostreamcontainer.hxx
@@ -60,7 +60,7 @@ class OFSStreamContainer : public cppu::OWeakObject,
     ::cppu::OTypeCollection* m_pTypeCollection;
 
 public:
-    OFSStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream );
+    explicit OFSStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream );
     virtual ~OFSStreamContainer();
 
     // XInterface
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 9e2c1ed..3916db7 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.cxx
@@ -51,7 +51,7 @@ public:
     mutable uno::Sequence< beans::Property > m_aPropSeq;
 
     SfxItemPropertyMap_Impl(){}
-    SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource );
+    explicit SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource );
 };
 
 SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource )
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 059c463..0753495 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -37,7 +37,7 @@ struct SvListView::Impl
     sal_uLong   m_nSelectionCount;
     bool        m_bVisPositionsValid;
 
-    Impl(SvListView & rThis)
+    explicit Impl(SvListView & rThis)
         : m_rThis(rThis)
         , m_nVisibleCount(0)
         , m_nSelectionCount(0)
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 1610bd5..7b1b37e 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1495,7 +1495,7 @@ struct SwXTextRangesImpl SAL_FINAL : public SwXTextRanges
     virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    SwXTextRangesImpl(SwPaM *const pPaM)
+    explicit SwXTextRangesImpl(SwPaM *const pPaM)
     {
         if (pPaM)
         {
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index f31aaae..d7bad03 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -211,7 +211,7 @@ class SwDataSourceRemovedListener : public cppu::WeakImplHelper<sdb::XDatabaseRe
     SwDBManager* m_pDBManager;
 
 public:
-    SwDataSourceRemovedListener(SwDBManager& rDBManager);
+    explicit SwDataSourceRemovedListener(SwDBManager& rDBManager);
     virtual ~SwDataSourceRemovedListener();
     virtual void SAL_CALL registeredDatabaseLocation(const sdb::DatabaseRegistrationEvent& rEvent) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual void SAL_CALL revokedDatabaseLocation(const sdb::DatabaseRegistrationEvent& rEvent) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 5d97fd3..70152d8 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -63,7 +63,7 @@ struct ComboBox::Impl
     Link<>              m_DoubleClickHdl;
     boost::signals2::scoped_connection m_AutocompleteConnection;
 
-    Impl(ComboBox & rThis)
+    explicit Impl(ComboBox & rThis)
         : m_rThis(rThis)
         , m_nDDHeight(0)
         , m_cMultiSep(0)
commit 15dfcb7f461893f83abcf28bfe01a4164209a160
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 15 12:18:10 2015 +0100

    don't hang with 0 len causing no progression
    
    Change-Id: Ie553dab291c7bfbde033d89b84159aff6b42a160

diff --git a/filter/qa/cppunit/data/met/fail/hang-1.met b/filter/qa/cppunit/data/met/fail/hang-1.met
new file mode 100644
index 0000000..c1a095d
Binary files /dev/null and b/filter/qa/cppunit/data/met/fail/hang-1.met differ
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index f1b9981..f152963 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2239,7 +2239,6 @@ void OS2METReader::ReadImageData(sal_uInt16 nDataID, sal_uInt16 nDataLen)
 void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
 {
     sal_uLong nPos, nMaxPos;
-    sal_uInt16 nLen;
     sal_uInt8 nByte, nTripType, nTripType2;
     OSFont * pF=new OSFont;
     pF->pSucc=pFontList; pFontList=pF;
@@ -2251,7 +2250,13 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
     nMaxPos=nPos+(sal_uLong)nFieldSize;
     pOS2MET->SeekRel(2); nPos+=2;
     while (nPos<nMaxPos && pOS2MET->GetError()==0) {
-        pOS2MET->ReadUChar( nByte ); nLen =((sal_uInt16)nByte) & 0x00ff;
+        pOS2MET->ReadUChar( nByte );
+        sal_uInt16 nLen = ((sal_uInt16)nByte) & 0x00ff;
+        if (nLen == 0)
+        {
+            pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+            ErrorCode=4;
+        }
         pOS2MET->ReadUChar( nTripType );
         switch (nTripType) {
             case 0x02:
@@ -2303,7 +2308,8 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
                 break;
             }
         }
-        nPos+=nLen; pOS2MET->Seek(nPos);
+        nPos+=nLen;
+        pOS2MET->Seek(nPos);
     }
 }
 


More information about the Libreoffice-commits mailing list