summaryrefslogtreecommitdiffstats
path: root/tools/src
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
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')
-rw-r--r--tools/src/h5repack/h5repack.c130
-rw-r--r--tools/src/h5repack/h5repack.h106
-rw-r--r--tools/src/h5repack/h5repack_copy.c180
-rw-r--r--tools/src/h5repack/h5repack_filters.c284
-rw-r--r--tools/src/h5repack/h5repack_main.c10
-rw-r--r--tools/src/h5repack/h5repack_opttable.c3
-rw-r--r--tools/src/h5repack/h5repack_parse.c13
-rw-r--r--tools/src/h5repack/h5repack_verify.c113
8 files changed, 397 insertions, 442 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 7ed9a90..f34d466 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -284,8 +284,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
/* Set return value */
ret_value = dt_ret->id_out;
- /* Increment the ref count on id_out, because the calling function will try
- * to close it */
+ /* Increment the ref count on id_out, because the calling function will try to close it */
if(H5Iinc_ref(ret_value) < 0)
ret_value = -1;
@@ -482,24 +481,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
if (options->verbose)
printf(FORMAT_OBJ_ATTR, "attr", name);
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- if (H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Tclose(wtype_id) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Sclose(space_id) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
- if (H5Aclose(attr_id) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
} /* u */
- return 0;
-
done:
H5E_BEGIN_TRY {
if (buf) {
@@ -541,8 +524,8 @@ static int check_options(pack_opt_t *options) {
*-------------------------------------------------------------------------
*/
if (options->verbose && have_request(options) /* only print if requested */) {
- printf("Objects to modify layout are...\n");
if (options->all_layout == 1) {
+ printf("All objects to modify layout are...\n");
switch (options->layout_g) {
case H5D_COMPACT:
strcpy(slayout, "compact");
@@ -563,14 +546,17 @@ static int check_options(pack_opt_t *options) {
strcpy(slayout, "invalid layout\n");
HGOTO_DONE(FAIL);
}
- printf(" Apply %s layout to all\n", slayout);
+ printf(" Apply %s layout to all", slayout);
if (H5D_CHUNKED == options->layout_g) {
- printf("with dimension [");
+ printf("with dimension [ ");
for (j = 0; j < options->chunk_g.rank; j++)
printf("%d ", (int) options->chunk_g.chunk_lengths[j]);
- printf("]\n");
+ printf("]");
}
+ printf("\n");
}
+ else
+ printf("No all objects to modify layout\n");
}/* verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
@@ -601,10 +587,14 @@ static int check_options(pack_opt_t *options) {
*/
if (options->verbose && have_request(options) /* only print if requested */) {
- printf("Objects to apply filter are...\n");
if (options->all_filter == 1) {
+ printf("All objects to apply filter are...\n");
for (k = 0; k < options->n_filter_g; k++) {
H5Z_filter_t filtn = options->filter_g[k].filtn;
+ if (filtn < 0) {
+ printf(" Unknown\n");
+ continue;
+ }
switch (filtn) {
case H5Z_FILTER_NONE:
printf(" Uncompress all\n");
@@ -623,6 +613,8 @@ static int check_options(pack_opt_t *options) {
} /* k */
};
}
+ else
+ printf("No all objects to apply filter\n");
} /* verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
@@ -631,7 +623,12 @@ static int check_options(pack_opt_t *options) {
for (j = 0; j < pack.nfilters; j++) {
if (options->verbose) {
- printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn));
+ if(pack.filter[j].filtn >= 0) {
+ if(pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET)
+ printf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn);
+ else
+ printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn));
+ }
}
has_cp = 1;
} /* j */
@@ -661,8 +658,7 @@ static int check_options(pack_opt_t *options) {
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
if (options->verbose) {
- printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
- options->ublock_filename);
+ printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename);
options->ublock_size = 1024;
}
}
@@ -692,27 +688,28 @@ done:
*-------------------------------------------------------------------------
*/
static int check_objects(const char* fname, pack_opt_t *options) {
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t fid;
+ hid_t did;
+ hid_t sid;
unsigned int i;
trav_table_t *travt = NULL;
/* nothing to do */
if (options->op_tbl->nelems == 0)
- return 0;
+ HGOTO_DONE(0);
/*-------------------------------------------------------------------------
- * open the file
- *-------------------------------------------------------------------------
- */
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) {
- printf("<%s>: %s\n", fname, H5FOPENERROR);
- return -1;
- }
+ * open the file
+ *-------------------------------------------------------------------------
+ */
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
- * get the list of objects in the file
- *-------------------------------------------------------------------------
- */
+ * get the list of objects in the file
+ *-------------------------------------------------------------------------
+ */
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
@@ -721,15 +718,15 @@ static int check_objects(const char* fname, pack_opt_t *options) {
/* get the list of objects in the file */
if (h5trav_gettable(fid, travt) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
/*-------------------------------------------------------------------------
- * compare with user supplied list
- *-------------------------------------------------------------------------
- */
+ * compare with user supplied list
+ *-------------------------------------------------------------------------
+ */
if (options->verbose)
- printf("Opening file <%s>. Searching for objects to modify...\n", fname);
+ printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
char* name = options->op_tbl->objs[i].path;
@@ -737,14 +734,14 @@ static int check_objects(const char* fname, pack_opt_t *options) {
printf(" <%s>", name);
/* the input object names are present in the file and are valid */
- if (h5trav_getindext(name, travt) < 0) {
- error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
+ if (h5trav_getindext(name, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose ? "\n" : ""), name, fname);
- goto done;
- }
if (options->verbose)
printf("...Found\n");
+ if (options->op_tbl->objs[i].filter->filtn < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
/* check for extra filter conditions */
switch (options->op_tbl->objs[i].filter->filtn) {
/* chunk size must be smaller than pixels per block */
@@ -755,8 +752,6 @@ static int check_objects(const char* fname, pack_opt_t *options) {
unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
- hid_t did;
- hid_t sid;
if (options->op_tbl->objs[i].chunk.rank > 0) {
rank = options->op_tbl->objs[i].chunk.rank;
@@ -765,25 +760,25 @@ static int check_objects(const char* fname, pack_opt_t *options) {
}
else {
if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if ((sid = H5Dget_space(did)) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
HDmemset(dims, 0, sizeof dims);
if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
for (j = 0; j < rank; j++)
csize *= dims[j];
if (H5Sclose(sid) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if (H5Dclose(did) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
}
if (csize < ppb) {
- printf(" <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
- goto done;
+ printf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n");
+ HGOTO_DONE(0);
}
}
break;
@@ -792,18 +787,15 @@ static int check_objects(const char* fname, pack_opt_t *options) {
}
} /* i */
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- H5Fclose(fid);
- trav_table_free(travt);
- return 0;
-
done:
- H5Fclose(fid);
- trav_table_free(travt);
- return -1;
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ } H5E_END_TRY;
+ if (travt)
+ trav_table_free(travt);
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -833,7 +825,9 @@ static int have_request(pack_opt_t *options) {
*/
static const char* get_sfilter(H5Z_filter_t filtn) {
- if (filtn == H5Z_FILTER_NONE)
+ if (filtn < 0)
+ return NULL;
+ else if (filtn == H5Z_FILTER_NONE)
return "NONE";
else if (filtn == H5Z_FILTER_DEFLATE)
return "GZIP";
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index c8c6a0e..0252768 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -29,7 +29,7 @@
#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
/* File space default information */
-#define FS_PAGESIZE_DEF 4096
+#define FS_PAGESIZE_DEF 4096
#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
#define FS_PERSIST_DEF FALSE
#define FS_THRESHOLD_DEF 1
@@ -42,7 +42,7 @@
/* a list of names */
typedef struct {
- char obj[MAX_NC_NAME];
+ char obj[MAX_NC_NAME];
} obj_list_t;
/*
@@ -60,16 +60,16 @@ typedef struct {
#define CD_VALUES 20
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 */
+ 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;
/* chunk lengths along each dimension and rank */
typedef struct {
- hsize_t chunk_lengths[MAX_VAR_DIMS];
- int rank;
+ hsize_t chunk_lengths[MAX_VAR_DIMS];
+ int rank;
} chunk_info_t;
/* we currently define a maximum value for the filters array,
@@ -78,19 +78,19 @@ typedef struct {
/* information for one object, contains PATH, CHUNK info and FILTER info */
typedef struct {
- char path[MAX_NC_NAME]; /* name of object */
- filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
- int nfilters; /* current number of filters */
- H5D_layout_t layout; /* layout information */
- chunk_info_t chunk; /* chunk information */
- hid_t refobj_id; /* object ID, references */
+ char path[MAX_NC_NAME]; /* name of object */
+ filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
+ int nfilters; /* current number of filters */
+ H5D_layout_t layout; /* layout information */
+ chunk_info_t chunk; /* chunk information */
+ hid_t refobj_id; /* object ID, references */
} pack_info_t;
/* store a table of all objects */
typedef struct {
- unsigned int size;
- unsigned int nelems;
- pack_info_t *objs;
+ unsigned int size;
+ unsigned int nelems;
+ pack_info_t *objs;
} pack_opttbl_t;
@@ -101,30 +101,30 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /*table with all -c and -f options */
- int all_layout; /*apply the layout to all objects */
- int all_filter; /*apply the filter to all objects */
- filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /*number of global filters */
- chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /*global layout information for the ALL case */
- int verbose; /*verbose mode */
- hsize_t min_comp; /*minimum size to compress, in bytes */
- int use_native; /*use a native type in write */
- hbool_t latest; /*pack file with the latest file format */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
- const char *ublock_filename; /* user block file name */
- hsize_t ublock_size; /* user block size */
- hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
- hsize_t threshold; /* alignment threshold for H5Pset_alignment */
- hsize_t alignment; /* alignment for H5Pset_alignment */
- H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
- int fs_persist; /* Free space section threshold */
- long fs_threshold; /* Free space section threshold */
- long long fs_pagesize; /* File space page size */
+ pack_opttbl_t *op_tbl; /*table with all -c and -f options */
+ int all_layout; /*apply the layout to all objects */
+ int all_filter; /*apply the filter to all objects */
+ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
+ int n_filter_g; /*number of global filters */
+ chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /*global layout information for the ALL case */
+ int verbose; /*verbose mode */
+ hsize_t min_comp; /*minimum size to compress, in bytes */
+ int use_native; /*use a native type in write */
+ hbool_t latest; /*pack file with the latest file format */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
+ const char *ublock_filename; /* user block file name */
+ hsize_t ublock_size; /* user block size */
+ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
+ hsize_t threshold; /* alignment threshold for H5Pset_alignment */
+ hsize_t alignment; /* alignment for H5Pset_alignment */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ int fs_persist; /* Free space section threshold */
+ long fs_threshold; /* Free space section threshold */
+ long long fs_pagesize; /* File space page size */
} pack_opt_t;
@@ -214,18 +214,18 @@ int apply_filters(const char* name, /* object name from traverse list */
* options table
*-------------------------------------------------------------------------
*/
-int options_table_init( pack_opttbl_t **tbl );
-int options_table_free( pack_opttbl_t *table );
-int options_add_layout( obj_list_t *obj_list,
- unsigned n_objs,
- pack_info_t *pack,
- pack_opttbl_t *table );
-int options_add_filter ( obj_list_t *obj_list,
- unsigned n_objs,
- filter_info_t filt,
- pack_opttbl_t *table );
-pack_info_t* options_get_object( const char *path,
- pack_opttbl_t *table);
+int options_table_init(pack_opttbl_t **tbl);
+int options_table_free(pack_opttbl_t *table);
+int options_add_layout(obj_list_t *obj_list,
+ unsigned n_objs,
+ pack_info_t *pack,
+ pack_opttbl_t *table);
+int options_add_filter(obj_list_t *obj_list,
+ unsigned n_objs,
+ filter_info_t filt,
+ pack_opttbl_t *table);
+pack_info_t* options_get_object(const char *path,
+ pack_opttbl_t *table);
/*-------------------------------------------------------------------------
* parse functions
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 47cad13..08bce60 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -109,9 +109,8 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
* open input file
*-------------------------------------------------------------------------
*/
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) {
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
- }
/* get user block size and file space strategy/persist/threshold */
{
@@ -119,23 +118,20 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
hid_t grp_in = -1; /* group ID */
hid_t gcpl_in = -1; /* group creation property list */
- if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
- }
- if (H5Pget_userblock(fcpl_in, &ub_size) < 0) {
+ if (H5Pget_userblock(fcpl_in, &ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size");
- }
/* If the -S option is not set, get "strategy" from the input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
+ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy");
- }
/* If the -G option is not set, get "pagesize" from the input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
+ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold");
- }
+
/* open root group */
if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
@@ -148,23 +144,19 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
- if (H5Pclose(fcpl_in) < 0) {
+ if (H5Pclose(fcpl_in) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list");
- }
}
/* Check if we need to create a non-default file creation property list */
if (options->latest || ub_size > 0) {
/* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
- }
- if (ub_size > 0) {
- if (H5Pset_userblock(fcpl, ub_size) < 0) {
+ if (ub_size > 0)
+ if (H5Pset_userblock(fcpl, ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size");
- }
- }
if (options->latest) {
unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
@@ -172,9 +164,8 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact,
- (unsigned) options->grp_indexed) < 0) {
+ (unsigned) options->grp_indexed) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
- }
for (i = 0; i < 5; i++) {
if (options->msg_size[i] > 0) {
@@ -209,26 +200,21 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
} /* end for */
if (nindex > 0) {
- if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
+ if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes");
- }
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
- for (i = 0; i < (nindex - 1); i++) {
- if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
+ for (i = 0; i < (nindex - 1); i++)
+ if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
- } /* end if */
- } /* end for */
} /* if (nindex>0) */
/* Create file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
- } /* end if */
- if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format");
- } /* end if */
} /* end if */
} /* end if */
#if defined (H5REPACK_DEBUG_USER_BLOCK)
@@ -241,17 +227,14 @@ print_user_block(fnamein, fidin);
*/
if (options->ublock_size > 0) {
/* either use the FCPL already created or create a new one */
- if (fcpl == H5P_DEFAULT) {
+ if (fcpl == H5P_DEFAULT)
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
- }
- }
/* set user block size */
- if (H5Pset_userblock(fcpl, options->ublock_size) < 0) {
+ if (H5Pset_userblock(fcpl, options->ublock_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size");
- }
}
/*-------------------------------------------------------------------------
@@ -260,16 +243,13 @@ print_user_block(fnamein, fidin);
*/
if (options->alignment > 0) {
/* either use the FAPL already created or create a new one */
- if (fapl == H5P_DEFAULT) {
+ if (fapl == H5P_DEFAULT)
/* create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
- }
- }
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) {
+ if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment");
- }
}
/*-------------------------------------------------------------------------
@@ -278,16 +258,13 @@ print_user_block(fnamein, fidin);
*/
if (options->meta_block_size > 0) {
/* either use the FAPL already created or create a new one */
- if (fapl == H5P_DEFAULT) {
+ if (fapl == H5P_DEFAULT)
/* create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
- }
- }
- if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) {
+ if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size");
- }
}
/*-------------------------------------------------------------------------
@@ -296,12 +273,10 @@ print_user_block(fnamein, fidin);
*/
/* either use the FCPL already created or create a new one */
- if (fcpl == H5P_DEFAULT) {
+ if (fcpl == H5P_DEFAULT)
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
- }
- }
if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed");
@@ -328,9 +303,8 @@ print_user_block(fnamein, fidin);
set_threshold = (hsize_t)options->fs_threshold;
/* Set file space information as specified */
- if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) {
+ if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy");
- }
if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
set_pagesize = (hsize_t)0;
@@ -338,30 +312,26 @@ print_user_block(fnamein, fidin);
set_pagesize = (hsize_t)options->fs_pagesize;
if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
- if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) {
+ if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size");
- }
/*-------------------------------------------------------------------------
* create the output file
*-------------------------------------------------------------------------
*/
if (options->verbose)
- printf("Making file <%s>...\n", fnameout);
+ printf("Making new file ...\n");
- if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
+ if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout);
- }
/*-------------------------------------------------------------------------
* write a new user block if requested
*-------------------------------------------------------------------------
*/
- if (options->ublock_size > 0) {
- if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) {
+ if (options->ublock_size > 0)
+ if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting...");
- }
- }
/*-------------------------------------------------------------------------
* get list of objects
@@ -381,18 +351,16 @@ print_user_block(fnamein, fidin);
* do the copy
*-------------------------------------------------------------------------
*/
- if (do_copy_objects(fidin, fidout, travt, options) < 0) {
+ if (do_copy_objects(fidin, fidout, travt, options) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
- } /* end if */
/*-------------------------------------------------------------------------
* do the copy of referenced objects
* and create hard links
*-------------------------------------------------------------------------
*/
- if (do_copy_refobjs(fidin, fidout, travt, options) < 0) {
+ if (do_copy_refobjs(fidin, fidout, travt, options) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
- }
/*-------------------------------------------------------------------------
* close
@@ -417,11 +385,9 @@ print_user_block(fnamein, fidin);
*-------------------------------------------------------------------------
*/
- if (ub_size > 0 && options->ublock_size == 0) {
- if (copy_user_block(fnamein, fnameout, ub_size) < 0) {
+ if (ub_size > 0 && options->ublock_size == 0)
+ if (copy_user_block(fnamein, fnameout, ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting...");
- }
- }
return 0;
@@ -738,7 +704,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hsize_t size_dset;
/*-------------------------------------------------------------------------
- * copy the suppplied object list
+ * copy the supplied object list
*-------------------------------------------------------------------------
*/
@@ -748,12 +714,13 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
printf("-----------------------------------------\n");
}
- for (i = 0; i < travt->nobjs; i++) {
- /* init variables per obj */
- buf = NULL;
- limit_maxdims = FALSE;
+ if (travt->objs) {
+ for (i = 0; i < travt->nobjs; i++) {
+ /* init variables per obj */
+ buf = NULL;
+ limit_maxdims = FALSE;
- switch (travt->objs[i].type) {
+ switch (travt->objs[i].type) {
case H5TRAV_TYPE_UNKNOWN:
break;
@@ -833,10 +800,13 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
req_filter = 1;
/* check if filters were requested for individual objects */
- for (u = 0; u < options->op_tbl->nelems; u++)
- if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- if (options->op_tbl->objs[u].filter->filtn > 0)
- req_filter = 1;
+ if (options->op_tbl->objs) {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
+ if (options->op_tbl->objs[u].filter->filtn > 0)
+ req_filter = 1;
+ }
+ }
/* check if layout change requested individual object */
if (options->layout_g != H5D_LAYOUT_ERROR) {
@@ -1012,9 +982,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
buf = HDmalloc(need);
if (buf != NULL) {
- /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
- CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/* Check if we have VL data in the dataset's
* datatype that must be reclaimed */
@@ -1097,9 +1068,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hs_select_nelmts = 1;
} /* rank */
- /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
- CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
- CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
+ if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/* reclaim any VL memory, if necessary */
if (vl_data)
@@ -1293,19 +1265,9 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
default:
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found");
- } /* switch */
-
- /* free */
- if (buf != NULL) {
- HDfree(buf);
- buf = NULL;
- }
- } /* i */
-
- /* Finalize (link) the stack of named datatypes (if any) */
- named_datatype_free(&named_dt_head, 0);
-
- return ret_value;
+ } /* switch */
+ } /* end for */
+ } /* end if */
done:
H5E_BEGIN_TRY
@@ -1322,8 +1284,7 @@ done:
H5Tclose(wtype_id);
H5Tclose(type_in);
H5Tclose(type_out);
- named_datatype_free(&named_dt_head, 1);
- }H5E_END_TRY;
+ } H5E_END_TRY;
/* free */
if (buf != NULL)
@@ -1331,6 +1292,14 @@ done:
if (hslab_buf != NULL)
HDfree(hslab_buf);
+ /* Finalize (link) the stack of named datatypes (if any) */
+ if (0 == ret_value)
+ named_datatype_free(&named_dt_head, 0);
+ else
+ H5E_BEGIN_TRY {
+ named_datatype_free(&named_dt_head, 1);
+ } H5E_END_TRY;
+
return ret_value;
}
@@ -1364,8 +1333,11 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p
for (i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_objname), f_objname, NULL);
+ if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_objname), f_objname, NULL)) < 0) {
+ HDstrcat(strfilter, "ERROR ");
+ continue;
+ }
switch (filtn) {
case H5Z_FILTER_NONE:
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index a74e5f3..ec5d672 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -25,23 +25,71 @@
#define MIN(a,b) (((a)<(b)) ? (a) : (b))
/*-------------------------------------------------------------------------
+ * Function: aux_copy_obj
+ *
+ * Purpose: copy the object filters for object copy
+ *
+ * Return: 0 success, -1 failure
+ *-------------------------------------------------------------------------
+ */
+static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
+ const char* name, /* object name from traverse list */
+ pack_info_t *objout /*OUT*/) /* info about object to filter */
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int nfilters; /* number of filters in DCPL */
+ char f_objname[256]; /* filter objname */
+ H5D_layout_t layout;
+ int rank; /* rank of dataset */
+ hsize_t chsize[64]; /* chunk size in elements */
+ unsigned int i, j;
+
+ /* get information about input filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed");
+ /* copy filter_info_t structure */
+ for (i = 0; i < nfilters; i++) {
+ if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts,
+ objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed");
+ }
+
+ objout->nfilters = nfilters;
+ HDstrcpy(objout->path, name);
+
+ if ((layout = H5Pget_layout(dcpl_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+ objout->layout = layout;
+
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
+ objout->chunk.rank = rank;
+ for (i = 0; i < rank; i++)
+ objout->chunk.chunk_lengths[i] = chsize[i];
+ }
+
+done:
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
* Function: aux_find_obj
*
* Purpose: find the object name NAME (got from the traverse list)
* in the repack options list
- *
*-------------------------------------------------------------------------
*/
static int aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest;
int result;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {
- if (HDstrcmp(options->op_tbl->objs[i].path,name) == 0) {
+ if (HDstrcmp(options->op_tbl->objs[i].path, name) == 0) {
*obj = options->op_tbl->objs[i];
return (int) i;
}
@@ -66,14 +114,12 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
* in the repack options list; assign the filter information OBJ
*
* Return: 0 not found, 1 found
- *
*-------------------------------------------------------------------------
*/
static int aux_assign_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
-
int idx, i;
pack_info_t tmp;
@@ -83,7 +129,6 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
/* name was on input */
if (idx >= 0) {
-
/* applying to all objects */
if (options->all_layout) {
/* assign the global layout info to the OBJ info */
@@ -92,8 +137,7 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
case H5D_CHUNKED:
tmp.chunk.rank = options->chunk_g.rank;
for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] =
- options->chunk_g.chunk_lengths[i];
+ tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -111,8 +155,7 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
case H5D_CHUNKED:
tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] =
- options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -123,7 +166,6 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
default:
break;
}/*switch*/
-
}
/* applying to all objects */
@@ -183,28 +225,24 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
* of H5Z_FILTER_NONE present in the PACK_INFO_T filter array
*
* Return: 0 success, -1 an error occured
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 19, 2003
- *
*-------------------------------------------------------------------------
*/
int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter) /* (OUT) object NAME has a filter */
+ int rank, /* rank of dataset */
+ hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter) /* (OUT) object NAME has a filter */
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
- int i;
+ int i, j;
pack_info_t obj;
+ pack_info_t filtobj;
*has_filter = 0;
@@ -212,15 +250,16 @@ int apply_filters(const char* name, /* object name from traverse list */
HGOTO_DONE(0);
/*-------------------------------------------------------------------------
- * initialize the assigment object
- *-------------------------------------------------------------------------
- */
+ * initialize the assigment object
+ *-------------------------------------------------------------------------
+ */
init_packobject(&obj);
+ init_packobject(&filtobj);
/*-------------------------------------------------------------------------
- * find options
- *-------------------------------------------------------------------------
- */
+ * find options
+ *-------------------------------------------------------------------------
+ */
if (aux_assign_obj(name, options, &obj) == 0)
HGOTO_DONE(0);
@@ -228,55 +267,61 @@ int apply_filters(const char* name, /* object name from traverse list */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed");
+
/*-------------------------------------------------------------------------
- * check if we have filters in the pipeline
- * we want to replace them with the input filters
- * only remove if we are inserting new ones
- *-------------------------------------------------------------------------
- */
+ * check if we have filters in the pipeline
+ * we want to replace them with the input filters
+ * only remove if we are inserting new ones
+ *-------------------------------------------------------------------------
+ */
if (nfilters && obj.nfilters) {
*has_filter = 1;
if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed");
- }
- /*-------------------------------------------------------------------------
- * check if there is an existent chunk
- * read it only if there is not a requested layout
- *-------------------------------------------------------------------------
- */
- if (obj.layout == -1) {
- if ((layout = H5Pget_layout(dcpl_id)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
-
- if (layout == H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
- obj.layout = H5D_CHUNKED;
- obj.chunk.rank = rank;
- for (i = 0; i < rank; i++)
- obj.chunk.chunk_lengths[i] = chsize[i];
+ /*-------------------------------------------------------------------------
+ * check if there is an existent chunk
+ * read it only if there is not a requested layout
+ *-------------------------------------------------------------------------
+ */
+ if (obj.layout == -1) {
+ if ((layout = H5Pget_layout(dcpl_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
+ obj.layout = H5D_CHUNKED;
+ obj.chunk.rank = rank;
+ for (i = 0; i < rank; i++)
+ obj.chunk.chunk_lengths[i] = chsize[i];
+ }
}
}
+ else if(nfilters) {
+ *has_filter = 1;
+ if (aux_copy_obj(dcpl_id, name, &filtobj) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "aux_copy_obj failed");
+ }
/*-------------------------------------------------------------------------
- * the type of filter and additional parameter
- * type can be one of the filters
- * H5Z_FILTER_NONE 0 , uncompress if compressed
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- * H5Z_FILTER_SZIP 4 , szip compression
- * H5Z_FILTER_NBIT 5 , nbit compression
- * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
- *-------------------------------------------------------------------------
- */
+ * the type of filter and additional parameter
+ * type can be one of the filters
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ * H5Z_FILTER_SZIP 4 , szip compression
+ * H5Z_FILTER_NBIT 5 , nbit compression
+ * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
+ *-------------------------------------------------------------------------
+ */
if (obj.nfilters) {
/*-------------------------------------------------------------------------
- * filters require CHUNK layout; if we do not have one define a default
- *-------------------------------------------------------------------------
- */
+ * filters require CHUNK layout; if we do not have one define a default
+ *-------------------------------------------------------------------------
+ */
if (obj.layout == -1) {
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
@@ -285,9 +330,9 @@ int apply_filters(const char* name, /* object name from traverse list */
obj.chunk.rank = rank;
/*
- * determine the strip mine size. The strip mine is
- * a hyperslab whose size is manageable.
- */
+ * determine the strip mine size. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
sm_nbytes = msize;
for (i = rank; i > 0; --i) {
@@ -305,18 +350,21 @@ int apply_filters(const char* name, /* object name from traverse list */
}
for (i = 0; i < obj.nfilters; i++) {
+ if (obj.filter[i].filtn < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
+
switch (obj.filter[i].filtn) {
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE 0 , uncompress if compressed
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_NONE:
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_DEFLATE:
{
unsigned aggression; /* the deflate level */
@@ -330,10 +378,10 @@ int apply_filters(const char* name, /* object name from traverse list */
}
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SZIP:
{
unsigned options_mask;
@@ -350,10 +398,10 @@ int apply_filters(const char* name, /* object name from traverse list */
}
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SHUFFLE:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
@@ -361,31 +409,30 @@ int apply_filters(const char* name, /* object name from traverse list */
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed");
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_FLETCHER32:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_fletcher32(dcpl_id) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed");
break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_NBIT , NBIT compression
- *-------------------------------------------------------------------------
- */
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_NBIT , NBIT compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_NBIT:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_nbit(dcpl_id) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed");
break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET , scale+offset compression
- *-------------------------------------------------------------------------
- */
-
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET , scale+offset compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SCALEOFFSET:
{
H5Z_SO_scale_type_t scale_type;
@@ -402,12 +449,12 @@ int apply_filters(const char* name, /* object name from traverse list */
break;
default:
{
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
obj.filter[i].cd_values) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed");
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
}
break;
} /* switch */
@@ -415,31 +462,16 @@ int apply_filters(const char* name, /* object name from traverse list */
}
/*obj.nfilters*/
- /*-------------------------------------------------------------------------
- * layout
- *-------------------------------------------------------------------------
- */
-
- if (obj.layout >= 0) {
- /* a layout was defined */
- if (H5Pset_layout(dcpl_id, obj.layout) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed");
-
- if (H5D_CHUNKED == obj.layout) {
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
- }
- else if (H5D_COMPACT == obj.layout) {
- if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed");
- }
- /* remove filters for the H5D_CONTIGUOUS case */
- else if (H5D_CONTIGUOUS == obj.layout) {
- if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed");
- }
+ if (filtobj.nfilters) {
+ for (i = 0; i < filtobj.nfilters; i++) {
+ if (filtobj.filter[i].filtn < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
+ if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%d filter unavailable", filtobj.filter[i].filtn);
+ }/*for*/
}
+ /*nfilters*/
done:
return ret_value;
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 3860451..d34c394 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -428,13 +428,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char) opt) {
- /* -i for backward compability */
+ /* -i for backward compatibility */
case 'i':
infile = opt_arg;
has_i_o = 1;
break;
- /* -o for backward compability */
+ /* -o for backward compatibility */
case 'o':
outfile = opt_arg;
has_i_o = 1;
@@ -695,8 +695,10 @@ int main(int argc, const char **argv)
}
/* initialize options */
- h5repack_init(&options, 0, FALSE);
-
+ if (h5repack_init(&options, 0, FALSE) < 0) {
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
/* Initialize default indexing options */
sort_by = H5_INDEX_CRT_ORDER;
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 6c409ec..7ab8c6e 100644
--- a/tools/src/h5repack/h5repack_opttable.c
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -30,6 +30,7 @@ void init_packobject(pack_info_t *obj) {
HDstrcpy(obj->path, "\0");
for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
obj->filter[j].filtn = -1;
+ obj->filter[j].cd_nelmts = CD_VALUES;
for (k = 0; k < CD_VALUES; k++)
obj->filter[j].cd_values[k] = 0;
}
@@ -261,7 +262,7 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
/* search if this object is already in the table; "path" is the key */
if (table->nelems > 0) {
- /* go tru the supplied list of names */
+ /* go through the supplied list of names */
for (j = 0; j < n_objs; j++) {
/* linear table search */
for (i = 0; i < table->nelems; i++) {
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)
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index e276b7b..bf53bf9 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -39,22 +39,22 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t fidin = -1; /* file ID for input file*/
hid_t fidout = -1; /* file ID for output file*/
hid_t did = -1; /* dataset ID */
hid_t pid = -1; /* dataset creation property list ID */
hid_t sid = -1; /* space ID */
hid_t tid = -1; /* type ID */
+ int ok = 1; /* step results */
unsigned int i;
trav_table_t *travt = NULL;
- int ok = 1;
- hid_t fcpl_in = -1; /* file creation property for input file */
- hid_t fcpl_out = -1; /* file creation property for output file */
+ hid_t fcpl_in = -1; /* file creation property for input file */
+ hid_t fcpl_out = -1; /* file creation property for output file */
H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
- hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
- hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
- hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
+ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
+ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
/* open the output file */
if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
@@ -84,7 +84,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
ok = 0;
-
/*-------------------------------------------------------------------------
* layout check
*-------------------------------------------------------------------------
@@ -104,10 +103,8 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
if (H5Tclose(tid) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
-
}
-
/*-------------------------------------------------------------------------
* check for the "all" objects option
*-------------------------------------------------------------------------
@@ -163,7 +160,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
ok = 0;
}
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -177,7 +173,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if (H5Tclose(tid) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
} /* if */
-
} /* i */
/* free table */
@@ -288,17 +283,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
}
}
- /* Closing */
- if (H5Pclose(fcpl_in) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Pclose(fcpl_out) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Fclose(fidin) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
- if (H5Fclose(fidout) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
-
- return ok;
+ ret_value = ok;
done:
H5E_BEGIN_TRY {
@@ -376,42 +361,29 @@ int verify_layout(hid_t pid, pack_info_t *obj)
int h5repack_cmp_pl(const char *fname1, const char *fname2)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fid1=-1; /* file ID */
- hid_t fid2=-1; /* file ID */
- hid_t dset1=-1; /* dataset ID */
- hid_t dset2=-1; /* dataset ID */
- hid_t gid=-1; /* group ID */
- hid_t dcpl1=-1; /* dataset creation property list ID */
- hid_t dcpl2=-1; /* dataset creation property list ID */
- hid_t gcplid=-1; /* group creation property list */
- unsigned crt_order_flag1; /* group creation order flag */
- unsigned crt_order_flag2; /* group creation order flag */
- trav_table_t *trav=NULL;
- int ret=1;
+ int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t fid1 =-1; /* file ID */
+ hid_t fid2 =-1; /* file ID */
+ hid_t dset1 =-1; /* dataset ID */
+ hid_t dset2 =-1; /* dataset ID */
+ hid_t gid =-1; /* group ID */
+ hid_t dcpl1 =-1; /* dataset creation property list ID */
+ hid_t dcpl2 =-1; /* dataset creation property list ID */
+ hid_t gcplid =-1; /* group creation property list */
+ unsigned crt_order_flag1; /* group creation order flag */
+ unsigned crt_order_flag2; /* group creation order flag */
+ trav_table_t *trav = NULL;
unsigned int i;
/*-------------------------------------------------------------------------
* open the files
*-------------------------------------------------------------------------
*/
-
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
-
- /* Open the files */
- if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) {
- error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
- return -1;
- }
- if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) {
- error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
- H5Fclose(fid1);
- return -1;
- }
- /* enable error reporting */
- } H5E_END_TRY;
+ /* Open the files */
+ if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
+ if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
* get file table list of objects
@@ -453,7 +425,7 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if (crt_order_flag1 != crt_order_flag2) {
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
+ HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
}
}
else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) {
@@ -470,12 +442,11 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
* compare the property lists
*-------------------------------------------------------------------------
*/
- if((ret = H5Pequal(dcpl1, dcpl2)) < 0)
+ if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
- if(ret == 0) {
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name);
- }
+ if(ret_value == 0)
+ HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name);
/*-------------------------------------------------------------------------
* close
@@ -490,29 +461,8 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
if(H5Dclose(dset2) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
} /*if*/
- } /*i*/
-
- /*-------------------------------------------------------------------------
- * free
- *-------------------------------------------------------------------------
- */
-
- trav_table_free(trav);
+ } /*for*/
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- H5Fclose(fid1);
- H5Fclose(fid2);
-
- return ret;
-
-/*-------------------------------------------------------------------------
-* error
-*-------------------------------------------------------------------------
-*/
done:
H5E_BEGIN_TRY
{
@@ -583,6 +533,8 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
cd_values, sizeof(f_name), f_name, NULL);
/* filter ID */
+ if (filtn < 0)
+ return -1;
if (filtn != filter[i].filtn)
return 0;
@@ -657,4 +609,3 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
return 1;
}
-