[Mesh] remove superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 02:37:33 +02:00
parent f467451ae3
commit 2bde1e6923
9 changed files with 16 additions and 16 deletions

View File

@@ -730,7 +730,7 @@ void MeshFacetGrid::Validate (const MeshKernel &rclMesh)
void MeshFacetGrid::Validate ()
{
if (_pclMesh == nullptr)
if (!_pclMesh)
return;
if (_pclMesh->CountFacets() != _ulCtElements)
@@ -1072,7 +1072,7 @@ void MeshPointGrid::Validate (const MeshKernel &rclMesh)
void MeshPointGrid::Validate ()
{
if (_pclMesh == nullptr)
if (!_pclMesh)
return;
if (_pclMesh->CountPoints() != _ulCtElements)

View File

@@ -262,8 +262,8 @@ bool MeshInput::LoadSTL (std::istream &rstrIn)
boost::algorithm::to_upper(szBuf);
try {
if ((strstr(szBuf, "SOLID") == nullptr) && (strstr(szBuf, "FACET") == nullptr) && (strstr(szBuf, "NORMAL") == nullptr) &&
(strstr(szBuf, "VERTEX") == nullptr) && (strstr(szBuf, "ENDFACET") == nullptr) && (strstr(szBuf, "ENDLOOP") == nullptr)) {
if (!strstr(szBuf, "SOLID") && !strstr(szBuf, "FACET") && !strstr(szBuf, "NORMAL") &&
!strstr(szBuf, "VERTEX") && !strstr(szBuf, "ENDFACET") && !strstr(szBuf, "ENDLOOP")) {
// probably binary STL
buf->pubseekoff(0, std::ios::beg, std::ios::in);
return LoadBinarySTL(rstrIn);

View File

@@ -72,7 +72,7 @@ App::DocumentObjectExecReturn *SetOperations::execute()
Mesh::Feature *mesh1 = dynamic_cast<Mesh::Feature*>(Source1.getValue());
Mesh::Feature *mesh2 = dynamic_cast<Mesh::Feature*>(Source2.getValue());
if ((mesh1 != nullptr) && (mesh2 != nullptr)) {
if (mesh1 && mesh2) {
const MeshObject& meshKernel1 = mesh1->Mesh.getValue();
const MeshObject& meshKernel2 = mesh2->Mesh.getValue();

View File

@@ -84,7 +84,7 @@ bool DelTriangle<Real>::IsInsertionComponent (int i, DelTriangle* pkAdj,
{
for (j = 0; j < 3; j++)
{
if (A[j] != nullptr && A[j] != pkAdj)
if (A[j] && A[j] != pkAdj)
{
break;
}

View File

@@ -632,7 +632,7 @@ const char* System::GetPath (const char* acDirectory, const char* acFilename)
//----------------------------------------------------------------------------
void System::Initialize ()
{
assert(ms_pkDirectories == nullptr);
assert(!ms_pkDirectories);
ms_pkDirectories = WM4_NEW std::vector<std::string>;
const char* acWm4Path = GetEnv("WM4_PATH");
@@ -839,7 +839,7 @@ const char* System::GetEnv (const char* acEnvVarName)
getenv_s(&uiRequiredSize,ms_acEnvVar,SYSTEM_MAX_ENVVAR,acEnvVarName);
#else
char* acEnvVar = getenv(acEnvVarName);
if (acEnvVar == nullptr)
if (!acEnvVar)
{
return nullptr;
}

View File

@@ -1255,7 +1255,7 @@ DockEvaluateMeshImp* DockEvaluateMeshImp::instance()
void DockEvaluateMeshImp::destruct ()
{
if (_instance != nullptr) {
if (_instance) {
DockEvaluateMeshImp *pTmp = _instance;
_instance = nullptr;
delete pTmp;

View File

@@ -540,7 +540,7 @@ void MeshSelection::pickFaceCallback(void * ud, SoEventCallback * n)
n->getAction()->setHandled();
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No facet picked.\n");
return;
}

View File

@@ -1265,7 +1265,7 @@ std::vector<Mesh::FacetIndex> ViewProviderMesh::getFacetsOfRegion(const SbViewpo
void ViewProviderMesh::panCamera(SoCamera * cam, float aspectratio, const SbPlane & panplane,
const SbVec2f & currpos, const SbVec2f & prevpos)
{
if (cam == nullptr) // can happen for empty scenegraph
if (!cam) // can happen for empty scenegraph
return;
if (currpos == prevpos) // useless invocation
return;
@@ -1589,7 +1589,7 @@ void ViewProviderMesh::faceInfoCallback(void * ud, SoEventCallback * n)
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No facet picked.\n");
return;
}
@@ -1663,7 +1663,7 @@ void ViewProviderMesh::fillHoleCallback(void * ud, SoEventCallback * n)
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No facet picked.\n");
return;
}
@@ -1730,7 +1730,7 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No facet picked.\n");
return;
}

View File

@@ -526,7 +526,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No facet picked.\n");
return;
}
@@ -564,7 +564,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
}
else if (ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == nullptr)
if (!point)
return;
n->setHandled();