summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-07-11 17:27:40 (GMT)
committerGitHub <noreply@github.com>2022-07-11 17:27:40 (GMT)
commit0412d3f292b255da700d865fd1eb990e05c038bb (patch)
tree1d4ad4ab8d32b0452a30abae4c52ebd9fed17f43 /tools
parentfa7caf843508b250f085e88cf5edfc2606da1205 (diff)
downloadhdf5-0412d3f292b255da700d865fd1eb990e05c038bb.zip
hdf5-0412d3f292b255da700d865fd1eb990e05c038bb.tar.gz
hdf5-0412d3f292b255da700d865fd1eb990e05c038bb.tar.bz2
Fixes for production mode gcc warnings (#1873)
* Fixes for production mode gcc warnings With the strict-overflow changes, this brings the number of warnings in the C library w/ gcc 12 to zero. * Fix typo * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/src/h5dump/h5dump_ddl.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index b0bce0c..939e5fe 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -1709,27 +1709,39 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* dimensions */
if (!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
- sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->start.len = ndims;
+ if (ndims > 0)
+ sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ else
+ sset->start.data = NULL;
+ sset->start.len = ndims;
}
if (!sset->stride.data) {
- sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->stride.len = ndims;
+ if (ndims > 0)
+ sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ else
+ sset->stride.data = NULL;
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
sset->stride.data[i] = 1;
}
if (!sset->count.data) {
- sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->count.len = ndims;
+ if (ndims > 0)
+ sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ else
+ sset->count.data = NULL;
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
sset->count.data[i] = 1;
}
if (!sset->block.data) {
- sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->block.len = ndims;
+ if (ndims > 0)
+ sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ else
+ sset->block.data = NULL;
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
sset->block.data[i] = 1;
}