diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-30 09:20:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-30 09:50:22 +0100 |
commit | 1c965f6aec81816170aaf8f9fa378ab6adcb91af (patch) | |
tree | 755cea02720a26578aba40736d32244ff893d64e | |
parent | 7db9fd0764dbd99c93b6fa7a368cce413f2a11da (diff) |
coverity#1411566 Unchecked dynamic_cast
and
coverity#1411567 Unchecked dynamic_cast
coverity#1411568 Unchecked dynamic_cast
coverity#1411569 Unchecked dynamic_cast
Change-Id: If1bb74941f2571ec3bdcb705bf2c9a87b54fe78d
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 22d010796da9..38e131f0b8b8 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1734,10 +1734,12 @@ void SwTiledRenderingTest::testDisableUndoRepair() SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); ViewCallback aView1; SwView* pView1 = dynamic_cast<SwView*>(SfxViewShell::Current()); + CPPUNIT_ASSERT(pView1); int nView1 = SfxLokHelper::getView(); SfxLokHelper::createView(); ViewCallback aView2; SwView* pView2 = dynamic_cast<SwView*>(SfxViewShell::Current()); + CPPUNIT_ASSERT(pView2); int nView2 = SfxLokHelper::getView(); { @@ -1756,12 +1758,14 @@ void SwTiledRenderingTest::testDisableUndoRepair() // first view, undo enabled pView1->GetState(aItemSet1); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet1.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))); + const SfxUInt32Item *pUnsetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet1.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(!pUnsetItem); // 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>(SwUndoId::CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue()); + const SfxUInt32Item *pSetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet2.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(pSetItem); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), pSetItem->GetValue()); }; // Insert a character in the first view. @@ -1782,12 +1786,14 @@ void SwTiledRenderingTest::testDisableUndoRepair() // second view, undo enabled pView2->GetState(aItemSet2); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet2.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))); + const SfxUInt32Item *pUnsetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet2.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(!pUnsetItem); // first view, undo conflict pView1->GetState(aItemSet1); CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet1.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))->GetValue()); + const SfxUInt32Item *pSetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet1.GetItem(SID_UNDO)); + CPPUNIT_ASSERT(pSetItem); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), pSetItem->GetValue()); } // Insert a character in the first view. |