diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-09-07 18:28:45 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-09-07 18:29:31 (GMT) |
commit | 1c7c5a604b449465a76fbaa054c5b125ad75bb56 (patch) | |
tree | 85010169bed7c6d8f2d460b80ce18cdb27442b9b /tools/src | |
parent | 56b48f6d2aee966bdd06e29c77f156c97cc05cdf (diff) | |
download | hdf5-1c7c5a604b449465a76fbaa054c5b125ad75bb56.zip hdf5-1c7c5a604b449465a76fbaa054c5b125ad75bb56.tar.gz hdf5-1c7c5a604b449465a76fbaa054c5b125ad75bb56.tar.bz2 |
HDFFV-10276 Add UD flag option to h5repack
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5repack/h5repack.h | 1 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_filters.c | 2 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 8 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_parse.c | 17 |
4 files changed, 20 insertions, 8 deletions
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index e5ae03f..c8c6a0e 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -61,6 +61,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; diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index c48158c..5ccb2ef 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -402,7 +402,7 @@ int apply_filters(const char* name, /* object name from traverse list */ default: { if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, - H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, + 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) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 31b1e14..136d550 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -101,7 +101,7 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold for H5Pset_file_space_strategy\n"); PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for H5Pset_file_space_page_size\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"); @@ -164,8 +164,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"); @@ -209,7 +209,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/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index a9a890d..4d62723 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/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'; |