summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dump_xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump/h5dump_xml.c')
-rw-r--r--tools/h5dump/h5dump_xml.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index ee897ae..089419b 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -1958,28 +1958,32 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
H5Tclose(type);
space = H5Aget_space(obj_id);
+ if(space == H5S_NULL || space == H5S_NO_CLASS) {
+ status = SUCCEED;
+ }
+ else {
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
- for (i = 0; i < ndims; i++)
- nelmts *= size[i];
+ buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
+ HDassert(buf);
- buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
- HDassert(buf);
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ }
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- if (H5Aread(obj_id, p_type, buf) >= 0) {
- h5tools_context_t datactx;
- HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
- datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ HDfree(buf);
}
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
-
- HDfree(buf);
H5Tclose(p_type);
H5Sclose(space);
H5Tclose(type);