diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-08-02 04:14:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 04:14:32 (GMT) |
commit | 74352dfda887c2ffe336bbcea19ee978dcd2ce8c (patch) | |
tree | a92a969252db4b36819d2d42a3efa91a6d524fbc /tools/src/h5dump | |
parent | a78863a82c789ea123a21d568a26f873edbe6e7e (diff) | |
download | hdf5-74352dfda887c2ffe336bbcea19ee978dcd2ce8c.zip hdf5-74352dfda887c2ffe336bbcea19ee978dcd2ce8c.tar.gz hdf5-74352dfda887c2ffe336bbcea19ee978dcd2ce8c.tar.bz2 |
Fix H5Otoken_to_str call in h5dump and other minor cleanup (#3314)
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index da9093c..8a02a49 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -920,7 +920,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; hid_t type, space; - unsigned attr_crt_order_flags; + unsigned attr_crt_order_flags = 0; hid_t dcpl_id; /* dataset creation property list ID */ h5tools_str_t buffer; /* string into which to render */ hsize_t curr_pos = 0; /* total data element position */ @@ -947,14 +947,16 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) outputformat = &string_dataformat; if ((dcpl_id = H5Dget_create_plist(did)) < 0) { - error_msg("error in getting creation property list ID\n"); + error_msg("error in getting creation property list ID for dataset '%s'\n", name); h5tools_setstatus(EXIT_FAILURE); } /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); + if (dcpl_id >= 0) { + if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting creation properties for dataset '%s'\n", name); + h5tools_setstatus(EXIT_FAILURE); + } } /* setup */ @@ -993,7 +995,9 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did); h5dump_type_table = NULL; } - H5Pclose(dcpl_id); + + if (dcpl_id >= 0) + H5Pclose(dcpl_id); ctx.sset = sset; ctx.display_index = dump_opts.display_ai; |