summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_verify.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack/h5repack_verify.c')
-rw-r--r--tools/h5repack/h5repack_verify.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 983371e..6653233 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -33,9 +33,9 @@
*/
int has_filter(hid_t dcpl_id,
- H5Z_filter_t filtnin)
+ H5Z_filter_t filtnin)
{
-
+
int nfilters; /* number of filters */
unsigned filt_flags; /* filter flags */
H5Z_filter_t filtn; /* filter identification number */
@@ -44,37 +44,37 @@ int has_filter(hid_t dcpl_id,
char f_name[256]; /* filter name */
int have=0; /* flag, filter is present */
int i; /* index */
-
+
/* if no information about the input filter is requested return exit */
if (filtnin==-1)
- return 1;
-
+ return 1;
+
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
if (!nfilters && filtnin==H5Z_FILTER_NONE)
return 1;
-
- for (i=0; i<nfilters; i++)
+
+ for (i=0; i<nfilters; i++)
{
cd_nelmts = NELMTS(cd_values);
#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
+ filtn = H5Pget_filter(dcpl_id,
+ (unsigned)i,
+ &filt_flags,
&cd_nelmts,
- cd_values,
- sizeof(f_name),
+ cd_values,
+ sizeof(f_name),
f_name);
#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
+ filtn = H5Pget_filter(dcpl_id,
+ (unsigned)i,
+ &filt_flags,
&cd_nelmts,
- cd_values,
- sizeof(f_name),
+ cd_values,
+ sizeof(f_name),
f_name,
NULL);
#endif /* H5_WANT_H5_V1_6_COMPAT */
@@ -82,7 +82,7 @@ int has_filter(hid_t dcpl_id,
if (filtnin==filtn)
have=1;
- }
+ }
return have;
}
@@ -92,7 +92,7 @@ int has_filter(hid_t dcpl_id,
* Function: has_layout
*
* Purpose: verify which layout is present in the property list DCPL_ID
- *
+ *
* H5D_COMPACT = 0
* H5D_CONTIGUOUS = 1
* H5D_CHUNKED = 2
@@ -107,44 +107,44 @@ int has_filter(hid_t dcpl_id,
*/
int has_layout(hid_t dcpl_id,
- pack_info_t *obj)
+ pack_info_t *obj)
{
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout; /* layout */
int nfilters; /* number of filters */
int rank; /* rank */
int i; /* index */
-
+
/* if no information about the input layout is requested return exit */
if (obj==NULL)
return 1;
-
+
/* check if we have filters in the input object */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
return -1;
-
+
/* a non chunked layout was requested on a filtered object; avoid the test */
if (nfilters && obj->layout!=H5D_CHUNKED)
return 1;
-
+
/* get layout */
- if ((layout = H5Pget_layout(dcpl_id))<0)
+ if ((layout = H5Pget_layout(dcpl_id))<0)
return -1;
-
+
if (obj->layout != layout)
return 0;
-
+
if (layout==H5D_CHUNKED)
{
if ((rank = H5Pget_chunk(dcpl_id,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;
}
-
+
return 1;
}
@@ -168,9 +168,9 @@ int h5repack_verify(const char *fname,
pack_opt_t *options)
{
hid_t fid; /* file ID */
- hid_t dset_id=-1; /* dataset ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
+ hid_t dset_id=-1; /* dataset ID */
+ hid_t dcpl_id=-1; /* dataset creation property list ID */
+ hid_t space_id=-1; /* space ID */
int ret=1, i, j;
trav_table_t *travt=NULL;
@@ -178,7 +178,7 @@ int h5repack_verify(const char *fname,
if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
return -1;
- for ( i=0; i<options->op_tbl->nelems; i++)
+ for ( i=0; i<options->op_tbl->nelems; i++)
{
char* name=options->op_tbl->objs[i].path;
pack_info_t *obj = &options->op_tbl->objs[i];
@@ -187,13 +187,13 @@ int h5repack_verify(const char *fname,
* open
*-------------------------------------------------------------------------
*/
- if ((dset_id=H5Dopen(fid,name))<0)
+ if ((dset_id=H5Dopen(fid,name))<0)
goto error;
- if ((space_id=H5Dget_space(dset_id))<0)
+ if ((space_id=H5Dget_space(dset_id))<0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
+ if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
@@ -215,11 +215,11 @@ int h5repack_verify(const char *fname,
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl_id)<0)
+ if (H5Pclose(dcpl_id)<0)
goto error;
- if (H5Sclose(space_id)<0)
+ if (H5Sclose(space_id)<0)
goto error;
- if (H5Dclose(dset_id)<0)
+ if (H5Dclose(dset_id)<0)
goto error;
}
@@ -232,10 +232,10 @@ int h5repack_verify(const char *fname,
if (options->all_filter==1 || options->all_layout==1)
{
-
+
/* init table */
trav_table_init(&travt);
-
+
/* get the list of objects in the file */
if (h5trav_gettable(fid,travt)<0)
goto error;
@@ -247,16 +247,16 @@ int h5repack_verify(const char *fname,
switch ( travt->objs[i].type )
{
case H5G_DATASET:
-
+
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
*/
- if ((dset_id=H5Dopen(fid,name))<0)
+ if ((dset_id=H5Dopen(fid,name))<0)
goto error;
- if ((space_id=H5Dget_space(dset_id))<0)
+ if ((space_id=H5Dget_space(dset_id))<0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
+ if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
goto error;
/*-------------------------------------------------------------------------
@@ -280,35 +280,35 @@ int h5repack_verify(const char *fname,
if (has_layout(dcpl_id,&pack)==0)
ret=0;
}
-
-
+
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl_id)<0)
+ if (H5Pclose(dcpl_id)<0)
goto error;
- if (H5Sclose(space_id)<0)
+ if (H5Sclose(space_id)<0)
goto error;
- if (H5Dclose(dset_id)<0)
+ if (H5Dclose(dset_id)<0)
goto error;
-
+
break;
default:
break;
} /* switch */
-
+
} /* i */
-
+
/* free table */
trav_table_free(travt);
}
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
+
if (H5Fclose(fid)<0)
return -1;
@@ -345,12 +345,12 @@ error:
int h5repack_cmpdcpl(const char *fname1,
const char *fname2)
{
- hid_t fid1=-1; /* file ID */
- hid_t fid2=-1; /* file ID */
- hid_t dset1=-1; /* dataset ID */
- hid_t dset2=-1; /* dataset ID */
- hid_t dcpl1=-1; /* dataset creation property list ID */
- hid_t dcpl2=-1; /* dataset creation property list ID */
+ hid_t fid1=-1; /* file ID */
+ hid_t fid2=-1; /* file ID */
+ hid_t dset1=-1; /* dataset ID */
+ hid_t dset2=-1; /* dataset ID */
+ hid_t dcpl1=-1; /* dataset creation property list ID */
+ hid_t dcpl2=-1; /* dataset creation property list ID */
trav_table_t *travt1=NULL;
trav_table_t *travt2=NULL;
int ret=1, i;
@@ -362,7 +362,7 @@ int h5repack_cmpdcpl(const char *fname1,
/* disable error reporting */
H5E_BEGIN_TRY {
-
+
/* Open the files */
if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
{
@@ -411,25 +411,25 @@ int h5repack_cmpdcpl(const char *fname1,
*-------------------------------------------------------------------------
*/
case H5G_DATASET:
- if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0)
+ if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0)
goto error;
- if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0)
+ if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0)
goto error;
- if ((dcpl1=H5Dget_create_plist(dset1))<0)
+ if ((dcpl1=H5Dget_create_plist(dset1))<0)
goto error;
- if ((dcpl2=H5Dget_create_plist(dset2))<0)
+ if ((dcpl2=H5Dget_create_plist(dset2))<0)
goto error;
/*-------------------------------------------------------------------------
* compare the property lists
*-------------------------------------------------------------------------
*/
- if ((ret=H5Pequal(dcpl1,dcpl2))<0)
+ if ((ret=H5Pequal(dcpl1,dcpl2))<0)
goto error;
if (ret==0)
{
- printf("Property lists for <%s> are different\n",travt1->objs[i].name);
+ printf("Property lists for <%s> are different\n",travt1->objs[i].name);
goto error;
}
@@ -437,15 +437,15 @@ int h5repack_cmpdcpl(const char *fname1,
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl1)<0)
+ if (H5Pclose(dcpl1)<0)
goto error;
- if (H5Pclose(dcpl2)<0)
+ if (H5Pclose(dcpl2)<0)
goto error;
- if (H5Dclose(dset1)<0)
+ if (H5Dclose(dset1)<0)
goto error;
- if (H5Dclose(dset2)<0)
+ if (H5Dclose(dset2)<0)
goto error;
-
+
break;
} /*switch*/
@@ -476,7 +476,7 @@ int h5repack_cmpdcpl(const char *fname1,
error:
H5E_BEGIN_TRY {
H5Pclose(dcpl1);
- H5Pclose(dcpl2);
+ H5Pclose(dcpl2);
H5Dclose(dset1);
H5Dclose(dset2);
H5Fclose(fid1);