basic/source/runtime/methods.cxx | 3 - chart2/source/view/axes/VCartesianAxis.cxx | 6 -- cppcanvas/source/mtfrenderer/implrenderer.cxx | 4 - cppcanvas/source/wrapper/implbitmapcanvas.hxx | 2 cppcanvas/source/wrapper/implcanvas.hxx | 2 cppcanvas/source/wrapper/implcolor.hxx | 2 cppu/source/AffineBridge/AffineBridge.cxx | 4 - cppu/source/threadpool/current.cxx | 48 ++++++++----------- cppu/source/typelib/typelib.cxx | 2 cppu/source/uno/IdentityMapping.cxx | 2 cppu/source/uno/lbenv.cxx | 2 cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx | 2 cppuhelper/source/compat.cxx | 2 cppuhelper/source/component_context.cxx | 8 +-- cppuhelper/source/factory.cxx | 2 cppuhelper/source/propshlp.cxx | 2 cppuhelper/source/tdmgr.cxx | 2 cppuhelper/source/typemanager.cxx | 4 - cppuhelper/source/weak.cxx | 4 - cppuhelper/test/cfg_test.cxx | 7 +- cppuhelper/test/testimplhelper.cxx | 2 editeng/source/misc/txtrange.cxx | 6 +- rsc/source/parser/rscibas.cxx | 6 -- sw/qa/extras/ooxmlexport/data/ooo47778-4.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8 ++- sw/source/filter/ww8/wrtww8.cxx | 62 +++++++++++++------------ sw/source/filter/ww8/wrtww8.hxx | 4 + xmlhelp/source/treeview/tvread.cxx | 3 - 28 files changed, 102 insertions(+), 99 deletions(-)
New commits: commit 60f8dd78fa3f19e8bed867f7f5926fcf9a8d8e67 Author: Caolán McNamara <[email protected]> Date: Tue Jun 9 10:11:28 2015 +0100 Resolves: more crash on export of ooo47778-3.sxw to docx This is more of the horror where the table in the frame has its cells out of visual sequence, extend the previous fix of this kind to accept cells within the original unmodified selected range Change-Id: I6e8220f712fe9de5d4b98fb3cb5ed67e3762e929 diff --git a/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt b/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt new file mode 100644 index 0000000..ae6b56b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 6b2fb6e..5fe36fd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -813,12 +813,18 @@ DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt") } } -DECLARE_OOXMLEXPORT_TEST(testOO47778, "ooo47778-3.odt") +DECLARE_OOXMLEXPORT_TEST(testOO47778_1, "ooo47778-3.odt") { if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) assertXPathContent(pXmlDoc, "(//w:t)[3]", "c"); } +DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + assertXPathContent(pXmlDoc, "(//w:t)[4]", "c"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index ba7e714..34af92f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1720,6 +1720,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u sal_uInt8 nOldTyp = m_nTextTyp; m_nTextTyp = nTTyp; SwPaM* pOldPam = m_pCurPam; //!! Simply shifting the PaM without restoring should do the job too + sal_uLong nOldStart = m_nCurStart; + sal_uLong nOldEnd = m_nCurEnd; SwPaM* pOldEnd = m_pOrigPam; bool bOldPageDescs = m_bOutPageDescs; m_bOutPageDescs = false; @@ -1731,6 +1733,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u m_bOutPageDescs = bOldPageDescs; delete m_pCurPam; // delete Pam m_pCurPam = pOldPam; + m_nCurStart = nOldStart; + m_nCurEnd = nOldEnd; m_pOrigPam = pOldEnd; m_nTextTyp = nOldTyp; } @@ -1791,6 +1795,8 @@ void WW8Export::WriteChar( sal_Unicode c ) void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) { + m_nCurStart = nStt; + m_nCurEnd = nEnd; m_pCurPam = Writer::NewSwPaM( *m_pDoc, nStt, nEnd ); // Recognize tables in special cases @@ -1842,6 +1848,8 @@ void MSWordExportBase::RestoreData() delete m_pCurPam; m_pCurPam = rData.pOldPam; + m_nCurStart = rData.nOldStart; + m_nCurEnd = rData.nOldEnd; m_pOrigPam = rData.pOldEnd; m_bOutTable = rData.bOldOutTable; @@ -2530,11 +2538,12 @@ class TrackContentToExport { private: SwPaM *m_pCurPam; - SwPaM m_aOrigPam; + sal_uLong m_nStart, m_nEnd; public: - TrackContentToExport(SwPaM *pCurPam) + TrackContentToExport(SwPaM *pCurPam, sal_uLong nCurStart, sal_uLong nCurEnd) : m_pCurPam(pCurPam) - , m_aOrigPam(*pCurPam, NULL) + , m_nStart(nCurStart) + , m_nEnd(nCurEnd) { } @@ -2559,8 +2568,8 @@ public: if (pNextNode && pCurrentNode != pNextNode) { - return pNextNode->GetIndex() >= m_aOrigPam.GetPoint()->nNode.GetIndex() && - pNextNode->GetIndex() < m_aOrigPam.GetMark()->nNode.GetIndex(); + return pNextNode->GetIndex() >= m_nStart && + pNextNode->GetIndex() < m_nEnd; } return false; @@ -2569,7 +2578,7 @@ public: void MSWordExportBase::WriteText() { - TrackContentToExport aContentTracking(m_pCurPam); + TrackContentToExport aContentTracking(m_pCurPam, m_nCurStart, m_nCurEnd); while (aContentTracking.contentRemainsToExport(m_pTableInfo.get())) { SwNode& rNd = m_pCurPam->GetNode(); @@ -3561,6 +3570,8 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM , m_bOutOutlineOnly(false) , m_bFontSizeWritten(false) , m_pDoc(pDocument) + , m_nCurStart(pCurrentPam->GetPoint()->nNode.GetIndex()) + , m_nCurEnd(pCurrentPam->GetMark()->nNode.GetIndex()) , m_pCurPam(pCurrentPam) , m_pOrigPam(pOriginalPam) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 1a6b064..16bf989 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -437,6 +437,7 @@ struct MSWordSaveData RndStdIds eOldAnchorType; ww::bytes* pOOld; ///< WW8Export only SwPaM* pOldPam, *pOldEnd; + sal_uLong nOldStart, nOldEnd; const sw::Frame* pOldFlyFormat; const SwPageDesc* pOldPageDesc; @@ -554,6 +555,7 @@ public: bool m_bFontSizeWritten; SwDoc *m_pDoc; + sal_uLong m_nCurStart, m_nCurEnd; SwPaM *m_pCurPam, *m_pOrigPam; /// Stack to remember the nesting (see MSWordSaveData for more) commit fce7587b4deea4d79c9da695bb8f43a2a5864ce2 Author: Caolán McNamara <[email protected]> Date: Tue Jun 9 09:43:43 2015 +0100 combine duplicate code into shared method Change-Id: I76d50a135153a7022b481e4025f9b5f948ce7efa diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 41cf0c2..ba7e714 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1724,17 +1724,7 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u bool bOldPageDescs = m_bOutPageDescs; m_bOutPageDescs = false; // bOutKF was setted / stored in WriteKF1 - m_pCurPam = Writer::NewSwPaM( *m_pDoc, nStart, nEnd ); - - // Tabelle in Sonderbereichen erkennen - if ( ( nStart != m_pCurPam->GetMark()->nNode.GetIndex() ) && - m_pDoc->GetNodes()[ nStart ]->IsTableNode() ) - { - m_pCurPam->GetMark()->nNode = nStart; - } - - m_pOrigPam = m_pCurPam; - m_pCurPam->Exchange(); + SetCurPam(nStart, nEnd); WriteText(); @@ -1799,6 +1789,21 @@ void WW8Export::WriteChar( sal_Unicode c ) Strm().WriteUChar( c ); } +void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) +{ + m_pCurPam = Writer::NewSwPaM( *m_pDoc, nStt, nEnd ); + + // Recognize tables in special cases + if ( nStt != m_pCurPam->GetMark()->nNode.GetIndex() && + m_pDoc->GetNodes()[ nStt ]->IsTableNode() ) + { + m_pCurPam->GetMark()->nNode = nStt; + } + + m_pOrigPam = m_pCurPam; + m_pCurPam->Exchange(); +} + void MSWordExportBase::SaveData( sal_uLong nStt, sal_uLong nEnd ) { MSWordSaveData aData; @@ -1820,17 +1825,7 @@ void MSWordExportBase::SaveData( sal_uLong nStt, sal_uLong nEnd ) aData.bOldStartTOX = m_bStartTOX; aData.bOldInWriteTOX = m_bInWriteTOX; - m_pCurPam = Writer::NewSwPaM( *m_pDoc, nStt, nEnd ); - - // Recognize tables in special cases - if ( nStt != m_pCurPam->GetMark()->nNode.GetIndex() && - m_pDoc->GetNodes()[ nStt ]->IsTableNode() ) - { - m_pCurPam->GetMark()->nNode = nStt; - } - - m_pOrigPam = m_pCurPam; - m_pCurPam->Exchange(); + SetCurPam(nStt, nEnd); m_bOutTable = false; // Caution: bIsInTable should not be set here diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 31b1232..1a6b064 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -860,6 +860,8 @@ protected: const NfKeywordTable & GetNfKeywordTable(); + void SetCurPam(sal_uLong nStt, sal_uLong nEnd); + /// Populates m_vecBulletPic with all the bullet graphics used by numberings. int CollectGrfsOfBullets(); /// Write the numbering picture bullets. commit 3d47d9d9b97b97459554a5e8376aef9aeeeda7d9 Author: Caolán McNamara <[email protected]> Date: Mon Jun 8 21:02:07 2015 +0100 cppcheck: unreadVariable Change-Id: Ia16c1ba6052e8cf86762be095930b7e748f4493d diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index b2964f1..b781639 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -531,8 +531,8 @@ void SvxBoundArgs::Concat( const tools::PolyPolygon* pPoly ) } else if( bSubtract ) // Subtract, if necessary separate { - long nOld; - if( nLeft > ( nOld = (*pOld)[ nLeftPos - 1 ] ) ) + const long nOld = (*pOld)[nLeftPos - 1]; + if (nLeft > nOld) { // Now we split the left part... if( nLeft - 1 > nOld ) { @@ -544,7 +544,7 @@ void SvxBoundArgs::Concat( const tools::PolyPolygon* pPoly ) } if( nRightPos - nLeftPos > 1 ) pOld->erase( pOld->begin() + nLeftPos, pOld->begin() + nRightPos - 1 ); - if( ++nRight >= ( nOld = (*pOld)[ nLeftPos ] ) ) + if (++nRight >= (*pOld)[nLeftPos]) pOld->erase( pOld->begin() + nLeftPos - 1, pOld->begin() + nLeftPos + 1 ); else (*pOld)[ nLeftPos - 1 ] = nRight; commit ad62165065a0f96933d8b491770775bb57ac51bd Author: Caolán McNamara <[email protected]> Date: Mon Jun 8 20:53:33 2015 +0100 cppcheck: noExplicitConstructor Change-Id: Ic33ee6936f40bec4f3a82aea39a180ae6e9a0928 diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 6fd6de5..56ed3d9 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -2648,7 +2648,7 @@ namespace cppcanvas class ActionRenderer { public: - ActionRenderer( const ::basegfx::B2DHomMatrix& rTransformation ) : + explicit ActionRenderer( const ::basegfx::B2DHomMatrix& rTransformation ) : maTransformation( rTransformation ), mbRet( true ) { @@ -2683,7 +2683,7 @@ namespace cppcanvas class AreaQuery { public: - AreaQuery( const ::basegfx::B2DHomMatrix& rTransformation ) : + explicit AreaQuery( const ::basegfx::B2DHomMatrix& rTransformation ) : maTransformation( rTransformation ), maBounds() { diff --git a/cppcanvas/source/wrapper/implbitmapcanvas.hxx b/cppcanvas/source/wrapper/implbitmapcanvas.hxx index 6f503e5..8c0be60 100644 --- a/cppcanvas/source/wrapper/implbitmapcanvas.hxx +++ b/cppcanvas/source/wrapper/implbitmapcanvas.hxx @@ -38,7 +38,7 @@ namespace cppcanvas class ImplBitmapCanvas : public virtual BitmapCanvas, protected virtual ImplCanvas { public: - ImplBitmapCanvas( const ::com::sun::star::uno::Reference< + explicit ImplBitmapCanvas( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& rCanvas ); virtual ~ImplBitmapCanvas(); diff --git a/cppcanvas/source/wrapper/implcanvas.hxx b/cppcanvas/source/wrapper/implcanvas.hxx index 9a04254..86535fc 100644 --- a/cppcanvas/source/wrapper/implcanvas.hxx +++ b/cppcanvas/source/wrapper/implcanvas.hxx @@ -50,7 +50,7 @@ namespace cppcanvas class ImplCanvas : public virtual Canvas { public: - ImplCanvas( const ::com::sun::star::uno::Reference< + explicit ImplCanvas( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >& rCanvas ); virtual ~ImplCanvas(); diff --git a/cppcanvas/source/wrapper/implcolor.hxx b/cppcanvas/source/wrapper/implcolor.hxx index 2d5e031..4c45844 100644 --- a/cppcanvas/source/wrapper/implcolor.hxx +++ b/cppcanvas/source/wrapper/implcolor.hxx @@ -37,7 +37,7 @@ namespace cppcanvas class ImplColor : public Color { public: - ImplColor( const ::com::sun::star::uno::Reference< + explicit ImplColor( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice ); virtual ~ImplColor(); diff --git a/cppu/source/AffineBridge/AffineBridge.cxx b/cppu/source/AffineBridge/AffineBridge.cxx index 2184a59..b0f23d4 100644 --- a/cppu/source/AffineBridge/AffineBridge.cxx +++ b/cppu/source/AffineBridge/AffineBridge.cxx @@ -90,7 +90,7 @@ class InnerThread : public osl::Thread AffineBridge * m_pAffineBridge; public: - InnerThread(AffineBridge * threadEnvironment) + explicit InnerThread(AffineBridge * threadEnvironment) : m_pAffineBridge(threadEnvironment) { create(); @@ -113,7 +113,7 @@ class OuterThread : public osl::Thread AffineBridge * m_pAffineBridge; public: - OuterThread(AffineBridge * threadEnvironment); + explicit OuterThread(AffineBridge * threadEnvironment); }; OuterThread::OuterThread(AffineBridge * threadEnvironment) diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index 610d4b3..cc313cd 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -106,41 +106,35 @@ class ThreadKey oslThreadKeyCallbackFunction _pCallback; public: - inline oslThreadKey getThreadKey(); - - inline ThreadKey( oslThreadKeyCallbackFunction pCallback ); - inline ~ThreadKey(); -}; - -inline ThreadKey::ThreadKey( oslThreadKeyCallbackFunction pCallback ) - : _bInit( false ) - , _hThreadKey( 0 ) - , _pCallback( pCallback ) -{ -} + oslThreadKey getThreadKey() + { + if (! _bInit) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if (! _bInit) + { + _hThreadKey = ::osl_createThreadKey( _pCallback ); + _bInit = true; + } + } + return _hThreadKey; + } -inline ThreadKey::~ThreadKey() -{ - if (_bInit) + explicit ThreadKey( oslThreadKeyCallbackFunction pCallback ) + : _bInit(false) + , _hThreadKey(0) + , _pCallback(pCallback) { - ::osl_destroyThreadKey( _hThreadKey ); } -} -inline oslThreadKey ThreadKey::getThreadKey() -{ - if (! _bInit) + ~ThreadKey() { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (! _bInit) + if (_bInit) { - _hThreadKey = ::osl_createThreadKey( _pCallback ); - _bInit = true; + ::osl_destroyThreadKey( _hThreadKey ); } } - return _hThreadKey; -} - +}; extern "C" void SAL_CALL delete_IdContainer( void * p ) { diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index ff76c8c..740b9bc 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -920,7 +920,7 @@ public: typedef std::vector< Entry > List; - BaseList(typelib_InterfaceTypeDescription const * desc); + explicit BaseList(typelib_InterfaceTypeDescription const * desc); List const & getList() const { return list; } diff --git a/cppu/source/uno/IdentityMapping.cxx b/cppu/source/uno/IdentityMapping.cxx index 270d065..4f8266c 100644 --- a/cppu/source/uno/IdentityMapping.cxx +++ b/cppu/source/uno/IdentityMapping.cxx @@ -33,7 +33,7 @@ struct IdentityMapping : public uno_Mapping sal_Int32 m_nRef; uno::Environment m_env; - IdentityMapping(uno::Environment const & rEnv); + explicit IdentityMapping(uno::Environment const & rEnv); }; extern "C" diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 8068e12..239b81b 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -82,7 +82,7 @@ struct ObjectEntry ::std::vector< InterfaceEntry > aInterfaces; bool mixedObject; - inline ObjectEntry( const OUString & rOId_ ); + explicit inline ObjectEntry( const OUString & rOId_ ); inline void append( uno_DefaultEnvironment * pEnv, diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx index 6c1870f..ff7c792 100644 --- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx +++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx @@ -46,7 +46,7 @@ class ContainerListener : public ::cppu::WeakImplHelper1< XEventListener > { ContainerStats *m_pStats; public: - ContainerListener(ContainerStats *pStats) + explicit ContainerListener(ContainerStats *pStats) : m_pStats(pStats) { m_pStats->m_nAlive++; } virtual ~ContainerListener() { m_pStats->m_nAlive--; } virtual void SAL_CALL disposing( const EventObject& ) diff --git a/cppuhelper/source/compat.cxx b/cppuhelper/source/compat.cxx index d1a7dc8..50e19bf 100644 --- a/cppuhelper/source/compat.cxx +++ b/cppuhelper/source/compat.cxx @@ -151,7 +151,7 @@ SAL_WNOUNREACHABLE_CODE_PUSH struct SAL_DLLPUBLIC_EXPORT ClassDataBase { ClassDataBase(); - ClassDataBase(sal_Int32); + explicit ClassDataBase(sal_Int32); ~ClassDataBase(); }; diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 7451daf..4dede24 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -285,16 +285,16 @@ static inline void try_dispose( Reference< lang::XComponent > const & xComp ) } } - - class DisposingForwarder : public WeakImplHelper1< lang::XEventListener > { Reference< lang::XComponent > m_xTarget; - inline DisposingForwarder( Reference< lang::XComponent > const & xTarget ) + explicit DisposingForwarder( Reference< lang::XComponent > const & xTarget ) : m_xTarget( xTarget ) - { OSL_ASSERT( m_xTarget.is() ); } + { + OSL_ASSERT( m_xTarget.is() ); + } public: // listens at source for disposing, then disposes target static inline void listen( diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index a634086..f7f79007 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -877,7 +877,7 @@ class OFactoryProxyHelper : public WeakImplHelper< XServiceInfo, XSingleServiceF public: - OFactoryProxyHelper( const Reference<XSingleServiceFactory > & rFactory ) + explicit OFactoryProxyHelper( const Reference<XSingleServiceFactory > & rFactory ) : xFactory( rFactory ) {} diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 153a921..904bf9a 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -76,7 +76,7 @@ class OPropertySetHelperInfo_Impl Sequence < Property > aInfos; public: - OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ ); + explicit OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ ); // XPropertySetInfo-methods virtual Sequence< Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 6c42384..d93d107 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -618,7 +618,7 @@ class EventListenerImpl Reference< container::XHierarchicalNameAccess > m_xTDMgr; public: - inline EventListenerImpl( + explicit EventListenerImpl( Reference< container::XHierarchicalNameAccess > const & xTDMgr ) : m_xTDMgr( xTDMgr ) {} diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index 2e32c5b..02de9ff 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -136,7 +136,7 @@ class PublishableDescription: public cppu::WeakImplHelper1< css::reflection::XPublished > { protected: - PublishableDescription(bool published): published_(published) {} + explicit PublishableDescription(bool published): published_(published) {} virtual ~PublishableDescription() {} @@ -847,7 +847,7 @@ MethodDescription::getExceptions() throw (css::uno::RuntimeException, std::excep class BaseOffset: private boost::noncopyable { public: - BaseOffset( + explicit BaseOffset( css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > const & description); diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 7532955..fa79fae 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -51,7 +51,7 @@ public: /** Hold the weak object without an acquire (only the pointer). */ - OWeakConnectionPoint( OWeakObject* pObj ) + explicit OWeakConnectionPoint( OWeakObject* pObj ) : m_aRefCount( 0 ) , m_pObject(pObj) , m_aReferences( getWeakMutex() ) @@ -320,7 +320,7 @@ namespace uno class OWeakRefListener: public XReference, private boost::noncopyable { public: - OWeakRefListener(const Reference< XInterface >& xInt); + explicit OWeakRefListener(const Reference< XInterface >& xInt); virtual ~OWeakRefListener(); // XInterface diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx index 27e2239..976dd3f 100644 --- a/cppuhelper/test/cfg_test.cxx +++ b/cppuhelper/test/cfg_test.cxx @@ -79,7 +79,7 @@ class ServiceImpl0 Reference< XComponentContext > m_xContext; public: - ServiceImpl0( Reference< XComponentContext > const & xContext ); + explicit ServiceImpl0( Reference< XComponentContext > const & xContext ); // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& rArgs ) throw (Exception, RuntimeException); @@ -150,9 +150,10 @@ sal_Bool ServiceImpl0::supportsService( const OUString & rServiceName ) class ServiceImpl1 : public ServiceImpl0 { public: - inline ServiceImpl1( Reference< XComponentContext > const & xContext ) + explicit ServiceImpl1( Reference< XComponentContext > const & xContext ) : ServiceImpl0( xContext ) - {} + { + } // XServiceInfo virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); diff --git a/cppuhelper/test/testimplhelper.cxx b/cppuhelper/test/testimplhelper.cxx index 0f359e3..b099d55 100644 --- a/cppuhelper/test/testimplhelper.cxx +++ b/cppuhelper/test/testimplhelper.cxx @@ -175,7 +175,7 @@ struct TestWeakImpl : public WeakImplHelper4< CA, DBA, FE, G > { return OUString("g"); } protected: - TestWeakImpl(int) {} + explicit TestWeakImpl(int) {} TestWeakImpl(int, int) {} commit cc0e9a37de8bceeb224b03a5bb1827b087e3e7b5 Author: Caolán McNamara <[email protected]> Date: Mon Jun 8 20:47:37 2015 +0100 cppcheck: variableScope Change-Id: If0c56c89e2722d47a401363f3854331229856490 diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 5a86549..6ecdf30 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3560,10 +3560,9 @@ RTLFUNC(Randomize) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - int nSeed; if( rPar.Count() == 2 ) { - nSeed = (int)rPar.Get(1)->GetInteger(); + int nSeed = (int)rPar.Get(1)->GetInteger(); theRandomNumberGenerator::get().global_rng.seed(nSeed); } // without parameter, no need to do anything - RNG is seeded at first use diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index c8ae9e0..90f5880 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -713,13 +713,12 @@ bool VCartesianAxis::createTextShapes( const TickInfo* pPreviousVisibleTickInfo = NULL; const TickInfo* pPREPreviousVisibleTickInfo = NULL; - const TickInfo* pLastVisibleNeighbourTickInfo = NULL; sal_Int32 nTick = 0; for( TickInfo* pTickInfo = rTickIter.firstInfo() ; pTickInfo ; pTickInfo = rTickIter.nextInfo(), nTick++ ) { - pLastVisibleNeighbourTickInfo = bIsStaggered ? + const TickInfo* pLastVisibleNeighbourTickInfo = bIsStaggered ? pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo; //don't create labels which does not fit into the rhythm @@ -909,13 +908,12 @@ bool VCartesianAxis::createTextShapesSimple( uno::Any* pLimitedSpaceAny = PropertyMapper::getValuePointerForLimitedSpace(aPropValues,aPropNames,bLimitedHeight); const TickInfo* pPreviousVisibleTickInfo = NULL; - const TickInfo* pLastVisibleNeighbourTickInfo = NULL; sal_Int32 nTick = 0; for( TickInfo* pTickInfo = rTickIter.firstInfo() ; pTickInfo ; pTickInfo = rTickIter.nextInfo(), nTick++ ) { - pLastVisibleNeighbourTickInfo = pPreviousVisibleTickInfo; + const TickInfo* pLastVisibleNeighbourTickInfo = pPreviousVisibleTickInfo; //don't create labels which does not fit into the rhythm if( nTick%rAxisLabelProperties.nRhythm != 0 ) diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx index 3836b47..395ba1f 100644 --- a/rsc/source/parser/rscibas.cxx +++ b/rsc/source/parser/rscibas.cxx @@ -150,22 +150,18 @@ void RscLangEnum::Init( RscNameTable& rNames ) Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames ) { Atom nResult = 0; - bool bAdd = false; KEY_STRUCT aStruct; if( ! rNames.Get( nResult = pHS->getID( pLang ), &aStruct ) ) { SetConstant( nResult = rNames.Put( pLang, CONSTNAME, mnLangId ), mnLangId ); // insert new lang to ULong_Iso_map OString aLang( pLang ); - bAdd = (GetLangId( aLang ) == 0); + bool bAdd = (GetLangId( aLang ) == 0); if ( bAdd ) ULong_Iso_map[ aLang ] = mnLangId; // increase id counter mnLangId++; } -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "AddLanguage( '%s' ) = %d (%s)\n", pLang, nResult, (bAdd ? "added" : "exists") ); -#endif return nResult; } diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 1954335..a13067b 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -707,7 +707,6 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL ); if( osl::Directory::E_None == aDirectory.open() ) { - int idx_ = 0; OUString aFileUrl, aFileName; while( aDirectory.getNextItem( aDirItem ) == osl::FileBase::E_None && aDirItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None && @@ -716,7 +715,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) { aFileUrl = aFileStatus.getFileURL(); aFileName = aFileStatus.getFileName(); - idx_ = aFileName.lastIndexOf( '.' ); + int idx_ = aFileName.lastIndexOf( '.' ); if( idx_ == -1 ) continue;
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
