sw/source/filter/ww8/ww8graf.cxx | 12 +++++++----- sw/source/ui/chrdlg/swuiccoll.cxx | 11 +++++++---- sw/source/uibase/docvw/edtwin.cxx | 22 +++++++++++----------- sw/source/uibase/shells/basesh.cxx | 7 ++++--- sw/source/uibase/shells/grfsh.cxx | 9 +++++---- sw/source/uibase/utlui/tmplctrl.cxx | 4 ++-- 6 files changed, 36 insertions(+), 29 deletions(-)
New commits: commit 5a13d6146e21355803b7c803ab98143dd41b8416 Author: Michael Stahl <mst...@redhat.com> Date: Mon Nov 28 15:16:49 2016 +0100 sw ui: de-obfuscate assignments in conditions to help GCC GCC 6.2.1 with -Og produces spurious -Werror=maybe-uninitialized on variables that are assigned in conditions; perhaps it's better to de-obfuscate the code if even GCC is confused about it. Change-Id: I5276f35be773f8e7a6d27f970085f0cd00cea0aa Reviewed-on: https://gerrit.libreoffice.org/31331 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 09e6dfd..53d782b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1035,10 +1035,11 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, for( int nLoop = 0; nLoop < 2; ++nLoop ) { - const sal_uInt8* pParams; - while( aSprmIter.GetSprms() - && (nullptr != (pParams = aSprmIter.GetAktParams())) ) + while (aSprmIter.GetSprms()) { + const sal_uInt8 *const pParams(aSprmIter.GetAktParams()); + if (nullptr == pParams) + break; sal_uInt16 nAktId = aSprmIter.GetAktId(); switch( nAktId ) { @@ -2033,8 +2034,9 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord, SwFrameFormat *pFlyFormat, WW8_FSPA *pF ) { const SwNodeIndex* pIdx = pFlyFormat->GetContent(false).GetContentIdx(); - SwGrfNode* pGrfNd; - if( pIdx && nullptr != (pGrfNd = m_rDoc.GetNodes()[pIdx->GetIndex() + 1]->GetGrfNode() )) + SwGrfNode *const pGrfNd( + pIdx ? m_rDoc.GetNodes()[pIdx->GetIndex() + 1]->GetGrfNode() : nullptr); + if (pGrfNd) { Size aSz(pGrfNd->GetTwipSize()); // use type <sal_uInt64> instead of sal_uLong to get correct results diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index df1b7d0..286f0d4 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -242,11 +242,14 @@ IMPL_LINK( SwCondCollPage, AssignRemoveHdl, ListBox&, rBox, void) void SwCondCollPage::AssignRemove(void* pBtn) { SvTreeListEntry* pE = m_pTbLinks->FirstSelected(); - sal_uLong nPos; - if( !pE || LISTBOX_ENTRY_NOTFOUND == - ( nPos = m_pTbLinks->GetModel()->GetAbsPos( pE ) ) ) + if (!pE) + { + OSL_ENSURE(false, "where's the empty entry from?"); + return; + } + sal_uLong const nPos(m_pTbLinks->GetModel()->GetAbsPos(pE)); + if (LISTBOX_ENTRY_NOTFOUND == nPos) { - OSL_ENSURE( pE, "where's the empty entry from?" ); return; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8899e5b..26e5014 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4047,9 +4047,6 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) // event processing for resizing if (pSdrView && pSdrView->AreObjectsMarked()) { - const SwFrameFormat* pFlyFormat; - const SvxMacro* pMacro; - const Point aSttPt( PixelToLogic( m_aStartPos ) ); // can we start? @@ -4059,13 +4056,16 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) g_eSdrMoveHdl = pHdl ? pHdl->GetKind() : SdrHdlKind::Move; } + const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat()); + const SvxMacro* pMacro = nullptr; + sal_uInt16 nEvent = SdrHdlKind::Move == g_eSdrMoveHdl ? SW_EVENT_FRM_MOVE : SW_EVENT_FRM_RESIZE; - if( nullptr != ( pFlyFormat = rSh.GetFlyFrameFormat() ) && - nullptr != ( pMacro = pFlyFormat->GetMacro().GetMacroTable(). - Get( nEvent )) && + if (nullptr != pFlyFormat) + pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent); + if (nullptr != pMacro && // or notify only e.g. every 20 Twip? m_aRszMvHdlPt != aDocPt ) { @@ -4520,16 +4520,16 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) else { { - const SwFrameFormat* pFlyFormat; - const SvxMacro* pMacro; + const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat()); + const SvxMacro* pMacro = nullptr; sal_uInt16 nEvent = SdrHdlKind::Move == eOldSdrMoveHdl ? SW_EVENT_FRM_MOVE : SW_EVENT_FRM_RESIZE; - if( nullptr != ( pFlyFormat = rSh.GetFlyFrameFormat() ) && - nullptr != ( pMacro = pFlyFormat->GetMacro().GetMacroTable(). - Get( nEvent )) ) + if (nullptr != pFlyFormat) + pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent); + if (nullptr != pMacro) { const Point aSttPt( PixelToLogic( m_aStartPos ) ); m_aRszMvHdlPt = aDocPt; diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 3127b1f..66cc701 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1273,10 +1273,11 @@ void SwBaseShell::Execute(SfxRequest &rReq) IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void) { - GraphicType nGrfType; SwWrtShell &rSh = GetShell(); - if( CNT_GRF == rSh.SwEditShell::GetCntType() && - GraphicType::NONE != ( nGrfType = rSh.GetGraphicType() ) && + if (CNT_GRF != rSh.SwEditShell::GetCntType()) + return; + GraphicType const nGrfType(rSh.GetGraphicType()); + if (GraphicType::NONE != nGrfType && !aGrfUpdateSlots.empty() ) { bool bProtect = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 6d9b706..7b51f39 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -495,10 +495,11 @@ void SwGrfShell::Execute(SfxRequest &rReq) void SwGrfShell::ExecAttr( SfxRequest &rReq ) { - GraphicType nGrfType; - if( CNT_GRF == GetShell().GetCntType() && - ( GraphicType::Bitmap == ( nGrfType = GetShell().GetGraphicType()) || - GraphicType::GdiMetafile == nGrfType )) + GraphicType nGrfType = GraphicType::NONE; + if (CNT_GRF == GetShell().GetCntType()) + nGrfType = GetShell().GetGraphicType(); + if (GraphicType::Bitmap == nGrfType || + GraphicType::GdiMetafile == nGrfType) { SfxItemSet aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN, RES_GRFATR_END -1 ); diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx index 3578e5f..1125359 100644 --- a/sw/source/uibase/utlui/tmplctrl.cxx +++ b/sw/source/uibase/utlui/tmplctrl.cxx @@ -97,8 +97,8 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt ) ScopedVclPtrInstance<SwTemplatePopup_Impl> aPop; { SwView* pView = ::GetActiveView(); - SwWrtShell* pWrtShell; - if( pView && nullptr != (pWrtShell = pView->GetWrtShellPtr()) && + SwWrtShell *const pWrtShell(pView ? pView->GetWrtShellPtr() : nullptr); + if (nullptr != pWrtShell && !pWrtShell->SwCursorShell::HasSelection()&& !pWrtShell->IsSelFrameMode() && !pWrtShell->IsObjSelected()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits