From 1c854737665f3f853a324c34292390ab57431fec Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 2 Apr 2020 03:57:05 -0700 Subject: Fixed unnecessary H5R casts in the tools that were raising warnings. --- tools/lib/h5tools.c | 4 ++-- tools/lib/h5tools_dump.c | 16 ++++++++-------- tools/src/h5ls/h5ls.c | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a975f4c..102822d 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1787,10 +1787,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; - if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed"); else { - if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (!h5tools_is_zero(mem, H5Tget_size(H5T_STD_REF))) { region_type = H5Sget_select_type(region_space); if(region_type == H5S_SEL_POINTS) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 96545c8..c10b36b 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -4091,10 +4091,10 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * switch (ref_type) { case H5R_OBJECT1: H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); - if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; @@ -4119,7 +4119,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; case H5R_DATASET_REGION1: H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; @@ -4131,13 +4131,13 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; case H5R_OBJECT2: H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); - if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: break; case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; @@ -4168,10 +4168,10 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * ncols = outputformat.line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); else { - if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); @@ -4223,7 +4223,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; case H5R_ATTR: H5TOOLS_DEBUG("ref_type is H5R_ATTR"); - if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); if(H5Aclose(new_obj_id) < 0) diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 7ab5001..d954367 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1333,10 +1333,10 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx switch (ref_type) { case H5R_OBJECT1: H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); - if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; @@ -1363,7 +1363,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx break; case H5R_DATASET_REGION1: H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; @@ -1377,13 +1377,13 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx break; case H5R_OBJECT2: H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); - if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: break; case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; @@ -1416,10 +1416,10 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx ncols = info->line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ - if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); else { - if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); @@ -1471,7 +1471,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx break; case H5R_ATTR: H5TOOLS_DEBUG("ref_type is H5R_ATTR"); - if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Aclose(new_obj_id) < 0) H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); -- cgit v0.12