summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-31 20:27:25 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-31 20:27:25 (GMT)
commit27b361687d8fda20f3ec885b7dbe36084aac6d85 (patch)
tree92cd6da0a886cea0b0b724c2bd122185c8a03cdc
parent48a87c89533b1143e63444a772e6eeb57a8b79f8 (diff)
downloadhdf5-27b361687d8fda20f3ec885b7dbe36084aac6d85.zip
hdf5-27b361687d8fda20f3ec885b7dbe36084aac6d85.tar.gz
hdf5-27b361687d8fda20f3ec885b7dbe36084aac6d85.tar.bz2
HDFFV-10276 add enable-error-stack to h5diff
-rw-r--r--tools/h5repack/CMakeTests.cmake12
-rw-r--r--tools/h5repack/h5repack.h9
-rw-r--r--tools/h5repack/h5repack_filters.c306
-rw-r--r--tools/h5repack/h5repack_main.c8
-rw-r--r--tools/h5repack/h5repack_parse.c17
-rw-r--r--tools/h5repack/h5repack_plugin.sh.in14
-rw-r--r--tools/h5repack/testfiles/h5repack-help.txt12
7 files changed, 173 insertions, 205 deletions
diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake
index dafed86..e9315ca 100644
--- a/tools/h5repack/CMakeTests.cmake
+++ b/tools/h5repack/CMakeTests.cmake
@@ -207,7 +207,8 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_CMP-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ )
else ()
add_test (
NAME H5REPACK_CMP-${testname}
@@ -240,7 +241,8 @@
# If using memchecker add tests without using scripts
add_test (
NAME H5REPACK_DMP-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ )
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
@@ -1000,15 +1002,15 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
- ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
- ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9)
+ ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
+ ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9)
ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
# check for no parameters
set (TESTRETVAL 255)
if (WIN32)
set (TESTRETVAL -1)
endif ()
- ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0)
+ ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0,0)
if (HDF5_TEST_VFD)
# Run test with different Virtual File Driver
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 9049472..bdde740 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -54,6 +54,7 @@ typedef struct {
typedef struct {
H5Z_filter_t filtn; /* filter identification number */
+ unsigned filt_flag; /* filter definition flag */
unsigned cd_values[CD_VALUES]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
} filter_info_t;
@@ -139,10 +140,10 @@ int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *out_fname, pack_opt_t *options);
int h5repack_cmp_pl(const char *fname1, const char *fname2);
-/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
- * and struct named_dt_t were located in h5repack_copy.c as static prior to
- * bugfix1726.
- * Made shared functions as copy_attr() was needed in h5repack_refs.c.
+/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
+ * and struct named_dt_t were located in h5repack_copy.c as static prior to
+ * bugfix1726.
+ * Made shared functions as copy_attr() was needed in h5repack_refs.c.
* However copy_attr() may be obsoleted when H5Acopy is available and put back
* others to static in h5repack_copy.c.
*/
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index fc8859d..ac3aa3c 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -32,37 +32,32 @@
*
*-------------------------------------------------------------------------
*/
-static int
-aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int aux_find_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- char *pdest;
- int result;
- unsigned int i;
-
- for ( i=0; i<options->op_tbl->nelems; i++)
- {
- if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
- {
- *obj = options->op_tbl->objs[i];
- return (int)i;
- }
-
- pdest = HDstrstr(name,options->op_tbl->objs[i].path);
- result = (int)(pdest - name);
-
- /* found at position 1, meaning without '/' */
- if( pdest != NULL && result==1 )
- {
- *obj = options->op_tbl->objs[i];
- return (int)i;
- }
- }/*i*/
-
- return -1;
-}
+ char *pdest;
+ int result;
+ unsigned int i;
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ if (HDstrcmp(options->op_tbl->objs[i].path,name) == 0) {
+ *obj = options->op_tbl->objs[i];
+ return (int) i;
+ }
+ pdest = HDstrstr(name, options->op_tbl->objs[i].path);
+ result = (int) (pdest - name);
+
+ /* found at position 1, meaning without '/' */
+ if (pdest != NULL && result == 1) {
+ *obj = options->op_tbl->objs[i];
+ return (int) i;
+ }
+ }/*i*/
+
+ return -1;
+}
/*-------------------------------------------------------------------------
* Function: aux_assign_obj
@@ -74,35 +69,31 @@ aux_find_obj(const char* name, /* object name from traverse list */
*
*-------------------------------------------------------------------------
*/
-static int
-aux_assign_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int aux_assign_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- int idx, i;
+ int idx, i;
pack_info_t tmp;
init_packobject(&tmp);
- idx = aux_find_obj(name,options,&tmp);
+ idx = aux_find_obj(name, options, &tmp);
/* name was on input */
- if (idx>=0)
- {
-
+ if (idx >= 0) {
/* applying to all objects */
- if (options->all_layout)
- {
+ if (options->all_layout) {
/* assign the global layout info to the OBJ info */
- tmp.layout=options->layout_g;
- switch (options->layout_g)
- {
+ tmp.layout = options->layout_g;
+ switch (options->layout_g) {
case H5D_CHUNKED:
- tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->chunk_g.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -113,15 +104,14 @@ aux_assign_obj(const char* name, /* object name from traverse list */
break;
}/*switch*/
}
- else
- {
+ else {
tmp.layout = options->op_tbl->objs[idx].layout;
- switch (tmp.layout)
- {
+ switch (tmp.layout) {
case H5D_CHUNKED:
tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->op_tbl->objs[idx].chunk.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -135,49 +125,37 @@ aux_assign_obj(const char* name, /* object name from traverse list */
}
/* applying to all objects */
- if (options->all_filter)
- {
+ if (options->all_filter) {
/* assign the global filter */
- tmp.nfilters=1;
- tmp.filter[0]=options->filter_g[0];
+ tmp.nfilters = 1;
+ tmp.filter[0] = options->filter_g[0];
} /* if all */
- else
- {
- tmp.nfilters=options->op_tbl->objs[idx].nfilters;
- for ( i=0; i<tmp.nfilters; i++)
- {
+ else {
+ tmp.nfilters = options->op_tbl->objs[idx].nfilters;
+ for (i = 0; i < tmp.nfilters; i++) {
tmp.filter[i] = options->op_tbl->objs[idx].filter[i];
}
}
-
-
} /* if idx */
-
-
/* no input name */
-
- else
- {
-
- if (options->all_filter)
- {
+ else {
+ if (options->all_filter) {
int k;
/* assign the global filters */
- tmp.nfilters=options->n_filter_g;
- for ( k = 0; k < options->n_filter_g; k++)
- tmp.filter[k]=options->filter_g[k];
+ tmp.nfilters = options->n_filter_g;
+ for (k = 0; k < options->n_filter_g; k++)
+ tmp.filter[k] = options->filter_g[k];
}
- if (options->all_layout)
- {
+ if (options->all_layout) {
/* assign the global layout info to the OBJ info */
- tmp.layout=options->layout_g;
- switch (options->layout_g)
- {
+ tmp.layout = options->layout_g;
+ switch (options->layout_g) {
case H5D_CHUNKED:
- tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->chunk_g.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -192,10 +170,8 @@ aux_assign_obj(const char* name, /* object name from traverse list */
*obj = tmp;
return 1;
-
}
-
/*-------------------------------------------------------------------------
* Function: apply_filters
*
@@ -212,25 +188,23 @@ aux_assign_obj(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter) /* (OUT) object NAME has a filter */
-
-
+int apply_filters(const char* name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter) /* (OUT) object NAME has a filter */
{
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
- int i;
- pack_info_t obj;
+ int i;
+ pack_info_t obj;
*has_filter = 0;
- if (rank==0) /* scalar dataset, do not apply */
+ if (rank == 0) /* scalar dataset, do not apply */
return 0;
/*-------------------------------------------------------------------------
@@ -243,11 +217,11 @@ int apply_filters(const char* name, /* object name from traverse list */
* find options
*-------------------------------------------------------------------------
*/
- if (aux_assign_obj(name,options,&obj)==0)
+ if (aux_assign_obj(name, options, &obj) == 0)
return 0;
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
/*-------------------------------------------------------------------------
@@ -256,10 +230,9 @@ int apply_filters(const char* name, /* object name from traverse list */
* only remove if we are inserting new ones
*-------------------------------------------------------------------------
*/
- if (nfilters && obj.nfilters )
- {
+ if (nfilters && obj.nfilters) {
*has_filter = 1;
- if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
return -1;
}
@@ -268,18 +241,16 @@ int apply_filters(const char* name, /* object name from traverse list */
* read it only if there is not a requested layout
*-------------------------------------------------------------------------
*/
- if (obj.layout == -1 )
- {
- if ((layout = H5Pget_layout(dcpl_id))<0)
+ if (obj.layout == -1) {
+ if ((layout = H5Pget_layout(dcpl_id)) < 0)
return -1;
- if (layout == H5D_CHUNKED)
- {
- if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0)
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
return -1;
obj.layout = H5D_CHUNKED;
obj.chunk.rank = rank;
- for ( i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
obj.chunk.chunk_lengths[i] = chsize[i];
}
}
@@ -297,19 +268,15 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
- if (obj.nfilters)
- {
-
- /*-------------------------------------------------------------------------
- * filters require CHUNK layout; if we do not have one define a default
- *-------------------------------------------------------------------------
- */
- if (obj.layout==-1)
- {
-
+ if (obj.nfilters) {
+ /*-------------------------------------------------------------------------
+ * filters require CHUNK layout; if we do not have one define a default
+ *-------------------------------------------------------------------------
+ */
+ if (obj.layout == -1) {
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nbytes; /*bytes per stripmine */
obj.chunk.rank = rank;
@@ -318,38 +285,29 @@ int apply_filters(const char* name, /* object name from traverse list */
* a hyperslab whose size is manageable.
*/
-
-
sm_nbytes = msize;
- for ( i = rank; i > 0; --i)
- {
+ for (i = rank; i > 0; --i) {
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
- if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
size = 1;
sm_size[i - 1] = MIN(dims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
HDassert(sm_nbytes > 0);
-
}
- for ( i = 0; i < rank; i++)
- {
+ for (i = 0; i < rank; i++) {
obj.chunk.chunk_lengths[i] = sm_size[i];
}
-
}
- for ( i=0; i<obj.nfilters; i++)
- {
- switch (obj.filter[i].filtn)
- {
-
+ for (i = 0; i < obj.nfilters; i++) {
+ switch (obj.filter[i].filtn) {
/*-------------------------------------------------------------------------
* H5Z_FILTER_NONE 0 , uncompress if compressed
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_NONE:
- break;
+ break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_DEFLATE 1 , deflation like gzip
@@ -357,13 +315,13 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
case H5Z_FILTER_DEFLATE:
{
- unsigned aggression; /* the deflate level */
+ unsigned aggression; /* the deflate level */
aggression = obj.filter[i].cd_values[0];
/* set up for deflated data */
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if(H5Pset_deflate(dcpl_id,aggression)<0)
+ if (H5Pset_deflate(dcpl_id, aggression) < 0)
return -1;
}
break;
@@ -374,18 +332,17 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
case H5Z_FILTER_SZIP:
{
- unsigned options_mask;
- unsigned pixels_per_block;
+ unsigned options_mask;
+ unsigned pixels_per_block;
- options_mask = obj.filter[i].cd_values[0];
+ options_mask = obj.filter[i].cd_values[0];
pixels_per_block = obj.filter[i].cd_values[1];
/* set up for szip data */
- if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
+ if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0)
return -1;
-
}
break;
@@ -394,9 +351,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SHUFFLE:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_shuffle(dcpl_id)<0)
+ if (H5Pset_shuffle(dcpl_id) < 0)
return -1;
break;
@@ -405,9 +362,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_FLETCHER32:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_fletcher32(dcpl_id)<0)
+ if (H5Pset_fletcher32(dcpl_id) < 0)
return -1;
break;
/*----------- -------------------------------------------------------------
@@ -415,9 +372,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_NBIT:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_nbit(dcpl_id)<0)
+ if (H5Pset_nbit(dcpl_id) < 0)
return -1;
break;
/*----------- -------------------------------------------------------------
@@ -428,28 +385,29 @@ int apply_filters(const char* name, /* object name from traverse list */
case H5Z_FILTER_SCALEOFFSET:
{
H5Z_SO_scale_type_t scale_type;
- int scale_factor;
+ int scale_factor;
- scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
- scale_factor = (int)obj.filter[i].cd_values[1];
+ scale_type = (H5Z_SO_scale_type_t) obj.filter[i].cd_values[0];
+ scale_factor = (int) obj.filter[i].cd_values[1];
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0)
+ if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0)
return -1;
}
break;
default:
- {
- if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0)
- return -1;
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
- return -1;
- }
+ {
+ if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
+ obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
+ obj.filter[i].cd_values) < 0)
+ return -1;
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ return -1;
+ }
break;
} /* switch */
}/*i*/
-
}
/*obj.nfilters*/
@@ -458,31 +416,27 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
- if (obj.layout>=0)
- {
+ if (obj.layout >= 0) {
/* a layout was defined */
- if (H5Pset_layout(dcpl_id, obj.layout)<0)
+ if (H5Pset_layout(dcpl_id, obj.layout) < 0)
return -1;
- if (H5D_CHUNKED == obj.layout)
- {
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5D_CHUNKED == obj.layout) {
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
}
- else if (H5D_COMPACT == obj.layout)
- {
- if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
+ else if (H5D_COMPACT == obj.layout) {
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
return -1;
}
/* remove filters for the H5D_CONTIGUOUS case */
- else if (H5D_CONTIGUOUS == obj.layout)
- {
- if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ else if (H5D_CONTIGUOUS == obj.layout) {
+ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
return -1;
}
}
- return 0;
+ return 0;
}
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index e1f13fd..a8c8475 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -93,7 +93,7 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n");
+ PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n");
PRINTVALSTREAM(rawoutstream, " E - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " S - is an integer\n");
PRINTVALSTREAM(rawoutstream, " U - is a filename.\n");
@@ -134,8 +134,8 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
PRINTVALSTREAM(rawoutstream, " is either IN or DS\n");
- PRINTVALSTREAM(rawoutstream, " UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>\n");
- PRINTVALSTREAM(rawoutstream, " required values for filter_number,cd_value_count,value_1\n");
+ PRINTVALSTREAM(rawoutstream, " UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>\n");
+ PRINTVALSTREAM(rawoutstream, " required values for filter_number,filter_flag,cd_value_count,value_1\n");
PRINTVALSTREAM(rawoutstream, " optional values for value_2 to value_N\n");
PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -179,7 +179,7 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,1,9 file1 file2 \n");
+ PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,0,1,9 file1 file2 \n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Add bzip2 filter to all datasets\n");
PRINTVALSTREAM(rawoutstream, "\n");
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index a9a890d..4d62723 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -42,7 +42,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
size_t i, m, u;
char c;
size_t len = HDstrlen(str);
- int k, l, p, q, end_obj = -1, no_param = 0;
+ int f, k, l, p, q, end_obj = -1, no_param = 0;
unsigned j, n;
char sobj[MAX_NC_NAME];
char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -209,13 +209,14 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/*-------------------------------------------------------------------------
* User Defined
- * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
+ * has the format UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
* BZIP2 example
- * UD=307,1,9
+ * UD=307,0,1,9
*-------------------------------------------------------------------------
*/
else if (HDstrcmp(scomp, "UD") == 0) {
l = -1; /* filter number index check */
+ f = -1; /* filter flag index check */
p = -1; /* CD_VAL count check */
for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) {
if (str[u] == ',') {
@@ -224,6 +225,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
filt->filtn = HDatoi(stype);
l = 0;
}
+ else if (f == -1) {
+ filt->filt_flag = HDstrtoul(stype, NULL, 0);
+ f = 0;
+ }
else if (p == -1) {
filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
p = 0;
@@ -240,6 +245,12 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
error_msg("filter number parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
+ else if (!HDisdigit(c) && f == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("filter flag parameter is not a digit in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
stype[q] = c;
} /* for u */
stype[q] = '\0';
diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in
index eaf6917..f21da3d 100644
--- a/tools/h5repack/h5repack_plugin.sh.in
+++ b/tools/h5repack/h5repack_plugin.sh.in
@@ -1,10 +1,10 @@
#! /bin/sh
#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
@@ -247,10 +247,10 @@ COPY_TESTFILES_TO_TESTDIR
version_str=`echo @H5_VERSION@ | awk -F"-" '{print $1}' | sed 's/\./,/g'`
# Run the test
-arg="h5repack_layout.h5 -v -f UD=260,4,9,$version_str"
+arg="h5repack_layout.h5 -v -f UD=260,0,4,9,$version_str"
TOOLTEST_DUMP plugin_version_test $arg
-arg="h5repack_layout.h5 -v -f UD=257,1,9"
+arg="h5repack_layout.h5 -v -f UD=257,0,1,9"
TOOLTEST_DUMP plugin_test $arg
#arg="h5repack_layout.UD.h5 -v -f NONE"
diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt
index b9157d7..337e004 100644
--- a/tools/h5repack/testfiles/h5repack-help.txt
+++ b/tools/h5repack/testfiles/h5repack-help.txt
@@ -22,7 +22,7 @@ usage: h5repack [OPTIONS] file1 file2
-f FILT, --filter=FILT Filter type
-l LAYT, --layout=LAYT Layout type
- M - is an integer greater than 1, size of dataset in bytes (default is 0)
+ M - is an integer greater than 1, size of dataset in bytes (default is 0)
E - is a filename.
S - is an integer
U - is a filename.
@@ -63,8 +63,8 @@ usage: h5repack [OPTIONS] file1 file2
NBIT (no parameter)
SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type
is either IN or DS
- UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
- required values for filter_number,cd_value_count,value_1
+ UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
+ required values for filter_number,filter_flag,cd_value_count,value_1
optional values for value_2 to value_N
NONE (no parameter)
@@ -99,16 +99,16 @@ Examples of use:
Chunked layout, with a layout size of 20x10, to objects dset1 and dset2
and remove filters to objects dset3, dset4, dset5
-4) h5repack -L -c 10 -s 20:dtype file1 file2
+4) h5repack -L -c 10 -s 20:dtype file1 file2
Using latest file format with maximum compact group size of 10 and
and minimum shared datatype size of 20
-5) h5repack -f SHUF -f GZIP=1 file1 file2
+5) h5repack -f SHUF -f GZIP=1 file1 file2
Add both filters SHUF and GZIP in this order to all datasets
-6) h5repack -f UD=307,1,9 file1 file2
+6) h5repack -f UD=307,0,1,9 file1 file2
Add bzip2 filter to all datasets