summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2021-08-23 21:14:53 (GMT)
committerGitHub <noreply@github.com>2021-08-23 21:14:53 (GMT)
commitf6c49fe8911a39810b236f7babf09a70fcc76c7b (patch)
tree4ee702ab548adf8e619525e14716dde7d26bb331 /c++
parentb5f5c59f297be19096051282068cdcc14275eb34 (diff)
downloadhdf5-f6c49fe8911a39810b236f7babf09a70fcc76c7b.zip
hdf5-f6c49fe8911a39810b236f7babf09a70fcc76c7b.tar.gz
hdf5-f6c49fe8911a39810b236f7babf09a70fcc76c7b.tar.bz2
More clang tidy (#908)
* Pacify clang-analyzer-unix.cstring.NullArg * Apply some bugprone-suspicious-string-compare * Apply some readability-simplify-boolean-expr * Apply some readability-make-member-function-const * Apple some bugprone-macro-parentheses * Changed an f suffix to L for `long double` * Applied some readability-uppercase-literal-suffix automatically * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5DataType.cpp5
-rw-r--r--c++/src/H5IdComponent.cpp5
-rw-r--r--c++/test/tattr.cpp18
-rw-r--r--c++/test/ttypes.cpp2
4 files changed, 12 insertions, 18 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index b00a526..af58a90 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -338,10 +338,7 @@ DataType::encode()
bool
DataType::hasBinaryDesc() const
{
- if (encoded_buf != NULL)
- return true;
- else
- return false;
+ return encoded_buf != NULL;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index d546d32..e1fc687 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -432,10 +432,7 @@ IdComponent::p_valid_id(const hid_t obj_id)
return false;
H5I_type_t id_type = H5Iget_type(obj_id);
- if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
- return false;
- else
- return true;
+ return (id_type > H5I_BADID && id_type < H5I_NTYPES);
}
// Notes about IdComponent::id
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index 35db334..26699d2 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -285,7 +285,7 @@ test_attr_getname()
// Check for existence of attribute FATTR1_NAME
bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open attribute
@@ -361,7 +361,7 @@ test_attr_getname()
// Check for existence of attribute
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open attribute
@@ -410,7 +410,7 @@ test_attr_rename()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Change attribute name
@@ -436,7 +436,7 @@ test_attr_rename()
// Check for existence of attribute
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Change attribute name
@@ -464,7 +464,7 @@ test_attr_rename()
// Check for existence of second attribute
attr_exists = dataset.attrExists(ATTR2_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open the second attribute
@@ -492,7 +492,7 @@ test_attr_rename()
// Check for existence of attribute after renaming
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
PASSED();
@@ -1681,13 +1681,13 @@ test_attr_exists()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
// Check for existence of attribute
attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"fid1,FATTR2_NAMEAttribute should exist but does not");
@@ -1696,7 +1696,7 @@ test_attr_exists()
// Check for existence of attribute
attr_exists = group.attrExists(ATTR2_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"group, ATTR2_NAMEAttribute should exist but does not");
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index 1cedef6..69c93d1 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -699,7 +699,7 @@ test_named()
}
// Check that it is committed.
- if (itype.committed() == false)
+ if (!itype.committed())
cerr << "IntType::committed() returned false" << endl;
// We should not be able to modify a type after it has been committed.