summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack/h5repack_parse.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-06 19:36:07 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-06 19:36:07 (GMT)
commita07d6b52fb0a231c2c6e60b1ae4d7550894c4b58 (patch)
treeb3242181fab7dcbd4463252edbaea409e8796b5c /tools/src/h5repack/h5repack_parse.c
parent0cef4c9151010e0e2498e81aa7a9186d3280c399 (diff)
downloadhdf5-a07d6b52fb0a231c2c6e60b1ae4d7550894c4b58.zip
hdf5-a07d6b52fb0a231c2c6e60b1ae4d7550894c4b58.tar.gz
hdf5-a07d6b52fb0a231c2c6e60b1ae4d7550894c4b58.tar.bz2
HDFFV-10297 - fix repack individual objects
includes H5Zfilter_avail() fix
Diffstat (limited to 'tools/src/h5repack/h5repack_parse.c')
-rw-r--r--tools/src/h5repack/h5repack_parse.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c
index 4d62723..05af197 100644
--- a/tools/src/h5repack/h5repack_parse.c
+++ b/tools/src/h5repack/h5repack_parse.c
@@ -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)