diff options
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5copy/h5copy.c | 4 | ||||
-rw-r--r-- | tools/src/h5diff/ph5diff_main.c | 3 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump.c | 4 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 8 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 22 | ||||
-rw-r--r-- | tools/src/h5format_convert/h5format_convert.c | 6 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 12 | ||||
-rw-r--r-- | tools/src/h5jam/h5jam.c | 4 | ||||
-rw-r--r-- | tools/src/h5jam/h5unjam.c | 4 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 28 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack.c | 32 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 44 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_refs.c | 38 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_verify.c | 32 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 2 | ||||
-rw-r--r-- | tools/src/misc/h5clear.c | 4 |
16 files changed, 124 insertions, 123 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 86bd6f6..e1370e2 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -211,8 +211,8 @@ main (int argc, const char *argv[]) H5E_auto2_t tools_func; void *edata; void *tools_edata; - hid_t fid_src = -1; - hid_t fid_dst = -1; + hid_t fid_src = H5I_INVALID_HID; + hid_t fid_dst = H5I_INVALID_HID; unsigned flag = 0; unsigned verbose = 0; unsigned parents = 0; diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index 380ab3b..5ba5fb3 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -126,7 +126,8 @@ int main(int argc, const char *argv[]) static void ph5diff_worker(int nID) { - hid_t file1_id = -1, file2_id = -1; + hid_t file1_id = H5I_INVALID_HID; + hid_t file2_id = H5I_INVALID_HID; while(1) { diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 0222c8b..731fcd7 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1393,8 +1393,8 @@ error: int main(int argc, const char *argv[]) { - hid_t fid = -1; - hid_t gid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; hid_t fapl_id = H5P_DEFAULT; H5E_auto2_t func; H5E_auto2_t tools_func; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index bc426f2..2eb11fd 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -614,7 +614,7 @@ dump_named_datatype(hid_t tid, const char *name) { H5O_info_t oinfo; unsigned attr_crt_order_flags; - hid_t tcpl_id = -1; /* datatype creation property list ID */ + hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */ hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -1415,7 +1415,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data) void handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name) { - hid_t gid = -1; + hid_t gid = H5I_INVALID_HID; if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg("unable to open root group\n"); @@ -1469,8 +1469,8 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name) { - hid_t oid = -1; - hid_t attr_id = -1; + hid_t oid = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; char *obj_name = NULL; char *attr_name = NULL; int j; diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index b63e68d..c116da8 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -1783,9 +1783,9 @@ xml_dump_dataspace(hid_t space) void xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex) { - hid_t space = -1; - hid_t type = -1; - hid_t p_type = -1; + hid_t space = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t p_type = H5I_INVALID_HID; hsize_t size[64]; hsize_t nelmts = 1; int ndims; @@ -1950,9 +1950,9 @@ herr_t xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED * op_data) { - hid_t attr_id = -1; - hid_t type = -1; - hid_t space = -1; + hid_t attr_id = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; H5S_class_t space_type; hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ @@ -2787,8 +2787,8 @@ static int xml_print_refs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hssize_t ssiz = -1; hsize_t i; size_t tsiz; @@ -2936,8 +2936,8 @@ static int xml_print_strs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hssize_t ssiz = -1; htri_t is_vlstr = FALSE; size_t tsiz = 0; @@ -4121,7 +4121,7 @@ xml_print_enum(hid_t type) unsigned char *value = NULL; /*value array */ unsigned nmembs; /*number of members */ hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ + hid_t native = H5I_INVALID_HID; /*native integer datatype */ size_t dst_size; /*destination value type size */ unsigned i; /*miscellaneous counters */ size_t j; diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 257a047..f5234f4 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -219,8 +219,8 @@ leave(int ret) static int convert(hid_t fid, const char *dname) { - hid_t dcpl = -1; - hid_t did = -1; + hid_t dcpl = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; H5D_layout_t layout_type; H5D_chunk_index_t idx_type; @@ -399,7 +399,7 @@ main(int argc, const char *argv[]) { H5E_auto2_t func; void *edata; - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index bd1689f..81f9a32 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1086,12 +1086,12 @@ out: */ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) { - hid_t group_id = -1; - hid_t dset_id = -1; - hid_t space_id = -1; - hid_t mspace_id = -1; - hid_t type_id = -1; - hid_t handle = -1; + hid_t group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t handle = H5I_INVALID_HID; char *str1 = NULL; char *str2 = NULL; char *str3 = NULL; diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 8222e06..07797c8 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -197,8 +197,8 @@ main (int argc, const char *argv[]) int ofid = -1; void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; herr_t status; htri_t testval; hsize_t usize; diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index aa893f9..203522b 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -199,8 +199,8 @@ main(int argc, const char *argv[]) { void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; off_t fsize; hsize_t usize; htri_t testval; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 03e7bed..e8a7a2b 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -879,7 +879,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) if (nmembs > 0) { char **name; /* member names */ unsigned char *value; /* value array */ - hid_t native = -1; /* native integer data type */ + hid_t native = H5I_INVALID_HID; /* native integer data type */ size_t dst_size; /* destination value type size */ unsigned i; /* miscellaneous counters */ @@ -2821,7 +2821,7 @@ leave(int ret) int main(int argc, const char *argv[]) { - hid_t file = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; char *fname = NULL, *oname = NULL, *x; const char *s = NULL; char *rest; @@ -3286,17 +3286,17 @@ main(int argc, const char *argv[]) fname = HDstrdup(argv[argno++]); oname = NULL; - file = -1; + file_id = H5I_INVALID_HID; while (fname && *fname) { if (fapl_id != H5P_DEFAULT) { - file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); + file_id = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); } else { - file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); + file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); } - if (file >= 0) { + if (file_id >= 0) { if (verbose_g) PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ @@ -3312,7 +3312,7 @@ main(int argc, const char *argv[]) *oname = '\0'; } /* end while */ - if (file < 0) { + if (file_id < 0) { HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]); HDfree(fname); err_exit = 1; @@ -3347,8 +3347,8 @@ main(int argc, const char *argv[]) /* Remember the file information for later */ iter.fname = fname; - iter.fid = file; - iter.gid = -1; + iter.fid = file_id; + iter.gid = H5I_INVALID_HID; iter.symlink_target = FALSE; iter.symlink_list = &symlink_list; iter.symlink_list->dangle_link = FALSE; @@ -3360,7 +3360,7 @@ main(int argc, const char *argv[]) /* Check for root group as object name */ if (HDstrcmp(oname, root_name)) { /* Check the type of link given */ - if (H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { + if (H5Lget_info(file_id, oname, &li, H5P_DEFAULT) < 0) { hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -3381,18 +3381,18 @@ main(int argc, const char *argv[]) /* Open the object and display it's information */ if (li.type == H5L_TYPE_HARD) { - if (visit_obj(file, oname, &iter) < 0) { + if (visit_obj(file_id, oname, &iter) < 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } } /* end if(li.type == H5L_TYPE_HARD) */ else { /* Specified name is not for object -- list that link */ - /* Use file ID for root group ID */ - iter.gid = file; + /* Use file_id ID for root group ID */ + iter.gid = file_id; list_lnk(oname, &li, &iter); } - H5Fclose(file); + H5Fclose(file_id); HDfree(fname); if (x) HDfree(oname); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 6f0e4eb..b138896 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -250,7 +250,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t /* Update the address and id */ dt->addr_in = travt->objs[i].objno; - dt->id_out = -1; + dt->id_out = H5I_INVALID_HID; /* Check if this type is the one requested */ if (oinfo.addr == dt->addr_in) { @@ -272,7 +272,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t /* Update the address and id */ dt_ret->addr_in = oinfo.addr; - dt_ret->id_out = -1; + dt_ret->id_out = H5I_INVALID_HID; } /* end if requested datatype not found */ /* If the requested datatype does not yet exist in the output file, copy it @@ -343,11 +343,11 @@ 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) { - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ + hid_t attr_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr_out = H5I_INVALID_HID; /* attr ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file type ID */ + hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ size_t msize; /* size of type */ void *buf = NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -385,7 +385,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ if ((is_named = H5Tcommitted(ftype_id)) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed"); if (is_named && travt) { - hid_t fidout = -1; + hid_t fidout = H5I_INVALID_HID; /* Create out file id */ if ((fidout = H5Iget_file_id(loc_out)) < 0) @@ -432,7 +432,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { - hid_t base_type = -1; + hid_t base_type = H5I_INVALID_HID; base_type = H5Tget_super(ftype_id); is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); @@ -500,16 +500,16 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ */ if (H5Sclose(space_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); - space_id = -1; + space_id = H5I_INVALID_HID; if (H5Tclose(wtype_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); - wtype_id = -1; + wtype_id = H5I_INVALID_HID; if (H5Tclose(ftype_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); - ftype_id = -1; + ftype_id = H5I_INVALID_HID; if (H5Aclose(attr_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed"); - attr_id = -1; + attr_id = H5I_INVALID_HID; } /* for u (each attribute) */ done: @@ -725,9 +725,9 @@ done: static int check_objects(const char* fname, pack_opt_t *options) { - hid_t fid = -1; - hid_t did = -1; - hid_t sid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; unsigned int i; int ifil; trav_table_t *travt = NULL; diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 613606f..7336125 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -61,11 +61,11 @@ static void print_user_block(const char *filename, hid_t fid); int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - hid_t fidin = -1; - hid_t fidout = -1; - hid_t fcpl_in = -1; /* file creation property list ID for input file */ - hid_t grp_in = -1; /* group ID */ - hid_t gcpl_in = -1; /* group creation property list */ + hid_t fidin = H5I_INVALID_HID; + hid_t fidout = H5I_INVALID_HID; + hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */ + hid_t grp_in = H5I_INVALID_HID; /* group ID */ + hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ hid_t fapl = H5P_DEFAULT; /* file access property list ID */ trav_table_t *travt = NULL; @@ -580,19 +580,19 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ + hid_t grp_in = H5I_INVALID_HID; /* group ID */ + hid_t grp_out = H5I_INVALID_HID; /* group ID */ + hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */ + hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */ + hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */ + hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */ + hid_t type_in = H5I_INVALID_HID; /* named type ID */ + hid_t type_out = H5I_INVALID_HID; /* named type ID */ + hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t f_space_id = H5I_INVALID_HID; /* file space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file type ID */ + hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ @@ -946,7 +946,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hsize_t zero[8]; /*vector of zeros */ int k; H5D_layout_t dset_layout; - hid_t dcpl_tmp = -1; /* dataset creation property list ID */ + hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */ /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) @@ -1095,7 +1095,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ else { - hid_t pid = -1; + hid_t pid = H5I_INVALID_HID; /* create property to pass copy options */ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) @@ -1167,7 +1167,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if (H5Tclose(type_out) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); - type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */ + type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */ break; @@ -1429,7 +1429,7 @@ print_user_block(const char *filename, hid_t fid) int fh = -1; /* file handle */ hsize_t ub_size; /* user block size */ hsize_t size; /* size read */ - hid_t fcpl = -1; /* file creation property list ID for HDF5 file */ + hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */ int i; int ret_value = 0; diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a7fbd3a..70204c8 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -42,15 +42,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in = -1; /* read group ID */ - hid_t grp_out = -1; /* write group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t type_in = -1; /* named type ID */ - hid_t dcpl_id = -1; /* dataset creation property list ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ + hid_t grp_in = H5I_INVALID_HID; /* read group ID */ + hid_t grp_out = H5I_INVALID_HID; /* write group ID */ + hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */ + hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */ + hid_t type_in = H5I_INVALID_HID; /* named type ID */ + hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */ + hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -145,7 +145,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { - hid_t refobj_id = -1; + hid_t refobj_id = H5I_INVALID_HID; hobj_ref_t *refbuf = NULL; /* buffer for object references */ hobj_ref_t *buf = NULL; const char* refname; @@ -221,7 +221,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { - hid_t refobj_id = -1; + hid_t refobj_id = H5I_INVALID_HID; hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ hdset_reg_ref_t *buf = NULL; /* output buffer */ const char* refname; @@ -260,7 +260,7 @@ int do_copy_refobjs(hid_t fidin, * in the second traversal of the file */ if((refname = MapIdToName(refobj_id, travt)) != NULL) { - hid_t region_id = -1; /* region id of the referenced dataset */ + hid_t region_id = H5I_INVALID_HID; /* region id of the referenced dataset */ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Rget_region failed"); @@ -430,11 +430,11 @@ static int copy_refs_attr(hid_t loc_in, trav_table_t *travt, hid_t fidout) /* for saving references */ { - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ + hid_t attr_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr_out = H5I_INVALID_HID; /* attr ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */ + hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize; /* memory size of type */ hsize_t nelmts; /* number of elements in dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ @@ -823,8 +823,8 @@ 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) { const char *ref_obj_name; - hid_t space_id = -1; - hid_t ref_obj_id = -1; + hid_t space_id = H5I_INVALID_HID; + hid_t ref_obj_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index d84766a..84cbf60 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -39,17 +39,17 @@ 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) { - 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 */ + hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/ + hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t sid = H5I_INVALID_HID; /* space ID */ + hid_t tid = H5I_INVALID_HID; /* type ID */ int ok = 1; /* step results */ unsigned int i; trav_table_t *travt = NULL; - 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 = H5I_INVALID_HID; /* file creation property for input file */ + hid_t fcpl_out = H5I_INVALID_HID; /* 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 */ @@ -355,14 +355,14 @@ int verify_layout(hid_t pid, pack_info_t *obj) int h5repack_cmp_pl(const char *fname1, const char *fname2) { - 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 */ + hid_t fid1 =H5I_INVALID_HID; /* file ID */ + hid_t fid2 =H5I_INVALID_HID; /* file ID */ + hid_t dset1 =H5I_INVALID_HID; /* dataset ID */ + hid_t dset2 =H5I_INVALID_HID; /* dataset ID */ + hid_t gid =H5I_INVALID_HID; /* group ID */ + hid_t dcpl1 =H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t dcpl2 =H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t gcplid =H5I_INVALID_HID; /* 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; diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 9ce7327..f160671 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1853,7 +1853,7 @@ main(int argc, const char *argv[]) { iter_t iter; const char *fname = NULL; - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index ae57031..927167b 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -252,8 +252,8 @@ int main (int argc, const char *argv[]) { char *fname = NULL; /* File name */ - hid_t fapl = -1; /* File access property list */ - hid_t fid = -1; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ haddr_t image_addr; hsize_t image_len; unsigned flags = H5F_ACC_RDWR; /* file access flags */ |