summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_parse.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
commitb8c6b68c35fa2be23ef488a1d81097ff3ed55000 (patch)
treec3429ee577e454526c8704d66a84f0c45b7959a1 /tools/h5repack/h5repack_parse.c
parent23a702e7bad93fc4f14eab07678c75d276e2d0ad (diff)
parent60f76980aab92f0e0730170b99a2363acd3c97fa (diff)
downloadhdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.zip
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.tar.gz
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.tar.bz2
Merge pull request #811 in HDFFV/hdf5 from hdf5_1_8_20 to 1.8/masterhdf5-1_8_20
* commit '60f76980aab92f0e0730170b99a2363acd3c97fa': (108 commits) Update version numbers and remove empty sections in RELEASE.txt. Restore line 1154: C2Cppfunction_map.mht to HTML_EXTRA_FILES. Update version for 1.8.20 release. Fixed documentation warnings HDFFV-10329 Correct LINK INTERFACE and VS20013 compile Switch default build mode from development to production. Increment version string to pre2. Add RELEASE.txt note for HDFFV-10274. (cherry picked from commit f7a7d0a00613cba997212fa8032091629a678797) Initialize hid_t variables in test_Attr_bug9. (cherry picked from commit 97bc393449f3fe02c5992872ab2842e12f611ef0) Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case. (cherry picked from commit 1b2c2ca9a6a7d7e1fcd5c3302e203f2e2dabf0af) Fix linking of libs Changed file path to relative. iAdd NAG to supported compilers in RELEASE.txt. Add description to RELEASE.txt for HDFFV-10323 Correct issue number Set version to 1.8.20-pre1 Update supported and tested platforms in RELEASE.txt. HDFFV-10321 Merge from 1.8 Incremented lib file .so numbers: revision for all except c++ for code change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. updated issues related to Fortran Incremented lib file .so numbers: revision for all except c++ for dcode change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. ...
Diffstat (limited to 'tools/h5repack/h5repack_parse.c')
-rw-r--r--tools/h5repack/h5repack_parse.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index a9a890d..05af197 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};
@@ -58,26 +58,30 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/* check for the end of object list and number of objects */
for (i = 0, n = 0; i < len; i++) {
c = str[i];
- if (c == ':')
+ if (c == ':') {
end_obj = (int) i;
+ break;
+ }
if (c == ',')
n++;
}
+ n++;
/* Check for missing : */
if (end_obj == -1) {
/* apply to all objects */
options->all_filter = 1;
*is_glb = 1;
+ *n_objs = 1;
}
+ else
+ *n_objs = n;
- n++;
obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t));
if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
}
- *n_objs = n;
/* get object list */
if (end_obj > 0)
@@ -89,6 +93,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
sobj[k] = '\0';
else
sobj[k + 1] = '\0';
+
HDstrcpy(obj_list[n].obj, sobj);
HDmemset(sobj, 0, sizeof(sobj));
n++;
@@ -142,7 +147,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
if (l == 2) {
smask[l] = '\0';
i = len - 1; /* end */
- (*n_objs)--; /* we counted an extra ',' */
if (HDstrcmp(smask,"NN") == 0)
filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK;
else if (HDstrcmp(smask,"EC") == 0)
@@ -193,7 +197,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
if (l == 2) {
smask[l] = '\0';
i = len - 1; /* end */
- (*n_objs)--; /* we counted an extra ',' */
if (HDstrcmp(smask,"IN") == 0)
filt->cd_values[j++] = H5Z_SO_INT;
else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE)
@@ -209,13 +212,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 +228,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 +248,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';