summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-09 17:59:28 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-09 17:59:28 (GMT)
commitdaddf169b078f2c3982af513416e7f0f9208a211 (patch)
tree0fcf0403d46599b3867cb37fabae528215b97162 /tools/src
parenta07d6b52fb0a231c2c6e60b1ae4d7550894c4b58 (diff)
downloadhdf5-daddf169b078f2c3982af513416e7f0f9208a211.zip
hdf5-daddf169b078f2c3982af513416e7f0f9208a211.tar.gz
hdf5-daddf169b078f2c3982af513416e7f0f9208a211.tar.bz2
HDFFV-10297 - Fix test errors - five remaining
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5repack/h5repack.c91
-rw-r--r--tools/src/h5repack/h5repack_copy.c9
-rw-r--r--tools/src/h5repack/h5repack_filters.c28
3 files changed, 79 insertions, 49 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index f34d466..6b8cf8a 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -693,6 +693,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
hid_t did;
hid_t sid;
unsigned int i;
+ unsigned int uf;
trav_table_t *travt = NULL;
/* nothing to do */
@@ -740,52 +741,54 @@ static int check_objects(const char* fname, pack_opt_t *options) {
if (options->verbose)
printf("...Found\n");
- if (options->op_tbl->objs[i].filter->filtn < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
- /* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter->filtn) {
- /* chunk size must be smaller than pixels per block */
- case H5Z_FILTER_SZIP:
- {
- int j;
- hsize_t csize = 1;
- unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
- hsize_t dims[H5S_MAX_RANK];
- int rank;
-
- if (options->op_tbl->objs[i].chunk.rank > 0) {
- rank = options->op_tbl->objs[i].chunk.rank;
- for (j = 0; j < rank; j++)
- csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
- }
- else {
- if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
- if ((sid = H5Dget_space(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
- if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
- HDmemset(dims, 0, sizeof dims);
- if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
- for (j = 0; j < rank; j++)
- csize *= dims[j];
- if (H5Sclose(sid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
- if (H5Dclose(did) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
- }
-
- if (csize < ppb) {
- printf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n");
- HGOTO_DONE(0);
+ for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) {
+ if (options->op_tbl->objs[i].filter[uf].filtn < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
+ /* check for extra filter conditions */
+ switch (options->op_tbl->objs[i].filter[uf].filtn) {
+ /* chunk size must be smaller than pixels per block */
+ case H5Z_FILTER_SZIP:
+ {
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
+
+ if (options->op_tbl->objs[i].chunk.rank > 0) {
+ rank = options->op_tbl->objs[i].chunk.rank;
+ for (j = 0; j < rank; j++)
+ csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
+ }
+ else {
+ if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((sid = H5Dget_space(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ for (j = 0; j < rank; j++)
+ csize *= dims[j];
+ if (H5Sclose(sid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Dclose(did) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ }
+
+ if (csize < ppb) {
+ printf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n");
+ HGOTO_DONE(0);
+ }
}
+ break;
+ default:
+ break;
}
- break;
- default:
- break;
- }
- } /* i */
+ } /* for uf */
+ } /* for i */
done:
H5E_BEGIN_TRY {
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 08bce60..9fcf218 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -698,6 +698,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
unsigned u;
+ unsigned uf;
int is_ref = 0;
htri_t is_named;
hbool_t limit_maxdims;
@@ -803,8 +804,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (options->op_tbl->objs) {
for (u = 0; u < options->op_tbl->nelems; u++) {
if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- if (options->op_tbl->objs[u].filter->filtn > 0)
- req_filter = 1;
+ for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) {
+ if (options->op_tbl->objs[u].filter[uf].filtn > 0)
+ req_filter = 1;
+ }
}
}
@@ -1293,7 +1296,7 @@ done:
HDfree(hslab_buf);
/* Finalize (link) the stack of named datatypes (if any) */
- if (0 == ret_value)
+ if (0 == ret_value && named_dt_head != NULL)
named_datatype_free(&named_dt_head, 0);
else
H5E_BEGIN_TRY {
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index ec5d672..e968b3c 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -469,9 +469,33 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%d filter unavailable", filtobj.filter[i].filtn);
- }/*for*/
+ } /* for */
+ } /* nfilters */
+
+ /*-------------------------------------------------------------------------
+ * layout
+ *-------------------------------------------------------------------------
+ */
+
+ if (obj.layout >= 0) {
+ /* a layout was defined */
+ if (H5Pset_layout(dcpl_id, obj.layout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed");
+
+ if (H5D_CHUNKED == obj.layout) {
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
+ }
+ else if (H5D_COMPACT == obj.layout) {
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed");
+ }
+ /* remove filters for the H5D_CONTIGUOUS case */
+ else if (H5D_CONTIGUOUS == obj.layout) {
+ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed");
+ }
}
- /*nfilters*/
done:
return ret_value;