chart2/source/controller/main/ChartController.cxx          |    3 ++-
 chart2/source/controller/main/ChartController_TextEdit.cxx |    6 +++---
 chart2/source/controller/main/ChartController_Window.cxx   |    3 ++-
 cli_ure/source/uno_bridge/cli_data.cxx                     |    2 +-
 codemaker/source/cppumaker/cpputype.cxx                    |    3 ++-
 cppu/source/uno/copy.hxx                                   |    7 +++++++
 drawinglayer/source/primitive2d/baseprimitive2d.cxx        |    8 +-------
 drawinglayer/source/primitive3d/baseprimitive3d.cxx        |    8 +-------
 editeng/qa/unit/core-test.cxx                              |    5 +++++
 javaunohelper/source/bootstrap.cxx                         |    1 +
 sal/osl/w32/backtrace.cxx                                  |    2 ++
 sc/source/core/tool/chgtrack.cxx                           |    5 +++--
 sc/source/ui/pagedlg/areasdlg.cxx                          |    6 +++---
 soltools/cpp/_tokens.c                                     |    2 ++
 sw/source/core/access/accfrmobj.cxx                        |    4 ++--
 sw/source/core/crsr/annotationmark.cxx                     |    5 +++--
 sw/source/core/txtnode/atrfld.cxx                          |   10 ++++++----
 sw/source/uibase/app/apphdl.cxx                            |    3 +--
 unodevtools/source/skeletonmaker/cpptypemaker.cxx          |    6 ++++--
 winaccessibility/source/service/AccFrameEventListener.cxx  |    4 ++--
 winaccessibility/source/service/AccObjectWinManager.cxx    |    5 ++---
 21 files changed, 55 insertions(+), 43 deletions(-)

New commits:
commit 85456fae54029edd26df2277a9eec5e2fe3d9739
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Apr 1 00:25:16 2019 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Apr 1 00:49:12 2019 +0200

    tdf#120703 PVS: Silence V522 warnings
    
    V522 There might be dereferencing of a potential null pointer.
    
    Change-Id: Ie617b41a8f8d334022cf5313b242a236baedba48
    Reviewed-on: https://gerrit.libreoffice.org/70017
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/chart2/source/controller/main/ChartController.cxx 
b/chart2/source/controller/main/ChartController.cxx
index bffd841f415d..533029f3024a 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -396,7 +396,8 @@ void SAL_CALL ChartController::attachFrame(
     uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
     if (xSidebar.is())
     {
-        sfx2::sidebar::SidebarController* pSidebar = 
dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
+        
assert(dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get()));
+        auto pSidebar = 
static_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
         sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, 
this);
         pSidebar->updateModel(getModel());
         css::lang::EventObject aEvent;
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx 
b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 71f9f02a28b3..a8148e3929b8 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -174,9 +174,9 @@ void 
ChartController::executeDispatch_InsertSpecialCharacter()
         const SfxItemSet* pSet = pDlg->GetOutputItemSet();
         const SfxPoolItem* pItem=nullptr;
         OUString aString;
-        if ( pSet && pSet->GetItemState( SID_CHARMAP, true, &pItem) == 
SfxItemState::SET &&
-             dynamic_cast< const SfxStringItem* >(pItem) !=  nullptr )
-                aString = dynamic_cast<const 
SfxStringItem*>(pItem)->GetValue();
+        if (pSet && pSet->GetItemState(SID_CHARMAP, true, &pItem) == 
SfxItemState::SET)
+            if (auto pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
+                aString = pStringItem->GetValue();
 
         OutlinerView* pOutlinerView = 
m_pDrawViewWrapper->GetTextEditOutlinerView();
         SdrOutliner*  pOutliner = m_pDrawViewWrapper->getOutliner();
diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index d2c7dfbd69a3..06e870dc05ae 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -852,7 +852,8 @@ void ChartController::execute_MouseButtonUp( const 
MouseEvent& rMEvt )
                             m_xUndoManager );
 
                         bool bChanged = false;
-                        ChartModel* pModel = 
dynamic_cast<ChartModel*>(getModel().get());
+                        assert(dynamic_cast<ChartModel*>(getModel().get()));
+                        ChartModel* pModel = 
static_cast<ChartModel*>(getModel().get());
                         if ( eObjectType == OBJECTTYPE_LEGEND )
                             bChanged = 
DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , 
true );
 
