From 3feb65096a5dbb2b9713293a997754f0257223b5 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 6 Apr 2019 23:31:55 +0300 Subject: tdf#120703 PVS: Silence V522 warnings V522 There might be dereferencing of a potential null pointer. Change-Id: I680f1628133216de6336ac5ffa846447ffd55a41 Reviewed-on: https://gerrit.libreoffice.org/70352 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- basic/source/runtime/dllmgr-x64.cxx | 18 ++++++++++++------ basic/source/runtime/dllmgr-x86.cxx | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'basic') diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index 4c5973fdc919..a56aeee2726a 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -159,8 +159,9 @@ std::size_t alignment(SbxVariable const * variable) { case SbxOBJECT: { std::size_t n = 1; - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { n = std::max(n, alignment(props->Get(i))); } @@ -175,6 +176,7 @@ std::size_t alignment(SbxVariable const * variable) { } } else { SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); for (int i = 0; i < dims; ++i) { @@ -210,8 +212,9 @@ ErrCode marshalStruct( MarshalData & data) { OSL_ASSERT(variable != nullptr); - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { ErrCode e = marshal(false, props->Get(i), false, blob, offset, data); if (e != ERRCODE_NONE) { @@ -227,6 +230,7 @@ ErrCode marshalArray( { OSL_ASSERT(variable != nullptr); SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); std::vector< sal_Int32 > up(dims); @@ -402,8 +406,9 @@ void const * unmarshal(SbxVariable * variable, void const * data) { align( reinterpret_cast< sal_uIntPtr >(data), alignment(variable))); - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { data = unmarshal(props->Get(i), data); } @@ -421,6 +426,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) { } } else { SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); std::vector< sal_Int32 > up(dims); diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx index 347f9ad4067d..74b470da2e04 100644 --- a/basic/source/runtime/dllmgr-x86.cxx +++ b/basic/source/runtime/dllmgr-x86.cxx @@ -166,8 +166,9 @@ std::size_t alignment(SbxVariable * variable) { case SbxOBJECT: { std::size_t n = 1; - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { n = std::max(n, alignment(props->Get(i))); } @@ -182,6 +183,7 @@ std::size_t alignment(SbxVariable * variable) { } } else { SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); for (int i = 0; i < dims; ++i) { @@ -218,8 +220,9 @@ ErrCode marshalStruct( MarshalData & data) { OSL_ASSERT(variable != 0); - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { ErrCode e = marshal(false, props->Get(i), false, blob, offset, data); if (e != ERRCODE_NONE) { @@ -235,6 +238,7 @@ ErrCode marshalArray( { OSL_ASSERT(variable != 0); SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); std::vector< sal_Int32 > up(dims); @@ -410,8 +414,9 @@ void const * unmarshal(SbxVariable * variable, void const * data) { align( reinterpret_cast< sal_uIntPtr >(data), alignment(variable))); - SbxArray * props = dynamic_cast( variable->GetObject() )-> - GetProperties(); + SbxObject* pobj = dynamic_cast(variable->GetObject()); + assert(pobj); + SbxArray* props = pobj->GetProperties(); for (sal_uInt16 i = 0; i < props->Count(); ++i) { data = unmarshal(props->Get(i), data); } @@ -429,6 +434,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) { } } else { SbxDimArray * arr = dynamic_cast( variable->GetObject() ); + assert(arr); int dims = arr->GetDims(); std::vector< sal_Int32 > low(dims); std::vector< sal_Int32 > up(dims); -- cgit