summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_verify.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-09-16 16:22:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-09-16 16:22:16 (GMT)
commitb9be0455961ca1098bc4977bf1138394932b75db (patch)
tree8bf7377bbda85d614e4e5984c5a1a59ac323310e /tools/h5repack/h5repack_verify.c
parent37a1f87664a1b2026e1d2a1dd5033eb2e8b1f5fc (diff)
downloadhdf5-b9be0455961ca1098bc4977bf1138394932b75db.zip
hdf5-b9be0455961ca1098bc4977bf1138394932b75db.tar.gz
hdf5-b9be0455961ca1098bc4977bf1138394932b75db.tar.bz2
[svn-r15629] Description:
Remove trailing whitespace from C/C++ source files, with the following script: foreach f (*.[ch] *.cpp) sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f end Tested on: Mac OS X/32 10.5.5 (amazon) No need for h5committest, just whitespace changes...
Diffstat (limited to 'tools/h5repack/h5repack_verify.c')
-rw-r--r--tools/h5repack/h5repack_verify.c206
1 files changed, 103 insertions, 103 deletions
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 465fdbf..fed4499 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -27,7 +27,7 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
*
* Purpose: verify if filters and layout in the input file match the output file
*
- * Return:
+ * Return:
* 1 match
* 0 do not match
* -1 error
@@ -39,7 +39,7 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
* Separate into 3 cases
* 1) no filter input, get all datasets and compare DCPLs. TO DO
* 2) filter input on selected datasets, get each one trough OBJ and match
- * 3) filter input on all datasets, get all objects and match
+ * 3) filter input on all datasets, get all objects and match
*
*-------------------------------------------------------------------------
*/
@@ -55,16 +55,16 @@ int h5repack_verify(const char *fname,
unsigned int i;
trav_table_t *travt = NULL;
int ok = 1;
-
+
/* open the file */
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];
-
+
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
@@ -77,7 +77,7 @@ int h5repack_verify(const char *fname,
goto error;
if((tid = H5Dget_type(did)) < 0)
goto error;
-
+
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
@@ -85,14 +85,14 @@ int h5repack_verify(const char *fname,
if(has_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
ok = 0;
-
+
/*-------------------------------------------------------------------------
* layout check
*-------------------------------------------------------------------------
*/
if((obj->layout != -1) && (has_layout(pid, obj) == 0))
ok = 0;
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -105,32 +105,32 @@ int h5repack_verify(const char *fname,
goto error;
if (H5Tclose(tid) < 0)
goto error;
-
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* check for the "all" objects option
*-------------------------------------------------------------------------
*/
-
- if(options->all_filter == 1 || options->all_layout == 1)
+
+ 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;
-
- for(i = 0; i < travt->nobjs; i++)
+
+ for(i = 0; i < travt->nobjs; i++)
{
char *name = travt->objs[i].name;
-
- if(travt->objs[i].type == H5TRAV_TYPE_DATASET)
+
+ if(travt->objs[i].type == H5TRAV_TYPE_DATASET)
{
-
+
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
@@ -143,23 +143,23 @@ int h5repack_verify(const char *fname,
goto error;
if((tid = H5Dget_type(did)) < 0)
goto error;
-
+
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
*/
if(options->all_filter == 1)
{
-
+
if(has_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
ok = 0;
}
-
+
/*-------------------------------------------------------------------------
* layout check
*-------------------------------------------------------------------------
*/
- if(options->all_layout == 1)
+ if(options->all_layout == 1)
{
pack_info_t pack;
init_packobject(&pack);
@@ -168,8 +168,8 @@ int h5repack_verify(const char *fname,
if(has_layout(pid, &pack) == 0)
ok = 0;
}
-
-
+
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -183,23 +183,23 @@ int h5repack_verify(const char *fname,
if (H5Tclose(tid) < 0)
goto error;
} /* if */
-
+
} /* i */
-
+
/* free table */
trav_table_free(travt);
}
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
+
if (H5Fclose(fid) < 0)
return -1;
-
+
return ok;
-
+
error:
H5E_BEGIN_TRY {
H5Pclose(pid);
@@ -240,26 +240,26 @@ int has_layout(hid_t pid,
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(pid)) < 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(pid)) < 0)
return -1;
-
+
if (obj->layout != layout)
return 0;
-
+
if (layout==H5D_CHUNKED)
{
if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0)
@@ -270,7 +270,7 @@ int has_layout(hid_t pid,
if (chsize[i] != obj->chunk.chunk_lengths[i])
return 0;
}
-
+
return 1;
}
@@ -301,16 +301,16 @@ int h5repack_cmpdcpl(const char *fname1,
trav_table_t *travt2=NULL;
int ret=1;
unsigned int i;
-
+
/*-------------------------------------------------------------------------
- * open the files
+ * open the files
*-------------------------------------------------------------------------
*/
-
+
/* disable error reporting */
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
-
+
/* Open the files */
if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
@@ -325,7 +325,7 @@ int h5repack_cmpdcpl(const char *fname1,
}
/* enable error reporting */
} H5E_END_TRY;
-
+
/*-------------------------------------------------------------------------
* get file table list of objects
*-------------------------------------------------------------------------
@@ -336,16 +336,16 @@ int h5repack_cmpdcpl(const char *fname1,
goto error;
if(h5trav_gettable(fid2, travt2) < 0)
goto error;
-
-
+
+
/*-------------------------------------------------------------------------
* traverse the suppplied object list
*-------------------------------------------------------------------------
*/
-
- for(i = 0; i < travt1->nobjs; i++)
+
+ for(i = 0; i < travt1->nobjs; i++)
{
- if(travt1->objs[i].type == H5TRAV_TYPE_DATASET)
+ if(travt1->objs[i].type == H5TRAV_TYPE_DATASET)
{
if((dset1 = H5Dopen2(fid1, travt1->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
@@ -355,20 +355,20 @@ int h5repack_cmpdcpl(const char *fname1,
goto error;
if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
goto error;
-
+
/*-------------------------------------------------------------------------
* compare the property lists
*-------------------------------------------------------------------------
*/
if((ret = H5Pequal(dcpl1, dcpl2)) < 0)
goto error;
-
- if(ret == 0)
+
+ if(ret == 0)
{
error_msg(progname, "property lists for <%s> are different\n",travt1->objs[i].name);
goto error;
}
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -383,31 +383,31 @@ int h5repack_cmpdcpl(const char *fname1,
goto error;
} /*if*/
} /*i*/
-
+
/*-------------------------------------------------------------------------
* free
*-------------------------------------------------------------------------
*/
-
+
trav_table_free(travt1);
trav_table_free(travt2);
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
+
H5Fclose(fid1);
H5Fclose(fid2);
return ret;
-
+
/*-------------------------------------------------------------------------
* error
*-------------------------------------------------------------------------
*/
-
+
error:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(dcpl1);
H5Pclose(dcpl2);
@@ -419,7 +419,7 @@ error:
trav_table_free(travt2);
} H5E_END_TRY;
return -1;
-
+
}
@@ -430,7 +430,7 @@ error:
* from user input are present in the property list PID obtained from
* the output file
*
- * Return:
+ * Return:
* 1 match
* 0 do not match
* -1 error
@@ -452,14 +452,14 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
char f_name[256]; /* filter name */
size_t size; /* type size */
unsigned i, j; /* index */
-
+
/* get information about filters */
if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
return -1;
-
+
/* if we do not have filters and the requested filter is NONE, return 1 */
- if(!nfilters_dcpl &&
- nfilters == 1 &&
+ if(!nfilters_dcpl &&
+ nfilters == 1 &&
filter[0].filtn == H5Z_FILTER_NONE )
return 1;
@@ -472,12 +472,12 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
*-------------------------------------------------------------------------
*/
- for( i = 0; i < nfilters_dcpl; i++)
+ for( i = 0; i < nfilters_dcpl; i++)
{
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter2(pid, i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
-
+
/* filter ID */
if (filtn != filter[i].filtn)
return 0;
@@ -485,24 +485,24 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
/* compare client data values. some filters do return local values */
switch (filtn)
{
-
+
case H5Z_FILTER_SHUFFLE:
-
+
/* 1 private client value is returned by DCPL */
if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS )
return 0;
-
+
/* get dataset's type size */
if((size = H5Tget_size(tid)) <= 0)
return -1;
-
+
/* the private client value holds the dataset's type size */
if ( size != cd_values[0] )
return 0;
-
-
+
+
break;
-
+
case H5Z_FILTER_SZIP:
/* 4 private client values are returned by DCPL */
@@ -512,61 +512,61 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
/* "User" parameter for pixels-per-block (index 1) */
if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] )
return 0;
-
-
+
+
break;
-
+
case H5Z_FILTER_NBIT:
-
+
/* only client data values number of values checked */
if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
return 0;
-
-
-
+
+
+
break;
-
+
case H5Z_FILTER_SCALEOFFSET:
/* only client data values checked */
- for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
+ for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
{
if (cd_values[j] != filter[i].cd_values[j])
{
- return 0;
+ return 0;
}
-
+
}
-
-
+
+
break;
-
+
/* for these filters values must match, no local values set in DCPL */
case H5Z_FILTER_FLETCHER32:
case H5Z_FILTER_DEFLATE:
-
+
if ( cd_nelmts != filter[i].cd_nelmts)
return 0;
-
- for( j = 0; j < cd_nelmts; j++)
+
+ for( j = 0; j < cd_nelmts; j++)
{
if (cd_values[j] != filter[i].cd_values[j])
{
- return 0;
+ return 0;
}
-
+
}
-
-
-
+
+
+
break;
-
-
-
+
+
+
} /* switch */
}
-
+
return 1;
}