summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r--tools/src/h5repack/h5repack.c14
-rw-r--r--tools/src/h5repack/h5repack_copy.c30
-rw-r--r--tools/src/h5repack/h5repack_filters.c10
3 files changed, 16 insertions, 38 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index a63e56f..e96dea5 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
hid_t did = -1;
hid_t sid = -1;
unsigned int i;
- unsigned int uf;
+ int ifil;
trav_table_t *travt = NULL;
/* nothing to do */
@@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
*/
if (options->verbose)
- printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs);
+ printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
char* name = options->op_tbl->objs[i].path;
@@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) {
if (options->verbose)
printf("...Found\n");
- for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) {
- if (options->op_tbl->objs[i].filter[uf].filtn < 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) {
+ if (options->op_tbl->objs[i].filter[ifil].filtn < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
/* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter[uf].filtn) {
+ switch (options->op_tbl->objs[i].filter[ifil].filtn) {
/* chunk size must be smaller than pixels per block */
case H5Z_FILTER_SZIP:
{
int j;
hsize_t csize = 1;
- unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0];
+ unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
@@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
default:
break;
}
- } /* for uf */
+ } /* for ifil */
} /* for i */
done:
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 0567269..8122d6d 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -33,20 +33,6 @@
/* size of buffer/# of bytes to xfer at a time when copying userblock */
#define USERBLOCK_XFER_SIZE 512
-/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
-#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
- H5E_BEGIN_TRY { \
- if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \
- hid_t _err_num = 0; \
- char _msg[80]; \
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
- H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
- error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
- HGOTO_DONE(_fail) \
- } \
- } H5E_END_TRY; \
-}
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
@@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile,
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
-static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata);
-/* get the major number from the error stack. */
-static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
- if (err_desc)
- *((hid_t *) udata) = err_desc->maj_num;
-
- return 0;
-}
/*-------------------------------------------------------------------------
* Function: copy_objects
@@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
unsigned u;
- unsigned uf;
+ int ifil;
int is_ref = 0;
htri_t is_named;
hbool_t limit_maxdims;
@@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (options->op_tbl->objs) {
for (u = 0; u < options->op_tbl->nelems; u++) {
if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) {
- if (options->op_tbl->objs[u].filter[uf].filtn > 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
+ if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
req_filter = 1;
}
}
@@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
if (!pr)
printf(FORMAT_OBJ, "dset", objname);
else {
- char str[255], temp[28];
+ char str[512], temp[512];
HDstrcpy(str, "dset ");
HDstrcat(str, strfilter);
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 3d9472a..7e32def 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5D_layout_t layout;
int rank; /* rank of dataset */
hsize_t chsize[64]; /* chunk size in elements */
- unsigned int i;
+ int i;
+ unsigned u;
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
objout->chunk.rank = rank;
- for (i = 0; i < rank; i++)
- objout->chunk.chunk_lengths[i] = chsize[i];
+ for (u = 0; u < (unsigned)rank; u++)
+ objout->chunk.chunk_lengths[u] = chsize[u];
}
done:
@@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest = NULL;
- char *pname = NULL;
- int result;
+ const char *pname = NULL;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {