diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-12-20 19:40:08 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-12-20 19:40:08 (GMT) |
commit | 37529db25c4bb0699024a26eb6e7a8f81390892b (patch) | |
tree | 83a53f4f063353d25e8dd6a47cb2b09d7dcfea1b /tools/src/h5repack | |
parent | a08a3eaebac031a909748db05f747cec72989f5c (diff) | |
download | hdf5-37529db25c4bb0699024a26eb6e7a8f81390892b.zip hdf5-37529db25c4bb0699024a26eb6e7a8f81390892b.tar.gz hdf5-37529db25c4bb0699024a26eb6e7a8f81390892b.tar.bz2 |
HDFFV-10976,-10980 h5dump, h5ls, h5diff use new ref APIs
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r-- | tools/src/h5repack/h5repack.c | 10 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 10 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_filters.c | 4 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_opttable.c | 35 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_refs.c | 6 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_verify.c | 4 |
6 files changed, 38 insertions, 31 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 971589e..4fb1507 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -222,10 +222,10 @@ h5repack_addlayout(const char *str, pack_opt_t *options) hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { + H5TOOLS_ERR_INIT(hid_t, H5I_INVALID_HID) named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ named_dt_t *dt_ret = NULL; /* Datatype to return */ H5O_info_t oinfo; /* Object info of input dtype */ - hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0) H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); @@ -311,8 +311,8 @@ done: int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { + H5TOOLS_ERR_INIT(int, -1) named_dt_t *dt = *named_dt_head_p; - int ret_value = -1; while (dt) { /* Pop the datatype off the stack and free it */ @@ -343,7 +343,7 @@ done: int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) hid_t attr_id = -1; /* attr ID */ hid_t attr_out = -1; /* attr ID */ hid_t space_id = -1; /* space ID */ @@ -546,7 +546,7 @@ done: static int check_options(pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) unsigned int i; int k, j, has_cp = 0, has_ck = 0; char slayout[30]; @@ -724,13 +724,13 @@ done: static int check_objects(const char* fname, pack_opt_t *options) { + H5TOOLS_ERR_INIT(int, 0) hid_t fid = -1; hid_t did = -1; hid_t sid = -1; unsigned int i; int ifil; trav_table_t *travt = NULL; - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ /* nothing to do */ if (options->op_tbl->nelems == 0) diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 5d41908..2c0af19 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -61,7 +61,7 @@ static void print_user_block(const char *filename, hid_t fid); int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) hid_t fidin = -1; hid_t fidout = -1; hid_t fcpl_in = -1; /* file creation property list ID for input file */ @@ -402,7 +402,7 @@ int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) int k; H5D_layout_t dset_layout; int rank_chunk; @@ -580,7 +580,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) hid_t grp_in = -1; /* group ID */ hid_t grp_out = -1; /* group ID */ hid_t dset_in = -1; /* read dataset ID */ @@ -1354,7 +1354,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) static int copy_user_block(const char *infile, const char *outfile, hsize_t size) { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) int infid = -1, outfid = -1; /* File descriptors */ /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ @@ -1426,7 +1426,7 @@ static void print_user_block(const char *filename, hid_t fid) { - int ret_value = 0; + H5TOOLS_ERR_INIT(int, 0) int fh = -1; /* file handle */ hsize_t ub_size; /* user block size */ hsize_t size; /* size read */ diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 891de25..9eb7c89 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -36,7 +36,7 @@ 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: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) int nfilters; /* number of filters in DCPL */ char f_objname[256]; /* filter objname */ H5D_layout_t layout; @@ -238,7 +238,7 @@ int apply_filters(const char* name, /* object name from traverse 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: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) int nfilters; /* number of filters in DCPL */ hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 9d35c4f..0239f6c 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -void init_packobject(pack_info_t *obj) { +void init_packobject(pack_info_t *obj) +{ int j, k; HDstrcpy(obj->path, "\0"); @@ -49,7 +50,9 @@ void init_packobject(pack_info_t *obj) { *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) { +static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) +{ + H5TOOLS_ERR_INIT(int, 0) if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) table->objs[I].filter[table->objs[I].nfilters++] = filt; else @@ -64,7 +67,8 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in * Return: void *------------------------------------------------------------------------- */ -static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) { +static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) +{ int k; table->objs[I].layout = pack->layout; @@ -96,19 +100,21 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info static int aux_inctable(pack_opttbl_t *table, unsigned n_objs) { + H5TOOLS_ERR_INIT(int, 0) unsigned u; table->size += n_objs; table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); - return -1; + ret_value = -1; + } + else { + for (u = table->nelems; u < table->size; u++) + init_packobject(&table->objs[u]); } - for (u = table->nelems; u < table->size; u++) - init_packobject(&table->objs[u]); - - return 0; + return ret_value; } @@ -121,27 +127,27 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) *------------------------------------------------------------------------- */ int options_table_init(pack_opttbl_t **tbl) { + H5TOOLS_ERR_INIT(int, 0) unsigned int i; pack_opttbl_t *table; if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); - return -1; + H5TOOLS_GOTO_ERROR(-1, H5E_tools_min_id_g, "not enough memory for options table"); } table->size = 30; table->nelems = 0; if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); HDfree(table); - return -1; + H5TOOLS_GOTO_ERROR(-1, H5E_tools_min_id_g, "not enough memory for options table"); } for (i = 0; i < table->size; i++) init_packobject(&table->objs[i]); *tbl = table; - return 0; +done: + return ret_value; } @@ -171,6 +177,7 @@ 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) { + H5TOOLS_ERR_INIT(herr_t, 0) unsigned i, j, I; unsigned added = 0; hbool_t found = FALSE; @@ -237,7 +244,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa table->nelems += added; - return 0; + return ret_value; } /*------------------------------------------------------------------------- diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 52917fb..02a2a6d 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -42,7 +42,7 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) hid_t grp_in = -1; /* read group ID */ hid_t grp_out = -1; /* write group ID */ hid_t dset_in = -1; /* read dataset ID */ @@ -429,7 +429,7 @@ static int copy_refs_attr(hid_t loc_in, trav_table_t *travt, hid_t fidout) /* for saving references */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) hid_t attr_id = -1; /* attr ID */ hid_t attr_out = -1; /* attr ID */ hid_t space_id = -1; /* space ID */ @@ -822,7 +822,7 @@ out: static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) const char *ref_obj_name; hid_t space_id = -1; hid_t ref_obj_id = -1; diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 30bd3f6..29ce5bd 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -39,7 +39,7 @@ 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: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 0) hid_t fidin = -1; /* file ID for input file*/ hid_t fidout = -1; /* file ID for output file*/ hid_t did = -1; /* dataset ID */ @@ -355,7 +355,7 @@ int verify_layout(hid_t pid, pack_info_t *obj) int h5repack_cmp_pl(const char *fname1, const char *fname2) { - int ret_value = 1; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + H5TOOLS_ERR_INIT(int, 1) hid_t fid1 =-1; /* file ID */ hid_t fid2 =-1; /* file ID */ hid_t dset1 =-1; /* dataset ID */ |