diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-27 03:16:18 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-27 09:23:52 +0200 |
commit | dc1858783e72bba808dbd87b5b03d5170449ad52 (patch) | |
tree | 5164686a8f38e64420f79b027900507d2c179a6d | |
parent | 5690acdb44e8017055bb88e86e19d207836bb95c (diff) |
tdf#120703 (PVS): V519 The variable is assigned values twice successively
Change-Id: I9265425a215609ef6bf4298ba39c8399f215ce27
Reviewed-on: https://gerrit.libreoffice.org/62406
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
24 files changed, 32 insertions, 61 deletions
diff --git a/cli_ure/source/uno_bridge/cli_environment.cxx b/cli_ure/source/uno_bridge/cli_environment.cxx index 2c4bdcde4129..3c054b5be870 100644 --- a/cli_ure/source/uno_bridge/cli_environment.cxx +++ b/cli_ure/source/uno_bridge/cli_environment.cxx @@ -117,8 +117,7 @@ System::Object^ Cli_environment::getRegisteredInterface(System::String^ oid, System::Type^ type) { //try if it is a UNO interface - System::Object^ ret = nullptr; - ret = m_objects[oid]; + System::Object^ ret = m_objects[oid]; if (! ret) { //try if it is a proxy for a cli object diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx index 622a06ef7fac..0bec73919687 100644 --- a/connectivity/source/drivers/postgresql/pq_statics.cxx +++ b/connectivity/source/drivers/postgresql/pq_statics.cxx @@ -124,7 +124,6 @@ Statics & getStatics() statics.NO_NULLS = "NO_NULLS"; statics.NULABLE = "NULABLE"; statics.NULLABLE_UNKNOWN = "NULLABLE_UNKNOWN"; - statics.cPERCENT = "%"; statics.TYPE = "Type"; statics.TYPE_NAME = "TypeName"; diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 46494e00c827..1a54edffe40e 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -756,11 +756,7 @@ void OPropertySetHelper::fire if( !bVetoable ) { - OInterfaceContainerHelper * pCont = nullptr; - pCont = rBHelper.aLC.getContainer( - getPropertiesTypeIdentifier( ) - ); - if( pCont ) + if (auto pCont = rBHelper.aLC.getContainer(getPropertiesTypeIdentifier())) { // Here is a Bug, unbound properties are also fired OInterfaceIteratorHelper aIt( *pCont ); diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 20f814313551..b5f514cf41d0 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -258,7 +258,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal AuthenticationRequest aRequest; aRequest.ServerName = sName; aRequest.Diagnostic = sLoginRequest; - aRequest.HasRealm = aRequest.HasAccount = false; + aRequest.HasRealm = false; // aRequest.Realm aRequest.HasUserName = pUser != nullptr; aRequest.UserName = pUser ? pUser->GetValue() : OUString(); diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index a717c5df6764..508d36ea3a66 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -161,8 +161,8 @@ RegError ORegKey::getKeyNames(const OUString& keyName, sal_uInt32 nSubKeys = pKey->countSubKeys(); *pnSubKeys = nSubKeys; - rtl_uString** pSubKeys = nullptr; - pSubKeys = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nSubKeys * sizeof(rtl_uString*))); + rtl_uString** pSubKeys + = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nSubKeys * sizeof(rtl_uString*))); OStoreDirectory::iterator iter; OStoreDirectory rStoreDir(pKey->getStoreDir()); diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx index 706d1ffc5c67..c9d1f3918bb2 100644 --- a/sal/rtl/digest.cxx +++ b/sal/rtl/digest.cxx @@ -326,8 +326,7 @@ rtlDigestError SAL_CALL rtl_digest_MD2( rtlDigest SAL_CALL rtl_digest_createMD2() SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestMD2_Impl); + DigestMD2_Impl *pImpl = RTL_DIGEST_CREATE(DigestMD2_Impl); if (pImpl) { pImpl->m_digest = MD2; @@ -664,8 +663,7 @@ rtlDigestError SAL_CALL rtl_digest_MD5( rtlDigest SAL_CALL rtl_digest_createMD5() SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestMD5_Impl); + DigestMD5_Impl *pImpl = RTL_DIGEST_CREATE(DigestMD5_Impl); if (pImpl) { pImpl->m_digest = MD5; @@ -1107,8 +1105,7 @@ rtlDigestError SAL_CALL rtl_digest_SHA( rtlDigest SAL_CALL rtl_digest_createSHA() SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestSHA_Impl); + DigestSHA_Impl *pImpl = RTL_DIGEST_CREATE(DigestSHA_Impl); if (pImpl) { pImpl->m_digest = SHA_0; @@ -1267,8 +1264,7 @@ rtlDigestError SAL_CALL rtl_digest_SHA1( rtlDigest SAL_CALL rtl_digest_createSHA1() SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestSHA_Impl); + DigestSHA_Impl *pImpl = RTL_DIGEST_CREATE(DigestSHA_Impl); if (pImpl) { pImpl->m_digest = SHA_1; @@ -1482,8 +1478,7 @@ rtlDigestError SAL_CALL rtl_digest_HMAC_MD5( rtlDigest SAL_CALL rtl_digest_createHMAC_MD5() SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestHMAC_MD5_Impl); + DigestHMAC_MD5_Impl *pImpl = RTL_DIGEST_CREATE(DigestHMAC_MD5_Impl); if (pImpl) { pImpl->m_digest = HMAC_MD5; @@ -1678,8 +1673,7 @@ rtlDigestError SAL_CALL rtl_digest_HMAC_SHA1( rtlDigest SAL_CALL rtl_digest_createHMAC_SHA1() SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = nullptr; - pImpl = RTL_DIGEST_CREATE(DigestHMAC_SHA1_Impl); + DigestHMAC_SHA1_Impl *pImpl = RTL_DIGEST_CREATE(DigestHMAC_SHA1_Impl); if (pImpl) { pImpl->m_digest = HMAC_SHA1; diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index fba0f6f6b6c4..182cc995dd68 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -176,8 +176,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) //formatting for B5: # ??/100 gets lost during import //test Sheet2 - const ScPatternAttr* pPattern = nullptr; - pPattern = pDoc->GetPattern(0,0,1); + const ScPatternAttr* pPattern = pDoc->GetPattern(0, 0, 1); vcl::Font aFont; pPattern->GetFont(aFont,SC_AUTOCOL_RAW); CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", 200l, aFont.GetFontSize().getHeight()); diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index d6b8a49f0c60..f930b245b063 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -78,7 +78,6 @@ const char* aFuncStrIds[] = // matching enum ScSubTotalFunc bool lcl_SearchMember( const std::vector<std::unique_ptr<ScDPResultMember>>& list, SCROW nOrder, SCROW& rIndex) { - rIndex = list.size(); bool bFound = false; SCROW nLo = 0; SCROW nHi = list.size() - 1; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 6af632a8a88c..2b30f4e1fe49 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1733,10 +1733,8 @@ void ScInterpreter::ScSumXMY2() if ( !MustHaveParamCount( GetByte(), 2 ) ) return; - ScMatrixRef pMat1 = nullptr; - ScMatrixRef pMat2 = nullptr; - pMat2 = GetMatrix(); - pMat1 = GetMatrix(); + ScMatrixRef pMat2 = GetMatrix(); + ScMatrixRef pMat1 = GetMatrix(); if (!pMat2 || !pMat1) { PushIllegalParameter(); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 4562df261e59..1758f5d9fcba 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -626,7 +626,7 @@ bool SdTransferable::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false ); // mba: no relative URLs for clipboard! SfxMedium aMedium( xWorkStore, OUString() ); - bRet = pEmbObj->DoSaveObjectAs( aMedium, false ); + pEmbObj->DoSaveObjectAs( aMedium, false ); pEmbObj->DoSaveCompleted(); uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 6bf964c8a98a..2a95052903f2 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1198,9 +1198,10 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) if ( xLayoutManager.is() ) { - bool bState = true; - bState = xLayoutManager->getElement( "private:resource/menubar/menubar" ).is() - && xLayoutManager->isElementVisible( "private:resource/menubar/menubar" ); + const bool bState + = xLayoutManager->getElement("private:resource/menubar/menubar").is() + && xLayoutManager->isElementVisible( + "private:resource/menubar/menubar"); SfxBoolItem aItem( SID_MENUBAR, bState ); rSet.Put( aItem ); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index a76685d757e0..7c092b64fe1e 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1736,8 +1736,6 @@ std::unique_ptr<SmStructureNode> SmParser::DoUnOper() aNodeToken.cMathChar = MS_VERTLINE; std::unique_ptr<SmNode> xLeft(new SmMathSymbolNode(aNodeToken)); - - aNodeToken.cMathChar = MS_VERTLINE; std::unique_ptr<SmNode> xRight(new SmMathSymbolNode(aNodeToken)); xSNode->SetSubNodes(xLeft.release(), xArg.release(), xRight.release()); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 3a84358d7ef2..2390f17f362c 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -931,7 +931,6 @@ void FmXFormShell::disposing() m_xExternalViewController = nullptr; m_xExtViewTriggerController = nullptr; m_xExternalDisplayedForm = nullptr; - m_xLastGridFound = nullptr; InterfaceBag aEmpty; m_aCurrentSelection.swap( aEmpty ); diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 0f934039ce07..b750a25663d9 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -146,7 +146,6 @@ void ParaPropertyPanel::InitToolBoxIndent() mpFLineIndent->SetModifyHdl( aLink ); m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); - m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); } void ParaPropertyPanel::InitToolBoxSpacing() diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index f624ae2a5562..b7938a2ff57d 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -207,7 +207,6 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl SetDragWithCopy(false); //TODO: aAni.Reset(); mpCurrentSdrDragMethod=nullptr; - mbDragLimit=false; SdrDragMode eTmpMode=meDragMode; if (eTmpMode==SdrDragMode::Move && pHdl!=nullptr && pHdl->GetKind()!=SdrHdlKind::Move) { eTmpMode=SdrDragMode::Resize; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index dca356d6ad8d..93cf268e765a 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2909,8 +2909,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan (*pStreamName) >>= sStreamName; pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr); - SwFlyFrameFormat* pFrameFormat = nullptr; - pFrameFormat = pDoc->getIDocumentContentOperations().InsertOLE( aPam, sStreamName, m_nDrawAspect, &aFrameSet, nullptr ); + SwFlyFrameFormat* pFrameFormat = pDoc->getIDocumentContentOperations().InsertOLE( + aPam, sStreamName, m_nDrawAspect, &aFrameSet, nullptr); // store main document name to show in the title bar SwOLENode* pNd = nullptr; @@ -2956,9 +2956,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan OUString rName; rPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName ); - SwFlyFrameFormat* pFrameFormat = nullptr; - pFrameFormat = pDoc->getIDocumentContentOperations().InsertEmbObject( - aPam, xObj, &aFrameSet); + SwFlyFrameFormat* pFrameFormat + = pDoc->getIDocumentContentOperations().InsertEmbObject(aPam, xObj, &aFrameSet); pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); pFrameFormat->Add(this); if(!m_sName.isEmpty()) diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 8ff9fd384af8..fb7eb937a91f 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -399,12 +399,11 @@ namespace sw else { dyaHdrTop = dyaHdrBottom = 0; - dyaHdrBottom = 0; } const SvxULSpaceItem &rUL = ItemGet<SvxULSpaceItem>(rPage, RES_UL_SPACE); - dyaHdrTop = dyaHdrTop + rUL.GetUpper(); - dyaHdrBottom = dyaHdrBottom + rUL.GetLower(); + dyaHdrTop += rUL.GetUpper(); + dyaHdrBottom += rUL.GetLower(); dyaTop = dyaHdrTop; dyaBottom = dyaHdrBottom; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a6b49ccf2c5a..6914ca7ccdc8 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1382,8 +1382,8 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwTextNode *pTextNode = static_cast<SwTextNode*>(pNode); - const SwNumFormat *pNum = nullptr; - pNum = GetNumFormatFromStack( *aRegion.GetPoint(), *pTextNode ); + const SwNumFormat* pNum + = GetNumFormatFromStack(*aRegion.GetPoint(), *pTextNode); if (!pNum) { pNum = GetNumFormatFromTextNode(*pTextNode); diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index 0f3b7b170b05..9facfa8ea404 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -245,7 +245,6 @@ void SwXDispatch::dispatch(const util::URL& aURL, else if(aURL.Complete == cInternalDBChangeNotification) { frame::FeatureStateEvent aEvent; - aEvent.IsEnabled = true; aEvent.Source = *static_cast<cppu::OWeakObject*>(this); const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc(); diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx index afa1fa45c939..41b325151492 100644 --- a/vbahelper/source/vbahelper/vbacommandbar.cxx +++ b/vbahelper/source/vbahelper/vbacommandbar.cxx @@ -162,8 +162,8 @@ sal_Int32 SAL_CALL ScVbaCommandBar::Type() { // #FIXME support msoBarTypePopup - sal_Int32 nType = office::MsoBarType::msoBarTypePopup; - nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar; + sal_Int32 nType + = m_bIsMenu ? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar; return nType; } diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 170476de444f..fcd2bafbe7d8 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3808,8 +3808,8 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) if (!rCtrlData.mpDisclosureMinus) rCtrlData.mpDisclosureMinus.reset(new Image(BitmapEx(SV_DISCLOSURE_MINUS))); - Image* pImg = nullptr; - pImg = IsChecked() ? rCtrlData.mpDisclosureMinus.get() : rCtrlData.mpDisclosurePlus.get(); + Image* pImg + = IsChecked() ? rCtrlData.mpDisclosureMinus.get() : rCtrlData.mpDisclosurePlus.get(); SAL_WARN_IF(!pImg, "vcl", "no disclosure image"); if (!pImg) diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index ab208fd2231d..bc0ff8a3e53b 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -551,7 +551,6 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated) maSwapInfo.maSizePixel = aDescriptor.GetSizePixel(); } maSwapInfo.mnAnimationLoopCount = 0; - maSwapInfo.mbIsAnimated = false; maSwapInfo.mbIsEPS = false; maSwapInfo.mbIsTransparent = false; maSwapInfo.mbIsAlpha = false; diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index d96aa4776fa1..ae703aa235fc 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -3481,8 +3481,6 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg, nLastModKeyCode = ModKeyFlags::NONE; // make sure no modkey messages are sent if they belong to a hotkey (see above) aKeyEvt.mnCharCode = 0; - aKeyEvt.mnCode = 0; - aKeyEvt.mnCode = ImplSalGetKeyCode( wParam ); if ( !bKeyUp ) { @@ -4487,8 +4485,6 @@ static LRESULT ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) // Set the appropriate foreground and background colors. RECT aRect = pDI->rcItem; - clrPrevBkgnd = SetBkColor( pDI->hDC, GetSysColor( COLOR_MENU ) ); - if ( fDisabled ) clrPrevText = SetTextColor( pDI->hDC, GetSysColor( COLOR_GRAYTEXT ) ); else diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index fc836d42cc09..548caba54f48 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -666,8 +666,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const sal_Int32 /*nElement*/, SvXMLImportContext *SdXMLImport::CreateBodyContext(const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>&) { - SvXMLImportContext *pContext = nullptr; - pContext = new SdXMLBodyContext(*this, rLocalName); + SvXMLImportContext* pContext = new SdXMLBodyContext(*this, rLocalName); return pContext; } |