[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;
}