summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 3cfe56b..896c310 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1299,8 +1299,8 @@ static int
h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer/*string into which to render */, size_t ncols,
- int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) {
- HERR_INIT(int, SUCCEED)
+ int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+{
hbool_t dimension_break = TRUE;
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
@@ -1311,11 +1311,13 @@ h5tools_print_region_data_blocks(hid_t region_id,
unsigned int region_flags; /* buffer extent flags */
hsize_t curr_pos;
int jndx;
+ size_t indx;
int type_size;
hid_t mem_space = -1;
void *region_buf = NULL;
int blkndx;
hid_t sid1 = -1;
+ int ret_value = SUCCEED;
/* Get the dataspace of the dataset */
if((sid1 = H5Dget_space(region_id)) < 0)
@@ -1371,8 +1373,8 @@ h5tools_print_region_data_blocks(hid_t region_id,
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/* assume entire data space to be printed */
- for (jndx = 0; jndx < (size_t) ctx.ndims; jndx++)
- ctx.p_min_idx[jndx] = start[jndx];
+ for (indx = 0; indx < (size_t) ctx.ndims; indx++)
+ ctx.p_min_idx[indx] = start[indx];
init_acc_pos(&ctx, total_size);
/* print the data */
@@ -1380,8 +1382,8 @@ h5tools_print_region_data_blocks(hid_t region_id,
if (blkndx == nblocks - 1)
region_flags |= END_OF_DATA;
- for (jndx = 0; jndx < ctx.ndims; jndx++)
- ctx.p_max_idx[jndx] = dims1[jndx];
+ for (indx = 0; indx < (size_t)ctx.ndims; indx++)
+ ctx.p_max_idx[indx] = dims1[indx];
curr_pos = 0;
ctx.sm_pos = blkndx*2*ndims;
@@ -1390,24 +1392,24 @@ h5tools_print_region_data_blocks(hid_t region_id,
h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0);
elmtno = 0;
- for (jndx = 0; jndx < numelem; jndx++, elmtno++, ctx.cur_elmt++) {
+ for (indx = 0; indx < numelem; indx++, elmtno++, ctx.cur_elmt++) {
/* Render the region data element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : "");
+ h5tools_str_append(buffer, "%s", indx ? OPTIONAL_LINE_BREAK "" : "");
h5tools_str_sprint(buffer, info, region_id, type_id,
- ((char*)region_buf + jndx * type_size), &ctx);
+ ((char*)region_buf + indx * type_size), &ctx);
- if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0)
+ if (indx + 1 < numelem || (region_flags & END_OF_DATA) == 0)
h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ","));
dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
- ncols, ptdata, jndx, elmtno);
+ ncols, ptdata, indx, elmtno);
/* Render the region data element end */
if(FALSE == dimension_break)
elmtno = 0;
- } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
+ } /* end for (indx = 0; indx < numelem; indx++, region_elmtno++, ctx.cur_elmt++) */
ctx.indent_level--;
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
@@ -1423,7 +1425,6 @@ h5tools_print_region_data_blocks(hid_t region_id,
if(H5Sclose(sid1) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
-CATCH
return ret_value;
}
@@ -1457,7 +1458,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_t *buffer/*string into which to render */,
hsize_t *curr_pos/*total data element position*/,
size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter) {
+ hsize_t elmt_counter)
+{
HERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
hssize_t nblocks;
@@ -1643,17 +1645,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_t *buffer, size_t ncols,
int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
- HERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
hsize_t *dims1 = NULL;
hsize_t elmtno; /* elemnt index */
unsigned int region_flags; /* buffer extent flags */
hsize_t curr_pos;
- int indx;
+ size_t indx;
int jndx;
int type_size;
hid_t mem_space = -1;
void *region_buf = NULL;
+ int ret_value = SUCCEED;
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
@@ -1717,7 +1719,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
dimension_break =
h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
- ncols, ptdata, 0, elmtno);
+ ncols, ptdata, (hsize_t)0, elmtno);
/* Render the point element end */
ctx.indent_level--;
@@ -1731,7 +1733,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
if(H5Sclose(mem_space) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
-CATCH
+
return ret_value;
}
@@ -1769,7 +1771,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
hsize_t alloc_size;
hsize_t *ptdata;
int ndims;
- int indx;
+ hssize_t indx;
hid_t dtype;
hid_t type_id;
@@ -1796,7 +1798,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if((ptdata = malloc((size_t) alloc_size)) == NULL)
+ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size)))
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
@@ -1965,7 +1967,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
HERR_INIT(herr_t, SUCCEED)
size_t i; /* counters */
size_t j; /* counters */
- hsize_t zero = 0; /* vector of zeros */
+ hsize_t zero[1] = {0}; /* vector of zeros */
unsigned int flags; /* buffer extent flags */
hsize_t elmtno; /* elemnt index */
hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
@@ -2028,13 +2030,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
}
assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
- if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL)
+ if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes)))
H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine");
if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
- if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0)
+ if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
/* read the data */
@@ -2129,7 +2131,6 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
hid_t dset, hid_t p_type, struct subset_t *sset,
hid_t f_space, hsize_t *total_size)
{
- HERR_INIT(herr_t, SUCCEED)
size_t i; /* counters */
hsize_t n; /* counters */
hsize_t count; /* hyperslab count */
@@ -2142,6 +2143,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */
hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */
int reset_dim;
+ herr_t ret_value = SUCCEED;
if (ctx->ndims == 1)
row_dim = 0;
@@ -2230,7 +2232,6 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
} /* outer_count */
-CATCH
return ret_value;
}
@@ -2440,7 +2441,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info,
}
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
- sm_buf = malloc((size_t)sm_nbytes);
+ sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes);
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -2516,7 +2517,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info,
H5Sclose(sm_space);
H5Sclose(f_space);
- free(sm_buf);
+ HDfree(sm_buf);
return SUCCEED;
}
@@ -3333,9 +3334,9 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
dst_size = type_size;
/* Get the names and raw values of all members */
- if((name = calloc(nmembs, sizeof(char *))) == NULL)
+ if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *))))
H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name");
- if((value = calloc(nmembs, MAX(type_size, dst_size))) == NULL)
+ if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size))))
H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value");
for (i = 0; i < nmembs; i++) {
@@ -3914,7 +3915,6 @@ static int
render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
{
- HERR_INIT(int, SUCCEED)
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
hsize_t *count = NULL;
@@ -3926,6 +3926,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
void *region_buf = NULL;
int blkndx;
hid_t sid1 = -1;
+ int ret_value = SUCCEED;
/* Get the dataspace of the dataset */
if((sid1 = H5Dget_space(region_id)) < 0)
@@ -3994,7 +3995,6 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
if(H5Sclose(sid1) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
-CATCH
return ret_value;
}
@@ -4085,12 +4085,12 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container,
int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
- HERR_INIT(int, SUCCEED)
hsize_t *dims1 = NULL;
int jndx;
int type_size;
hid_t mem_space = -1;
void *region_buf = NULL;
+ int ret_value = SUCCEED;
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
@@ -4122,7 +4122,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
if(H5Sclose(mem_space) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
-CATCH
+
return ret_value;
}
@@ -4160,7 +4160,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if((ptdata = malloc((size_t) alloc_size)) == NULL)
+ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size)))
HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);