From ba11d549dca2a04a220b59aaf9223ee8f7043da0 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 6 Feb 2011 23:16:23 +0100 Subject: [PATCH] Some cppcheck cleaning --- basctl/source/basicide/basobj3.cxx | 2 +- cui/source/dialogs/hangulhanjadlg.cxx | 2 +- cui/source/dialogs/iconcdlg.cxx | 5 ++-- cui/source/options/connpoolsettings.cxx | 2 +- cui/source/options/connpoolsettings.hxx | 2 +- cui/source/options/optinet2.cxx | 28 ++++++++++----------- cui/source/tabpages/transfrm.cxx | 3 +-- package/source/zipapi/XUnbufferedStream.cxx | 4 ++- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 6d15f5a9a74f..1bf6081c6f0c 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -372,10 +372,10 @@ void BasicStopped( BOOL* pbAppWindowDisabled, *ppSWLockViewCount = 0; // AppWait ? - USHORT nWait = 0; BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); if( pIDEShell ) { + USHORT nWait = 0; while ( pIDEShell->GetViewFrame()->GetWindow().IsWait() ) { pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index bc16fa576d04..c082c79582f7 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -1758,13 +1758,13 @@ namespace svx //fill found entries into boxes sal_uInt32 nCnt = aEntries.getLength(); - sal_uInt32 n = 0; if( nCnt ) { if( !m_pSuggestions ) m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS ); const OUString* pSugg = aEntries.getConstArray(); + sal_uInt32 n = 0; while( nCnt ) { m_pSuggestions->Set( pSugg[ n ], sal_uInt16( n ) ); diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index f8822c8d5f6f..2fa5101d95a6 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -877,6 +877,7 @@ void IconChoiceDialog::ActivatePageImpl () DBG_ASSERT( !maPageList.empty(), "keine Pages angemeldet" ); IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); DBG_ASSERT( pData, "Id nicht bekannt" ); + BOOL bReadOnly = FALSE; if ( pData ) { if ( !pData->pPage ) @@ -916,11 +917,11 @@ void IconChoiceDialog::ActivatePageImpl () if ( pExampleSet ) pData->pPage->ActivatePage( *pExampleSet ); + SetHelpId( pData->pPage->GetHelpId() ); + bReadOnly = pData->pPage->IsReadOnly(); } - SetHelpId( pData->pPage->GetHelpId() ); - BOOL bReadOnly = pData->pPage->IsReadOnly(); if ( bReadOnly || bHideResetBtn ) aResetBtn.Hide(); else diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx index 8c32ad12f40d..6f43863c3bf7 100644 --- a/cui/source/options/connpoolsettings.cxx +++ b/cui/source/options/connpoolsettings.cxx @@ -75,7 +75,7 @@ namespace offapp //==================================================================== TYPEINIT1( DriverPoolingSettingsItem, SfxPoolItem ) //-------------------------------------------------------------------- - DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings ) + DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings ) :SfxPoolItem(_nId) ,m_aSettings(_rSettings) { diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx index a347d1588c4e..1f53d207f2ab 100644 --- a/cui/source/options/connpoolsettings.hxx +++ b/cui/source/options/connpoolsettings.hxx @@ -92,7 +92,7 @@ namespace offapp public: TYPEINFO(); - DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings ); + DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings ); virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 214234dac155..7febbad6d8ea 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -342,15 +342,15 @@ void SvxProxyTabPage::ReadConfigData_Impl() } } - catch(container::NoSuchElementException e) { + catch(container::NoSuchElementException &e) { OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: NoSuchElementException caught" ); } - catch(com::sun::star::lang::WrappedTargetException e) { + catch(com::sun::star::lang::WrappedTargetException &e) { OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: WrappedTargetException caught" ); } - catch(RuntimeException e) { + catch(RuntimeException &e) { OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: RuntimeException caught" ); } @@ -400,16 +400,16 @@ void SvxProxyTabPage::ReadConfigDefaults_Impl() aNoProxyForED.SetText( aStringValue ); } } - catch(beans::UnknownPropertyException e) + catch(beans::UnknownPropertyException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" ); } - catch(com::sun::star::lang::WrappedTargetException e) { + catch(com::sun::star::lang::WrappedTargetException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" ); } - catch(RuntimeException e) + catch(RuntimeException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" ); } @@ -434,16 +434,16 @@ void SvxProxyTabPage::RestoreConfigDefaults_Impl() xChangesBatch->commitChanges(); } - catch(beans::UnknownPropertyException e) + catch(beans::UnknownPropertyException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" ); } - catch(com::sun::star::lang::WrappedTargetException e) { + catch(com::sun::star::lang::WrappedTargetException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" ); } - catch(RuntimeException e) + catch(RuntimeException &e) { OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" ); } @@ -539,23 +539,23 @@ BOOL SvxProxyTabPage::FillItemSet(SfxItemSet& ) xChangesBatch->commitChanges(); } - catch(com::sun::star::lang::IllegalArgumentException e) { + catch(com::sun::star::lang::IllegalArgumentException &e) { OSL_TRACE( "SvxProxyTabPage::FillItemSet: IllegalArgumentException caught" ); } - catch(beans::UnknownPropertyException e) { + catch(beans::UnknownPropertyException &e) { OSL_TRACE( "SvxProxyTabPage::FillItemSet: UnknownPropertyException caught" ); } - catch(beans::PropertyVetoException e) { + catch(beans::PropertyVetoException &e) { OSL_TRACE( "SvxProxyTabPage::FillItemSet: PropertyVetoException caught" ); } - catch(com::sun::star::lang::WrappedTargetException e) { + catch(com::sun::star::lang::WrappedTargetException &e) { OSL_TRACE( "SvxProxyTabPage::FillItemSet: WrappedTargetException caught" ); } - catch(RuntimeException e) { + catch(RuntimeException &e) { OSL_TRACE( "SvxProxyTabPage::FillItemSet: RuntimeException caught" ); } diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 2c6b73bc2985..a929df3e2cfc 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -558,7 +558,6 @@ void SvxSlantTabPage::Construct() BOOL SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) { BOOL bModified = FALSE; - INT32 nValue = 0L; String aStr = aMtrRadius.GetText(); if( aStr != aMtrRadius.GetSavedValue() ) @@ -575,7 +574,7 @@ BOOL SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) if( aStr != aMtrAngle.GetSavedValue() ) { - nValue = static_cast(aMtrAngle.GetValue()); + INT32 nValue = static_cast(aMtrAngle.GetValue()); rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); bModified = TRUE; } diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 35e9dfe6bdb1..1cad883f972a 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -169,10 +169,12 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa if ( mnMyCurrent + nRequestedBytes > mnZipSize + maHeader.getLength() ) nRequestedBytes = static_cast < sal_Int32 > ( mnZipSize + maHeader.getLength() - mnMyCurrent ); - sal_Int32 nRead = 0, nLastRead = 0, nTotal = 0; + sal_Int32 nTotal = 0; aData.realloc ( nRequestedBytes ); if ( nRequestedBytes ) { + sal_Int32 nRead = 0; + sal_Int32 nLastRead = 0; if ( mbRawStream ) { sal_Int64 nDiff = mnZipEnd - mnZipCurrent;