summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-10 18:06:12 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-10 18:06:12 (GMT)
commit0c07376431a6882ee6b6d437a462796d758cb42c (patch)
treee3dc3942f1956d9968558d45a3244ea8d6c78382 /tools
parent2f636b5d4a067465d458f825823728cd4a9e568e (diff)
downloadhdf5-0c07376431a6882ee6b6d437a462796d758cb42c.zip
hdf5-0c07376431a6882ee6b6d437a462796d758cb42c.tar.gz
hdf5-0c07376431a6882ee6b6d437a462796d758cb42c.tar.bz2
HDFFV-10297 Fix resource errors and cleanup whitespace
Diffstat (limited to 'tools')
-rw-r--r--tools/src/h5repack/h5repack_refs.c259
-rw-r--r--tools/src/h5repack/h5repack_verify.c98
-rw-r--r--tools/test/h5repack/h5repacktst.c1692
3 files changed, 991 insertions, 1058 deletions
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 36038b5..376ab92 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -30,15 +30,10 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
*
- * Purpose: duplicate all referenced HDF5 objects in the file
- * and create hard links
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December, 10, 2003
+ * Purpose: duplicate all referenced HDF5 objects in the file
+ * and create hard links
*
+ * Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
@@ -47,41 +42,39 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t grp_in = (-1); /* read group ID */
- hid_t grp_out = (-1); /* write group ID */
- hid_t dset_in = (-1); /* read dataset ID */
- hid_t dset_out = (-1); /* write dataset ID */
- hid_t type_in = (-1); /* named type ID */
- hid_t dcpl_id = (-1); /* dataset creation property list ID */
- hid_t space_id = (-1); /* space ID */
- hid_t ftype_id = (-1); /* file data type ID */
- hid_t mtype_id = (-1); /* memory data type ID */
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t grp_in = -1; /* read group ID */
+ hid_t grp_out = -1; /* write group ID */
+ hid_t dset_in = -1; /* read dataset ID */
+ hid_t dset_out = -1; /* write dataset ID */
+ hid_t type_in = -1; /* named type ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file data type ID */
+ hid_t mtype_id = -1; /* memory data type ID */
size_t msize; /* memory size of memory type */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
unsigned int i, j;
int k;
- named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes
- copied */
+ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
/*-------------------------------------------------------------------------
* browse
*-------------------------------------------------------------------------
*/
for(i = 0; i < travt->nobjs; i++) {
- switch(travt->objs[i].type)
- {
+ switch(travt->objs[i].type) {
/*-------------------------------------------------------------------------
- * H5TRAV_TYPE_GROUP
- *-------------------------------------------------------------------------
- */
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
case H5TRAV_TYPE_GROUP:
/*-------------------------------------------------------------------------
- * copy referenced objects in attributes
- *-------------------------------------------------------------------------
- */
+ * copy referenced objects in attributes
+ *-------------------------------------------------------------------------
+ */
if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
@@ -97,18 +90,18 @@ int do_copy_refobjs(hid_t fidin,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
/*-------------------------------------------------------------------------
- * check for hard links
- *-------------------------------------------------------------------------
- */
+ * check for hard links
+ *-------------------------------------------------------------------------
+ */
if(travt->objs[i].nlinks)
for(j = 0; j < travt->objs[i].nlinks; j++)
H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
/*-------------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5TRAV_TYPE_DATASET
+ *-------------------------------------------------------------------------
+ */
case H5TRAV_TYPE_DATASET:
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
@@ -141,16 +134,16 @@ int do_copy_refobjs(hid_t fidin,
*/
if(h5tools_canreadf(NULL, dcpl_id) == 1) {
/*-------------------------------------------------------------------------
- * test for a valid output dataset
- *-------------------------------------------------------------------------
- */
+ * test for a valid output dataset
+ *-------------------------------------------------------------------------
+ */
dset_out = FAIL;
/*-------------------------------------------------------------------------
- * object references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- *-------------------------------------------------------------------------
- */
+ * object references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ *-------------------------------------------------------------------------
+ */
if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
hid_t refobj_id;
hobj_ref_t *refbuf = NULL; /* buffer for object references */
@@ -159,9 +152,9 @@ int do_copy_refobjs(hid_t fidin,
unsigned u;
/*-------------------------------------------------------------------------
- * read to memory
- *-------------------------------------------------------------------------
- */
+ * read to memory
+ *-------------------------------------------------------------------------
+ */
if(nelmts) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
if(buf==NULL) {
@@ -201,9 +194,9 @@ int do_copy_refobjs(hid_t fidin,
} /*nelmts*/
/*-------------------------------------------------------------------------
- * create/write dataset/close
- *-------------------------------------------------------------------------
- */
+ * create/write dataset/close
+ *-------------------------------------------------------------------------
+ */
if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
if(nelmts)
@@ -223,11 +216,10 @@ int do_copy_refobjs(hid_t fidin,
} /*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
- * dataset region references
- *-------------------------------------------------------------------------
- */
- else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
- {
+ * dataset region references
+ *-------------------------------------------------------------------------
+ */
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
hid_t refobj_id;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
hdset_reg_ref_t *buf = NULL; /* output buffer */
@@ -235,9 +227,9 @@ int do_copy_refobjs(hid_t fidin,
unsigned u;
/*-------------------------------------------------------------------------
- * read input to memory
- *-------------------------------------------------------------------------
- */
+ * read input to memory
+ *-------------------------------------------------------------------------
+ */
if(nelmts) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
if(buf == NULL) {
@@ -248,9 +240,9 @@ int do_copy_refobjs(hid_t fidin,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/*-------------------------------------------------------------------------
- * create output
- *-------------------------------------------------------------------------
- */
+ * create output
+ *-------------------------------------------------------------------------
+ */
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
if(refbuf == NULL) {
printf("cannot allocate memory\n");
@@ -289,9 +281,9 @@ int do_copy_refobjs(hid_t fidin,
} /*nelmts*/
/*-------------------------------------------------------------------------
- * create/write dataset/close
- *-------------------------------------------------------------------------
- */
+ * create/write dataset/close
+ *-------------------------------------------------------------------------
+ */
if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
if(nelmts)
@@ -310,25 +302,25 @@ int do_copy_refobjs(hid_t fidin,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
} /* H5T_STD_REF_DSETREG */
/*-------------------------------------------------------------------------
- * not references, open previously created object in 1st traversal
- *-------------------------------------------------------------------------
- */
+ * not references, open previously created object in 1st traversal
+ *-------------------------------------------------------------------------
+ */
else {
if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
} /* end else */
/*-------------------------------------------------------------------------
- * copy referenced objects in attributes
- *-------------------------------------------------------------------------
- */
+ * copy referenced objects in attributes
+ *-------------------------------------------------------------------------
+ */
if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
/*-------------------------------------------------------------------------
- * check for hard links
- *-------------------------------------------------------------------------
- */
+ * check for hard links
+ *-------------------------------------------------------------------------
+ */
if(travt->objs[i].nlinks)
for(j = 0; j < travt->objs[i].nlinks; j++)
H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
@@ -338,9 +330,9 @@ int do_copy_refobjs(hid_t fidin,
} /*can_read*/
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ * close
+ *-------------------------------------------------------------------------
+ */
if(H5Tclose(ftype_id) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(mtype_id) < 0)
@@ -354,9 +346,9 @@ int do_copy_refobjs(hid_t fidin,
break;
/*-------------------------------------------------------------------------
- * H5TRAV_TYPE_NAMED_DATATYPE
- *-------------------------------------------------------------------------
- */
+ * H5TRAV_TYPE_NAMED_DATATYPE
+ *-------------------------------------------------------------------------
+ */
case H5TRAV_TYPE_NAMED_DATATYPE:
if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed");
@@ -365,9 +357,9 @@ int do_copy_refobjs(hid_t fidin,
break;
/*-------------------------------------------------------------------------
- * H5TRAV_TYPE_LINK
- *-------------------------------------------------------------------------
- */
+ * H5TRAV_TYPE_LINK
+ *-------------------------------------------------------------------------
+ */
case H5TRAV_TYPE_LINK:
/*nothing to do */
break;
@@ -410,27 +402,22 @@ done:
/*-------------------------------------------------------------------------
* Function: copy_refs_attr
*
- * Purpose: duplicate all referenced HDF5 located in attributes
- * relative to LOC_IN, which is obtained either from
- * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen2(fid, name, H5P_DEFAULT);
- * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
- *
- * Return: 0, ok, -1 no
+ * Purpose: duplicate all referenced HDF5 located in attributes
+ * relative to LOC_IN, which is obtained either from
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Return: 0, ok, -1 no
*
- * Modifier: xcao@hdfgroup.org, 9/12/2011
- * Update values of references(object and region) for the following types:
+ * Modified:
+ * Update values of references(object and region) for the following types:
* 1) References,
* 2) ARRAY of reference,
* 3) VLEN of references.
* 4) COMPOUND of references.
- * This function does not handle references in other complicated structures,
- * such as references in nested compound datatypes.
- *
- * Date: October, 28, 2003
- *
+ * This function does not handle references in other complicated structures,
+ * such as references in nested compound datatypes.
*-------------------------------------------------------------------------
*/
@@ -438,30 +425,32 @@ static int copy_refs_attr(hid_t loc_in,
hid_t loc_out,
pack_opt_t *options,
trav_table_t *travt,
- hid_t fidout /* for saving references */
- )
+ hid_t fidout) /* for saving references */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file data type ID */
- hid_t mtype_id = -1; /* memory data type ID */
- size_t msize; /* memory size of type */
- hsize_t nelmts; /* number of elements in dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- char name[255];
- H5O_info_t oinfo; /* Object info */
- unsigned u, i, j;
- int rank;
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t attr_id = -1; /* attr ID */
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file data type ID */
+ hid_t mtype_id = -1; /* memory data type ID */
+ size_t msize; /* memory size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ H5O_info_t oinfo; /* Object info */
+ unsigned u, i, j;
+ int rank;
H5T_class_t type_class = -1;
- hbool_t is_ref=0, is_ref_vlen=0, is_ref_array=0, is_ref_comp=0;
- void *refbuf = NULL;
- void *buf = NULL;
- const char* refname = NULL;
- unsigned *ref_comp_index = NULL;
- size_t *ref_comp_size = NULL;
- int ref_comp_field_n = 0;
+ hbool_t is_ref = 0,
+ is_ref_vlen = 0,
+ is_ref_array = 0,
+ is_ref_comp = 0;
+ void *refbuf = NULL;
+ void *buf = NULL;
+ const char *refname = NULL;
+ unsigned *ref_comp_index = NULL;
+ size_t *ref_comp_size = NULL;
+ int ref_comp_field_n = 0;
if(H5Oget_info(loc_in, &oinfo) < 0)
@@ -492,7 +481,7 @@ static int copy_refs_attr(hid_t loc_in,
hid_t base_type;
base_type = H5Tget_super(ftype_id);
- is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE);
+ is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
H5Tclose(base_type);
}
@@ -500,7 +489,7 @@ static int copy_refs_attr(hid_t loc_in,
hid_t base_type;
base_type = H5Tget_super(ftype_id);
- is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE);
+ is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
H5Tclose(base_type);
}
@@ -515,9 +504,9 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_field_n = 0;
for (i=0; i<(unsigned)nmembers; i++) {
- hid_t mtid = H5Tget_member_type( ftype_id, i );
+ hid_t mtid = H5Tget_member_type(ftype_id, i);
- if ((H5Tget_class(mtid)==H5T_REFERENCE)) {
+ if ((H5Tget_class(mtid) == H5T_REFERENCE)) {
ref_comp_index[ref_comp_field_n] = i;
ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
ref_comp_field_n++;
@@ -627,9 +616,9 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
/*-------------------------------------------------------------------------
- * create output
- *-------------------------------------------------------------------------
- */
+ * create output
+ *-------------------------------------------------------------------------
+ */
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
if(refbuf == NULL) {
printf( "cannot allocate memory\n" );
@@ -669,7 +658,8 @@ static int copy_refs_attr(hid_t loc_in,
HDmemcpy(&(ptr[j]), &ref_out, msize);
}
} /* for (i=0; i<nelems; i++) */
- } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
+ }
+ else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
hdset_reg_ref_t ref_out;
for (i=0; i<(unsigned)nelmts; i++) {
@@ -689,8 +679,7 @@ static int copy_refs_attr(hid_t loc_in,
buf = HDmalloc((unsigned)(nelmts * msize));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL)
- {
+ if(buf == NULL) {
printf( "cannot read into memory\n" );
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
@@ -767,8 +756,6 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
- return ret_value;
-
done:
if(refbuf)
HDfree(refbuf);
@@ -795,7 +782,7 @@ done:
/*-------------------------------------------------------------------------
* Function: MapIdToName
*
- * Purpose: map a ID from a reference to a dataset name
+ * Purpose: map a ID from a reference to a dataset name
*
*-------------------------------------------------------------------------
*/
@@ -803,7 +790,7 @@ static const char*
MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
unsigned int u;
- const char* ret = NULL;
+ const char *ret = NULL;
/* linear search */
for(u = 0; u < travt->nobjs; u++) {
@@ -830,18 +817,16 @@ out:
/*-------------------------------------------------------------------------
* Function: Update_Ref_value
*
- * Purpose: Update a reference value
- *
- * Programmer: xcao@hdfgroup.org 9/12/2011
- *
+ * Purpose: Update a reference value
*-------------------------------------------------------------------------
*/
static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
hid_t fid_out, void *ref_out, trav_table_t *travt)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- const char* ref_obj_name;
- hid_t space_id=-1, ref_obj_id=-1;
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ const char *ref_obj_name;
+ hid_t space_id = -1;
+ hid_t ref_obj_id = -1;
ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
if (ref_obj_id < 0)
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index bf53bf9..dbe8e1a 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -177,6 +177,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* free table */
trav_table_free(travt);
+ travt = NULL;
}
/*-------------------------------------------------------------------------
@@ -185,39 +186,33 @@ 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 )
+ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname);
/* Get file creation property list for input file */
- if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ 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");
- }
/* Get file space info for input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
+ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
- }
/* Get file space page size for input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
+ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size");
- }
/* Output file is already opened */
/* Get file creation property list for output file */
- if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
+ if((fcpl_out = H5Fget_create_plist(fidout)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
- }
/* Get file space info for output file */
- if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) {
+ if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
- }
/* Get file space page size for output file */
- if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) {
+ if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size");
- }
/*
* If -S option is set, the file space handling strategy should be set as specified.
@@ -225,14 +220,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* the same as the input file's strategy.
*/
if(options->fs_strategy) {
- if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) {
+ if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
- }
}
else {
- if(out_strategy != in_strategy) {
+ if(out_strategy != in_strategy)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
- }
}
/*
@@ -241,14 +234,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* the same as the input file's free-space persist status
*/
if(options->fs_persist) {
- if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) {
+ if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
- }
}
else {
- if(out_persist != in_persist) {
+ if(out_persist != in_persist)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected");
- }
}
/*
@@ -257,14 +248,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* input file's threshold size.
*/
if(options->fs_threshold) {
- if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) {
+ if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
- }
}
else {
- if(out_threshold != in_threshold) {
+ if(out_threshold != in_threshold)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected");
- }
}
/*
@@ -273,14 +262,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* the same as the input file's file space page size.
*/
if(options->fs_pagesize) {
- if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) {
+ if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
- }
}
else { /* "-G" is not set */
- if(out_pagesize != in_pagesize) {
+ if(out_pagesize != in_pagesize)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected");
- }
+
}
ret_value = ok;
@@ -292,6 +280,7 @@ done:
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
+ H5Tclose(tid);
H5Fclose(fidin);
H5Fclose(fidout);
if (travt)
@@ -304,13 +293,15 @@ done:
/*-------------------------------------------------------------------------
* Function: verify_layout
*
- * Purpose: verify which layout is present in the property list DCPL_ID
- *
- * H5D_COMPACT = 0
- * H5D_CONTIGUOUS = 1
- * H5D_CHUNKED = 2
+ * Purpose: verify which layout is present in the property list DCPL_ID
+ * H5D_COMPACT = 0
+ * H5D_CONTIGUOUS = 1
+ * H5D_CHUNKED = 2
*
- * Return: 1 has, 0 does not, -1 error
+ * Return:
+ * 1 has,
+ * 0 does not,
+ * -1 error
*-------------------------------------------------------------------------
*/
@@ -327,7 +318,7 @@ int verify_layout(hid_t pid, pack_info_t *obj)
return -1;
/* a non chunked layout was requested on a filtered object */
- if (nfilters && obj->layout!=H5D_CHUNKED)
+ if (nfilters && obj->layout != H5D_CHUNKED)
return 0;
/* get layout */
@@ -338,11 +329,11 @@ int verify_layout(hid_t pid, pack_info_t *obj)
return 0;
if (layout==H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0)
+ if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize/*out*/)) < 0)
return -1;
if (obj->chunk.rank != rank)
return 0;
- for ( i=0; i<rank; i++)
+ for (i = 0; i < rank; i++)
if (chsize[i] != obj->chunk.chunk_lengths[i])
return 0;
}
@@ -353,9 +344,12 @@ int verify_layout(hid_t pid, pack_info_t *obj)
/*-------------------------------------------------------------------------
* Function: h5repack_cmp_pl
*
- * Purpose: compare 2 files for identical property lists of all objects
+ * Purpose: compare 2 files for identical property lists of all objects
*
- * Return: 1=identical, 0=not identical, -1=error
+ * Return:
+ * 1 = identical,
+ * 0 = not identical,
+ * -1 = error
*-------------------------------------------------------------------------
*/
@@ -380,9 +374,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
*-------------------------------------------------------------------------
*/
/* Open the files */
- if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ if ((fid1 = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ if ((fid2 = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
@@ -424,9 +418,8 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
if (H5Gclose(gid) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
- if (crt_order_flag1 != crt_order_flag2) {
+ if (crt_order_flag1 != crt_order_flag2)
HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
- }
}
else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) {
if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
@@ -446,7 +439,7 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
if(ret_value == 0)
- HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name);
+ HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name);
/*-------------------------------------------------------------------------
* close
@@ -474,7 +467,8 @@ done:
H5Fclose(fid2);
H5Pclose(gcplid);
H5Gclose(gid);
- trav_table_free(trav);
+ if(trav)
+ trav_table_free(trav);
} H5E_END_TRY;
return ret_value;
@@ -484,14 +478,14 @@ done:
/*-------------------------------------------------------------------------
* Function: verify_filters
*
- * Purpose: verify if all requested filters in the array FILTER obtained
- * from user input are present in the property list PID obtained from
- * the output file
+ * Purpose: verify if all requested filters in the array FILTER obtained
+ * from user input are present in the property list PID obtained from
+ * the output file
*
* Return:
- * 1 match
- * 0 do not match
- * -1 error
+ * 1 match
+ * 0 do not match
+ * -1 error
*-------------------------------------------------------------------------
*/
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 6449844..264550e 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
#include "h5test.h"
@@ -78,15 +78,15 @@
#define FNAME18 "h5repack_layout2.h5"
/* Files for testing file space paging */
-#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
+#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
const char *H5REPACK_FSPACE_FNAMES[] = {
"h5repack_latest.h5", /* 0 */
"h5repack_default.h5", /* 1 */
- "h5repack_page_persist.h5", /* 2 */
- "h5repack_fsm_aggr_persist.h5", /* 3 */
+ "h5repack_page_persist.h5", /* 2 */
+ "h5repack_fsm_aggr_persist.h5", /* 3 */
"h5repack_page_threshold.h5", /* 4 */
- "h5repack_fsm_aggr_threshold.h5", /* 5 */
+ "h5repack_fsm_aggr_threshold.h5", /* 5 */
"h5repack_aggr.h5", /* 6 */
"h5repack_none.h5" /* 7 */
};
@@ -126,9 +126,9 @@ const char *H5REPACK_FILENAMES[] = {
#define REG_REF_DS1 "Dset_REGREF"
/*-------------------------------------------------------------------------
-* prototypes
-*-------------------------------------------------------------------------
-*/
+ * prototypes
+ *-------------------------------------------------------------------------
+ */
static int make_all_objects(hid_t loc_id);
static int make_attributes(hid_t loc_id);
static int make_hlinks(hid_t loc_id);
@@ -164,31 +164,27 @@ static int make_complex_attr_references(hid_t loc_id);
/*-------------------------------------------------------------------------
-* Function: main
-*
-* Purpose: Executes h5repack tests
-*
-* Return: Success: zero
-* Failure: 1
-*
-* Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
-* January, 6, 2004
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: main
+ *
+ * Purpose: Executes h5repack tests
+ *
+ * Return: Success: zero
+ * Failure: 1
+ *-------------------------------------------------------------------------
+ */
int main (void)
{
pack_opt_t pack_options;
diff_opt_t diff_options;
- unsigned j; /* Local index variable for testing file space */
- const char *fname; /* File name for testing file space */
+ unsigned j; /* Local index variable for testing file space */
+ const char *fname; /* File name for testing file space */
- h5_stat_t file_stat;
- h5_stat_size_t fsize1, fsize2; /* file sizes */
+ h5_stat_t file_stat;
+ h5_stat_size_t fsize1, fsize2; /* file sizes */
#if defined (H5_HAVE_FILTER_SZIP)
- int szip_can_encode = 0;
+ int szip_can_encode = 0;
#endif
h5tools_setprogname(PROGRAMNAME);
@@ -211,28 +207,28 @@ int main (void)
PASSED();
/*-------------------------------------------------------------------------
- * Format of the tests:
- *
- * 1) make a copy of the file with h5repack
- * 2) use the h5diff function to compare the input and output file
- *-------------------------------------------------------------------------
- */
+ * Format of the tests:
+ *
+ * 1) make a copy of the file with h5repack
+ * 2) use the h5diff function to compare the input and output file
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * Testing file space info setting
- *-------------------------------------------------------------------------
- */
+ * Testing file space info setting
+ *-------------------------------------------------------------------------
+ */
TESTING(" files with file space info setting--no options (-S, -P, -T, -G) are set");
- j = 0; /* #0 */
+ j = 0; /* #0 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
-
+
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
@@ -240,20 +236,20 @@ int main (void)
TESTING(" files with file space info setting--all options -S, -P, -T, -G are set");
- ++j; /* #1 */
+ ++j; /* #1 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
+ fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 1;
+ pack_options.fs_threshold = 1;
pack_options.fs_pagesize = 8192;
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
@@ -261,18 +257,18 @@ int main (void)
TESTING(" files with file space info setting--options -S and -T are set");
- ++j; /* #2 */
+ ++j; /* #2 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
- pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
+ pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
+ pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
@@ -280,7 +276,7 @@ int main (void)
TESTING(" files with file space info setting-- options -S and -P are set & -L");
- ++j; /* #3 */
+ ++j; /* #3 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, TRUE) < 0)
@@ -291,32 +287,32 @@ int main (void)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -P and -T are set & -L");
- ++j; /* #4 */
+ ++j; /* #4 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 2;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 2;
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S and -G are set & -L");
- ++j; /* #5 */
+ ++j; /* #5 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, TRUE) < 0)
@@ -327,180 +323,179 @@ int main (void)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
- ++j; /* #6 */
+ ++j; /* #6 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 1;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 1;
pack_options.fs_pagesize = 8192;
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
- ++j; /* #7 */
+ ++j; /* #7 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
if(h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
- pack_options.fs_threshold = 1;
+ pack_options.fs_threshold = 1;
pack_options.fs_pagesize = 4096;
if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0)
+ if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * file with fill values
- *-------------------------------------------------------------------------
- */
-
+ * file with fill values
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of datasets (fill values)");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0)
+ if (h5repack(FNAME0, FNAME0OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME0, FNAME0OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME0, FNAME0OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME0, FNAME0OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0)
+ if (h5repack_cmp_pl(FNAME0, FNAME0OUT) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * file with all kinds of dataset datatypes
- *-------------------------------------------------------------------------
- */
+ * file with all kinds of dataset datatypes
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0)
+ if (h5repack_cmp_pl(FNAME1, FNAME1OUT) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * file with attributes
- *-------------------------------------------------------------------------
- */
+ * file with attributes
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of datasets (attributes)");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0)
+ if (h5repack(FNAME2, FNAME2OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME2, FNAME2OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME2, FNAME2OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME2, FNAME2OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0)
+ if (h5repack_cmp_pl(FNAME2, FNAME2OUT) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * file with hardlinks
- *-------------------------------------------------------------------------
- */
+ * file with hardlinks
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of datasets (hardlinks)");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0)
+ if (h5repack(FNAME3, FNAME3OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME3, FNAME3OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME3, FNAME3OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME3, FNAME3OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0)
+ if (h5repack_cmp_pl(FNAME3, FNAME3OUT) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * alloc early test
- *-------------------------------------------------------------------------
- */
+ * alloc early test
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of allocation early file");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0)
+ if (h5repack(FNAME5, FNAME5OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME5, FNAME5OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options)<=0)
+ if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * the remaining files differ in the dcpl's
- *-------------------------------------------------------------------------
- */
+ * the remaining files differ in the dcpl's
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * deflate
- *-------------------------------------------------------------------------
- */
+ * deflate
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding deflate filter (old_format)");
#ifdef H5_HAVE_FILTER_DEFLATE
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:GZIP=9", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
#else
@@ -510,24 +505,24 @@ int main (void)
TESTING(" adding deflate filter (new format)");
#ifdef H5_HAVE_FILTER_DEFLATE
/*-------------------------------------------------------------------------
- * test an individual object option
- * For new format, "dset1" should be using Fixed Array indexing
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:GZIP=9", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
#else
@@ -535,27 +530,27 @@ int main (void)
#endif
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding deflate filter to all");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
+ if (h5repack_addfilter("GZIP=1", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -564,40 +559,40 @@ int main (void)
#endif
/*-------------------------------------------------------------------------
- * SZIP
- *-------------------------------------------------------------------------
- */
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding szip filter");
#if defined (H5_HAVE_FILTER_SZIP)
- if (h5tools_can_encode(H5Z_FILTER_SZIP) >0) {
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) > 0)
szip_can_encode = 1;
- }
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
if (szip_can_encode) {
if (h5repack_init (&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0)
+ if (h5repack_addfilter("dset2:SZIP=8,EC", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("dset2:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset2:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -606,28 +601,29 @@ int main (void)
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding szip filter to all");
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0)
+ if (h5repack_addfilter("SZIP=8,NN", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -638,47 +634,47 @@ int main (void)
TESTING(" addding shuffle filter");
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
TESTING(" addding shuffle filter to all");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("SHUF",&pack_options) < 0)
+ if (h5repack_addfilter("SHUF", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -687,48 +683,45 @@ int main (void)
TESTING(" adding checksum filter");
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
-
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:FLET", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
-
-
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding checksum filter to all");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("FLET",&pack_options) < 0)
+ if (h5repack_addfilter("FLET", &pack_options) < 0)
GOERROR;
- if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -737,38 +730,38 @@ int main (void)
TESTING(" filter queue fletcher, shuffle, deflate, szip");
/*-------------------------------------------------------------------------
- * add some filters
- *-------------------------------------------------------------------------
- */
+ * add some filters
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK 20x10", &pack_options) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:FLET", &pack_options) < 0)
GOERROR;
- if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0)
GOERROR;
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:SZIP=8,NN", &pack_options) < 0)
GOERROR;
}
#endif
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_addfilter("dset1:GZIP=1",&pack_options) < 0)
+ if (h5repack_addfilter("dset1:GZIP=1", &pack_options) < 0)
GOERROR;
#endif
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -777,63 +770,63 @@ int main (void)
TESTING(" adding layout chunked (old format)");
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" adding layout chunked (new format)");
/*-------------------------------------------------------------------------
- * test an individual object option
- * For new format, "dset1" should be using Fixed Array indexing
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
TESTING(" adding layout chunked to all");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -841,20 +834,20 @@ int main (void)
TESTING(" adding layout contiguous");
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -862,37 +855,37 @@ int main (void)
TESTING(" adding layout contiguous to all");
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
/*-------------------------------------------------------------------------
- * do the same test for a file with filters (chunked)
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * do the same test for a file with filters (chunked)
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -900,42 +893,42 @@ int main (void)
TESTING(" adding layout compact");
/*-------------------------------------------------------------------------
- * test an individual object option
- *-------------------------------------------------------------------------
- */
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0)
+ if (h5repack_addlayout("dset1:COMPA", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" adding layout compact to all");
/*-------------------------------------------------------------------------
- * test all objects option
- *-------------------------------------------------------------------------
- */
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("COMPA",&pack_options) < 0)
+ if (h5repack_addlayout("COMPA", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -944,210 +937,209 @@ int main (void)
TESTING(" layout compact to contiguous conversion");
/*-------------------------------------------------------------------------
- * layout compact to contiguous conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout compact to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("dset_compact:CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout compact to chunk conversion");
/*-------------------------------------------------------------------------
- * layout compact to chunk conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout compact to chunk conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0)
+ if (h5repack_addlayout("dset_compact:CHUNK=2x5", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout compact to compact conversion");
/*-------------------------------------------------------------------------
- * layout compact to compact conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout compact to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0)
+ if (h5repack_addlayout("dset_compact:COMPA", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options)<= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout contiguous to compact conversion");
/*-------------------------------------------------------------------------
- * layout contiguous to compact conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout contiguous to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0)
+ if (h5repack_addlayout("dset_contiguous:COMPA", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout contiguous to chunk conversion");
/*-------------------------------------------------------------------------
- * layout contiguous to chunk conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout contiguous to chunk conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0)
+ if (h5repack_addlayout("dset_contiguous:CHUNK=3x6", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout contiguous to contiguous conversion");
/*-------------------------------------------------------------------------
- * layout contiguous to contiguous conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout contiguous to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("dset_contiguous:CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout chunked to compact conversion");
/*-------------------------------------------------------------------------
- * layout chunked to compact conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout chunked to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0)
+ if (h5repack_addlayout("dset_chunk:COMPA", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout chunked to contiguous conversion");
/*-------------------------------------------------------------------------
- * layout chunked to contiguous conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout chunked to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0)
+ if (h5repack_addlayout("dset_chunk:CONTI", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" layout chunked to chunk conversion");
/*-------------------------------------------------------------------------
- * layout chunked to chunked conversion
- *-------------------------------------------------------------------------
- */
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ * layout chunked to chunked conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0)
+ if (h5repack_addlayout("dset_chunk:CHUNK=18x13", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * the following tests assume the input files have filters
- * FNAME7
- * FNAME8
- * FNAME9
- * FNAME10
- * FNAME11
- *-------------------------------------------------------------------------
- */
-
-
+ * the following tests assume the input files have filters
+ * FNAME7
+ * FNAME8
+ * FNAME9
+ * FNAME10
+ * FNAME11
+ *-------------------------------------------------------------------------
+ */
TESTING(" copy of szip filter");
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
+ if (h5repack(FNAME7, FNAME7OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME7, FNAME7OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0)
+ if (h5repack_cmp_pl(FNAME7, FNAME7OUT) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -1158,21 +1150,22 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_szip:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
+ if (h5repack(FNAME7, FNAME7OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME7, FNAME7OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -1183,15 +1176,15 @@ int main (void)
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1203,17 +1196,17 @@ int main (void)
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_deflate:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1225,15 +1218,15 @@ int main (void)
TESTING(" copy of shuffle filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
+ if (h5repack(FNAME9, FNAME9OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME9, FNAME9OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME9, FNAME9OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1241,17 +1234,17 @@ int main (void)
TESTING(" removing shuffle filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_shuffle:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
+ if (h5repack(FNAME9, FNAME9OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME9, FNAME9OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME9, FNAME9OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1259,15 +1252,15 @@ int main (void)
TESTING(" copy of fletcher filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
+ if (h5repack(FNAME10, FNAME10OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME10, FNAME10OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME10, FNAME10OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1275,17 +1268,17 @@ int main (void)
TESTING(" removing fletcher filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_fletcher32:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
+ if (h5repack(FNAME10, FNAME10OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME10, FNAME10OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME10, FNAME10OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1293,15 +1286,15 @@ int main (void)
TESTING(" copy of nbit filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1309,17 +1302,17 @@ int main (void)
TESTING(" removing nbit filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_nbit:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1327,17 +1320,17 @@ int main (void)
TESTING(" adding nbit filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0)
+ if (h5repack_addfilter("dset_int31:NBIT", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options)<= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1345,15 +1338,15 @@ int main (void)
TESTING(" copy of scaleoffset filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1361,17 +1354,17 @@ int main (void)
TESTING(" removing scaleoffset filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0)
+ if (h5repack_addfilter("dset_scaleoffset:NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1379,53 +1372,52 @@ int main (void)
TESTING(" adding scaleoffset filter");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0)
+ if (h5repack_addfilter("dset_none:SOFF=31,IN", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * file with all filters
- * dset_all
- * dset_deflate
- * dset_szip
- * dset_shuffle
- * dset_fletcher32
- *-------------------------------------------------------------------------
- */
-
-
+ * file with all filters
+ * dset_all
+ * dset_deflate
+ * dset_szip
+ * dset_shuffle
+ * dset_fletcher32
+ *-------------------------------------------------------------------------
+ */
TESTING(" filter conversion from deflate to szip");
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0)
+ if (h5repack_addfilter("dset_deflate:SZIP=8,NN", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -1437,21 +1429,22 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0)
+ if (h5repack_addfilter("dset_szip:GZIP=1", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
- } else {
+ }
+ else {
SKIPPED();
}
#else
@@ -1460,25 +1453,25 @@ int main (void)
/*-------------------------------------------------------------------------
- * test the NONE global option
- *-------------------------------------------------------------------------
- */
+ * test the NONE global option
+ *-------------------------------------------------------------------------
+ */
TESTING(" removing all filters");
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("NONE",&pack_options) < 0)
+ if (h5repack_addfilter("NONE", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1487,44 +1480,44 @@ int main (void)
#endif
/*-------------------------------------------------------------------------
- * test a big file
- *-------------------------------------------------------------------------
- */
+ * test a big file
+ *-------------------------------------------------------------------------
+ */
TESTING(" big file");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0)
+ if (h5repack(FNAME14, FNAME14OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME14,FNAME14OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME14, FNAME14OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME14, FNAME14OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME14, FNAME14OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test external dataset
- *-------------------------------------------------------------------------
- */
+ * test external dataset
+ *-------------------------------------------------------------------------
+ */
TESTING(" external datasets");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0)
+ if (h5repack(FNAME15, FNAME15OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0)
+ if (h5diff(FNAME15, FNAME15OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME15, FNAME15OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME15, FNAME15OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
TESTING(" file with userblock");
if(h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1541,53 +1534,53 @@ int main (void)
PASSED();
/*-------------------------------------------------------------------------
- * test --latest options
- *-------------------------------------------------------------------------
- */
+ * test --latest options
+ *-------------------------------------------------------------------------
+ */
TESTING(" latest file format options");
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.latest=1;
- pack_options.grp_compact=10;
- pack_options.grp_indexed=5;
+ pack_options.latest = 1;
+ pack_options.grp_compact = 10;
+ pack_options.grp_indexed = 5;
pack_options.msg_size[0] = 10;
pack_options.msg_size[1] = 20;
pack_options.msg_size[2] = 30;
pack_options.msg_size[3] = 40;
pack_options.msg_size[4] = 50;
- if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) > 0)
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options)<=0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
/*-------------------------------------------------------------------------
- * test several global filters
- *-------------------------------------------------------------------------
- */
+ * test several global filters
+ *-------------------------------------------------------------------------
+ */
TESTING(" several global filters");
#if defined (H5_HAVE_FILTER_DEFLATE)
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
+ if (h5repack_addfilter("GZIP=1", &pack_options) < 0)
GOERROR;
- if (h5repack_addfilter("SHUF",&pack_options) < 0)
+ if (h5repack_addfilter("SHUF", &pack_options) < 0)
GOERROR;
- if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1597,9 +1590,9 @@ int main (void)
/*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
TESTING(" file with added userblock");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1630,9 +1623,9 @@ int main (void)
/*-------------------------------------------------------------------------
- * test file with aligment
- *-------------------------------------------------------------------------
- */
+ * test file with aligment
+ *-------------------------------------------------------------------------
+ */
TESTING(" file with aligment");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1655,20 +1648,20 @@ int main (void)
{
hsize_t threshold;
hsize_t alignment;
- hid_t fapl;
- hid_t fid;
+ hid_t fapl;
+ hid_t fid;
- if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ if ((fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
GOERROR;
if ((fapl = H5Fget_access_plist(fid)) < 0)
GOERROR;
- if ( H5Pget_alignment(fapl, &threshold, &alignment ) < 0)
+ if (H5Pget_alignment(fapl, &threshold, &alignment) < 0)
GOERROR;
- if ( threshold != 1 )
+ if (threshold != 1)
GOERROR;
- if ( alignment != 1 )
+ if (alignment != 1)
GOERROR;
- if ( H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
GOERROR;
if (H5Fclose(fid) < 0)
GOERROR;
@@ -1686,9 +1679,9 @@ int main (void)
#endif
/*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
TESTING(" file with committed datatypes");
if(h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1707,13 +1700,13 @@ int main (void)
PASSED();
/*-------------------------------------------------------------------------
- * test --metadata_block_size option
- * Also verify that output file using the metadata_block_size option is
- * larger than the output file one not using it.
- * FNAME4 is used because it is the same as the test file used for the
- * shell script version of this test (h5repack.sh).
- *-------------------------------------------------------------------------
- */
+ * test --metadata_block_size option
+ * Also verify that output file using the metadata_block_size option is
+ * larger than the output file one not using it.
+ * FNAME4 is used because it is the same as the test file used for the
+ * shell script version of this test (h5repack.sh).
+ *-------------------------------------------------------------------------
+ */
TESTING(" metadata block size option");
/* First run without metadata option. No need to verify the correctness */
/* since this has been verified by earlier tests. Just record the file */
@@ -1751,9 +1744,9 @@ int main (void)
/*-------------------------------------------------------------------------
- * clean temporary test files
- *-------------------------------------------------------------------------
- */
+ * clean temporary test files
+ *-------------------------------------------------------------------------
+ */
{
hid_t fapl;
@@ -1778,24 +1771,24 @@ error:
/*-------------------------------------------------------------------------
* Function: make_testfiles
*
-* Purpose: make a test file with all types of HDF5 objects,
-* datatypes and filters
+* Purpose: make a test file with all types of HDF5 objects,
+* datatypes and filters
*
*-------------------------------------------------------------------------
*/
static
int make_testfiles(void)
{
- hid_t fid;
- hid_t fcpl; /* File creation property list */
- hid_t fapl; /* File access property list */
- unsigned j; /* Local index variable */
+ hid_t fid = -1;
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t fapl = -1; /* File access property list */
+ unsigned j; /* Local index variable */
/*-------------------------------------------------------------------------
- * create a file for general copy test
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file for general copy test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fill(fid) < 0)
goto out;
@@ -1803,10 +1796,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create another file for general copy test (all datatypes)
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create another file for general copy test (all datatypes)
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_all_objects(fid) < 0)
goto out;
@@ -1814,10 +1807,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file for attributes copy test
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file for attributes copy test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_attributes(fid) < 0)
goto out;
@@ -1825,10 +1818,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file for hard links test
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file for hard links test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_hlinks(fid) < 0)
goto out;
@@ -1836,10 +1829,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file for layouts test
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file for layouts test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_layout(fid) < 0)
goto out;
@@ -1847,9 +1840,9 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file for layout conversion test
- *-------------------------------------------------------------------------
- */
+ * create a file for layout conversion test
+ *-------------------------------------------------------------------------
+ */
if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
@@ -1860,9 +1853,9 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * for test layout conversions form chunk with unlimited max dims
- *-------------------------------------------------------------------------
- */
+ * for test layout conversions form chunk with unlimited max dims
+ *-------------------------------------------------------------------------
+ */
if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
@@ -1873,18 +1866,18 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file for the H5D_ALLOC_TIME_EARLY test
- *-------------------------------------------------------------------------
- */
+ * create a file for the H5D_ALLOC_TIME_EARLY test
+ *-------------------------------------------------------------------------
+ */
if (make_early() < 0)
goto out;
/*-------------------------------------------------------------------------
- * create a file with the SZIP filter
- *-------------------------------------------------------------------------
- */
+ * create a file with the SZIP filter
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
- if((fid = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_szip(fid) < 0)
goto out;
@@ -1894,10 +1887,10 @@ int make_testfiles(void)
/*-------------------------------------------------------------------------
- * create a file with the deflate filter
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with the deflate filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_deflate(fid) < 0)
goto out;
@@ -1905,10 +1898,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with the shuffle filter
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with the shuffle filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_shuffle(fid) < 0)
goto out;
@@ -1916,10 +1909,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with the fletcher32 filter
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with the fletcher32 filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fletcher32(fid) < 0)
goto out;
@@ -1927,10 +1920,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with all the filters
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with all the filters
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_all_filters(fid) < 0)
goto out;
@@ -1938,10 +1931,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with the nbit filter
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with the nbit filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_nbit(fid) < 0)
goto out;
@@ -1949,10 +1942,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with the scaleoffset filter
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with the scaleoffset filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_scaleoffset(fid) < 0)
goto out;
@@ -1960,10 +1953,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a big dataset
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a big dataset
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_big(fid) < 0)
goto out;
@@ -1971,10 +1964,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with external dataset
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with external dataset
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_external(fid) < 0)
goto out;
@@ -1982,24 +1975,24 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with userblock
- *-------------------------------------------------------------------------
- */
+ * create a file with userblock
+ *-------------------------------------------------------------------------
+ */
if(make_userblock() < 0)
goto out;
/*-------------------------------------------------------------------------
- * create a userblock file
- *-------------------------------------------------------------------------
- */
+ * create a userblock file
+ *-------------------------------------------------------------------------
+ */
if(make_userblock_file() < 0)
goto out;
/*-------------------------------------------------------------------------
- * create a file with named datatypes
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME17,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with named datatypes
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_named_dtype(fid) < 0)
goto out;
@@ -2007,11 +2000,12 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create obj and region reference type datasets (bug1814)
- * add attribute with int type (bug1726)
- * add attribute with obj and region reference type (bug1726)
- *-------------------------------------------------------------------------*/
- if((fid = H5Fcreate(FNAME_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create obj and region reference type datasets (bug1814)
+ * add attribute with int type (bug1726)
+ * add attribute with obj and region reference type (bug1726)
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* create reference type datasets */
if (make_references(fid) < 0)
@@ -2020,10 +2014,10 @@ int make_testfiles(void)
return -1;
/*-------------------------------------------------------------------------
- * create a file with obj and region references in attribute of compound and
- * vlen datatype
- *-------------------------------------------------------------------------*/
- if((fid = H5Fcreate(FNAME_ATTR_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ * create a file with obj and region references in attribute of compound and
+ * vlen datatype
+ *-------------------------------------------------------------------------*/
+ if((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_complex_attr_references(fid) < 0)
goto out;
@@ -2042,9 +2036,9 @@ int make_testfiles(void)
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- /*
- * #0 -- h5repack_latest.h5
- * default: strategy=FSM_AGGR, persist=FALSE, threshold=1
+ /*
+ * #0 -- h5repack_latest.h5
+ * default: strategy=FSM_AGGR, persist=FALSE, threshold=1
* default: inpage=4096
*/
j = 0;
@@ -2053,9 +2047,9 @@ int make_testfiles(void)
if(H5Fclose(fid) < 0)
return -1;
- /*
- * #1 -- h5repack_default.h5
- * default: strategy=FSM_AGGR, persist=FALSE, threshold=1
+ /*
+ * #1 -- h5repack_default.h5
+ * default: strategy=FSM_AGGR, persist=FALSE, threshold=1
* default: inpage=4096
*/
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
@@ -2064,11 +2058,11 @@ int make_testfiles(void)
if(H5Fclose(fid) < 0)
return -1;
- /*
+ /*
* #2 -- h5repack_page_persist.h5
- * Setting:
- * strategy=PAGE, persist=TRUE, threshold=1
- * inpage=512
+ * Setting:
+ * strategy=PAGE, persist=TRUE, threshold=1
+ * inpage=512
* latest format
*/
/* Create file creation property list */
@@ -2087,10 +2081,10 @@ int make_testfiles(void)
return -1;
- /*
+ /*
* #3 -- h5repack_fsm_aggr_persist.h5
* Setting:
- * strategy=FSM_AGGR, persist=TRUE, threshold=1
+ * strategy=FSM_AGGR, persist=TRUE, threshold=1
* default: inpage=4096
*/
/* Create file creation property list */
@@ -2107,10 +2101,10 @@ int make_testfiles(void)
return -1;
- /*
+ /*
* #4 -- h5repack_page_threshold.h5
* Setting:
- * strategy=PAGE, persist=FALSE, threshold=3
+ * strategy=PAGE, persist=FALSE, threshold=3
* inpage=8192
* latest format
*/
@@ -2133,8 +2127,8 @@ int make_testfiles(void)
/*
* #5 -- h5repack_fsm_aggr_threshold.h5
* Setting:
- * strategy=FSM_AGGR, persist=FALSE, threshold=3
- * inpage=4096
+ * strategy=FSM_AGGR, persist=FALSE, threshold=3
+ * inpage=4096
*/
/* Create file creation property list */
@@ -2152,10 +2146,10 @@ int make_testfiles(void)
if(H5Pclose(fcpl) < 0)
return -1;
- /*
- * #6 -- h5repack_aggr.h5
+ /*
+ * #6 -- h5repack_aggr.h5
* Setting:
- * strategy=AGGR, persist=FALSE, threshold=1
+ * strategy=AGGR, persist=FALSE, threshold=1
* latest format
*/
@@ -2172,11 +2166,11 @@ int make_testfiles(void)
if(H5Pclose(fcpl) < 0)
return -1;
- /*
+ /*
* #7 -- h5repack_none.h5
* Setting:
- * strategy=NONE, persist=FALSE, threshold=1
- * inpage=8192
+ * strategy=NONE, persist=FALSE, threshold=1
+ * inpage=8192
*/
/* Create file creation property list */
@@ -2209,20 +2203,20 @@ out:
/*-------------------------------------------------------------------------
* Function: make_all_objects
*
-* Purpose: make a test file with all types of HDF5 objects
+* Purpose: make a test file with all types of HDF5 objects
*
*-------------------------------------------------------------------------
*/
static
int make_all_objects(hid_t loc_id)
{
- hid_t did=-1;
- hid_t gid=-1;
- hid_t tid=-1;
- hid_t rid=-1;
- hid_t sid=-1;
- hid_t gcplid=-1;
- hsize_t dims[1]={2};
+ hid_t did = -1;
+ hid_t gid = -1;
+ hid_t tid = -1;
+ hid_t rid = -1;
+ hid_t sid = -1;
+ hid_t gcplid = -1;
+ hsize_t dims[1] = {2};
/* compound datatype */
typedef struct s_t
{
@@ -2297,7 +2291,7 @@ int make_all_objects(hid_t loc_id)
if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
goto out;
- if (write_dset_in(rid,"dset_referenced",loc_id,0) < 0)
+ if (write_dset_in(rid, "dset_referenced", loc_id, 0) < 0)
goto out;
if (H5Gclose(rid) < 0)
goto out;
@@ -2331,18 +2325,18 @@ out:
/*-------------------------------------------------------------------------
* Function: make_attributes
*
-* Purpose: make a test file with all types of attributes
+* Purpose: make a test file with all types of attributes
*
*-------------------------------------------------------------------------
*/
static
int make_attributes(hid_t loc_id)
{
- hid_t did=-1;
- hid_t gid=-1;
- hid_t rid=-1;
- hid_t sid=-1;
- hsize_t dims[1]={2};
+ hid_t did = -1;
+ hid_t gid = -1;
+ hid_t rid = -1;
+ hid_t sid = -1;
+ hsize_t dims[1] = {2};
/*-------------------------------------------------------------------------
* H5G_DATASET
@@ -2367,11 +2361,11 @@ int make_attributes(hid_t loc_id)
*-------------------------------------------------------------------------
*/
- if ( write_attr_in(did,"dset",loc_id,0) < 0)
+ if ( write_attr_in(did, "dset", loc_id, 0) < 0)
goto out;
- if (write_attr_in(gid,"dset",loc_id,0) < 0)
+ if (write_attr_in(gid, "dset", loc_id, 0) < 0)
goto out;
- if (write_attr_in(rid,"dset",loc_id,0) < 0)
+ if (write_attr_in(rid, "dset", loc_id, 0) < 0)
goto out;
/* close */
@@ -2401,18 +2395,18 @@ out:
/*-------------------------------------------------------------------------
* Function: make_hlinks
*
-* Purpose: make a test file with hard links
+* Purpose: make a test file with hard links
*
*-------------------------------------------------------------------------
*/
static
int make_hlinks(hid_t loc_id)
{
- hid_t g1id=-1;
- hid_t g2id=-1;
- hid_t g3id=-1;
- hsize_t dims[2]={3,2};
- int buf[3][2]= {{1,1},{1,2},{2,2}};
+ hid_t g1id =- 1;
+ hid_t g2id = -1;
+ hid_t g3id = -1;
+ hsize_t dims[2] = {3,2};
+ int buf[3][2] = {{1,1}, {1,2}, {2,2}};
/*-------------------------------------------------------------------------
* create a dataset and some hard links to it
@@ -2471,7 +2465,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_szip
*
-* Purpose: make a dataset with the SZIP filter
+* Purpose: make a dataset with the SZIP filter
*
*-------------------------------------------------------------------------
*/
@@ -2479,21 +2473,19 @@ out:
static
int make_szip(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=8;
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 8;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
int szip_can_encode = 0;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2512,21 +2504,17 @@ int make_szip(hid_t loc_id)
*/
/* Make sure encoding is enabled */
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
- {
szip_can_encode = 1;
- }
- if (szip_can_encode)
- {
+
+ if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto out;
- if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
goto out;
}
else
- {
/* WARNING? SZIP is decoder only, can't generate test files */
- }
if(H5Sclose(sid) < 0)
goto out;
@@ -2556,20 +2544,18 @@ out:
static
int make_deflate(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1,DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
hobj_ref_t bufref[1]; /* reference */
- hsize_t dims1r[1]={1};
+ hsize_t dims1r[1] = {1};
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
@@ -2591,14 +2577,14 @@ int make_deflate(hid_t loc_id)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
goto out;
- if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
goto out;
/* create a reference to the dataset, test second seeep of file for references */
- if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&bufref[0], loc_id, "dset_deflate", H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0)
+ if (write_dset(loc_id, 1, dims1r, "ref", H5T_STD_REF_OBJ, bufref) < 0)
goto out;
#endif
@@ -2698,18 +2684,16 @@ out:
static
int make_fletcher32(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2767,20 +2751,18 @@ out:
static
int make_nbit(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dtid = -1;
+ hid_t dsid = -1;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2795,43 +2777,25 @@ int make_nbit(hid_t loc_id)
dtid = H5Tcopy(H5T_NATIVE_INT);
if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
- {
- H5Tclose(dtid);
goto out;
- }
/* remove the filters from the dcpl */
if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- {
- H5Tclose(dtid);
goto out;
- }
- if(H5Pset_nbit(dcpl) < 0) {
- H5Tclose(dtid);
+ if(H5Pset_nbit(dcpl) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
- H5Tclose(dtid);
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
/*-------------------------------------------------------------------------
@@ -2849,8 +2813,10 @@ int make_nbit(hid_t loc_id)
out:
H5E_BEGIN_TRY {
+ H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
+ H5Dclose(dsid);
} H5E_END_TRY;
return -1;
}
@@ -2866,20 +2832,18 @@ out:
static
int make_scaleoffset(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dtid = -1;
+ hid_t dsid = -1;
+ hsize_t dims[RANK] = {DIM1,DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2895,31 +2859,19 @@ int make_scaleoffset(hid_t loc_id)
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
- H5Tclose(dtid);
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto out;
- }
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0) {
- H5Tclose(dtid);
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
- if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Tclose(dtid);
H5Dclose(dsid);
@@ -2936,6 +2888,8 @@ int make_scaleoffset(hid_t loc_id)
out:
H5E_BEGIN_TRY {
+ H5Dclose(dsid);
+ H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
@@ -2946,7 +2900,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_all_filters
*
-* Purpose: make a file with all filters
+* Purpose: make a file with all filters
*
*-------------------------------------------------------------------------
*/
@@ -3374,7 +3328,7 @@ out:
H5E_BEGIN_TRY {
H5Pclose(contig_dcpl);
H5Pclose(chunked_dcpl);
-
+
H5Sclose(s_sid);
} H5E_END_TRY;
@@ -3389,9 +3343,9 @@ out:
* Purpose: make chunked datasets with unlimited max dim and chunk dim is
* bigger than current dim. (HDFFV-7933)
* Test for converting chunk to chunk , chunk to conti and chunk
-* to compact.
-* - The chunk to chunk changes layout bigger than any current dim
-* again.
+* to compact.
+* - The chunk to chunk changes layout bigger than any current dim
+* again.
* - The chunk to compact test dataset bigger than 64K, should
* remain original layout.*
*
@@ -4449,7 +4403,7 @@ int write_dset_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
if(make_diffs)
buf23[i][j][k] = 0;
- else
+ else
buf23[i][j][k] = (char)(n++);
}
}
@@ -6195,9 +6149,9 @@ out:
/*-------------------------------------------------------------------------
* Function: add_attr_with_objref
*
- * Purpose:
+ * Purpose:
* Create attributes with object reference to objects (dset,
- * group, datatype).
+ * group, datatype).
*
* Note:
* this function depends on locally created objects, however can be modified
@@ -6215,7 +6169,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
/* --------------------------------
* add attribute with obj ref type
- */
+ */
/* ref to dset */
status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1);
if (status < 0)
@@ -6261,7 +6215,7 @@ out:
/*-------------------------------------------------------------------------
* Function: add_attr_with_regref
*
- * Purpose:
+ * Purpose:
* Create attributes with region reference to dset
*
* Note:
@@ -6332,11 +6286,11 @@ out:
/*-------------------------------------------------------------------------
* Function: gen_refered_objs
*
- * Purpose:
+ * Purpose:
* Create objects (dataset, group, datatype) to be referenced
*
* Note:
- * This function is to use along with gen_obj_ref() gen_region_ref()
+ * This function is to use along with gen_obj_ref() gen_region_ref()
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
@@ -6351,12 +6305,12 @@ static herr_t gen_refered_objs(hid_t loc_id)
int data[3] = {10,20,30};
/* Dset2 */
- hid_t sid2=0, did2=0;
+ hid_t sid2=0, did2=0;
hsize_t dims2[2] = {3,16};
char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
/*-----------------------
- * add short dataset
+ * add short dataset
* (define NAME_OBJ_DS1)
*/
sid = H5Screate_simple(1, dims1, NULL);
@@ -6384,7 +6338,7 @@ static herr_t gen_refered_objs(hid_t loc_id)
}
/*--------------
- * add group
+ * add group
* (define NAME_OBJ_GRP)
*/
gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -6454,17 +6408,17 @@ out:
if(sid2 > 0)
H5Sclose(sid2);
return ret;
-
+
}
/*-------------------------------------------------------------------------
* Function: gen_obj_ref
*
- * Purpose:
+ * Purpose:
* Generate object references to objects (dataset,group and named datatype)
*
* Note:
- * copied from h5copygentest.c and upate to create named datatype
+ * copied from h5copygentest.c and upate to create named datatype
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
@@ -6478,7 +6432,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
/* attr with int type */
hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ int data_attr_int[2] = {10,20};
/* write buffer for obj reference */
hobj_ref_t objref_buf[3];
@@ -6515,7 +6469,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
}
/*---------------------------------------------------------
- * create dataset contain references
+ * create dataset contain references
*/
sid = H5Screate_simple (1, dims_dset_objref, NULL);
if (sid < 0)
@@ -6579,7 +6533,7 @@ out:
* Purpose: Generate dataset region references
*
* Note:
- * copied from h5copygentest.c
+ * copied from h5copygentest.c
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
@@ -6589,11 +6543,11 @@ static herr_t gen_region_ref(hid_t loc_id)
herr_t ret = SUCCEED;
/* target dataset */
- hid_t sid_trg=0;
+ hid_t sid_trg=0;
hsize_t dims_trg[2] = {3,16};
/* dset with region ref type */
- hid_t sid_ref=0, oid_ref=0;
+ hid_t sid_ref=0, oid_ref=0;
/* region ref to target dataset */
hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
@@ -6606,7 +6560,7 @@ static herr_t gen_region_ref(hid_t loc_id)
/* attr with int type */
hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ int data_attr_int[2] = {10,20};
sid_trg = H5Screate_simple (2, dims_trg, NULL);
if (sid_trg < 0)
@@ -6707,7 +6661,7 @@ out:
if (sid_ref > 0)
H5Sclose (sid_ref);
if (sid_trg > 0)
- H5Sclose (sid_trg);
+ H5Sclose (sid_trg);
return ret;
}
@@ -6715,7 +6669,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_references
*
-* Purpose: create a file with obj and region references
+* Purpose: create a file with obj and region references
*
* Programmer: Jonathan Kim (March 18, 2010)
*-------------------------------------------------------------------------
@@ -6731,7 +6685,7 @@ static herr_t make_references(hid_t loc_id)
{
fprintf(stderr, "Failed to generate referenced object.\n");
ret = FAIL;
- }
+ }
/* add object reference */
status = gen_obj_ref(loc_id);
@@ -6755,7 +6709,7 @@ static herr_t make_references(hid_t loc_id)
/*-------------------------------------------------------------------------
* Function: make_complex_attr_references
*
-* Purpose:
+* Purpose:
* create a file with :
* 1. obj ref in attribute of compound type
* 2. region ref in attribute of compound type
@@ -6787,14 +6741,14 @@ static herr_t make_references(hid_t loc_id)
/* 4. region references in vlen attr */
#define RANK_VLEN_REGREF 1
#define DIM_VLEN_REGREF 1 /* for element region */
-#define LEN0_VLEN_REGREF 1 /* element region */
+#define LEN0_VLEN_REGREF 1 /* element region */
static herr_t make_complex_attr_references(hid_t loc_id)
{
herr_t ret = SUCCEED;
- herr_t status;
- /*
- * for objects
+ herr_t status;
+ /*
+ * for objects
*/
hid_t objgid=0, objdid=0, objtid=0, objsid=0;
hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
@@ -6815,8 +6769,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
*/
hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET};
hid_t main_sid=0, main_did=0;
- /*
- * 1. obj references in compound attr
+ /*
+ * 1. obj references in compound attr
*/
hid_t comp_objref_tid=0, comp_objref_aid=0;
typedef struct comp_objref_t {
@@ -6827,8 +6781,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
hid_t comp_objref_attr_sid=0;
hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
- /*
- * 2. region references in compound attr
+ /*
+ * 2. region references in compound attr
*/
hid_t comp_regref_tid=0, comp_regref_aid=0;
typedef struct comp_regref_t {
@@ -6839,16 +6793,16 @@ static herr_t make_complex_attr_references(hid_t loc_id)
hid_t comp_regref_attr_sid=0;
hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} };
-
- /*
- * 3. obj references in vlen attr
+
+ /*
+ * 3. obj references in vlen attr
*/
hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0;
hid_t vlen_objref_attr_id=0;
hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF};
- /*
+ /*
* 4. region references in vlen attr
*/
hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0;
@@ -6858,7 +6812,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/* ---------------------------------------
- * create objects which to be referenced
+ * create objects which to be referenced
*/
/* object1 group */
objgid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -6886,7 +6840,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/* ---------------------------------------------
- * Put testing objs in this group
+ * Put testing objs in this group
* create group contain dataset with attribute and the attribute has
* compound type which contain obj and region reference */
main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -6903,7 +6857,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL);
main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT);
-
+
status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
if (status < 0)
{
@@ -6916,8 +6870,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
* 1. create obj references in a attribute of compound type
*/
- /*
- * create compound type for attribute
+ /*
+ * create compound type for attribute
*/
comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t));
@@ -6956,8 +6910,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
goto out;
}
comp_objref_data[2].val_int = 20;
-
- /*
+
+ /*
* create attribute and write the object ref
*/
comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL);
@@ -6982,7 +6936,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT);
/*
- * create the region reference
+ * create the region reference
*/
status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
if (status < 0)
@@ -7027,8 +6981,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
- /*
- * create obj references
+ /*
+ * create obj references
*/
/* reference to dataset */
status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
@@ -7039,7 +6993,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
goto out;
}
/* reference to group */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
if (status < 0)
{
fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
@@ -7054,15 +7008,15 @@ static herr_t make_complex_attr_references(hid_t loc_id)
ret = FAIL;
goto out;
}
-
- /*
+
+ /*
* create vlen type with obj reference
*/
vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ);
vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
/*
- * create attribute and write the object reference
+ * create attribute and write the object reference
*/
vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
@@ -7085,7 +7039,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*-------------------------------------------------------------------
* 4. create region references in a attribute of vlen type
*/
-
+
/*
* prepare vlen data
*/
@@ -7093,7 +7047,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
/*
- * create region reference
+ * create region reference
*/
status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
if (status < 0)
@@ -7109,15 +7063,15 @@ static herr_t make_complex_attr_references(hid_t loc_id)
ret = FAIL;
goto out;
}
-
- /*
+
+ /*
* create vlen type with region reference
*/
vlen_regref_attr_tid = H5Tvlen_create(H5T_STD_REF_DSETREG);
vlen_regref_attr_sid = H5Screate_simple(RANK_VLEN_REGREF, vlen_regref_dim, NULL);
-
+
/*
- * create attribute and write the region reference
+ * create attribute and write the region reference
*/
vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
@@ -7127,7 +7081,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
ret = FAIL;
goto out;
}
-
+
/* close resource for vlen data */
status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
if (status < 0)