From 2ce2fafa1b19f3eaad89ec57ac312ce2f33fbf20 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 12 Feb 2013 14:47:52 +0100 Subject: [PATCH] Some cppcheck cleaning Change-Id: Idb380dbb7470dbdb371778ba0c486392cc55380e --- basic/source/comp/dim.cxx | 3 +-- cui/source/tabpages/border.cxx | 8 +++----- svx/source/gallery2/galbrws2.cxx | 7 ++++--- unodevtools/source/skeletonmaker/javatypemaker.cxx | 2 +- vcl/win/source/window/salobj.cxx | 3 +-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 3a6c5c93d971..3f79a2874092 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -615,10 +615,9 @@ void SbiParser::DefType( bool bPrivate ) for ( short i=0; iGetSize();++i ) { - sal_Int32 ub = -1; sal_Int32 lb = nBase; SbiExprNode* pNode = pDim->Get(i)->GetExprNode(); - ub = pNode->GetNumber(); + sal_Int32 ub = pNode->GetNumber(); if ( !pDim->Get( i )->IsBased() ) // each dim is low/up { if ( ++i >= pDim->GetSize() ) // trouble diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 3eb3c00f91ef..0772e5da7a5d 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -246,14 +246,13 @@ SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs // fill ColorBox out of the XColorList SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = NULL; XColorListRef pColorTable; DBG_ASSERT( pDocSh, "DocShell not found!" ); if ( pDocSh ) { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); + const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem != NULL ) pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); } @@ -562,7 +561,6 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) SvxBoxItem* pOldBoxItem = (SvxBoxItem*)GetOldItem( rCoreAttrs, SID_ATTR_BORDER_OUTER ); SfxMapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich ); - const SfxPoolItem* pOld = 0; //------------------ // outer border: @@ -684,7 +682,7 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) rCoreAttrs.Put( aBoxItem ); bAttrsChanged |= sal_True; } - pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False ); + const SfxPoolItem* pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False ); if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) ) { @@ -796,7 +794,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl) IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb ) { - ColorListBox* pColLb = (ColorListBox*)pLb; + ColorListBox* pColLb = (ColorListBox*)(pLb); if (pLb == m_pLbLineColor) { diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 6b8ed1c925cc..2111eed07173 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -107,18 +107,19 @@ void GalleryBackgroundPopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, if ( ( nSID == SID_GALLERY_BG_BRUSH ) && pItem && ( eState != SFX_ITEM_DISABLED ) ) { SfxStringListItem* pStrLstItem; - SfxStringItem* pStrItem; PopupMenu::Clear(); - if( ( pStrLstItem = PTR_CAST( SfxStringListItem, pItem ) ) != NULL ) + if ( ( pStrLstItem = PTR_CAST( SfxStringListItem, pItem ) ) != NULL ) { const std::vector &aList = pStrLstItem->GetList(); for ( sal_uIntPtr i = 0, nCount = aList.size(); i < nCount; i++ ) InsertItem( (sal_uInt16) i + 1, aList[i]); + return; } - else if( ( pStrItem = PTR_CAST( SfxStringItem, pItem ) ) != NULL ) + SfxStringItem* pStrItem = PTR_CAST( SfxStringItem, pItem ); + if (pStrItem) InsertItem( 1, pStrItem->GetValue() ); else { diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index 96870f5a9a8c..88e961d36408 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -460,8 +460,8 @@ void printMethods(std::ostream & o, // REMOVE next line OUString tmp = reader.getFieldName(i); - bool setAttrMethod = false; if ( (reader.getFieldFlags(i) & RT_ACCESS_READONLY) == 0 ) { + bool setAttrMethod = false; o << indentation << "public void set" << (codemaker::convertString(reader.getFieldName(i)). getStr()) diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index 0324a3500785..e2c1b24840c2 100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -243,7 +243,6 @@ void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT /* nDispatchResult */ ) { // Used for Unicode and none Unicode SalData* pSalData = GetSalData(); - WinSalFrame* pFrame; if ( (pMsg->message == WM_KEYDOWN) || (pMsg->message == WM_KEYUP) ) { @@ -253,7 +252,7 @@ void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT /* nDispatchResult */ ) if ( pMsg->hwnd == ::GetFocus() ) { ImplSalYieldMutexAcquireWithWait(); - pFrame = ImplFindSalObjectFrame( pMsg->hwnd ); + WinSalFrame* pFrame = ImplFindSalObjectFrame( pMsg->hwnd ); if ( pFrame ) ImplHandleSalObjKeyMsg( pFrame->mhWnd, pMsg->message, pMsg->wParam, pMsg->lParam ); ImplSalYieldMutexRelease();