[svn-r30321] HDFFV-9974: Correct parsing of UD filter parameters.

Verified by user, who reported issue.
This commit is contained in:
Allen Byrne 2016-08-25 13:57:27 -05:00
parent 169014d154
commit b947f7e911
4 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -0,0 +1,9 @@
Objects to modify layout are...
Objects to apply filter are...
User Defined 250
Making file <out-plugin_zero.h5repack_layout.h5>...
-----------------------------------------
Type Filter (Compression) Name
-----------------------------------------
group /
h5repack error: <h5repack_layout.h5>: Could not copy data to: out-plugin_zero.h5repack_layout.h5