diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-08-02 20:14:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 20:14:59 (GMT) |
commit | f2ba867b58f22809af3dfb2d087c700587835359 (patch) | |
tree | 25e8fa8f30791731170b88517965f8e8cff9fd6d /tools/src/h5dump | |
parent | d8dd57aba1cb78771ff1c86330b08453e0cc2838 (diff) | |
download | hdf5-f2ba867b58f22809af3dfb2d087c700587835359.zip hdf5-f2ba867b58f22809af3dfb2d087c700587835359.tar.gz hdf5-f2ba867b58f22809af3dfb2d087c700587835359.tar.bz2 |
Fix H5Otoken_to_str call in h5dump and other minor cleanup (#3314) (#3329)
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; |