sc/qa/unit/tiledrendering/tiledrendering.cxx | 9 ++++++--- sd/qa/unit/tiledrendering/tiledrendering.cxx | 15 +++++++++------ sw/qa/extras/tiledrendering/tiledrendering.cxx | 5 +++-- 3 files changed, 18 insertions(+), 11 deletions(-)
New commits: commit 6209fcbdc694ca0ef22f157d3f5c5b74ed8c76c8 Author: Caolán McNamara <[email protected]> Date: Wed Jul 5 10:40:05 2017 +0100 coverity#1414486 Unchecked dynamic_cast and coverity#1414482 Unchecked dynamic_cast coverity#1414480 Unchecked dynamic_cast coverity#1414479 Unchecked dynamic_cast Change-Id: Ia33e4cfa5c13beeae5dfa46411f526433d87ea99 Reviewed-on: https://gerrit.libreoffice.org/39568 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c90032a8c0ca..521735ebd4fc 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1389,7 +1389,9 @@ void ScTiledRenderingTest::testDisableUndoRepair() CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet1.GetItem(SID_UNDO))); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet2.GetItemState(SID_UNDO)); CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO))); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO))->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(aSet2.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); } // text edit a cell in view #2 @@ -1407,8 +1409,9 @@ void ScTiledRenderingTest::testDisableUndoRepair() pView1->GetSlotState(SID_UNDO, nullptr, &aSet1); pView2->GetSlotState(SID_UNDO, nullptr, &aSet2); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet1.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO))); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO))->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(aSet1.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet2.GetItemState(SID_UNDO)); CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet2.GetItem(SID_UNDO))); } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 0ff3e16717c1..715b444e5262 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1196,8 +1196,9 @@ void SdTiledRenderingTest::testUndoLimiting() SfxRequest aReq2(SID_UNDO, SfxCallMode::SLOT, pXImpressDocument->GetDocShell()->GetDoc()->GetPool()); aReq2.AppendItem(SfxUInt16Item(SID_UNDO, 1)); pViewShell2->ExecuteSlot(aReq2); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aReq2.GetReturnValue())); - CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(aReq2.GetReturnValue())->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(aReq2.GetReturnValue()); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); } // Now check view1 can undo action @@ -1800,8 +1801,9 @@ void SdTiledRenderingTest::testDisableUndoRepair() pView1->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem1); pView2->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem2); CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item* >(pItem1.get())); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(pItem2.get())); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(pItem2.get())->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(pItem2.get()); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); } // Insert a character in the second view. @@ -1818,8 +1820,9 @@ void SdTiledRenderingTest::testDisableUndoRepair() pView1->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem1); pView2->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem2); CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item* >(pItem2.get())); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(pItem1.get())); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(pItem1.get())->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(pItem1.get()); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); } } diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 8bf0f359c288..1d5926c33a88 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1740,8 +1740,9 @@ void checkUndoRepairStates(SwXTextDocument* pXTextDocument, SwView* pView1, SwVi // second view, undo conflict pView2->GetState(aItemSet2); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet2.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue()); + const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item*>(aItemSet2.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(pUInt32Item); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); }; }
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
