From b947f7e911e498f5455a78836a6f82a042dd5b33 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 25 Aug 2016 13:57:27 -0500 Subject: [PATCH] [svn-r30321] HDFFV-9974: Correct parsing of UD filter parameters. Verified by user, who reported issue. --- MANIFEST | 1 + tools/h5repack/CMakeTests.cmake | 3 +++ tools/h5repack/h5repack_parse.c | 13 +++++-------- .../testfiles/h5repack_layout.h5-plugin_zero.tst | 9 +++++++++ 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst diff --git a/MANIFEST b/MANIFEST index bc5ecb69c8..eb877cf856 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2306,6 +2306,7 @@ ./tools/h5repack/testfiles/h5repack_layout.h5.ddl ./tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl ./tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +./tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst ./tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl ./tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl ./tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index a93fe769a0..cad675edc1 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -121,6 +121,7 @@ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero.tst ) foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) @@ -1145,6 +1146,8 @@ ############################################################################## ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) + # check for no parameters + ADD_H5_CMP_TEST (plugin_zero "" "TEST" 255 h5repack_layout.h5 -v -f UD=250,0) if (HDF5_TEST_VFD) # Run test with different Virtual File Driver diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index b414b108cd..004b9e4cf8 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -44,7 +44,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, r, q, end_obj = -1, no_param = 0; + int k, l, p, q, end_obj = -1, no_param = 0; unsigned j, n; char sobj[MAX_NC_NAME]; char scomp[10]; @@ -219,7 +219,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, else if (HDstrcmp(scomp, "UD") == 0) { l = -1; /* filter number index check */ p = -1; /* CD_VAL count check */ - r = -1; /* CD_VAL check */ for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) { if (str[u] == ',') { stype[q] = '\0'; /* end digit */ @@ -232,7 +231,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, p = 0; } else - r = 0; + filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0); q = 0; u++; /* skip ',' */ } @@ -244,11 +243,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, HDexit(EXIT_FAILURE); } stype[q] = c; - if (l == 0 && p == 0) { - if (r == 0) - filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0); - } - } /* u */ + } /* for u */ stype[q] = '\0'; } /*if */ @@ -273,6 +268,8 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, } /*if */ filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0); + if(filt->cd_nelmts == 0) + j = 0; i += m; /* jump */ } else if (i == len - 1) { /*no more parameters */ diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst new file mode 100644 index 0000000000..0993d5b86a --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst @@ -0,0 +1,9 @@ +Objects to modify layout are... +Objects to apply filter are... + User Defined 250 +Making file ... +----------------------------------------- + Type Filter (Compression) Name +----------------------------------------- + group / +h5repack error: : Could not copy data to: out-plugin_zero.h5repack_layout.h5