diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-03-09 19:02:15 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-03-09 19:02:24 (GMT) |
commit | 2e3313e3d82cb965842e1c65c594c9f446100b7d (patch) | |
tree | a412dffe721db3a74e5399cf81fa134bf2b2235f /tools/lib | |
parent | b765eca684dcc60600d0e72572cb58872acc2aec (diff) | |
download | hdf5-2e3313e3d82cb965842e1c65c594c9f446100b7d.zip hdf5-2e3313e3d82cb965842e1c65c594c9f446100b7d.tar.gz hdf5-2e3313e3d82cb965842e1c65c594c9f446100b7d.tar.bz2 |
Check sizeof type to use correct ref_type
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools_dump.c | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index f9560a0..d963a2f 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3749,34 +3749,17 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_sprint(&buffer, &outputformat, obj_id, f_type, memref, &datactx); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - if ((region_id = H5Rdereference(obj_id, H5R_OBJECT, memref)) >= 0) { - datactx.indent_level++; - h5tools_dump_data(stream, &outputformat, &datactx, region_id, TRUE); - datactx.indent_level--; - } - else { - if ((region_id = H5Rdereference(obj_id, H5R_DATASET_REGION, memref)) >= 0) { - if ((region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref)) >= 0) { - if (h5tools_is_zero(memref, H5Tget_size(f_type))) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION"); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.need_prefix = TRUE; - datactx.indent_level++; - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - else { + if (!h5tools_is_zero(memref, H5Tget_size(f_type))) { + if (nsize == H5R_OBJ_REF_BUF_SIZE) { + if ((region_id = H5Rdereference(obj_id, H5R_OBJECT, memref)) >= 0) { + datactx.indent_level++; + h5tools_dump_data(stream, &outputformat, &datactx, region_id, TRUE); + datactx.indent_level--; + } + } + else { + if ((region_id = H5Rdereference(obj_id, H5R_DATASET_REGION, memref)) >= 0) { + if ((region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref)) >= 0) { H5S_sel_type region_type; region_type = H5Sget_select_type(region_space); @@ -3796,20 +3779,20 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } else H5TOOLS_INFO("invalid region type"); - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(region_space) < 0) - H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION failed"); - } /* end if (region_space >= 0) */ - else - H5TOOLS_INFO("H5Rget_region H5R_DATASET_REGION failed"); - if(H5Dclose(region_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION failed"); - } /* if (region_id >= 0) */ - else { - /* if (region_id < 0) - could mean that no reference was written do not throw failure */ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); + if(H5Sclose(region_space) < 0) + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION failed"); + } /* end if (region_space >= 0) */ + else + H5TOOLS_INFO("H5Rget_region H5R_DATASET_REGION failed"); + if(H5Dclose(region_id) < 0) + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION failed"); + } /* if (region_id >= 0) */ + else { + /* if (region_id < 0) - could mean that no reference was written do not throw failure */ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); + } } - } + } /* end else to if (h5tools_is_zero(... */ H5TOOLS_DEBUG("finished reference loop:%d",i); } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */ |