summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2020-01-19 14:09:44 (GMT)
committerkmu <kmu@hdfgroup.org>2020-01-19 14:09:44 (GMT)
commit628d267162895adef5a73e1cd5810030cc98335a (patch)
tree05471ae798eaef041ea98fecdd285c9380ce381a /tools/lib
parentd46ea2d08af456f1cfaf6c6fd3060f39b92be8de (diff)
parent7e93acd94f20c73d27bb2eb4f7b4389d88cfb299 (diff)
downloadhdf5-628d267162895adef5a73e1cd5810030cc98335a.zip
hdf5-628d267162895adef5a73e1cd5810030cc98335a.tar.gz
hdf5-628d267162895adef5a73e1cd5810030cc98335a.tar.bz2
merge and fix conflict
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c4
-rw-r--r--tools/lib/h5diff_array.c20
-rw-r--r--tools/lib/h5diff_attr.c9
-rw-r--r--tools/lib/h5diff_dset.c12
-rw-r--r--tools/lib/h5tools.c36
-rw-r--r--tools/lib/h5tools_dump.c26
-rw-r--r--tools/lib/h5tools_str.c14
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_type.c4
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/lib/h5trav.c4
11 files changed, 63 insertions, 70 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 92d2769..d7fc991 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -510,8 +510,8 @@ h5diff(const char *fname1,
const char *objname2,
diff_opt_t *opts)
{
- hid_t file1_id = -1;
- hid_t file2_id = -1;
+ hid_t file1_id = H5I_INVALID_HID;
+ hid_t file2_id = H5I_INVALID_HID;
char filenames[2][MAX_FILENAME];
hsize_t nfound = 0;
int l_ret1 = -1;
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 98b9db3..f671b06 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -487,7 +487,7 @@ static hsize_t diff_datum(
case H5T_COMPOUND:
H5TOOLS_DEBUG("diff_datum H5T_COMPOUND");
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
nmembs = members->n;
for (j = 0; j < nmembs; j++) {
@@ -698,7 +698,7 @@ static hsize_t diff_datum(
*/
case H5T_ARRAY:
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
hsize_t adims[H5S_MAX_RANK];
int ndims;
@@ -734,8 +734,8 @@ static hsize_t diff_datum(
H5TOOLS_GOTO_DONE(opts->err_stat);
}
else if (!iszero1 && !iszero2) {
- hid_t obj1_id = -1;
- hid_t obj2_id = -1;
+ hid_t obj1_id = H5I_INVALID_HID;
+ hid_t obj2_id = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_STD_REF
@@ -744,8 +744,8 @@ static hsize_t diff_datum(
*/
if (H5Tequal(m_type, H5T_STD_REF)) {
/* if (type_size == H5R_STD_REF_SIZE) */
- hid_t region1_id = -1;
- hid_t region2_id = -1;
+ hid_t region1_id = H5I_INVALID_HID;
+ hid_t region2_id = H5I_INVALID_HID;
H5R_ref_t *ref1_buf = (const H5R_ref_t *)_mem1;
H5R_ref_t *ref2_buf = (const H5R_ref_t *)_mem2;
H5O_type_t obj1_type = -1; /* Object type */
@@ -1024,8 +1024,8 @@ static hsize_t diff_datum(
*/
else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) {
/* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */
- hid_t region1_id = -1;
- hid_t region2_id = -1;
+ hid_t region1_id = H5I_INVALID_HID;
+ hid_t region2_id = H5I_INVALID_HID;
H5TOOLS_INFO("H5T_STD_REF_DSETREG reference type");
@@ -1113,7 +1113,7 @@ static hsize_t diff_datum(
*/
case H5T_VLEN:
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
H5TOOLS_DEBUG("diff_datum H5T_VLEN");
/* get the VL sequences's base datatype for each element */
@@ -4509,7 +4509,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
static
int ull2float(unsigned long long ull_value, float *f_value)
{
- hid_t dxpl_id = -1;
+ hid_t dxpl_id = H5I_INVALID_HID;
unsigned char *buf = NULL;
size_t src_size;
size_t dst_size;
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 5a85d79..4b3ea71 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -218,9 +218,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr1_id);
- attr1_id = -1;
+ attr1_id = H5I_INVALID_HID;
H5Aclose(attr2_id);
- attr2_id = -1;
+ attr2_id = H5I_INVALID_HID;
} /* end while */
/* list1 did not end */
@@ -244,7 +244,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr1_id);
- attr1_id = -1;
+ attr1_id = H5I_INVALID_HID;
}
/* list2 did not end */
@@ -267,7 +267,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr2_id);
- attr2_id = -1;
+ attr2_id = H5I_INVALID_HID;
}
/*------------------------------------------------------
@@ -336,7 +336,6 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
char np1[512];
char np2[512];
- unsigned u; /* Local index variable */
hsize_t nfound = 0;
int j;
diff_err_t ret_value = opts->err_stat;
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 8a6eeeb..f757f92 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -34,10 +34,10 @@ hsize_t diff_dataset(hid_t file1_id,
diff_opt_t *opts)
{
int status = -1;
- hid_t did1 = -1;
- hid_t did2 = -1;
- hid_t dcpl1 = -1;
- hid_t dcpl2 = -1;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
hsize_t nfound = 0;
diff_err_t ret_value = opts->err_stat;
@@ -814,8 +814,8 @@ int diff_can_type(hid_t f_tid1, /* file data type */
int nmembs1;
int nmembs2;
int j;
- hid_t memb_type1 = -1;
- hid_t memb_type2 = -1;
+ hid_t memb_type1 = H5I_INVALID_HID;
+ hid_t memb_type2 = H5I_INVALID_HID;
H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND");
nmembs1 = H5Tget_nmembers(f_tid1);
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 84b8eb8..c0868bf 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -24,11 +24,11 @@
/* global variables */
hid_t H5tools_ERR_STACK_g = 0;
-hid_t H5tools_ERR_CLS_g = -1;
-hid_t H5E_tools_g = -1;
-hid_t H5E_tools_min_id_g = -1;
-hid_t H5E_tools_min_info_id_g = -1;
-hid_t H5E_tools_min_dbg_id_g = -1;
+hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
+hid_t H5E_tools_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID;
int compound_data;
FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
@@ -430,7 +430,7 @@ h5tools_set_error_file(const char *fname, int is_bin)
static hid_t
h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
{
- hid_t new_fapl = -1; /* Copy of file access property list passed in, or new property list */
+ hid_t new_fapl = H5I_INVALID_HID; /* Copy of file access property list passed in, or new property list */
herr_t ret_value = SUCCEED;
/* Make a copy of the FAPL, for the file open call to use, eventually */
@@ -504,7 +504,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
done:
if((new_fapl != H5P_DEFAULT) && (ret_value < 0)) {
H5Pclose(new_fapl);
- new_fapl = -1;
+ new_fapl = H5I_INVALID_HID;
}
return(new_fapl);
@@ -1343,7 +1343,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
mem = ((unsigned char*)_mem) + block_index * size;
for (j = 0; j < nmembs; j++) {
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
size_t offset;
offset = H5Tget_member_offset(tid, j);
@@ -1363,7 +1363,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
{
int k, ndims;
hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
H5TOOLS_DEBUG("H5T_ARRAY");
/* get the array's base datatype for each element */
@@ -1397,7 +1397,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_VLEN:
{
hsize_t nelmts;
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
H5TOOLS_DEBUG("H5T_VLEN");
/* get the VL sequences's base datatype for each element */
@@ -1480,8 +1480,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
break;
} /* end switch */
-done:
-
CATCH
H5TOOLS_ENDDEBUG("exit");
return ret_value;
@@ -1509,11 +1507,11 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hsize_t total_size[H5S_MAX_RANK];
unsigned jndx;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
hbool_t past_catch = FALSE;
hsize_t blkndx;
- hid_t sid1 = -1;
+ hid_t sid1 = H5I_INVALID_HID;
int ret_value = -1;
/* Get the dataspace of the dataset */
@@ -1606,8 +1604,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hsize_t *ptdata = NULL;
int sndims;
unsigned ndims;
- hid_t dtype = -1;
- hid_t type_id = -1;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
hbool_t past_catch = FALSE;
hbool_t ret_value = TRUE;
@@ -1674,7 +1672,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
{
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
int ret_value = 0;
@@ -1729,8 +1727,8 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
hsize_t npoints;
int sndims;
unsigned ndims;
- hid_t dtype = -1;
- hid_t type_id = -1;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
hbool_t past_catch = FALSE;
hbool_t ret_value = TRUE;
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index cdc4581..f446444 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -504,8 +504,8 @@ h5tools_print_region_data_blocks(hid_t region_id,
unsigned jndx;
hbool_t past_catch = FALSE;
size_t type_size;
- hid_t mem_space = -1;
- hid_t sid1 = -1;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
h5tools_context_t ctx;
void *region_buf = NULL;
int ret_value = 0;
@@ -2062,10 +2062,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_context_t *ctx, hid_t type, int object_search)
{
char *mname;
- hid_t mtype = -1;
- hid_t str_type = -1;
- hid_t super = -1;
- hid_t tmp_type = -1;
+ hid_t mtype = H5I_INVALID_HID;
+ hid_t str_type = H5I_INVALID_HID;
+ hid_t super = H5I_INVALID_HID;
+ hid_t tmp_type = H5I_INVALID_HID;
int snmembers;
int sndims;
unsigned nmembers;
@@ -2629,8 +2629,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
}
-done:
-
CATCH
H5TOOLS_ENDDEBUG("exit");
return ret_value;
@@ -2734,8 +2732,8 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
unsigned i;
unsigned nmembs = 0; /*number of members */
int snmembs;
- hid_t super = -1; /*enum base integer type */
- hid_t native = -1; /*native integer datatype */
+ hid_t super = H5I_INVALID_HID; /*enum base integer type */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
H5T_sign_t sign_type; /*sign of value type */
size_t type_size; /*value type size */
size_t dst_size; /*destination value type size */
@@ -3074,7 +3072,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id)
{
size_t size;
- hid_t n_type = -1;
+ hid_t n_type = H5I_INVALID_HID;
void *buf = NULL;
n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
@@ -3309,7 +3307,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
if (vmaps) {
size_t next;
- ssize_t H5_ATTR_SANITY_CHECK ssize_out;
+ ssize_t H5_ATTR_NDEBUG_UNUSED ssize_out;
ctx->indent_level++;
for (next = 0; next < (unsigned) vmaps; next++) {
@@ -3776,8 +3774,8 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex
error_msg("unable to open attribute \"%s\"\n", attr_name);
}
else {
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
ctx->indent_level++;
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 0aa5152..fddd6ab 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1133,7 +1133,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
break;
} /* end switch */
H5Oclose(obj);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
/* Print OID */
if(info->obj_hidefileno)
@@ -1145,7 +1145,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5R_DATASET_REGION1:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
h5tools_str_append(str, H5_TOOLS_DATASET);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_OBJECT2:
H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
@@ -1169,17 +1169,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, H5_TOOLS_UNKNOWN);
break;
} /* end switch */
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_DATASET_REGION2:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
h5tools_str_append(str, H5_TOOLS_DATASET);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_ATTR:
H5TOOLS_DEBUG("ref_type is H5R_ATTR");
h5tools_str_append(str, H5_TOOLS_ATTRIBUTE);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
@@ -1334,7 +1334,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end switch */
}
-done:
ret_value = h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s"));
H5TOOLS_ENDDEBUG("exit with %s", ret_value);
@@ -1351,8 +1350,7 @@ done:
*-------------------------------------------------------------------------
*/
void
-h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, H5R_ref_t *ref_vp)
+h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
{
ssize_t buf_size;
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 6fdf36a..02bfe40 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -41,7 +41,7 @@ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_
H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, H5R_ref_t *vp);
+H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *vp);
H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index f63c228..22e4a39 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -26,7 +26,7 @@
hid_t
h5tools_get_little_endian_type(hid_t tid)
{
- hid_t p_type=-1;
+ hid_t p_type=H5I_INVALID_HID;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
@@ -106,7 +106,7 @@ h5tools_get_little_endian_type(hid_t tid)
hid_t
h5tools_get_big_endian_type(hid_t tid)
{
- hid_t p_type = -1;
+ hid_t p_type = H5I_INVALID_HID;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 1036199..323c9b3 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -721,7 +721,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
case H5O_TYPE_DATASET:
if(NULL == already_seen) {
- hid_t dset = -1;
+ hid_t dset = H5I_INVALID_HID;
/* Add the dataset to the list of objects */
add_obj(info->dset_table, oinfo->addr, name, TRUE);
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 1ecd5c0..fb768a4 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -834,8 +834,8 @@ trav_attr(hid_t
#ifdef H5TRAV_PRINT_SPACE
}
else {
- hid_t attr = -1;
- hid_t space = -1;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hsize_t size[H5S_MAX_RANK];
int ndims;
int i;