summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-19 20:15:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-19 20:15:44 (GMT)
commit6d7133bf01b40a013813377cd2eba29de787f1ce (patch)
treed103c5d579b548255f318dc75f0d346ae998d1c8 /tools/h5repack
parent2dbd7c685fa09a5ec231212a4b0e237e5ff41ff5 (diff)
downloadhdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.zip
hdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.tar.gz
hdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.tar.bz2
HDFFV-10297 merge from develop
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/CMakeTests.cmake4
-rw-r--r--tools/h5repack/h5repack.c50
-rw-r--r--tools/h5repack/h5repack_copy.c209
-rw-r--r--tools/h5repack/h5repack_refs.c29
-rw-r--r--tools/h5repack/h5repacktst.c6
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c1
6 files changed, 128 insertions, 171 deletions
diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake
index 20d0463..b6ec914 100644
--- a/tools/h5repack/CMakeTests.cmake
+++ b/tools/h5repack/CMakeTests.cmake
@@ -229,12 +229,12 @@
endif ()
add_test (
NAME H5REPACK-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects)
add_test (
NAME H5REPACK-${testname}_DFF
- COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname})
endif ()
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index efbd8be..61bf097 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -221,13 +221,12 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
if (H5Oget_info(type_in, &oinfo) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
if (*named_dt_head_p) {
/* Stack already exists, search for the datatype */
while (dt && dt->addr_in != oinfo.addr)
dt = dt->next;
-
dt_ret = dt;
}
else {
@@ -238,7 +237,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
/* Push onto the stack */
if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed");
dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
@@ -259,7 +258,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
if (!dt_ret) {
/* Push the new datatype onto the stack */
if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed");
dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
@@ -276,9 +275,9 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
else
dt_ret->id_out = H5Tcopy(type_in);
if (dt_ret->id_out < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed");
if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed");
} /* end if */
/* Set return value */
@@ -286,7 +285,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
/* 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;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iinc_ref failed");
done:
return ret_value;
@@ -305,7 +304,7 @@ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
while (dt) {
/* Pop the datatype off the stack and free it */
if (H5Tclose(dt->id_out) < 0 && !ignore_err)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
dt = dt->next;
HDfree(*named_dt_head_p);
*named_dt_head_p = dt;
@@ -332,7 +331,7 @@ 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; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
hid_t attr_id = -1; /* attr ID */
hid_t attr_out = -1; /* attr ID */
hid_t space_id = -1; /* space ID */
@@ -426,7 +425,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
base_type = H5Tget_super(ftype_id);
is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
if (type_class == H5T_COMPOUND) {
@@ -435,7 +435,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
for (j = 0; j < nmembers; j++) {
hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
H5T_class_t mtclass = H5Tget_class(mtid);
- H5Tclose(mtid);
+ if (H5Tclose(mtid) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed");
if (mtclass == H5T_REFERENCE) {
is_ref = 1;
@@ -481,7 +482,24 @@ 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);
- } /* u */
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ space_id = -1;
+ if (H5Tclose(wtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ wtype_id = -1;
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ ftype_id = -1;
+ if (H5Aclose(attr_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ attr_id = -1;
+ } /* for u */
done:
H5E_BEGIN_TRY {
@@ -495,11 +513,11 @@ done:
HDfree(buf);
} /* end if */
- H5Tclose(ftype_id);
- H5Tclose(wtype_id);
+ H5Aclose(attr_out);
H5Sclose(space_id);
+ H5Tclose(wtype_id);
+ H5Tclose(ftype_id);
H5Aclose(attr_id);
- H5Aclose(attr_out);
} H5E_END_TRY;
return ret_value;
@@ -789,9 +807,9 @@ static int check_objects(const char* fname, pack_opt_t *options) {
done:
H5E_BEGIN_TRY {
- H5Fclose(fid);
H5Sclose(sid);
H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
if (travt)
trav_table_free(travt);
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 86c6e6f..fada1a8 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -78,23 +78,21 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t
*
* Return: 0, ok,
* -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October, 23, 2003
- *
*-------------------------------------------------------------------------
*/
int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- int ret_value = 0; /* no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fidin;
+ int ret_value = 0;
+ hid_t fidin = -1;
hid_t fidout = -1;
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
+ 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 fcpl = H5P_DEFAULT; /* file creation property list ID */
hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+ trav_table_t *travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
unsigned crt_order_flags; /* group creation order flag */
/*-------------------------------------------------------------------------
@@ -106,10 +104,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* get user block size and file space strategy/threshold */
{
- hid_t fcpl_in; /* file creation property list ID for input file */
- hid_t grp_in = -1; /* group ID */
- hid_t gcpl_in = -1; /* group creation property list */
-
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");
@@ -293,42 +287,26 @@ print_user_block(fnamein, fidin);
/* init table */
trav_table_init(&travt);
- /* get the list of objects in the file */
- if (h5trav_gettable(fidin, travt) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
-
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
- 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);
-
- /*-------------------------------------------------------------------------
- * do the copy of referenced objects
- * and create hard links
- *-------------------------------------------------------------------------
- */
- 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
- *-------------------------------------------------------------------------
- */
-
- if (fapl > 0)
- H5Pclose(fapl);
-
- if (fcpl > 0)
- H5Pclose(fcpl);
-
- H5Fclose(fidin);
- H5Fclose(fidout);
-
- /* free table */
- trav_table_free(travt);
- travt = NULL;
+ if (travt) {
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fidin, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+ 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);
+
+ /*-------------------------------------------------------------------------
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
+ 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);
+ }
/*-------------------------------------------------------------------------
* write only the input file user block if there is no user block file input
@@ -339,17 +317,15 @@ print_user_block(fnamein, fidin);
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;
-
- /*-------------------------------------------------------------------------
- * out
- *-------------------------------------------------------------------------
- */
-
done:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl_in);
+ H5Pclose(gcpl_in);
H5Pclose(fapl);
H5Pclose(fcpl);
+ H5Gclose(grp_in);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
H5Fclose(fidin);
H5Fclose(fidout);
} H5E_END_TRY;
@@ -366,7 +342,7 @@ done:
* The size of hyperslab is limitted by H5TOOLS_BUFSIZE.
* Return the hyperslab dimentions and size in byte.
*
- * Return: 0 - SUCCEED, -1 FAILED
+ * Return: 0 - SUCCEED, -1 FAILED
*
* Parameters:
* dcpl_id : [IN] dataset creation property.
@@ -376,8 +352,6 @@ done:
* dims_hslab[] : [OUT] calculated hyperslab dimentions
* * hslab_nbytes_p : [OUT] total byte of the hyperslab
*
- * Programmer: Jonathan Kim
- * Date: Feburary, 2012
* Update:
* The hyperslab calucation would be depend on if the dataset is chunked
* or not.
@@ -391,25 +365,23 @@ done:
* the boundary would be dataset's dims.
*
* The calulation starts from the last dimention (h5dump dims output).
- *
- * Note:
- * Added for JIRA HDFFV-7862.
*-----------------------------------------*/
-int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
+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; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
int k;
H5D_layout_t dset_layout;
int rank_chunk;
hsize_t dims_chunk[H5S_MAX_RANK];
hsize_t size_chunk = 1;
- hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
- hsize_t hslab_nbytes; /* size of hyperslab in byte */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
/* init to set as size of a data element */
hslab_nbytes = size_datum;
@@ -522,24 +494,9 @@ done:
/*-------------------------------------------------------------------------
* Function: do_copy_objects
*
- * Purpose: duplicate all HDF5 objects in the file
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October, 23, 2003
- *
- * Modifications:
- *
- * July 2004: Introduced the extra EC or NN option for SZIP
- *
- * December 2004: Added a check for H5Dcreate; if the dataset cannot be created
- * with the requested filter, use the input one
- *
- * October 2006: Read/write using the file type by default.
+ * Purpose: duplicate all HDF5 objects in the file
*
- * October 2006: Read by hyperslabs for big datasets.
+ * Return: 0, ok, -1 no
*
* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
* i.e., if the memory needed to read a dataset is greater than this limit,
@@ -580,31 +537,6 @@ done:
* in (2) is that, when using the strip mine size, it assures that the "remaining" part
* of the dataset that does not fill an entire strip mine is processed.
*
- * November 2006: Use H5Ocopy in the copy of objects. The logic for using
- * H5Ocopy or not is if a change of filters or layout is requested by the user
- * then use read/write else use H5Ocopy.
- *
- * May, 1, 2008: Add a printing of the compression ratio of old size / new size
- *
- * Feburary 2012: improve Read/Write by hyperslabs for big datasets.
- * Programmer: Jonathan Kim
- *
- * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done
- * i.e., if the memory needed to read a dataset is greater than this limit,
- * then hyperslab I/O is done instead of one operation I/O
- * For each dataset, the memory needed is calculated according to
- *
- * memory needed = number of elements * size of each element
- *
- * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
- * are done
- *
- * H5Dread( input_dataset )
- * H5Dwrite( output_dataset )
- *
- * with all elements in the datasets selected. If the memory needed is greater than
- * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
- *
* 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()).
* 2. Calculate the hyperslab selections as the selection is moving forward.
* Selection would be same as the hyperslab except for the remaining edge portion
@@ -616,7 +548,7 @@ done:
int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
hid_t grp_in = -1; /* group ID */
hid_t grp_out = -1; /* group ID */
hid_t dset_in = -1; /* read dataset ID */
@@ -1193,6 +1125,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if (H5Tclose(type_out) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */
break;
@@ -1223,6 +1156,18 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
} /* end if */
done:
+
+ /* Finalize (link) the stack of named datatypes (if any) first
+ * because of reference counting */
+ if (0 == ret_value && named_dt_head != NULL) {
+ if (named_datatype_free(&named_dt_head, 0) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed");
+ }
+ else
+ H5E_BEGIN_TRY {
+ named_datatype_free(&named_dt_head, 1);
+ } H5E_END_TRY;
+
H5E_BEGIN_TRY
{
H5Gclose(grp_in);
@@ -1245,14 +1190,6 @@ done:
if (hslab_buf != NULL)
HDfree(hslab_buf);
- /* Finalize (link) the stack of named datatypes (if any) */
- if (0 == ret_value && named_dt_head != NULL)
- named_datatype_free(&named_dt_head, 0);
- else
- H5E_BEGIN_TRY {
- named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
-
return ret_value;
}
@@ -1260,10 +1197,10 @@ done:
* Function: print_dataset_info
*
* Purpose: print name, filters, percentage compression of a dataset
- *
*-------------------------------------------------------------------------
*/
-static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
+static void
+print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
{
char strfilter[255];
#if defined (PRINT_DEBUG )
@@ -1275,7 +1212,7 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p
unsigned cd_values[20]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
char f_objname[256]; /* filter objname */
- int i;
+ int i;
HDstrcpy(strfilter, "\0");
@@ -1367,19 +1304,15 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p
/*-------------------------------------------------------------------------
* Function: copy_user_block
*
- * Purpose: copy user block from one file to another
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Peter Cao
- *
- * Date: October, 25, 2007
+ * Purpose: copy user block from one file to another
*
+ * Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
-static int copy_user_block(const char *infile, const char *outfile, hsize_t size)
+static int
+copy_user_block(const char *infile, const char *outfile, hsize_t size)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 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.) */
@@ -1441,21 +1374,17 @@ done:
/*-------------------------------------------------------------------------
* Function: print_user_block
*
- * Purpose: print user block
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente
- *
- * Date: August, 20, 2008
+ * Purpose: print user block
*
+ * Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static
-void print_user_block(const char *filename, hid_t fid)
+void
+print_user_block(const char *filename, hid_t fid)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
int fh; /* file handle */
hsize_t ub_size; /* user block size */
hsize_t size; /* size read */
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 01b3407..5133966 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -189,7 +189,8 @@ int do_copy_refobjs(hid_t fidin,
refname);
}
} /*refname*/
- H5Oclose(refobj_id);
+ if (H5Oclose(refobj_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refob failed");
} /* u */
} /*nelmts*/
@@ -276,7 +277,8 @@ int do_copy_refobjs(hid_t fidin,
refname);
}
} /*refname*/
- H5Oclose(refobj_id);
+ if (H5Oclose(refobj_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refobj_id failed");
} /* u */
} /*nelmts*/
@@ -392,7 +394,7 @@ done:
H5Tclose(ftype_id);
H5Tclose(mtype_id);
H5Tclose(type_in);
- named_datatype_free(&named_dt_head, 0);
+ named_datatype_free(&named_dt_head, 1);
} H5E_END_TRY;
return ret_value;
@@ -483,7 +485,8 @@ static int copy_refs_attr(hid_t loc_in,
base_type = H5Tget_super(ftype_id);
is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
else if(type_class == H5T_ARRAY ) {
hid_t base_type;
@@ -491,7 +494,8 @@ static int copy_refs_attr(hid_t loc_in,
base_type = H5Tget_super(ftype_id);
is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
else if(type_class == H5T_COMPOUND) {
int nmembers = H5Tget_nmembers(ftype_id) ;
@@ -511,7 +515,8 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
ref_comp_field_n++;
}
- H5Tclose(mtid);
+ if (H5Tclose(mtid) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed");
}
/* if compound don't contain reference type member, free the above
@@ -533,9 +538,12 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = (ref_comp_field_n > 0);
if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
- H5Tclose(mtype_id);
- H5Tclose(ftype_id);
- H5Aclose(attr_id);
+ if (H5Tclose(mtype_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtype_id failed");
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose ftype_id failed");
+ if (H5Aclose(attr_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Aclose attr_id failed");
continue;
}
@@ -568,7 +576,8 @@ static int copy_refs_attr(hid_t loc_in,
base_type = H5Tget_super(ftype_id);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 7e4fad4..72f76c3 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -2652,9 +2652,9 @@ int make_all_filters(hid_t loc_id)
/* close */
if(H5Tclose(dtid) < 0)
- return -1;
+ goto out;
if(H5Dclose(dsid) < 0)
- return -1;
+ goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -2666,6 +2666,8 @@ int make_all_filters(hid_t loc_id)
out:
H5E_BEGIN_TRY
{
+ H5Tclose(dtid);
+ H5Dclose(dsid);
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index e08d5ab..6e7a24e 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
#include "h5tools_utils.h"