diff --git a/cli_ure/source/uno_bridge/cli_data.cxx 
b/cli_ure/source/uno_bridge/cli_data.cxx
index 722536a3057d..16f7047a80dd 100644
--- a/cli_ure/source/uno_bridge/cli_data.cxx
+++ b/cli_ure/source/uno_bridge/cli_data.cxx
@@ -1330,7 +1330,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ 
cli_data,
                             {
                                 void * p= ((uno_Sequence *) 
seq.get())->elements +
                                     (nPos * element_td.get()->nSize);
-                                System::Object^ elemData= 
dynamic_cast<System::Array^>(cli_data)->GetValue(nPos);
+                                System::Object^ elemData= 
safe_cast<System::Array^>(cli_data)->GetValue(nPos);
                                 map_to_uno(
                                     p, elemData, element_td.get()->pWeakRef,
                                     false /* no assign */);
diff --git a/codemaker/source/cppumaker/cpputype.cxx 
b/codemaker/source/cppumaker/cpputype.cxx
index 4b3face0c702..0dcd8a047037 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -527,8 +527,9 @@ void CppuType::dumpInitializer(
                 out << "0";
                 break;
             case codemaker::UnoType::Sort::Enum:
+                assert(dynamic_cast<unoidl::EnumTypeEntity*>(ent.get()));
                 out << codemaker::cpp::scopedCppName(u2b(n)) << "_"
-                    << (dynamic_cast< unoidl::EnumTypeEntity * >(ent.get())->
+                    << (static_cast<unoidl::EnumTypeEntity*>(ent.get())->
                         getMembers()[0].name);
                 break;
             case codemaker::UnoType::Sort::String:
diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx
index 79c738f7f37b..b0811b5fab10 100644
--- a/cppu/source/uno/copy.hxx
+++ b/cppu/source/uno/copy.hxx
@@ -21,6 +21,7 @@
 
 #include "prim.hxx"
 #include "constr.hxx"
+#include <cassert>
 #include <cstdlib>
 
 namespace cppu
@@ -138,6 +139,7 @@ inline void _copyConstructAnyFromData(
             pDestAny->pData = &pDestAny->pReserved;
         else
             pDestAny->pData = std::malloc( sizeof(sal_Int64) );
+        assert(pDestAny->pData);
         *static_cast<sal_Int64 *>(pDestAny->pData) = *static_cast<sal_Int64 
*>(pSource);
         break;
     case typelib_TypeClass_FLOAT:
@@ -145,6 +147,7 @@ inline void _copyConstructAnyFromData(
             pDestAny->pData = &pDestAny->pReserved;
         else
             pDestAny->pData = std::malloc( sizeof(float) );
+        assert(pDestAny->pData);
         *static_cast<float *>(pDestAny->pData) = *static_cast<float 
*>(pSource);
         break;
     case typelib_TypeClass_DOUBLE:
@@ -152,6 +155,7 @@ inline void _copyConstructAnyFromData(
             pDestAny->pData = &pDestAny->pReserved;
         else
             pDestAny->pData = std::malloc( sizeof(double) );
+        assert(pDestAny->pData);
         *static_cast<double *>(pDestAny->pData) = *static_cast<double 
*>(pSource);
         break;
     case typelib_TypeClass_STRING:
@@ -297,6 +301,7 @@ inline void _copyConstructAny(
                     pDestAny->pData = &pDestAny->pReserved;
                 else
                     pDestAny->pData = std::malloc( sizeof(sal_Int64) );
+                assert(pDestAny->pData);
                 *static_cast<sal_Int64 *>(pDestAny->pData) = 0;
                 break;
             case typelib_TypeClass_FLOAT:
@@ -304,6 +309,7 @@ inline void _copyConstructAny(
                     pDestAny->pData = &pDestAny->pReserved;
                 else
                     pDestAny->pData = std::malloc( sizeof(float) );
+                assert(pDestAny->pData);
                 *static_cast<float *>(pDestAny->pData) = 0.0;
                 break;
             case typelib_TypeClass_DOUBLE:
@@ -311,6 +317,7 @@ inline void _copyConstructAny(
                     pDestAny->pData = &pDestAny->pReserved;
                 else
                     pDestAny->pData = std::malloc( sizeof(double) );
+                assert(pDestAny->pData);
                 *static_cast<double *>(pDestAny->pData) = 0.0;
                 break;
             case typelib_TypeClass_STRING:
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 9646add14cf6..17ad2de6e06f 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -219,14 +219,8 @@ namespace drawinglayer
 
             const BasePrimitive2D* pA(dynamic_cast< const BasePrimitive2D* 
>(rxA.get()));
             const BasePrimitive2D* pB(dynamic_cast< const BasePrimitive2D* 
>(rxB.get()));
-            const bool bAEqualZero(pA == nullptr);
 
-            if(bAEqualZero != (pB == nullptr))
-            {
-                return false;
-            }
-
-            if(bAEqualZero)
+            if (!pA || !pB)
             {
                 return false;
             }
diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx 
b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
index 828e4fdcf14c..3e184400f612 100644
--- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
@@ -166,14 +166,8 @@ namespace drawinglayer
 
             const BasePrimitive3D* pA(dynamic_cast< const BasePrimitive3D* 
>(rxA.get()));
             const BasePrimitive3D* pB(dynamic_cast< const BasePrimitive3D* 
>(rxB.get()));
-            const bool bAEqualZero(pA == nullptr);
 
-            if(bAEqualZero != (pB == nullptr))
-            {
-                return false;
-            }
-
-            if(bAEqualZero)
+            if(!pA || !pB)
             {
                 return false;
             }
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 020a5a32d7aa..b5369c2e0603 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -617,6 +617,7 @@ void Test::testHyperlinkCopyPaste()
     CPPUNIT_ASSERT_EQUAL( sal_Int32(13), aURLFieldInfo1.aPosition.nIndex );
     CPPUNIT_ASSERT_EQUAL( sal_uInt16(EE_FEATURE_FIELD), 
aURLFieldInfo1.pFieldItem->Which() );
     SvxURLField* pURLField1 = dynamic_cast<SvxURLField*> ( 
const_cast<SvxFieldData*> (aURLFieldInfo1.pFieldItem->GetField()) );
+    CPPUNIT_ASSERT(pURLField1);
     CPPUNIT_ASSERT_EQUAL( aURL1, pURLField1->GetURL() );
     CPPUNIT_ASSERT_EQUAL( aRepres1, pURLField1->GetRepresentation() );
 
@@ -625,6 +626,7 @@ void Test::testHyperlinkCopyPaste()
     CPPUNIT_ASSERT_EQUAL( sal_Int32(21), aURLFieldInfo2.aPosition.nIndex );
     CPPUNIT_ASSERT_EQUAL( sal_uInt16(EE_FEATURE_FIELD), 
aURLFieldInfo2.pFieldItem->Which() );
     SvxURLField* pURLField2 = dynamic_cast<SvxURLField*> ( 
const_cast<SvxFieldData*> (aURLFieldInfo2.pFieldItem->GetField()) );
+    CPPUNIT_ASSERT(pURLField2);
     CPPUNIT_ASSERT_EQUAL( aURL2, pURLField2->GetURL() );
     CPPUNIT_ASSERT_EQUAL( aRepres2, pURLField2->GetRepresentation() );
 
@@ -652,6 +654,7 @@ void Test::testHyperlinkCopyPaste()
     CPPUNIT_ASSERT_EQUAL( sal_Int32(13), aACPURLFieldInfo1.aPosition.nIndex );
     CPPUNIT_ASSERT_EQUAL( sal_uInt16(EE_FEATURE_FIELD), 
aACPURLFieldInfo1.pFieldItem->Which() );
     SvxURLField* pACPURLField1 = dynamic_cast<SvxURLField*> ( 
const_cast<SvxFieldData*> (aACPURLFieldInfo1.pFieldItem->GetField()) );
+    CPPUNIT_ASSERT(pACPURLField1);
     CPPUNIT_ASSERT_EQUAL( aURL1, pACPURLField1->GetURL() );
     CPPUNIT_ASSERT_EQUAL( aRepres1, pACPURLField1->GetRepresentation() );
 
@@ -660,6 +663,7 @@ void Test::testHyperlinkCopyPaste()
     CPPUNIT_ASSERT_EQUAL( sal_Int32(21), aACPURLFieldInfo2.aPosition.nIndex );
     CPPUNIT_ASSERT_EQUAL( sal_uInt16(EE_FEATURE_FIELD), 
aACPURLFieldInfo2.pFieldItem->Which() );
     SvxURLField* pACPURLField2 = dynamic_cast<SvxURLField*> ( 
const_cast<SvxFieldData*> (aACPURLFieldInfo2.pFieldItem->GetField()) );
+    CPPUNIT_ASSERT(pACPURLField2);
     CPPUNIT_ASSERT_EQUAL( aURL2, pACPURLField2->GetURL() );
     CPPUNIT_ASSERT_EQUAL( aRepres2, pACPURLField2->GetRepresentation() )    ;
 
@@ -668,6 +672,7 @@ void Test::testHyperlinkCopyPaste()
     CPPUNIT_ASSERT_EQUAL( sal_Int32(38), aACPURLFieldInfo3.aPosition.nIndex );
     CPPUNIT_ASSERT_EQUAL( sal_uInt16(EE_FEATURE_FIELD), 
aACPURLFieldInfo3.pFieldItem->Which() );
     SvxURLField* pACPURLField3 = dynamic_cast<SvxURLField*> ( 
const_cast<SvxFieldData*> (aACPURLFieldInfo3.pFieldItem->GetField()) );
+    CPPUNIT_ASSERT(pACPURLField3);
     CPPUNIT_ASSERT_EQUAL( aURL1, pACPURLField3->GetURL() );
     CPPUNIT_ASSERT_EQUAL( aRepres1, pACPURLField3->GetRepresentation() );
 }
diff --git a/javaunohelper/source/bootstrap.cxx 
b/javaunohelper/source/bootstrap.cxx
index 442dd00ef2c5..8d593ce54112 100644
--- a/javaunohelper/source/bootstrap.cxx
+++ b/javaunohelper/source/bootstrap.cxx
@@ -55,6 +55,7 @@ static OUString jstring_to_oustring( jstring jstr, JNIEnv * 
jni_env )
     jsize len = jni_env->GetStringLength( jstr );
     rtl_uString * ustr =
         static_cast<rtl_uString *>(std::malloc( sizeof (rtl_uString) + (len * 
sizeof (sal_Unicode)) ));
+    assert(ustr);
     jni_env->GetStringRegion( jstr, 0, len, reinterpret_cast<jchar 
*>(ustr->buffer) );
     OSL_ASSERT( !jni_env->ExceptionCheck() );
     ustr->refCount = 1;
diff --git a/sal/osl/w32/backtrace.cxx b/sal/osl/w32/backtrace.cxx
index 160d4e7d0207..9e31616eaaff 100644
--- a/sal/osl/w32/backtrace.cxx
+++ b/sal/osl/w32/backtrace.cxx
@@ -55,6 +55,7 @@ OUString osl::detail::backtraceAsString(sal_uInt32 maxDepth)
 
     SYMBOL_INFO  * pSymbol;
     pSymbol = static_cast<SYMBOL_INFO *>(calloc( sizeof( SYMBOL_INFO ) + 1024 
* sizeof( char ), 1 ));
+    assert(pSymbol);
     pSymbol->MaxNameLen = 1024 - 1;
     pSymbol->SizeOfStruct = sizeof( SYMBOL_INFO );
 
@@ -99,6 +100,7 @@ OUString sal::backtrace_to_string(BacktraceState* 
backtraceState)
 
     SYMBOL_INFO  * pSymbol;
     pSymbol = static_cast<SYMBOL_INFO *>(calloc( sizeof( SYMBOL_INFO ) + 1024 
* sizeof( char ), 1 ));
+    assert(pSymbol);
     pSymbol->MaxNameLen = 1024 - 1;
     pSymbol->SizeOfStruct = sizeof( SYMBOL_INFO );
     HANDLE hProcess = GetCurrentProcess();
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index f25d6bb27bbc..5f165aab0172 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -4483,8 +4483,9 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* 
pDocument ) const
                 break;
             case SC_CAT_MOVE:
                 {
-                    const ScChangeActionMove* pMove = dynamic_cast< const 
ScChangeActionMove* >( pAction );
-                    OSL_ENSURE( pMove, "ScChangeTrack::Clone: pMove is null!" 
);
+                    assert(dynamic_cast<const ScChangeActionMove*>(pAction)
+                           && "ScChangeTrack::Clone: pMove is null!");
+                    auto pMove = static_cast<const 
ScChangeActionMove*>(pAction);
 
                     pClonedAction = new ScChangeActionMove(
                         pAction->GetActionNumber(),
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx 
b/sc/source/ui/pagedlg/areasdlg.cxx
index 6b46dd41790b..de0196609adf 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -124,9 +124,9 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, 
SfxChildWindow* pCW, vcl::Win
     get(pBtnCancel,"cancel");
 
     ScTabViewShell* pScViewSh = dynamic_cast<ScTabViewShell*>( 
SfxViewShell::Current()  );
-    ScDocShell*     pScDocSh  = dynamic_cast<ScDocShell*>(     
SfxObjectShell::Current()  );
-
-    OSL_ENSURE( pScDocSh, "Current DocumentShell not found :-(" );
+    SfxObjectShell* pSfxObjSh = SfxObjectShell::Current();
+    assert(dynamic_cast<ScDocShell*>(pSfxObjSh) && "Current DocumentShell not 
found :-(");
+    ScDocShell* pScDocSh = static_cast<ScDocShell*>(pSfxObjSh);
 
     pDoc = &pScDocSh->GetDocument();
 
diff --git a/soltools/cpp/_tokens.c b/soltools/cpp/_tokens.c
index cb0beecf991d..c095ca6c6b9d 100644
--- a/soltools/cpp/_tokens.c
+++ b/soltools/cpp/_tokens.c
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -217,6 +218,7 @@ Token *
 
     trp->max = 3 * trp->max / 2 + 1;
     trp->bp = (Token *) realloc(trp->bp, trp->max * sizeof(Token));
+    assert(trp->bp); // realloc failure is OOM -> no point to handle
     trp->lp = &trp->bp[nlast];
     trp->tp = &trp->bp[ncur];
     return trp->lp;
diff --git a/sw/source/core/access/accfrmobj.cxx 
b/sw/source/core/access/accfrmobj.cxx
index 3057d226957f..5923eb11f2a4 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -244,11 +244,11 @@ SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& 
rAccMap ) const
     }
     else if( mpDrawObj )
     {
-        SwDrawContact const*const pContact(dynamic_cast<SwDrawContact 
const*>(::GetUserCall(mpDrawObj)));
+        const SwContact* const pContact = ::GetUserCall(mpDrawObj);
         // assume that a) the SwVirt* objects that don't have this are handled
         // by the mpFrame case above b) for genuine SdrObject this must be set
         // if it's connected to layout
-        assert(pContact);
+        assert(dynamic_cast<SwDrawContact const*>(pContact));
         SwPageFrame const*const pPage(const_cast<SwAnchoredObject *>(
             pContact->GetAnchoredObj(mpDrawObj))->FindPageFrameOfAnchor());
         if (pPage) // may end up here with partial layout -> not visible
diff --git a/sw/source/core/crsr/annotationmark.cxx 
b/sw/source/core/crsr/annotationmark.cxx
index 280193f4b3b9..7ba754b1d931 100644
--- a/sw/source/core/crsr/annotationmark.cxx
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -56,8 +56,9 @@ namespace sw { namespace mark
         SwTextField *const pTextField = pTextNode->GetFieldTextAttrAt(
             GetMarkEnd().nContent.GetIndex()-1, true);
         assert(pTextField != nullptr);
-        const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* 
>(pTextField->GetFormatField().GetField());
-        assert(pPostItField != nullptr);
+        const SwField* pField = pTextField->GetFormatField().GetField();
+        assert(dynamic_cast<const SwPostItField*>(pField));
+        const SwPostItField* pPostItField = static_cast<const 
SwPostItField*>(pField);
         // use the annotation mark's name as the annotation name, if
         // - the annotation field has an empty annotation name or
         // - the annotation mark's name differs (on mark creation a name clash 
had been detected)
diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index 3feaa1ea6e6f..cb7ec4c52323 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -582,8 +582,9 @@ void SwTextInputField::UpdateFieldContent()
         const sal_Int32 nLen = static_cast<sal_Int32>(std::max<sal_Int32>( 0, 
( (*End()) - 1 - nIdx ) ));
         const OUString aNewFieldContent = GetTextNode().GetExpandText(nullptr, 
nIdx, nLen);
 
-        const SwInputField* pInputField = dynamic_cast<const 
SwInputField*>(GetFormatField().GetField());
-        assert(pInputField != nullptr);
+        const SwField* pField = GetFormatField().GetField();
+        assert(dynamic_cast<const SwInputField*>(pField));
+        const SwInputField* pInputField = static_cast<const 
SwInputField*>(pField);
         const_cast<SwInputField*>(pInputField)->applyFieldContent( 
aNewFieldContent );
         // trigger update of fields for scenarios in which the Input Field's 
content is part of e.g. a table formula
         
GetTextNode().GetDoc()->getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty(true);
@@ -623,8 +624,9 @@ SwTextAnnotationField::~SwTextAnnotationField()
 
 ::sw::mark::IMark* SwTextAnnotationField::GetAnnotationMark() const
 {
-    const SwPostItField* pPostItField = dynamic_cast<const 
SwPostItField*>(GetFormatField().GetField());
-    assert(pPostItField != nullptr);
+    const SwField* pField = GetFormatField().GetField();
+    assert(dynamic_cast<const SwPostItField*>(pField));
+    const SwPostItField* pPostItField = static_cast<const 
SwPostItField*>(pField);
 
     SwDoc* pDoc = static_cast<const 
SwPostItFieldType*>(pPostItField->GetTyp())->GetDoc();
     assert(pDoc != nullptr);
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 0288b37d61b4..9e52c5b00b29 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -323,9 +323,8 @@ SwView* lcl_LoadDoc(SwView* pView, const OUString& rURL)
             SfxViewShell* pViewShell = pShell->GetViewShell();
             if(pViewShell)
             {
-                if( nullptr!= dynamic_cast<SwView*>(pViewShell) )
+                if ((pNewView = dynamic_cast<SwView*>(pViewShell)))
                 {
-                    pNewView = dynamic_cast< SwView* >(pViewShell);
                     pNewView->GetViewFrame()->GetFrame().Appear();
                 }
                 else
diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx 
b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
index 21c336ba02ad..92a2db00c4b5 100644
--- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
@@ -64,8 +64,9 @@ static void printType(
 
     if (defaultvalue && referenceType == 16) {
         if (sort == codemaker::UnoType::Sort::Enum) {
+            assert(dynamic_cast<unoidl::EnumTypeEntity *>(entity.get()));
             o << nucleus.copy(nucleus.lastIndexOf('.') + 1) << "_"
-              << dynamic_cast< unoidl::EnumTypeEntity * >(entity.get())->
+              << static_cast<unoidl::EnumTypeEntity*>(entity.get())->
                 getMembers()[0].name;
         }
         return;
@@ -926,9 +927,10 @@ void generateDocumentation(std::ostream & o,
                 o << "; construction methods:\n";
                 printConstructors(o, options, manager, nucleus);
             }
+            
assert(dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity*>(entity.get()));
             generateDocumentation(
                 o, options, manager,
-                u2b(dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * 
>(
+                u2b(static_cast<unoidl::SingleInterfaceBasedServiceEntity*>(
                         entity.get())->getBase()),
                 delegate);
             break;
diff --git a/winaccessibility/source/service/AccFrameEventListener.cxx 
b/winaccessibility/source/service/AccFrameEventListener.cxx
index 8f7a6bc32753..cf1968d65032 100644
--- a/winaccessibility/source/service/AccFrameEventListener.cxx
+++ b/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -85,8 +85,8 @@ void AccFrameEventListener::HandleChildChangedEvent(Any 
oldValue, Any newValue)
         {
             XAccessible* pAcc = xChild.get();
 
-            VCLXWindow* pvclwindow =
-                dynamic_cast<VCLXWindow*>(m_xAccessible.get());
+            assert(dynamic_cast<VCLXWindow*>(m_xAccessible.get()));
+            VCLXWindow* pvclwindow = 
static_cast<VCLXWindow*>(m_xAccessible.get());
             const SystemEnvData* systemdata
                 = pvclwindow->GetWindow()->GetSystemData();
 
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx 
b/winaccessibility/source/service/AccObjectWinManager.cxx
index 90714dea6339..72774cf42d37 100644
--- a/winaccessibility/source/service/AccObjectWinManager.cxx
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -111,9 +111,8 @@ AccObjectWinManager::Get_ToATInterface(HWND hWnd, long 
lParam, WPARAM wParam)
 
     if ( pRetIMAcc && lParam == OBJID_CLIENT )
     {
-        IAccessible* pTemp = dynamic_cast<IAccessible*>( pRetIMAcc );
-        LRESULT result = LresultFromObject(IID_IAccessible, wParam, pTemp);
-        pTemp->Release();
+        LRESULT result = LresultFromObject(IID_IAccessible, wParam, pRetIMAcc);
+        pRetIMAcc->Release();
         return result;
     }
     return 0;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to