summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack/h5repack_verify.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/h5repack/h5repack_verify.c')
-rw-r--r--tools/src/h5repack/h5repack_verify.c158
1 files changed, 79 insertions, 79 deletions
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index dbe8e1a..683988c 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -39,26 +39,26 @@ 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) */
- 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 */
hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ int ret_value = 0;
/* open the output file */
if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on <%s>", out_fname);
+ H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on <%s>", out_fname);
for(i = 0; i < options->op_tbl->nelems; i++) {
char *name = options->op_tbl->objs[i].path;
@@ -69,13 +69,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
if((sid = H5Dget_space(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
if((tid = H5Dget_type(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
/*-------------------------------------------------------------------------
* filter check
@@ -95,14 +95,14 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* close
*-------------------------------------------------------------------------
*/
- if(H5Pclose(pid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(pid) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if (H5Dclose(did) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (H5Tclose(tid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
}
/*-------------------------------------------------------------------------
@@ -114,11 +114,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidout, &travt);
/* get the list of objects in the file */
if(h5trav_gettable(fidout, travt) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+ H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
for(i = 0; i < travt->nobjs; i++) {
char *name = travt->objs[i].name;
@@ -129,13 +129,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
if((sid = H5Dget_space(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
if((tid = H5Dget_type(did)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
/*-------------------------------------------------------------------------
* filter check
@@ -165,13 +165,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if (H5Pclose(pid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if (H5Dclose(did) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (H5Tclose(tid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
} /* if */
} /* i */
@@ -187,32 +187,32 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* open the input file */
if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname);
+ H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on file <%s>", in_fname);
/* Get file creation property list for input file */
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");
+ H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for input file */
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 & threshold");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for input file */
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 page size");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/* Output file is already opened */
/* Get file creation property list for output file */
if((fcpl_out = H5Fget_create_plist(fidout)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
+ H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for output file */
if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for output file */
if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/*
* If -S option is set, the file space handling strategy should be set as specified.
@@ -221,11 +221,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(options->fs_strategy) {
if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
else {
if(out_strategy != in_strategy)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
/*
@@ -235,11 +235,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(options->fs_persist) {
if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
else {
if(out_persist != in_persist)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
/*
@@ -249,11 +249,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(options->fs_threshold) {
if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
else {
if(out_threshold != in_threshold)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
/*
@@ -263,11 +263,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(options->fs_pagesize) {
if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
}
else { /* "-G" is not set */
if(out_pagesize != in_pagesize)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
+ H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
}
@@ -355,19 +355,19 @@ 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: 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 */
+ 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;
+ trav_table_t *trav = NULL;
unsigned int i;
+ int ret_value = 1;
/*-------------------------------------------------------------------------
* open the files
@@ -375,9 +375,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
*/
/* 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);
+ H5TOOLS_GOTO_ERROR((-1), "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);
+ H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
* get file table list of objects
@@ -386,9 +386,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&trav);
+ trav_table_init(fid1, &trav);
if(h5trav_gettable(fid1, trav) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+ H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
/*-------------------------------------------------------------------------
* traverse the suppplied object list
@@ -397,62 +397,62 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
for(i = 0; i < trav->nobjs; i++) {
if(trav->objs[i].type == H5TRAV_TYPE_GROUP) {
if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on first <%s>", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on first <%s>", trav->objs[i].name);
if ((gcplid = H5Gget_create_plist(gid)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Gclose(gid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on second <%s>", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on second <%s>", trav->objs[i].name);
if ((gcplid = H5Gget_create_plist(gid)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Gclose(gid) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
if (crt_order_flag1 != crt_order_flag2)
- HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
}
else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) {
if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on first <%s>", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on first <%s>", trav->objs[i].name);
if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on second <%s>", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on second <%s>", trav->objs[i].name);
if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
/*-------------------------------------------------------------------------
* compare the property lists
*-------------------------------------------------------------------------
*/
if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pequal failed");
if(ret_value == 0)
- HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
+ H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
if(H5Pclose(dcpl1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if(H5Pclose(dcpl2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if(H5Dclose(dset1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if(H5Dclose(dset2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*if*/
} /*for*/