summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack
diff options
context:
space:
mode:
authorRichard Warren <Richard.Warren@hdfgroup.org>2017-10-04 20:35:46 (GMT)
committerRichard Warren <Richard.Warren@hdfgroup.org>2017-10-04 20:35:46 (GMT)
commitbccbe8e53eaef9ad0d4afbbc9298a8bba19ab827 (patch)
treef4960a936b2b5287468d33009bc46c140f0286c4 /tools/src/h5repack
parentda0f8223df7d37f3ae31da286a86fe62d58f6ea0 (diff)
parent281efe75c4aa55d8bbb875a23a883247279e8598 (diff)
downloadhdf5-bccbe8e53eaef9ad0d4afbbc9298a8bba19ab827.zip
hdf5-bccbe8e53eaef9ad0d4afbbc9298a8bba19ab827.tar.gz
hdf5-bccbe8e53eaef9ad0d4afbbc9298a8bba19ab827.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into optimize_superblock_read
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r--tools/src/h5repack/h5repack.c161
-rw-r--r--tools/src/h5repack/h5repack_copy.c107
-rw-r--r--tools/src/h5repack/h5repack_filters.c52
-rw-r--r--tools/src/h5repack/h5repack_main.c17
-rw-r--r--tools/src/h5repack/h5repack_opttable.c191
-rw-r--r--tools/src/h5repack/h5repack_verify.c177
6 files changed, 254 insertions, 451 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 76ca117..7ed9a90 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -39,11 +39,6 @@ static int have_request(pack_opt_t *options);
* object name requests
*
* Return: 0, ok, -1, fail
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September, 22, 2003
- *
*-------------------------------------------------------------------------
*/
int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
@@ -68,7 +63,6 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
* Purpose: initialize options
*
* Return: 0, ok, -1, fail
- *
*-------------------------------------------------------------------------
*/
int
@@ -96,7 +90,6 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
* Function: h5repack_end
*
* Purpose: free options table
- *
*-------------------------------------------------------------------------
*/
@@ -111,18 +104,17 @@ int h5repack_end(pack_opt_t *options) {
* Example: -f dset:GZIP=6
*
* Return: 0, ok, -1, fail
- *
*-------------------------------------------------------------------------
*/
int
-h5repack_addfilter(const char* str, pack_opt_t *options)
+h5repack_addfilter(const char *str, pack_opt_t *options)
{
obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
filter_info_t filter; /* filter info for the current -f option entry */
unsigned n_objs; /* number of objects in the current -f or -l option entry */
int is_glb; /* is the filter global */
- /* parse the -f option */
+ /* parse the -f (--filter) option */
if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb)))
return -1;
@@ -152,11 +144,10 @@ h5repack_addfilter(const char* str, pack_opt_t *options)
* Purpose: add a layout option
*
* Return: 0, ok, -1, fail
- *
*-------------------------------------------------------------------------
*/
int
-h5repack_addlayout(const char* str, pack_opt_t *options)
+h5repack_addlayout(const char *str, pack_opt_t *options)
{
obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */
unsigned n_objs; /*number of objects in the current -t or -c option entry */
@@ -220,11 +211,6 @@ h5repack_addlayout(const char* str, pack_opt_t *options)
* returned must be closed after it is no longer needed.
* named_datatype_free must be called before the program exits
* to free the stack.
- *
- * Programmer: Neil Fortner
- *
- * Date: April 14, 2009
- *
*-------------------------------------------------------------------------
*/
hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
@@ -304,18 +290,13 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
ret_value = -1;
done:
- return (ret_value);
+ return ret_value;
} /* end copy_named_datatype */
/*-------------------------------------------------------------------------
* Function: named_datatype_free
*
* Purpose: Frees the stack of named datatypes.
- *
- * Programmer: Neil Fortner
- *
- * Date: April 14, 2009
- *
*-------------------------------------------------------------------------
*/
int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
@@ -346,11 +327,6 @@ done:
* loc_id = H5Topen2( fid, name);
*
* Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October, 28, 2003
- *
*-------------------------------------------------------------------------
*/
int
@@ -477,7 +453,6 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
buf = (void *)HDmalloc((size_t)(nelmts * msize));
if (buf == NULL) {
- error_msg("h5repack", "cannot read into memory\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if (H5Aread(attr_id, wtype_id, buf) < 0)
@@ -489,7 +464,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
*/
if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed on ,%s>", name);
if (H5Awrite(attr_out, wtype_id, buf) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
@@ -553,13 +528,10 @@ done:
* Purpose: print options, checks for invalid options
*
* Return: void, return -1 on error
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September, 22, 2003
*-------------------------------------------------------------------------
*/
static int check_options(pack_opt_t *options) {
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
unsigned int i;
int k, j, has_cp = 0, has_ck = 0;
char slayout[30];
@@ -586,11 +558,10 @@ static int check_options(pack_opt_t *options) {
break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
- error_msg("invalid layout\n");
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid layout");
default:
strcpy(slayout, "invalid layout\n");
- return -1;
+ HGOTO_DONE(FAIL);
}
printf(" Apply %s layout to all\n", slayout);
if (H5D_CHUNKED == options->layout_g) {
@@ -609,25 +580,20 @@ static int check_options(pack_opt_t *options) {
if (options->verbose) {
printf(" <%s> with chunk size ", name);
for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
- printf("%d ",
- (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+ printf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
printf("\n");
}
has_ck = 1;
}
else if (options->op_tbl->objs[i].chunk.rank == -2) {
if (options->verbose)
- printf(" <%s> %s\n", name, "NONE (contigous)");
+ printf(" <%s> %s\n", name, "NONE (contiguous)");
has_ck = 1;
}
}
- if (options->all_layout == 1 && has_ck) {
- error_msg(
- "invalid chunking input: 'all' option\
- is present with other objects\n");
- return -1;
- }
+ if (options->all_layout == 1 && has_ck)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects");
/*-------------------------------------------------------------------------
* objects to filter
@@ -649,8 +615,7 @@ static int check_options(pack_opt_t *options) {
break;
case H5Z_FILTER_SZIP:
case H5Z_FILTER_DEFLATE:
- printf(" All with %s, parameter %d\n", get_sfilter(filtn),
- options->filter_g[k].cd_values[0]);
+ printf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]);
break;
default:
printf(" User Defined %d\n", filtn);
@@ -666,48 +631,29 @@ static int check_options(pack_opt_t *options) {
for (j = 0; j < pack.nfilters; j++) {
if (options->verbose) {
- printf(" <%s> with %s filter\n", name,
- get_sfilter(pack.filter[j].filtn));
+ printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn));
}
-
has_cp = 1;
-
} /* j */
} /* i */
- if (options->all_filter == 1 && has_cp) {
- error_msg(
- "invalid compression input: 'all' option\
- is present with other objects\n");
- return -1;
- }
+ if (options->all_filter == 1 && has_cp)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects");
/*-------------------------------------------------------------------------
* check options for the latest format
*-------------------------------------------------------------------------
*/
- if (options->grp_compact < 0) {
- error_msg(
- "invalid maximum number of links to store as header messages\n");
- return -1;
- }
- if (options->grp_indexed < 0) {
- error_msg(
- "invalid minimum number of links to store in the indexed format\n");
- return -1;
- }
- if (options->grp_indexed > options->grp_compact) {
- error_msg(
- "minimum indexed size is greater than the maximum compact size\n");
- return -1;
- }
- for (i = 0; i < 8; i++) {
- if (options->msg_size[i] < 0) {
- error_msg("invalid shared message size\n");
- return -1;
- }
- }
+ if (options->grp_compact < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages");
+ if (options->grp_indexed < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format");
+ if (options->grp_indexed > options->grp_compact)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size");
+ for (i = 0; i < 8; i++)
+ if (options->msg_size[i] < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size");
/*--------------------------------------------------------------------------------
* verify new user userblock options; file name must be present
@@ -715,30 +661,25 @@ static int check_options(pack_opt_t *options) {
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
if (options->verbose) {
- printf(
- "Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
+ printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
options->ublock_filename);
options->ublock_size = 1024;
}
}
- if (options->ublock_filename == NULL && options->ublock_size != 0) {
- error_msg("file name missing for user block\n",
- options->ublock_filename);
- return -1;
- }
+ if (options->ublock_filename == NULL && options->ublock_size != 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename);
/*--------------------------------------------------------------------------------
* verify alignment options; threshold is zero default but alignment not
*---------------------------------------------------------------------------------
*/
- if (options->alignment == 0 && options->threshold != 0) {
- error_msg("alignment for H5Pset_alignment missing\n");
- return -1;
- }
+ if (options->alignment == 0 && options->threshold != 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing");
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -748,11 +689,6 @@ static int check_options(pack_opt_t *options) {
* supplied list
*
* Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: September, 23, 2003
- *
*-------------------------------------------------------------------------
*/
static int check_objects(const char* fname, pack_opt_t *options) {
@@ -768,8 +704,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))
- < 0) {
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) {
printf("<%s>: %s\n", fname, H5FOPENERROR);
return -1;
}
@@ -786,7 +721,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
/* get the list of objects in the file */
if (h5trav_gettable(fid, travt) < 0)
- goto out;
+ goto done;
/*-------------------------------------------------------------------------
* compare with user supplied list
@@ -794,8 +729,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
*/
if (options->verbose)
- printf("Opening file <%s>. Searching for objects to modify...\n",
- fname);
+ printf("Opening file <%s>. Searching for objects to modify...\n", fname);
for (i = 0; i < options->op_tbl->nelems; i++) {
char* name = options->op_tbl->objs[i].path;
@@ -806,7 +740,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
if (h5trav_getindext(name, travt) < 0) {
error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose ? "\n" : ""), name, fname);
- goto out;
+ goto done;
}
if (options->verbose)
printf("...Found\n");
@@ -831,26 +765,25 @@ static int check_objects(const char* fname, pack_opt_t *options) {
}
else {
if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
- goto out;
+ goto done;
if ((sid = H5Dget_space(did)) < 0)
- goto out;
+ goto done;
if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
- goto out;
+ goto done;
HDmemset(dims, 0, sizeof dims);
if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
- goto out;
+ goto done;
for (j = 0; j < rank; j++)
csize *= dims[j];
if (H5Sclose(sid) < 0)
- goto out;
+ goto done;
if (H5Dclose(did) < 0)
- goto out;
+ goto done;
}
if (csize < ppb) {
- printf(
- " <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
- goto out;
+ printf(" <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
+ goto done;
}
}
break;
@@ -867,7 +800,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
trav_table_free(travt);
return 0;
-out:
+done:
H5Fclose(fid);
trav_table_free(travt);
return -1;
@@ -879,9 +812,6 @@ out:
* Purpose: check if a filter or layout was requested
*
* Return: 1 yes, 0 no
- *
- * Date: May, 24, 2007
- *
*-------------------------------------------------------------------------
*/
static int have_request(pack_opt_t *options) {
@@ -899,7 +829,6 @@ static int have_request(pack_opt_t *options) {
* Purpose: return the filter as a string name
*
* Return: name of filter, exit on error
- *
*-------------------------------------------------------------------------
*/
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 501f084..47cad13 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -110,8 +110,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) {
- error_msg("<%s>: %s\n", fnamein, H5FOPENERROR);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
}
/* get user block size and file space strategy/persist/threshold */
@@ -121,25 +120,21 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
hid_t gcpl_in = -1; /* group creation property list */
if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
}
if (H5Pget_userblock(fcpl_in, &ub_size) < 0) {
- error_msg("failed to retrieve userblock size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size");
}
/* If the -S option is not set, get "strategy" from the input file */
if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
- error_msg("failed to retrieve file space strategy\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy");
}
/* If the -G option is not set, get "pagesize" from the input file */
if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
- error_msg("failed to retrieve file space threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold");
}
/* open root group */
if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0)
@@ -154,8 +149,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
if (H5Pclose(fcpl_in) < 0) {
- error_msg("failed to close property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list");
}
}
@@ -163,14 +157,12 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if (options->latest || ub_size > 0) {
/* Create file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
- error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
}
if (ub_size > 0) {
if (H5Pset_userblock(fcpl, ub_size) < 0) {
- error_msg("failed to set non-default userblock size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size");
}
}
@@ -181,8 +173,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* (So that it is created in "dense storage" form) */
if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact,
(unsigned) options->grp_indexed) < 0) {
- error_msg("fail to adjust group creation parameters for root group\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
}
for (i = 0; i < 5; i++) {
@@ -219,28 +210,24 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if (nindex > 0) {
if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
- error_msg("fail to set the number of shared object header message indexes\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes");
}
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
for (i = 0; i < (nindex - 1); i++) {
if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
- error_msg("fail to configure the specified shared object header message index\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
} /* end if */
} /* end for */
} /* if (nindex>0) */
/* Create file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg("Could not create file access property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
} /* end if */
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- error_msg("Could not set property for using latest version of the format\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format");
} /* end if */
} /* end if */
} /* end if */
@@ -257,15 +244,13 @@ print_user_block(fnamein, fidin);
if (fcpl == H5P_DEFAULT) {
/* create a file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
- error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
}
}
/* set user block size */
if (H5Pset_userblock(fcpl, options->ublock_size) < 0) {
- error_msg("failed to set userblock size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size");
}
}
@@ -278,14 +263,12 @@ print_user_block(fnamein, fidin);
if (fapl == H5P_DEFAULT) {
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg("Could not create file access property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
}
}
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) {
- error_msg("failed to set alignment\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment");
}
}
@@ -298,14 +281,12 @@ print_user_block(fnamein, fidin);
if (fapl == H5P_DEFAULT) {
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg("Could not create file access property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
}
}
if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) {
- error_msg("failed to set metadata block size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size");
}
}
@@ -318,8 +299,7 @@ print_user_block(fnamein, fidin);
if (fcpl == H5P_DEFAULT) {
/* create a file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
- error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
}
}
@@ -349,8 +329,7 @@ print_user_block(fnamein, fidin);
/* Set file space information as specified */
if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) {
- error_msg("failed to set file space strategy\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy");
}
if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
@@ -360,8 +339,7 @@ print_user_block(fnamein, fidin);
if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) {
- error_msg("failed to set file space page size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size");
}
/*-------------------------------------------------------------------------
@@ -372,8 +350,7 @@ print_user_block(fnamein, fidin);
printf("Making file <%s>...\n", fnameout);
if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
- error_msg("<%s>: Could not create file\n", fnameout);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout);
}
/*-------------------------------------------------------------------------
@@ -382,8 +359,7 @@ print_user_block(fnamein, fidin);
*/
if (options->ublock_size > 0) {
if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) {
- error_msg("Could not copy user block. Exiting...\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting...");
}
}
@@ -399,15 +375,14 @@ print_user_block(fnamein, fidin);
/* get the list of objects in the file */
if (h5trav_gettable(fidin, travt) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
/*-------------------------------------------------------------------------
* do the copy
*-------------------------------------------------------------------------
*/
if (do_copy_objects(fidin, fidout, travt, options) < 0) {
- error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
} /* end if */
/*-------------------------------------------------------------------------
@@ -416,8 +391,7 @@ print_user_block(fnamein, fidin);
*-------------------------------------------------------------------------
*/
if (do_copy_refobjs(fidin, fidout, travt, options) < 0) {
- printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
}
/*-------------------------------------------------------------------------
@@ -445,8 +419,7 @@ print_user_block(fnamein, fidin);
if (ub_size > 0 && options->ublock_size == 0) {
if (copy_user_block(fnamein, fnameout, ub_size) < 0) {
- error_msg("Could not copy user block. Exiting...\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting...");
}
}
@@ -533,7 +506,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
/* get chunk dims */
rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk);
if (rank_chunk < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
for (k = rank_dset; k > 0; --k)
size_chunk *= dims_chunk[k - 1];
@@ -595,7 +568,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
hslab_nbytes *= dims_hslab[k - 1];
if (hslab_nbytes <= 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed");
}
}
}
@@ -619,7 +592,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
hslab_nbytes *= dims_hslab[k - 1];
if (hslab_nbytes <= 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed");
}
}
@@ -1488,9 +1461,9 @@ static int copy_user_block(const char *infile, const char *outfile, hsize_t size
/* Open files */
if ((infid = HDopen(infile, O_RDONLY)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed input file <%s>", infile);
if ((outfid = HDopen(outfile, O_WRONLY)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed output file <%s>", outfile);
/* Copy the userblock from the input file to the output file */
while (size > 0) {
@@ -1504,7 +1477,7 @@ static int copy_user_block(const char *infile, const char *outfile, hsize_t size
else
nread = HDread(infid, rbuf, (size_t)size);
if (nread < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed to read userblock");
/* Write buffer to destination file */
/* (compensating for interrupted writes & checking for errors, etc.) */
@@ -1566,24 +1539,20 @@ void print_user_block(const char *filename, hid_t fid)
/* get user block size */
if(( fcpl = H5Fget_create_plist(fid)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
}
if(H5Pget_userblock(fcpl, &ub_size) < 0) {
- error_msg("failed to retrieve userblock size\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size");
}
if(H5Pclose(fcpl) < 0) {
- error_msg("failed to close property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed to close property list");
}
/* open file */
if((fh = HDopen(filename, O_RDONLY)) < 0) {
- error_msg("failed to open file\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename);
}
size = ub_size;
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 5ccb2ef..a74e5f3 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -199,6 +199,7 @@ int apply_filters(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
int *has_filter) /* (OUT) object NAME has a filter */
{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
int nfilters; /* number of filters in DCPL */
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
@@ -208,7 +209,7 @@ int apply_filters(const char* name, /* object name from traverse list */
*has_filter = 0;
if (rank == 0) /* scalar dataset, do not apply */
- return 0;
+ HGOTO_DONE(0);
/*-------------------------------------------------------------------------
* initialize the assigment object
@@ -221,11 +222,11 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
if (aux_assign_obj(name, options, &obj) == 0)
- return 0;
+ HGOTO_DONE(0);
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed");
/*-------------------------------------------------------------------------
* check if we have filters in the pipeline
@@ -236,7 +237,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (nfilters && obj.nfilters) {
*has_filter = 1;
if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed");
}
/*-------------------------------------------------------------------------
@@ -246,11 +247,11 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
if (obj.layout == -1) {
if ((layout = H5Pget_layout(dcpl_id)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
if (layout == H5D_CHUNKED) {
if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
obj.layout = H5D_CHUNKED;
obj.chunk.rank = rank;
for (i = 0; i < rank; i++)
@@ -323,9 +324,9 @@ int apply_filters(const char* name, /* object name from traverse list */
aggression = obj.filter[i].cd_values[0];
/* set up for deflated data */
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_deflate(dcpl_id, aggression) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_deflate failed");
}
break;
@@ -343,9 +344,9 @@ int apply_filters(const char* name, /* object name from traverse list */
/* set up for szip data */
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_szip failed");
}
break;
@@ -355,9 +356,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
case H5Z_FILTER_SHUFFLE:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_shuffle(dcpl_id) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed");
break;
/*-------------------------------------------------------------------------
@@ -366,9 +367,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
case H5Z_FILTER_FLETCHER32:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_fletcher32(dcpl_id) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed");
break;
/*----------- -------------------------------------------------------------
* H5Z_FILTER_NBIT , NBIT compression
@@ -376,9 +377,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
case H5Z_FILTER_NBIT:
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_nbit(dcpl_id) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed");
break;
/*----------- -------------------------------------------------------------
* H5Z_FILTER_SCALEOFFSET , scale+offset compression
@@ -394,9 +395,9 @@ int apply_filters(const char* name, /* object name from traverse list */
scale_factor = (int) obj.filter[i].cd_values[1];
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_scaleoffset failed");
}
break;
default:
@@ -404,9 +405,9 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
obj.filter[i].cd_values) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed");
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
}
break;
} /* switch */
@@ -422,24 +423,25 @@ int apply_filters(const char* name, /* object name from traverse list */
if (obj.layout >= 0) {
/* a layout was defined */
if (H5Pset_layout(dcpl_id, obj.layout) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed");
if (H5D_CHUNKED == obj.layout) {
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed");
}
else if (H5D_COMPACT == obj.layout) {
if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed");
}
/* remove filters for the H5D_CONTIGUOUS case */
else if (H5D_CONTIGUOUS == obj.layout) {
if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed");
}
}
- return 0;
+done:
+ return ret_value;
}
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index a3f5678..3860451 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -221,10 +221,6 @@ static void usage(const char *prog) {
* Purpose: Shutdown MPI & HDF5 and call exit()
*
* Return: Does not return
- *
- * Programmer: Quincey Koziol
- * Saturday, 31. January 2004
- *
*-------------------------------------------------------------------------
*/
static void leave(int ret)
@@ -239,11 +235,6 @@ static void leave(int ret)
* Purpose: read comp and chunk options from a file
*
* Return: void, exit on error
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September, 22, 2003
- *
*-------------------------------------------------------------------------
*/
static
@@ -425,7 +416,6 @@ set_sort_order(const char *form)
* Function: parse_command_line
*
* Purpose: parse command line input
- *
*-------------------------------------------------------------------------
*/
static
@@ -674,13 +664,6 @@ done:
* Return: Success: EXIT_SUCCESS(0)
*
* Failure: EXIT_FAILURE(1)
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
*-------------------------------------------------------------------------
*/
int main(int argc, const char **argv)
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 93e34b3..6c409ec 100644
--- a/tools/src/h5repack/h5repack_opttable.c
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -21,23 +21,22 @@
* Purpose: initialize a pack_info_t structure
*
* Return: void
- *
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
void init_packobject(pack_info_t *obj) {
- int j, k;
-
- HDstrcpy(obj->path, "\0");
- for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
- obj->filter[j].filtn = -1;
- for (k = 0; k < CD_VALUES; k++)
- obj->filter[j].cd_values[k] = 0;
- }
- obj->chunk.rank = -1;
- obj->refobj_id = -1;
- obj->layout = H5D_LAYOUT_ERROR;
- obj->nfilters = 0;
+ int j, k;
+
+ HDstrcpy(obj->path, "\0");
+ for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
+ obj->filter[j].filtn = -1;
+ for (k = 0; k < CD_VALUES; k++)
+ obj->filter[j].cd_values[k] = 0;
+ }
+ obj->chunk.rank = -1;
+ obj->refobj_id = -1;
+ obj->layout = H5D_LAYOUT_ERROR;
+ obj->nfilters = 0;
}
/*-------------------------------------------------------------------------
@@ -46,20 +45,14 @@ void init_packobject(pack_info_t *obj) {
* Purpose: auxiliary function, inserts the filter in object OBJS[ I ]
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I,
- filter_info_t filt) {
- if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) {
- table->objs[I].filter[table->objs[I].nfilters++] = filt;
- }
- else {
- error_msg(
- "cannot insert the filter in this object.\
- Maximum capacity exceeded\n");
- }
+static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) {
+ if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS)
+ table->objs[I].filter[table->objs[I].nfilters++] = filt;
+ else
+ H5TOOLS_INFO(H5E_tools_min_id_g, "cannot insert the filter in this object. Maximum capacity exceeded");
}
/*-------------------------------------------------------------------------
@@ -68,30 +61,27 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I,
* Purpose: auxiliary function, inserts the layout in object OBJS[ I ]
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
-
-static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I,
- pack_info_t *pack) {
- int k;
-
- table->objs[I].layout = pack->layout;
- if (H5D_CHUNKED == pack->layout) {
- /* -2 means the NONE option, remove chunking
- and set the layout to contiguous */
- if (pack->chunk.rank == -2) {
- table->objs[I].layout = H5D_CONTIGUOUS;
- table->objs[I].chunk.rank = -2;
- }
- /* otherwise set the chunking type */
- else {
- table->objs[I].chunk.rank = pack->chunk.rank;
- for (k = 0; k < pack->chunk.rank; k++)
- table->objs[I].chunk.chunk_lengths[k] =
- pack->chunk.chunk_lengths[k];
- }
- }
+static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) {
+ int k;
+
+ table->objs[I].layout = pack->layout;
+ if (H5D_CHUNKED == pack->layout) {
+ /* -2 means the NONE option, remove chunking
+ and set the layout to contiguous */
+ if (pack->chunk.rank == -2) {
+ table->objs[I].layout = H5D_CONTIGUOUS;
+ table->objs[I].chunk.rank = -2;
+ }
+ /* otherwise set the chunking type */
+ else {
+ table->objs[I].chunk.rank = pack->chunk.rank;
+ for (k = 0; k < pack->chunk.rank; k++)
+ table->objs[I].chunk.chunk_lengths[k] =
+ pack->chunk.chunk_lengths[k];
+ }
+ }
}
/*-------------------------------------------------------------------------
@@ -100,7 +90,6 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I,
* Purpose: auxiliary function, increases the size of the collection by N_OBJS
*
* Return: 0, ok, -1, fail
- *
*-------------------------------------------------------------------------
*/
static int
@@ -111,7 +100,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
table->size += n_objs;
table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs == NULL) {
- error_msg("not enough memory for options table\n");
+ H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table");
return -1;
}
@@ -128,32 +117,30 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
* Purpose: init options table
*
* Return: 0, ok, -1, fail
- *
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
int options_table_init(pack_opttbl_t **tbl) {
- unsigned int i;
- pack_opttbl_t *table;
-
- if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
- error_msg("not enough memory for options table\n");
- return -1;
- }
-
- table->size = 30;
- table->nelems = 0;
- if (NULL == (table->objs =
- (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) {
- error_msg("not enough memory for options table\n");
- HDfree(table);
- return -1;
- }
-
- for (i = 0; i < table->size; i++)
- init_packobject(&table->objs[i]);
-
- *tbl = table;
- return 0;
+ unsigned int i;
+ pack_opttbl_t *table;
+
+ if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
+ H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table");
+ return -1;
+ }
+
+ table->size = 30;
+ table->nelems = 0;
+ if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) {
+ H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table");
+ HDfree(table);
+ return -1;
+ }
+
+ for (i = 0; i < table->size; i++)
+ init_packobject(&table->objs[i]);
+
+ *tbl = table;
+ return 0;
}
@@ -163,14 +150,13 @@ int options_table_init(pack_opttbl_t **tbl) {
* Purpose: free table memory
*
* Return: 0
- *
*-------------------------------------------------------------------------
*/
int options_table_free(pack_opttbl_t *table) {
- HDfree(table->objs);
- HDfree(table);
- return 0;
+ HDfree(table->objs);
+ HDfree(table);
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -179,12 +165,10 @@ int options_table_free(pack_opttbl_t *table) {
* Purpose: add a layout option to the option list
*
* Return: 0, ok, -1, fail
- *
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
int
-options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack,
- pack_opttbl_t *table)
+options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
{
unsigned i, j, I;
unsigned added = 0;
@@ -205,7 +189,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack,
if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank > 0) {
- error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj);
+ H5TOOLS_INFO(H5E_tools_min_id_g, "chunk information already inserted for <%s>\n", obj_list[j].obj);
HDexit(EXIT_FAILURE);
}
/* insert the layout info */
@@ -261,12 +245,10 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack,
* Purpose: add a compression -f option to the option list
*
* Return: 0, ok, -1, fail
- *
*-------------------------------------------------------------------------
*/
int
-options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt,
- pack_opttbl_t *table)
+options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table)
{
unsigned int i, j, I;
unsigned added = 0;
@@ -337,29 +319,26 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt,
* Purpose: get object from table; "path" is the key
*
* Return: pack_info_t* OBJECT or NULL if not found; PATH is the key
- *
*-------------------------------------------------------------------------
*/
pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) {
- unsigned int i;
- char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
-
- for (i = 0; i < table->nelems; i++) {
- /* make full path (start with "/") to compare correctly */
- if (HDstrncmp(table->objs[i].path, "/", 1)) {
- HDstrcpy(tbl_path, "/");
- HDstrcat(tbl_path, table->objs[i].path);
- }
- else
- HDstrcpy(tbl_path, table->objs[i].path);
-
- /* found it */
- if (HDstrcmp(tbl_path, path) == 0) {
- return (&table->objs[i]);
- }
- }
-
- return NULL;
-}
+ unsigned int i;
+ char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
+
+ for (i = 0; i < table->nelems; i++) {
+ /* make full path (start with "/") to compare correctly */
+ if (HDstrncmp(table->objs[i].path, "/", 1)) {
+ HDstrcpy(tbl_path, "/");
+ HDstrcat(tbl_path, table->objs[i].path);
+ }
+ else
+ HDstrcpy(tbl_path, table->objs[i].path);
+ /* found it */
+ if (HDstrcmp(tbl_path, path) == 0) {
+ return (&table->objs[i]);
+ }
+ }
+ return NULL;
+}
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 1a0dab7..e276b7b 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -33,11 +33,6 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
* 1 match
* 0 do not match
* -1 error
- *
- * Programmer: Pedro Vicente, pvn@hdfgroup.org
- *
- * Date: December 19, 2003
- *
*-------------------------------------------------------------------------
*/
@@ -63,11 +58,10 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* open the output file */
if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on <%s>", out_fname);
- for(i = 0; i < options->op_tbl->nelems; i++)
- {
- char* name = options->op_tbl->objs[i].path;
+ for(i = 0; i < options->op_tbl->nelems; i++) {
+ char *name = options->op_tbl->objs[i].path;
pack_info_t *obj = &options->op_tbl->objs[i];
/*-------------------------------------------------------------------------
@@ -75,7 +69,7 @@ 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name);
if((sid = H5Dget_space(did)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
@@ -119,9 +113,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
- if(options->all_filter == 1 || options->all_layout == 1)
- {
-
+ if(options->all_filter == 1 || options->all_layout == 1) {
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
@@ -131,19 +123,16 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if(h5trav_gettable(fidout, travt) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
- for(i = 0; i < travt->nobjs; i++)
- {
+ for(i = 0; i < travt->nobjs; i++) {
char *name = travt->objs[i].name;
- if(travt->objs[i].type == H5TRAV_TYPE_DATASET)
- {
-
+ if(travt->objs[i].type == H5TRAV_TYPE_DATASET) {
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
*/
if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name);
if((sid = H5Dget_space(did)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
@@ -155,8 +144,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* filter check
*-------------------------------------------------------------------------
*/
- if(options->all_filter == 1)
- {
+ if(options->all_filter == 1) {
if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
ok = 0;
}
@@ -165,8 +153,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* layout check
*-------------------------------------------------------------------------
*/
- if(options->all_layout == 1)
- {
+ if(options->all_layout == 1) {
pack_info_t pack;
init_packobject(&pack);
@@ -204,43 +191,37 @@ 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname);
/* Get file creation property list for input file */
if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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) {
- error_msg("failed to retrieve file space strategy & threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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) {
- error_msg("failed to retrieve file space page size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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) {
- error_msg("failed to retrieve file creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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) {
- error_msg("failed to retrieve file space strategy & threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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) {
- error_msg("failed to retrieve file space page size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size");
}
/*
@@ -250,12 +231,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)) {
- error_msg("file space strategy not set as unexpected\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
}
- } else {
+ }
+ else {
if(out_strategy != in_strategy) {
- error_msg("file space strategy not set as unexpected\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
}
}
@@ -267,13 +247,12 @@ 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)) {
- error_msg("free-space persist status is not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
}
- } else {
+ }
+ else {
if(out_persist != in_persist) {
- error_msg("free-space persist status is not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
}
}
@@ -284,13 +263,12 @@ 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)) {
- error_msg("threshold is not set as unexpectec\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
}
- } else {
+ }
+ else {
if(out_threshold != in_threshold) {
- error_msg("threshold is not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
}
}
@@ -301,13 +279,12 @@ 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)) {
- error_msg("file space page size is not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
}
- } else { /* "-G" is not set */
+ }
+ else { /* "-G" is not set */
if(out_pagesize != in_pagesize) {
- error_msg("file space page size is not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
}
}
@@ -339,8 +316,6 @@ done:
return ret_value;
} /* h5repack_verify() */
-
-
/*-------------------------------------------------------------------------
* Function: verify_layout
*
@@ -351,16 +326,10 @@ done:
* H5D_CHUNKED = 2
*
* Return: 1 has, 0 does not, -1 error
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 30, 2003
- *
*-------------------------------------------------------------------------
*/
-int verify_layout(hid_t pid,
- pack_info_t *obj)
+int verify_layout(hid_t pid, pack_info_t *obj)
{
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout; /* layout */
@@ -383,8 +352,7 @@ int verify_layout(hid_t pid,
if (obj->layout != layout)
return 0;
- if (layout==H5D_CHUNKED)
- {
+ if (layout==H5D_CHUNKED) {
if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0)
return -1;
if (obj->chunk.rank != rank)
@@ -403,16 +371,10 @@ int verify_layout(hid_t pid,
* Purpose: compare 2 files for identical property lists of all objects
*
* Return: 1=identical, 0=not identical, -1=error
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 31, 2003
- *
*-------------------------------------------------------------------------
*/
-int h5repack_cmp_pl(const char *fname1,
- const char *fname2)
+int h5repack_cmp_pl(const char *fname1, const char *fname2)
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t fid1=-1; /* file ID */
@@ -439,13 +401,11 @@ int h5repack_cmp_pl(const char *fname1,
{
/* Open the files */
- if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
- {
+ if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) {
error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
return -1;
}
- if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
- {
+ if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) {
error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
H5Fclose(fid1);
return -1;
@@ -468,14 +428,10 @@ int h5repack_cmp_pl(const char *fname1,
* traverse the suppplied object list
*-------------------------------------------------------------------------
*/
- for(i = 0; i < trav->nobjs; i++)
- {
-
- if(trav->objs[i].type == H5TRAV_TYPE_GROUP)
- {
-
+ 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0)
@@ -486,7 +442,7 @@ int h5repack_cmp_pl(const char *fname1,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0)
@@ -497,20 +453,14 @@ int h5repack_cmp_pl(const char *fname1,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if (crt_order_flag1 != crt_order_flag2) {
- error_msg("property lists for <%s> are different\n",trav->objs[i].name);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
}
-
}
-
-
-
- else if(trav->objs[i].type == H5TRAV_TYPE_DATASET)
- {
+ 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "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");
if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
@@ -524,8 +474,7 @@ int h5repack_cmp_pl(const char *fname1,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
if(ret == 0) {
- error_msg("property lists for <%s> are different\n",trav->objs[i].name);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name);
}
/*-------------------------------------------------------------------------
@@ -593,11 +542,6 @@ done:
* 1 match
* 0 do not match
* -1 error
- *
- * Programmer: Pedro Vicente, pvn@hdfgroup.org
- *
- * Date: December 21, 2007
- *
*-------------------------------------------------------------------------
*/
@@ -621,11 +565,11 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
/* if we do not have filters and the requested filter is NONE, return 1 */
if(!nfilters_dcpl &&
nfilters == 1 &&
- filter[0].filtn == H5Z_FILTER_NONE )
+ filter[0].filtn == H5Z_FILTER_NONE)
return 1;
/* else the numbers of filters must match */
- if (nfilters_dcpl != nfilters )
+ if (nfilters_dcpl != nfilters)
return 0;
/*-------------------------------------------------------------------------
@@ -633,8 +577,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
*-------------------------------------------------------------------------
*/
- for( i = 0; i < nfilters_dcpl; i++)
- {
+ for (i = 0; i < nfilters_dcpl; i++) {
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
@@ -644,15 +587,13 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
return 0;
/* compare client data values. some filters do return local values */
- switch (filtn)
- {
-
+ switch (filtn) {
case H5Z_FILTER_NONE:
break;
case H5Z_FILTER_SHUFFLE:
/* 1 private client value is returned by DCPL */
- if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS )
+ if (cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS)
return 0;
/* get dataset's type size */
@@ -660,31 +601,31 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
return -1;
/* the private client value holds the dataset's type size */
- if ( size != cd_values[0] )
+ if (size != cd_values[0])
return 0;
break;
case H5Z_FILTER_SZIP:
/* 4 private client values are returned by DCPL */
- if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS )
+ if (cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS)
return 0;
/* "User" parameter for pixels-per-block (index 1) */
- if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] )
+ if (cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB])
return 0;
break;
case H5Z_FILTER_NBIT:
/* only client data values number of values checked */
- if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
+ if (H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
return 0;
break;
case H5Z_FILTER_SCALEOFFSET:
/* only client data values checked */
- for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
+ for (j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
if (cd_values[j] != filter[i].cd_values[j])
return 0;
break;
@@ -693,20 +634,20 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
case H5Z_FILTER_FLETCHER32:
case H5Z_FILTER_DEFLATE:
- if ( cd_nelmts != filter[i].cd_nelmts)
+ if (cd_nelmts != filter[i].cd_nelmts)
return 0;
- for( j = 0; j < cd_nelmts; j++)
+ for (j = 0; j < cd_nelmts; j++)
if (cd_values[j] != filter[i].cd_values[j])
return 0;
break;
default:
- if ( cd_nelmts != filter[i].cd_nelmts)
+ if (cd_nelmts != filter[i].cd_nelmts)
return 0;
- for( j = 0; j < cd_nelmts; j++)
+ for (j = 0; j < cd_nelmts; j++)
if (cd_values[j] != filter[i].cd_values[j])
return 0;
break;