summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--tools/lib/h5diff.c8
-rw-r--r--tools/lib/h5tools.c32
-rw-r--r--tools/lib/h5tools_dump.c88
-rw-r--r--tools/src/h5dump/h5dump_xml.c3
-rw-r--r--tools/src/h5import/h5import.c12
-rw-r--r--tools/src/h5repack/h5repack_copy.c6
-rw-r--r--tools/src/h5repack/h5repack_main.c2
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c355
-rw-r--r--tools/test/h5jam/getub.c2
-rw-r--r--tools/test/h5repack/h5repacktst.c20
-rw-r--r--tools/test/h5stat/h5stat_gentest.c312
-rw-r--r--tools/test/perform/zip_perf.c6
13 files changed, 409 insertions, 439 deletions
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 453db12..6668c22 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -261,7 +261,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* chain puts its associated output code on the output queue.
*/
while (CurCode > DataMask) {
- if (OutCount > 1024) {
+ if (OutCount >= 1024) {
/*return error message*/
}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 28b1f00..594bf51 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -274,12 +274,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
int cmp;
trav_table_t *table = NULL;
size_t idx;
+ int ret_value = 0;
h5difftrace("build_match_list start\n");
/* init */
trav_table_init(&table);
- if (table == NULL)
- H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table");
+ if (table == NULL) {
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create traverse table");
+ HGOTO_DONE(-1);
+ }
/*
* This is necessary for the case that given objects are group and
* have different names (ex: obj1 is /grp1 and obj2 is /grp5).
@@ -367,6 +370,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
free_exclude_path_list (opts);
+done:
*table_out = table;
h5difftrace("build_match_list finish\n");
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 470df63..d93f7b0 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1241,10 +1241,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
H5T_class_t type_class;
if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed")
if((type_class = H5Tget_class(tid)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed")
switch (type_class) {
case H5T_INTEGER:
@@ -1264,7 +1264,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
bytes_wrote = HDfwrite(mem, 1, bytes_in, stream);
if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
block_index -= (hsize_t)bytes_wrote;
mem = mem + bytes_wrote;
@@ -1287,7 +1287,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (s != NULL)
size = HDstrlen(s);
else
- H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string")
}
else {
s = (char *) mem;
@@ -1295,7 +1295,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
} /* i */
} /* for (block_index = 0; block_index < block_nelmts; block_index++) */
}
@@ -1306,7 +1306,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
unsigned nmembs;
if((snmembs = H5Tget_nmembers(tid)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed")
nmembs = (unsigned)snmembs;
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1322,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed")
}
H5Tclose(memb);
@@ -1350,7 +1350,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
}
else {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed")
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1358,7 +1358,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, mem, nelmts) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed")
}
}
H5Tclose(memb);
@@ -1380,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed")
}
}
H5Tclose(memb);
@@ -1426,7 +1426,7 @@ 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 (size != HDfwrite(mem, sizeof(char), size, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
} /* end for */
break;
@@ -1434,7 +1434,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_NCLASSES:
default:
/* Badness */
- H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class")
break;
} /* end switch */
@@ -1562,12 +1562,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hid_t type_id = -1;
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed")
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
@@ -1683,12 +1683,12 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
hid_t type_id = -1;
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed")
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
if((dtype = H5Dget_type(region_id)) < 0)
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 69cecb0..a8b7e30 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -618,12 +618,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
HDassert(buffer);
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed")
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
/* Render the region { element begin */
@@ -944,12 +944,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
HDassert(buffer);
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed")
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
/* Render the region { element begin */
@@ -1156,7 +1156,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
unsigned int vl_data = 0; /* contains VL datatypes */
if ((size_t) ctx->ndims > NELMTS(sm_size))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed")
if (ctx->ndims > 0)
init_acc_pos(ctx, total_size);
@@ -1184,10 +1184,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* calculate the potential number of elements we're going to print */
if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed")
if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed")
sm_nelmts = (hsize_t)ssm_nelmts;
if (sm_nelmts > 0) {
@@ -1196,7 +1196,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
* a hyperslab whose size is manageable.
*/
if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed")
if (ctx->ndims > 0)
for (i = ctx->ndims; i > 0; --i) {
@@ -1210,17 +1210,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
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");
+ 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");
+ 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)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed")
/* read the data */
if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed")
/* print the data */
flags = START_OF_DATA;
@@ -1234,7 +1234,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* print array indices. get the lower bound of the hyperslab and calulate
the element position at the start of hyperslab */
if(H5Sget_select_bounds(f_space, low, high) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed")
elmtno = 0;
for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
@@ -1259,13 +1259,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
if(H5Sclose(sm_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
if(sm_buf)
HDfree(sm_buf);
sm_buf = NULL;
}
else
- H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print");
+ H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print")
ctx->continuation++;
@@ -1462,10 +1462,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
if((f_space = H5Dget_space(dset)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed")
if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
/* assume entire data space to be printed */
@@ -1474,7 +1474,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
ctx->p_min_idx[i] = 0;
if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed")
ctx->size_last_dim = total_size[ctx->ndims - 1];
/* Set the compound datatype field list for display */
@@ -1484,7 +1484,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
return ret_value;
}
@@ -1540,15 +1540,15 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
f_space = H5Dget_space(dset);
if (f_space == FAIL)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed")
sndims = H5Sget_simple_extent_ndims(f_space);
if(sndims < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
if ((size_t)ctx->ndims > NELMTS(sm_size))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed")
/* Assume entire data space to be printed */
if (ctx->ndims > 0)
@@ -1629,7 +1629,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
/* Read the data */
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) {
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed")
}
/* Print the data */
@@ -1667,9 +1667,9 @@ CATCH
done:
if(sm_space >= 0 && H5Sclose(sm_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
return ret_value;
}
@@ -1696,11 +1696,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
sndims = H5Sget_simple_extent_ndims(space);
if(sndims < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed")
/* Assume entire data space to be printed */
for (i = 0; i < ctx->ndims; i++)
@@ -1900,7 +1900,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
const char *order_s = NULL; /* byte order string */
if((type_class = H5Tget_class(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed")
if (object_search && H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
obj_t *obj = NULL; /* Found object */
@@ -2280,7 +2280,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
char *ttag;
if(NULL == (ttag = H5Tget_tag(type)))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed")
ctx->need_prefix = TRUE;
@@ -2300,7 +2300,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_COMPOUND:
if((snmembers = H5Tget_nmembers(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed")
nmembers = (unsigned)snmembers;
h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin);
@@ -2344,7 +2344,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_ENUM:
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
@@ -2374,14 +2374,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_VLEN:
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin);
h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
if(H5Tclose(super) < 0)
- HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed")
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend);
@@ -2456,10 +2456,10 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
int i;
if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed")
if((space_type = H5Sget_simple_extent_type(space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed")
switch(space_type) {
case H5S_SCALAR:
@@ -2544,15 +2544,15 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
ncols = info->line_ncols;
if((snmembs = H5Tget_nmembers(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed")
nmembs = (unsigned)snmembs;
HDassert(nmembs > 0);
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
if((type_size = H5Tget_size(type)) <= 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed")
/*
* Determine what datatype to use for the native values. To simplify
@@ -2565,7 +2565,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
dst_size = sizeof(long long);
if((sign_type = H5Tget_sign(type))<0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed")
if(H5T_SGN_NONE == sign_type)
native = H5T_NATIVE_ULLONG;
else
@@ -2576,20 +2576,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/* Get the names and raw values of all members */
if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name")
if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value")
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
if(H5Tget_member_value(type, i, value + i * type_size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed")
}
/* Convert values to native datatype */
if (native > 0)
if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed")
/*
* Sort members by increasing value
@@ -2646,7 +2646,7 @@ CATCH
HDfree(value);
if(super >= 0 && H5Tclose(super) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class")
if(0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index e399d8f..ec76511 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -3438,8 +3438,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"");
for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf);
- buf = (char *) buf + sizeof(unsigned int);
+ h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int)));
}
h5tools_str_append(&buffer, "\"");
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 3b64a0e..ea40322 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -98,6 +98,9 @@ int main(int argc, char *argv[])
(void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ /* Initialize the file structure to 0 */
+ HDmemset(&opt, 0, sizeof(struct Options));
+
if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
print_version(PROGRAMNAME);
HDexit(EXIT_SUCCESS);
@@ -112,9 +115,6 @@ int main(int argc, char *argv[])
goto err;
}
- /* Initialize the file structure to 0 */
- HDmemset(&opt, 0, sizeof(struct Options));
-
/*
* parse the command line
*/
@@ -1665,7 +1665,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else { /* Dimension */
icount++;
- if (icount > MAX_NUM_DIMENSION) {
+ if (icount >+ MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
@@ -1750,7 +1750,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else { /* comma */
i++;
- if (i > MAX_NUM_DIMENSION) {
+ if (i >= MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
@@ -2023,7 +2023,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else { /* Dimension */
icount++;
- if (icount > MAX_NUM_DIMENSION) {
+ if (icount >= MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index b279cf9..0567269 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -1422,9 +1422,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
} /* end while */
done:
- if (infid > 0)
+ if (infid >= 0)
HDclose(infid);
- if (outfid > 0)
+ if (outfid >= 0)
HDclose(outfid);
return ret_value;
@@ -1497,7 +1497,7 @@ print_user_block(const char *filename, hid_t fid)
}
done:
- if (fh > 0)
+ if (fh >= 0)
HDclose(fh);
return;
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 8f0178f..dec25f9 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -707,6 +707,8 @@ int main(int argc, const char **argv)
void *edata;
void *tools_edata;
+ HDmemset(&options, 0, sizeof(pack_opt_t));
+
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c
index 8c873be..e112c9e 100644
--- a/tools/test/h5format_convert/h5fc_gentest.c
+++ b/tools/test/h5format_convert/h5fc_gentest.c
@@ -14,7 +14,7 @@
/*
* Generate the binary hdf5 files for the h5format_convert tests.
* Usage: just execute the program without any arguments will
- * generate all the binary hdf5 files
+ * generate all the binary hdf5 files
*
* If you regenerate the test files (e.g., changing some code,
* trying it on a new platform, ...), you need to verify the correctness
@@ -24,71 +24,71 @@
#include "hdf5.h"
#include "H5private.h"
-#define NON_V3_FILE "h5fc_non_v3.h5"
-#define EDGE_V3_FILE "h5fc_edge_v3.h5"
-#define ERR_LEVEL_FILE "h5fc_err_level.h5"
+#define NON_V3_FILE "h5fc_non_v3.h5"
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
+#define ERR_LEVEL_FILE "h5fc_err_level.h5"
const char *FILENAME[] = {
- "h5fc_ext1_i.h5", /* 0 */
- "h5fc_ext1_s.h5", /* 1 */
- "h5fc_ext1_f.h5", /* 2 */
- "h5fc_ext2_is.h5", /* 3 */
- "h5fc_ext2_if.h5", /* 4 */
- "h5fc_ext2_sf.h5", /* 5 */
- "h5fc_ext3_isf.h5", /* 6 */
- "h5fc_ext_none.h5", /* 7 */
+ "h5fc_ext1_i.h5", /* 0 */
+ "h5fc_ext1_s.h5", /* 1 */
+ "h5fc_ext1_f.h5", /* 2 */
+ "h5fc_ext2_is.h5", /* 3 */
+ "h5fc_ext2_if.h5", /* 4 */
+ "h5fc_ext2_sf.h5", /* 5 */
+ "h5fc_ext3_isf.h5", /* 6 */
+ "h5fc_ext_none.h5", /* 7 */
NULL
};
-#define GROUP "GROUP"
+#define GROUP "GROUP"
-#define DSET_COMPACT "DSET_COMPACT"
-#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
+#define DSET_COMPACT "DSET_COMPACT"
+#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
-#define DSET_EA "DSET_EA"
-#define DSET_NDATA_EA "DSET_NDATA_EA"
-#define DSET_BT2 "DSET_BT2"
-#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
-#define DSET_FA "DSET_FA"
-#define DSET_NDATA_FA "DSET_NDATA_FA"
-#define DSET_NONE "DSET_NONE"
-#define DSET_NDATA_NONE "DSET_NDATA_NONE"
+#define DSET_EA "DSET_EA"
+#define DSET_NDATA_EA "DSET_NDATA_EA"
+#define DSET_BT2 "DSET_BT2"
+#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NDATA_FA "DSET_NDATA_FA"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NDATA_NONE "DSET_NDATA_NONE"
-#define DSET_EDGE "DSET_EDGE"
-#define DSET_ERR "DSET_ERR"
+#define DSET_EDGE "DSET_EDGE"
+#define DSET_ERR "DSET_ERR"
#define ISTORE_IK 64
-#define ISTORE_ERR 1
+#define ISTORE_ERR 1
#define NUM 500
/*
- * Function: gen_non()
+ * Function: gen_non()
*
* Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support:
- * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
- * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
+ * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
+ * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
* Re-open the file with write+non-latest-format and create:
- * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
- * 4) 1 chunked dataset with extensible array indexing type (with data)
- * 5) 1 compact and 1 contiguous datasets
+ * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
+ * 4) 1 chunked dataset with extensible array indexing type (with data)
+ * 5) 1 compact and 1 contiguous datasets
*/
static void
gen_non(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
+ hid_t fid = -1; /* file id */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
@@ -115,7 +115,7 @@ gen_non(const char *fname)
if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
- /*
+ /*
* Create a chunked dataset with extensible array chunk indexing type (without data)
*/
@@ -135,7 +135,7 @@ gen_non(const char *fname)
if(H5Dclose(did1) < 0)
goto error;
- /*
+ /*
* Create a chunked dataset with version 2 B-tree chunk indexing type (with data)
*/
@@ -226,7 +226,7 @@ gen_non(const char *fname)
if(H5Dclose(did2) < 0)
goto error;
- /*
+ /*
* Create a compact dataset in the group
*/
@@ -251,7 +251,7 @@ gen_non(const char *fname)
if(H5Sclose(sid) < 0)
goto error;
- /*
+ /*
* Create a contiguous dataset with (2d with data) in the file
*/
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -278,9 +278,9 @@ gen_non(const char *fname)
goto error;
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
if(H5Pclose(fcpl) < 0)
- goto error;
+ goto error;
if(H5Fclose(fid) < 0)
goto error;
@@ -298,24 +298,24 @@ error:
} /* gen_non() */
/*
- * Function: gen_edge()
+ * Function: gen_edge()
*
* Create a file with write+latest-format--this will result in v3 superblock+latest version support:
- * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
- * (i.e. the dataset does not filter partial edge chunks)
+ * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
+ * (i.e. the dataset does not filter partial edge chunks)
*/
static void
gen_edge(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1; /* dataset id */
- hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
- hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
- float buf[12][6]; /* Buffer for writing data */
- int i, j; /* local index variable */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1; /* dataset id */
+ hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
+ hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
+ float buf[12][6]; /* Buffer for writing data */
+ int i, j; /* local index variable */
/* Create a new format file */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -377,37 +377,37 @@ error:
/*
- * Function: gen_err_level()
+ * Function: gen_err_level()
*
* Generate a file to test the situtation described in HDFFV-9434:
- * Exceed the limit of v1-btree level
+ * Exceed the limit of v1-btree level
*
- * Create a file with H5Pset_istore_k(fcpl, 1).
- * Create a chunked dataset with extensible array chunk index and
- * appends many chunks to the dataset.
+ * Create a file with H5Pset_istore_k(fcpl, 1).
+ * Create a chunked dataset with extensible array chunk index and
+ * appends many chunks to the dataset.
*
- * When h5format_convert tries to convert the dataset with
- * extensive array index in the file to v1-btree chunk index,
- * it will insert the dataset chunks to the v1-btree chunk index.
- * The tree will split quickly due to the 'K' value of 1 and the
- * tree level will eventually hit the maximum: 2^8(256).
+ * When h5format_convert tries to convert the dataset with
+ * extensive array index in the file to v1-btree chunk index,
+ * it will insert the dataset chunks to the v1-btree chunk index.
+ * The tree will split quickly due to the 'K' value of 1 and the
+ * tree level will eventually hit the maximum: 2^8(256).
*/
static void
gen_err_level(const char *fname)
{
- hid_t fid = -1; /* file ID */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t did = -1; /* dataset ID */
- hid_t fsid = -1; /* file dataspace ID */
- hid_t msid = -1; /* memory dataspace ID */
- unsigned char *buf = NULL; /* buffer for data */
- hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
- hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
- int n = 0; /* local index variable */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t did = -1; /* dataset ID */
+ hid_t fsid = -1; /* file dataspace ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ unsigned char *buf = NULL; /* buffer for data */
+ hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
+ int n = 0; /* local index variable */
/* Create a new format file */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -459,50 +459,51 @@ gen_err_level(const char *fname)
/* Loop through appending 1 element at a time */
for(n = 0; n < NUM; n++) {
- hsize_t start[2] = {0, 0};
- hsize_t count[2] = {1, 1};
- hsize_t extent[2] = {0, 0};
-
- start[0] = 0;
- start[1] = (hsize_t)n;
- extent[0] = 1;
- extent[1] = (hsize_t)(n + 1);
-
- /* Set current dimension sizes for the dataset */
- if(H5Dset_extent(did, extent) < 0)
- goto error;
-
- /* Set up memory dataspace */
- if((msid = H5Screate_simple(2, count, NULL)) < 0)
- goto error;
-
- /* Get file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
- goto error;
-
- if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
- goto error;
-
- /* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
- goto error;
-
- if(H5Sclose(fsid) < 0)
- goto error;
- if(H5Sclose(msid) < 0)
- goto error;
+ hsize_t start[2] = {0, 0};
+ hsize_t count[2] = {1, 1};
+ hsize_t extent[2] = {0, 0};
+
+ start[0] = 0;
+ start[1] = (hsize_t)n;
+ extent[0] = 1;
+ extent[1] = (hsize_t)(n + 1);
+
+ /* Set current dimension sizes for the dataset */
+ if(H5Dset_extent(did, extent) < 0)
+ goto error;
+
+ /* Set up memory dataspace */
+ if((msid = H5Screate_simple(2, count, NULL)) < 0)
+ goto error;
+
+ /* Get file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ goto error;
+
+ if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if(H5Sclose(fsid) < 0)
+ goto error;
+ if(H5Sclose(msid) < 0)
+ goto error;
}
/* Closing */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
if(H5Fclose(fid) < 0)
- goto error;
+ goto error;
if(H5Pclose(fapl) < 0)
- goto error;
- if(buf) free(buf);
+ goto error;
error:
+ if(buf)
+ free(buf);
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
@@ -517,33 +518,33 @@ error:
} /* gen_err_level() */
/*
- * Function: gen_ext()
+ * Function: gen_ext()
*
* Create a file with/without latest format with:
- * 1) 1 contiguous dataset (without data)
- * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data)
- * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
- * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data)
- * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data)
+ * 1) 1 contiguous dataset (without data)
+ * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data)
+ * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
+ * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data)
+ * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data)
* It will create the file with/without messages in the superblock extension depending
* on the parameter "what".
*/
static void
gen_ext(const char *fname, unsigned new_format, unsigned what)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
@@ -559,34 +560,34 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
/* Generate messages that might be placed in superblock extension */
switch(what) {
- case 0:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- break;
- case 1:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 2:
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
- break;
- case 3:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 4:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
- break;
- case 5:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_page_size(fcpl, (hsize_t)512);
- break;
- case 6:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
- break;
- default:
- break;
+ case 0:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ break;
+ case 1:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 2:
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ break;
+ case 3:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 4:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
+ break;
+ case 5:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ break;
+ case 6:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ break;
+ default:
+ break;
}
/* Create the file */
@@ -604,8 +605,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create a contiguous dataset
+ /*
+ * Create a contiguous dataset
*/
/* Create dataspace */
@@ -622,8 +623,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
if(H5Dclose(did1) < 0)
goto error;
- /*
- * Create 2 chunked datasets with extensible array chunk indexing type
+ /*
+ * Create 2 chunked datasets with extensible array chunk indexing type
* (one with data; one without data)
*/
@@ -657,8 +658,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create 2 chunked datasets with version 2 B-tree chunk indexing type
+ /*
+ * Create 2 chunked datasets with version 2 B-tree chunk indexing type
* (one with data; one without data)
*/
@@ -689,7 +690,7 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
/*
- * Create 2 chunked datasets with fixed array chunk indexing type
+ * Create 2 chunked datasets with fixed array chunk indexing type
* (one with data; one without data)
*/
@@ -719,8 +720,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create 2 chunked datasets with implicit chunk indexing type
+ /*
+ * Create 2 chunked datasets with implicit chunk indexing type
* (one with data; one without data)
*/
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
index 7cfde36..26a427d 100644
--- a/tools/test/h5jam/getub.c
+++ b/tools/test/h5jam/getub.c
@@ -148,7 +148,7 @@ main(int argc, const char *argv[])
error:
if(buf)
HDfree(buf);
- if(fd > -1)
+ if(fd >= 0)
HDclose(fd);
return EXIT_FAILURE;
} /* end main() */
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index f6166da..0ae570b 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -3728,7 +3728,7 @@ out:
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -3797,7 +3797,7 @@ out:
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -3838,7 +3838,7 @@ make_userblock_file(void)
out:
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -4134,13 +4134,19 @@ int write_dset_in(hid_t loc_id,
}
/* create a type larger than TEST_BUFSIZE */
- if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0)
+ if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) {
+ HDfree(dbuf);
goto out;
+ }
size = H5Tget_size(tid);
- if ((sid = H5Screate_simple(1, sdims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) {
+ HDfree(dbuf);
goto out;
- if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ }
+ if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ HDfree(dbuf);
goto out;
+ }
#if defined(WRITE_ARRAY)
H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
#endif
@@ -4149,7 +4155,7 @@ int write_dset_in(hid_t loc_id,
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
- HDfree( dbuf );
+ HDfree(dbuf);
}
/*-------------------------------------------------------------------------
diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c
index 2daf24b..ae11032 100644
--- a/tools/test/h5stat/h5stat_gentest.c
+++ b/tools/test/h5stat/h5stat_gentest.c
@@ -14,7 +14,7 @@
/*
* Generate the binary hdf5 files for the h5stat tests.
* Usage: just execute the program without any arguments will
- * generate all the binary hdf5 files
+ * generate all the binary hdf5 files
*
* If you regenerate the test files (e.g., changing some code,
* trying it on a new platform, ...), you need to verify the correctness
@@ -24,25 +24,25 @@
#include "H5private.h"
/* For gen_newgrat_file() */
-#define NEWGRAT_FILE "h5stat_newgrat.h5"
-#define DATASET_NAME "DATASET_NAME"
-#define GROUP_NAME "GROUP"
-#define ATTR_NAME "ATTR"
-#define NUM_GRPS 35000
-#define NUM_ATTRS 100
+#define NEWGRAT_FILE "h5stat_newgrat.h5"
+#define DATASET_NAME "DATASET_NAME"
+#define GROUP_NAME "GROUP"
+#define ATTR_NAME "ATTR"
+#define NUM_GRPS 35000
+#define NUM_ATTRS 100
/* Declarations for gen_idx_file() */
-#define IDX_FILE "h5stat_idx.h5"
-#define DSET "dset"
-#define DSET_FILTER "dset_filter"
+#define IDX_FILE "h5stat_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
/* For gen_threshold_file() */
-#define THRESHOLD_FILE "h5stat_threshold.h5"
-#define THRES_ATTR_NAME "attr"
-#define THRES_ATTR_GRP_NAME "grp_attr"
-#define THRES_DSET_NAME "dset"
-#define THRES_NUM 10
-#define THRES_NUM_25 25
+#define THRESHOLD_FILE "h5stat_threshold.h5"
+#define THRES_ATTR_NAME "attr"
+#define THRES_ATTR_GRP_NAME "grp_attr"
+#define THRES_DSET_NAME "dset"
+#define THRES_NUM 10
+#define THRES_NUM_25 25
/* For gen_err_refcount() */
#define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5"
@@ -51,7 +51,7 @@
* Generate HDF5 file with latest format with
* NUM_GRPS groups and NUM_ATTRS attributes for the dataset
*/
-static void
+static void
gen_newgrat_file(const char *fname)
{
hid_t fcpl = -1; /* File creation property */
@@ -62,79 +62,66 @@ gen_newgrat_file(const char *fname)
hid_t sid = -1; /* Dataspace id */
hid_t attr_id = -1; /* Attribute id */
hid_t did = -1; /* Dataset id */
- char name[30]; /* Group name */
- char attrname[30]; /* Attribute name */
- int i; /* Local index variable */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int i; /* Local index variable */
/* Get a copy file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ goto error;
/* Set to use latest library format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ goto error;
/* Get a copy of file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- goto error;
+ goto error;
/* Set file space handling strategy */
if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0)
- goto error;
+ goto error;
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- goto error;
+ goto error;
/* Create NUM_GRPS groups in the root group */
for(i = 1; i <= NUM_GRPS; i++) {
sprintf(name, "%s%d", GROUP_NAME,i);
if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
} /* end for */
/* Create a datatype to commit and use */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- goto error;
+ goto error;
/* Create dataspace for dataset */
if((sid = H5Screate(H5S_SCALAR)) < 0)
- goto error;
+ goto error;
/* Create dataset */
if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create NUM_ATTRS for the dataset */
for(i = 1; i <= NUM_ATTRS; i++) {
sprintf(attrname, "%s%d", ATTR_NAME,i);
if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
} /* end for */
/* Close dataset, dataspace, datatype, file */
- if(H5Pclose(fapl) < 0)
- goto error;
- if(H5Pclose(fcpl) < 0)
- goto error;
- if(H5Dclose(did) < 0)
- goto error;
- if(H5Sclose(sid) < 0)
- goto error;
- if(H5Tclose(tid) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Pclose(fcpl);
- H5Aclose(attr_id);
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Aclose(attr_id);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
@@ -145,192 +132,175 @@ error:
/*
* Generate an HDF5 file with groups, datasets, attributes for testing the options:
- * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
- * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
- * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
+ * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
+ * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
+ * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
*/
static void
gen_threshold_file(const char *fname)
{
- hid_t fid; /* File ID */
- hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */
- hid_t did; /* Dataset ID */
- hid_t attr_id; /* Attribute ID */
- hid_t gid; /* Group ID */
- hsize_t two_dims[] = {2, 5}; /* Dimension array */
- hsize_t one_dims[] = {6}; /* Dimension array */
- hsize_t zero_dims[] = {0}; /* Dimension array */
- char name[30]; /* Name */
- unsigned i; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t sid0 = -1; /* Dataspace IDs */
+ hid_t sid1 = -1; /* Dataspace IDs */
+ hid_t sid2 = -1; /* Dataspace IDs */
+ hid_t sid3 = -1; /* Dataspace IDs */
+ hid_t sid4 = -1; /* Dataspace IDs */
+ hid_t did = -1; /* Dataset ID */
+ hid_t attr_id = -1; /* Attribute ID */
+ hid_t gid = -1; /* Group ID */
+ hsize_t two_dims[] = {2, 5}; /* Dimension array */
+ hsize_t one_dims[] = {6}; /* Dimension array */
+ hsize_t zero_dims[] = {0}; /* Dimension array */
+ char name[30]; /* Name */
+ unsigned i; /* Local index variable */
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 1-D dataspace with zero dimension size */
if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create 1-D dataspace with non-zero dimension size*/
if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create 2-D dataspace */
if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create scalar dataspace */
if((sid3 = H5Screate(H5S_SCALAR)) < 0)
- goto error;
+ goto error;
/* Create null dataspace */
if((sid4 = H5Screate(H5S_NULL)) < 0)
- goto error;
+ goto error;
/* Create an attribute for the root group */
if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Create 1-D dataset with zero dimension size for the root group */
if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 11 attributes for the dataset */
for(i = 1; i <= (THRES_NUM+1); i++) {
sprintf(name, "%s%d", THRES_ATTR_NAME,i);
if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create dataset with scalar dataspace for the root group */
if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create dataset with null dataspace for the root group */
if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create 2-D dataset for the root group */
if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 10 attributes for the 2-D dataset */
for(i = 1; i <= THRES_NUM; i++) {
sprintf(name, "%s%d", THRES_ATTR_NAME,i);
if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create first group */
if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create an attribute for the group */
if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Close attribute */
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Create 10 1-D datasets with non-zero dimension size for the group */
for(i = 1; i <= THRES_NUM; i++) {
- /* set up dataset name */
+ /* set up dataset name */
sprintf(name, "%s%d", THRES_DSET_NAME,i);
- /* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Close the dataset */
+ /* Close the dataset */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
}
/* Close the group */
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
/* Create second group */
if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 25 attributes for the group */
for(i = 1; i <= THRES_NUM_25; i++) {
- /* Set up attribute name */
+ /* Set up attribute name */
sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i);
- /* Create the attribute */
+ /* Create the attribute */
if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
- /* Close the attribute */
+ /* Close the attribute */
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
/* Close the group */
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
/* Create third group */
if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 9 1-D datasets with non-zero dimension size for the group */
for(i = 1; i < THRES_NUM; i++) {
- /* set up dataset name */
+ /* set up dataset name */
sprintf(name, "%s%d", THRES_DSET_NAME,i);
- /* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Close the dataset */
+ /* Close the dataset */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
}
- /* Close the group */
- if(H5Gclose(gid) < 0)
- goto error;
-
-
- /* Close dataspaces */
- if(H5Sclose(sid0) < 0)
- goto error;
- if(H5Sclose(sid1) < 0)
- goto error;
- if(H5Sclose(sid2) < 0)
- goto error;
- if(H5Sclose(sid3) < 0)
- goto error;
- if(H5Sclose(sid4) < 0)
- goto error;
-
- /* Close file */
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
- H5Aclose(attr_id);
+ H5Aclose(attr_id);
H5Dclose(did);
H5Sclose(sid0);
H5Sclose(sid1);
@@ -346,84 +316,73 @@ error:
* Function: gen_idx_file
*
* Purpose: Create a file with datasets that use Fixed Array indexing:
- * one dataset: fixed dimension, chunked layout, w/o filters
- * one dataset: fixed dimension, chunked layout, w/ filters
+ * one dataset: fixed dimension, chunked layout, w/o filters
+ * one dataset: fixed dimension, chunked layout, w/ filters
*
*/
-static void
+static void
gen_idx_file(const char *fname)
{
- hid_t fapl = -1; /* file access property id */
- hid_t fid = -1; /* file id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1, did2 = -1; /* dataset id */
- hsize_t dims[1] = {10}; /* dataset dimension */
- hsize_t c_dims[1] = {2}; /* chunk dimension */
- int i; /* local index variable */
- int buf[10]; /* data buffer */
+ hid_t fapl = -1; /* file access property id */
+ hid_t fid = -1; /* file id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1, did2 = -1; /* dataset id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
/* Get a copy of the file access property */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ goto error;
/* Set the "use the latest format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ goto error;
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ goto error;
/* Create data */
for(i = 0; i < 10; i++)
- buf[i] = i;
+ buf[i] = i;
/* Set chunk */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ goto error;
if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
- goto error;
+ goto error;
/* Create a 1D dataset */
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
- goto error;
+ goto error;
if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
-
+ goto error;
+
/* Write to the dataset */
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
#if defined (H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
- goto error;
+ goto error;
/* Create and write the dataset */
if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
/* Close the dataset */
if(H5Dclose(did2) < 0)
- goto error;
+ goto error;
#endif
/* closing: dataspace, dataset, file */
- if(H5Pclose(fapl) < 0)
- goto error;
- if(H5Pclose(dcpl) < 0)
- goto error;
- if(H5Sclose(sid) < 0)
- goto error;
- if(H5Dclose(did) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
H5Pclose(fapl);
@@ -451,7 +410,7 @@ error:
* H5O_refcount_decode in the jira issue.
*
*/
-static void
+static void
gen_err_refcount(const char *fname)
{
hid_t fid = -1; /* File identifier */
@@ -525,16 +484,13 @@ gen_err_refcount(const char *fname)
/* Offset of the message ID to modify is as follows: */
/* 4520: the offset of the object header containing the attribute message
with the committed datatype */
- /* 24: the offset in the object header containing the version of the
+ /* 24: the offset in the object header containing the version of the
attribute message */
- if((fd = HDopen(fname, O_RDWR, 0633)) < 0)
- goto error;
- if(HDlseek(fd, 4520+24, SEEK_SET) < 0)
- goto error;
- if(HDwrite(fd, &val, 2) < 0)
- goto error;
- if(HDclose(fd) < 0)
- goto error;
+ if((fd = HDopen(fname, O_RDWR, 0633)) >= 0) {
+ HDlseek(fd, 4520+24, SEEK_SET);
+ HDwrite(fd, &val, 2);
+ HDclose(fd);
+ }
error:
H5E_BEGIN_TRY {
@@ -548,8 +504,8 @@ error:
} H5E_END_TRY;
} /* gen_err_refcount() */
-/*
- * The following two test files are generated with older versions
+/*
+ * The following two test files are generated with older versions
* of the library for HDFFV-10333. They are used for testing in
* testh5stat.sh.in.
*
@@ -559,7 +515,7 @@ error:
* Then a "0" is written to the "dimension" field in the layout
* message to trigger the error.
* This is to verify HDFFV-10333 that h5stat will exit gracefully
- * when encountered error similar to H5O__layout_decode in the
+ * when encountered error similar to H5O__layout_decode in the
* jira issue.
*
* (2) h5stat_err_old_fill.h5
@@ -568,7 +524,7 @@ error:
* Then an illegal size is written to the "size" fild in the
* fill value message to trigger the error.
* This is to verify HDFFV-10333 that h5stat will exit gracefully
- * when encountered error similar to H5O_fill_old_decode in the
+ * when encountered error similar to H5O_fill_old_decode in the
* jira issue.
*/
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index 0636d3b..e301bb3 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -419,7 +419,9 @@ fill_with_random_data(Bytef *src, uLongf src_len)
buf += rc;
len -= (size_t)rc;
}
- } else {
+ HDclose(fd);
+ }
+ else {
HDfprintf(stdout, "Using random() for random data\n");
for (u = 0; u < src_len; ++u)
@@ -557,7 +559,7 @@ main(int argc, char **argv)
int opt;
prog = argv[0];
-
+
/* Initialize h5tools lib */
h5tools_init();