summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-13 20:53:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-13 20:53:35 (GMT)
commit6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch)
tree5a7a112fe7a8a98c6fecb45b513789d15962eb3d /tools/h5repack
parent6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff)
downloadhdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip
hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz
hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2
[svn-r11245] Purpose:
Code cleanup Description: Trim trailing whitespace, which is making 'diff'ing the two branches difficult. Solution: Ran this script in each directory: foreach f (*.[ch] *.cpp) sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f end Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/h5repack.c86
-rw-r--r--tools/h5repack/h5repack.h76
-rw-r--r--tools/h5repack/h5repack_copy.c268
-rw-r--r--tools/h5repack/h5repack_filters.c186
-rw-r--r--tools/h5repack/h5repack_list.c44
-rw-r--r--tools/h5repack/h5repack_main.c34
-rw-r--r--tools/h5repack/h5repack_opttable.c100
-rw-r--r--tools/h5repack/h5repack_parse.c90
-rw-r--r--tools/h5repack/h5repack_refs.c268
-rw-r--r--tools/h5repack/h5repack_verify.c154
-rw-r--r--tools/h5repack/testh5repack_attr.c92
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c8
-rw-r--r--tools/h5repack/testh5repack_dset.c88
-rw-r--r--tools/h5repack/testh5repack_main.c140
-rw-r--r--tools/h5repack/testh5repack_make.c208
-rw-r--r--tools/h5repack/testh5repack_util.c46
16 files changed, 944 insertions, 944 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 09d83b9..5b5f8c3 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -17,7 +17,7 @@
/*-------------------------------------------------------------------------
* File: h5repack.c
- * Purpose: Public API functions
+ * Purpose: Public API functions
*-------------------------------------------------------------------------
*/
@@ -37,7 +37,7 @@ static void aux_initglb_filter(pack_opt_t *options)
{
int k;
options->filter_g.filtn = -1;
- for ( k=0; k<CDVALUES; k++)
+ for ( k=0; k<CDVALUES; k++)
options->filter_g.cd_values[k] = -1;
}
@@ -45,12 +45,12 @@ static void aux_initglb_filter(pack_opt_t *options)
/*-------------------------------------------------------------------------
* Function: h5repack
*
- * Purpose: locate all high-level HDF5 objects in the file
+ * Purpose: locate all high-level HDF5 objects in the file
* and compress/chunk them using options
*
* Algorythm: 2 traversals are made to the file; the 1st builds a list of
* the objects, the 2nd makes a copy of them, using the options;
- * the reason for the 1st traversal is to check for invalid
+ * the reason for the 1st traversal is to check for invalid
* object name requests
*
* Return: 0, ok, -1, fail
@@ -61,23 +61,23 @@ static void aux_initglb_filter(pack_opt_t *options)
*
*-------------------------------------------------------------------------
*/
-int h5repack(const char* infile,
- const char* outfile,
+int h5repack(const char* infile,
+ const char* outfile,
pack_opt_t *options)
{
/* check input */
if (check_options(options)<0)
return -1;
-
+
/* check for objects in input that are in the file */
if (check_objects(infile,options)<0)
return -1;
-
+
/* copy the objects */
if (copy_objects(infile,outfile,options)<0)
return -1;
-
+
return 0;
}
@@ -93,7 +93,7 @@ int h5repack(const char* infile,
*-------------------------------------------------------------------------
*/
-int h5repack_init (pack_opt_t *options,
+int h5repack_init (pack_opt_t *options,
int verbose)
{
memset(options,0,sizeof(pack_opt_t));
@@ -118,7 +118,7 @@ int h5repack_end (pack_opt_t *options)
/*-------------------------------------------------------------------------
* Function: h5repack_addfilter
*
- * Purpose: add a compression -f option to table
+ * Purpose: add a compression -f option to table
* Example: -f dset:GZIP=6
*
* Return: 0, ok, -1, fail
@@ -126,7 +126,7 @@ int h5repack_end (pack_opt_t *options)
*-------------------------------------------------------------------------
*/
-int h5repack_addfilter(const char* str,
+int h5repack_addfilter(const char* str,
pack_opt_t *options)
{
obj_list_t *obj_list=NULL; /*one object list for the -f and -c option entry */
@@ -172,10 +172,10 @@ int h5repack_addfilter(const char* str,
*/
-int h5repack_addlayout(const char* str,
+int h5repack_addlayout(const char* str,
pack_opt_t *options)
{
-
+
obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */
int n_objs; /*number of objects in the current -t or -c option entry */
pack_info_t pack; /*info about layout to extract from parse */
@@ -188,7 +188,7 @@ int h5repack_addlayout(const char* str,
is present with other objects <%s>\n",str);
return -1;
}
-
+
/* parse the layout option */
obj_list=parse_layout(str,&n_objs,&pack,options);
if (obj_list==NULL)
@@ -198,7 +198,7 @@ int h5repack_addlayout(const char* str,
if (options->all_layout==1 )
{
options->layout_g=pack.layout;
- if (pack.layout==H5D_CHUNKED)
+ if (pack.layout==H5D_CHUNKED)
{
/* -2 means the NONE option, remove chunking
and set the global layout to contiguous */
@@ -210,7 +210,7 @@ int h5repack_addlayout(const char* str,
else
{
options->chunk_g.rank=pack.chunk.rank;
- for (j = 0; j < pack.chunk.rank; j++)
+ for (j = 0; j < pack.chunk.rank; j++)
options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j];
}
}
@@ -249,7 +249,7 @@ static int check_options(pack_opt_t *options)
* objects to layout
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose)
{
printf("Objects to modify layout are...\n");
if (options->all_layout==1) {
@@ -271,22 +271,22 @@ static int check_options(pack_opt_t *options)
printf(" Apply %s layout to all\n", slayout);
if (H5D_CHUNKED==options->layout_g) {
printf("with dimension [");
- for ( j = 0; j < options->chunk_g.rank; j++)
+ for ( j = 0; j < options->chunk_g.rank; j++)
printf("%d ",(int)options->chunk_g.chunk_lengths[j]);
printf("]\n");
}
}
}/* verbose */
- 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;
-
+
if (options->op_tbl->objs[i].chunk.rank>0)
{
if (options->verbose){
- printf(" <%s> with chunk size ",name);
- for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
+ printf(" <%s> with chunk size ",name);
+ for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
printf("%d ",(int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
printf("\n");
}
@@ -295,26 +295,26 @@ static int check_options(pack_opt_t *options)
else if (options->op_tbl->objs[i].chunk.rank==-2)
{
if (options->verbose)
- printf(" <%s> %s\n",name,"NONE (contigous)");
+ printf(" <%s> %s\n",name,"NONE (contigous)");
has_ck=1;
}
}
-
+
if (options->all_layout==1 && has_ck){
printf("Error: Invalid chunking input: all option\
is present with other objects\n");
return -1;
}
-
+
/*-------------------------------------------------------------------------
* objects to filter
*-------------------------------------------------------------------------
*/
-
- if (options->verbose)
+
+ if (options->verbose)
{
printf("Objects to apply filter are...\n");
- if (options->all_filter==1)
+ if (options->all_filter==1)
{
H5Z_filter_t filtn=options->filter_g.filtn;
switch (filtn)
@@ -336,14 +336,14 @@ static int check_options(pack_opt_t *options)
}
} /* verbose */
- for ( i = 0; i < options->op_tbl->nelems; i++)
+ for ( i = 0; i < options->op_tbl->nelems; i++)
{
pack_info_t pack = options->op_tbl->objs[i];
char* name = pack.path;
for ( j=0; j<pack.nfilters; j++)
{
- if (options->verbose)
+ if (options->verbose)
{
printf(" <%s> with %s filter\n",
name,
@@ -354,13 +354,13 @@ static int check_options(pack_opt_t *options)
} /* j */
} /* i */
-
+
if (options->all_filter==1 && has_cp){
printf("Error: Invalid compression input: all option\
is present with other objects\n");
return -1;
}
-
+
return 0;
}
@@ -380,7 +380,7 @@ static int check_options(pack_opt_t *options)
*/
void read_info(const char *filename,
- pack_opt_t *options)
+ pack_opt_t *options)
{
char stype[10];
@@ -390,15 +390,15 @@ void read_info(const char *filename,
int i, rc=1;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing file */
-
+
/* compose the name of the file to open, using the srcdir, if appropriate */
if (srcdir){
strcpy(data_file,srcdir);
strcat(data_file,"/");
- }
+ }
strcat(data_file,filename);
-
+
if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
printf( "Cannot open options file %s", filename);
exit(1);
@@ -410,12 +410,12 @@ void read_info(const char *filename,
rc=fscanf(fp, "%s", stype);
if (rc==-1)
break;
-
+
/*-------------------------------------------------------------------------
* filter
*-------------------------------------------------------------------------
*/
- if (strcmp(stype,"-f") == 0) {
+ if (strcmp(stype,"-f") == 0) {
/* find begining of info */
i=0; c='0';
@@ -434,7 +434,7 @@ void read_info(const char *filename,
if (feof(fp)) break;
if (c==10 /*eol*/) break;
}
- comp_info[i-1]='\0'; /*cut the last " */
+ comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addfilter(comp_info,options)==-1){
printf( "Could not add compression option. Exiting\n");
@@ -445,8 +445,8 @@ void read_info(const char *filename,
* layout
*-------------------------------------------------------------------------
*/
- else if (strcmp(stype,"-l") == 0) {
-
+ else if (strcmp(stype,"-l") == 0) {
+
/* find begining of info */
i=0; c='0';
while( c!=' ' )
@@ -464,7 +464,7 @@ void read_info(const char *filename,
if (feof(fp)) break;
if (c==10 /*eol*/) break;
}
- comp_info[i-1]='\0'; /*cut the last " */
+ comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addlayout(comp_info,options)==-1){
printf( "Could not add chunck option. Exiting\n");
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 315079d..fb99718 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -38,17 +38,17 @@
/* a list of names */
typedef struct {
- char obj[MAX_NC_NAME];
+ char obj[MAX_NC_NAME];
} obj_list_t;
-/*
- the type of filter and additional parameter
+/*
+ the type of filter and additional parameter
type can be one of the filters
H5Z_FILTER_NONE 0, uncompress if compressed
- H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ H5Z_FILTER_DEFLATE 1 , deflation like gzip
H5Z_FILTER_SHUFFLE 2 , shuffle the data
H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC
- H5Z_FILTER_SZIP 4 , szip compression
+ H5Z_FILTER_SZIP 4 , szip compression
*/
#define CDVALUES 2
@@ -57,15 +57,15 @@ typedef struct {
H5Z_filter_t filtn; /* filter identification number */
int cd_values[CDVALUES]; /* filter client data values */
/* extra input for szip, selects the coding method
- entropy coding method: EC=0
- nearest neighbor coding method: NN=1
+ entropy coding method: EC=0
+ nearest neighbor coding method: NN=1
*/
- int szip_coding;
+ int szip_coding;
} filter_info_t;
/* chunk lengths along each dimension and rank */
typedef struct {
- hsize_t chunk_lengths[MAX_VAR_DIMS];
+ hsize_t chunk_lengths[MAX_VAR_DIMS];
int rank;
} chunk_info_t;
@@ -141,29 +141,29 @@ int h5repack_cmpdcpl (const char *fname1,
*/
-int check_objects(const char* fname,
+int check_objects(const char* fname,
pack_opt_t *options);
-int copy_objects(const char* fnamein,
+int copy_objects(const char* fnamein,
const char* fnameout,
pack_opt_t *options);
-void print_objlist(const char *filename,
- int nobjects,
+void print_objlist(const char *filename,
+ int nobjects,
trav_info_t *travi );
-int do_copy_objects(hid_t fidin,
- hid_t fidout,
+int do_copy_objects(hid_t fidin,
+ hid_t fidout,
trav_table_t *travt,
pack_opt_t *options);
-int copy_attr(hid_t loc_in,
- hid_t loc_out,
+int copy_attr(hid_t loc_in,
+ hid_t loc_out,
pack_opt_t *options
);
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
+int do_copy_refobjs(hid_t fidin,
+ hid_t fidout,
trav_table_t *travt,
pack_opt_t *options); /* repack options */
@@ -235,13 +235,13 @@ pack_info_t* options_get_object( const char *path,
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_filter(const char *str,
- int *n_objs,
+obj_list_t* parse_filter(const char *str,
+ int *n_objs,
filter_info_t *filt,
pack_opt_t *options);
-obj_list_t* parse_layout(const char *str,
- int *n_objs,
+obj_list_t* parse_layout(const char *str,
+ int *n_objs,
pack_info_t *pack, /* info about object */
pack_opt_t *options);
@@ -283,23 +283,23 @@ int parse_number(char *str);
int make_testfiles(void);
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
const char *dset_name,
- hid_t type_id,
+ hid_t type_id,
void *buf );
-int write_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
+int write_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
const char *attr_name,
- hid_t type_id,
+ hid_t type_id,
void *buf);
-void write_attr_in(hid_t loc_id,
+void write_attr_in(hid_t loc_id,
const char* dset_name, /* for saving reference to dataset*/
hid_t fid, /* for reference create */
int make_diffs /* flag to modify data buffers */);
-void write_dset_in(hid_t loc_id,
+void write_dset_in(hid_t loc_id,
const char* dset_name, /* for saving reference to dataset*/
hid_t file_id,
int make_diffs /* flag to modify data buffers */);
@@ -312,15 +312,15 @@ void write_dset_in(hid_t loc_id,
*/
int make_dset(hid_t loc_id,
const char *name,
- hid_t sid,
+ hid_t sid,
hid_t dcpl,
void *buf);
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
const char *attr_name,
- hid_t type_id,
+ hid_t type_id,
void *buf);
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 05ea7fa..5b0520d 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -26,16 +26,16 @@
/*-------------------------------------------------------------------------
* Function: print_obj
*
- * Purpose: print name and filters of an object
+ * Purpose: print name and filters of an object
*
*-------------------------------------------------------------------------
*/
static void print_obj(hid_t dcpl_id, char *name)
{
- char str[255];
+ char str[255];
#if defined (PRINT_DEBUG )
- char temp[255];
-#endif
+ char temp[255];
+#endif
int nfilters; /* number of filters */
unsigned filt_flags; /* filter flags */
H5Z_filter_t filtn; /* filter identification number */
@@ -47,7 +47,7 @@ static void print_obj(hid_t dcpl_id, char *name)
strcpy(str,"\0");
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
return;
for ( i=0; i<nfilters; i++)
@@ -55,20 +55,20 @@ static void print_obj(hid_t dcpl_id, char *name)
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 */
@@ -83,7 +83,7 @@ static void print_obj(hid_t dcpl_id, char *name)
#if defined (PRINT_DEBUG)
{
- unsigned level=cd_values[0];
+ unsigned level=cd_values[0];
sprintf(temp,"(%d)",level);
strcat(str,temp);
}
@@ -96,12 +96,12 @@ static void print_obj(hid_t dcpl_id, char *name)
#if defined (PRINT_DEBUG)
{
unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/
- unsigned ppb=cd_values[1];
+ unsigned ppb=cd_values[1];
sprintf(temp,"(%d,",ppb);
strcat(str,temp);
- if (options_mask & H5_SZIP_EC_OPTION_MASK)
+ if (options_mask & H5_SZIP_EC_OPTION_MASK)
strcpy(temp,"EC) ");
- else if (options_mask & H5_SZIP_NN_OPTION_MASK)
+ else if (options_mask & H5_SZIP_NN_OPTION_MASK)
strcpy(temp,"NN) ");
}
strcat(str,temp);
@@ -132,7 +132,7 @@ static void print_obj(hid_t dcpl_id, char *name)
/*-------------------------------------------------------------------------
* Function: copy_objects
*
- * Purpose: duplicate all HDF5 objects in the file
+ * Purpose: duplicate all HDF5 objects in the file
*
* Return: 0, ok, -1 no
*
@@ -143,16 +143,16 @@ static void print_obj(hid_t dcpl_id, char *name)
*-------------------------------------------------------------------------
*/
-int copy_objects(const char* fnamein,
+int copy_objects(const char* fnamein,
const char* fnameout,
pack_opt_t *options)
{
- hid_t fidin;
- hid_t fidout=(-1);
+ hid_t fidin;
+ hid_t fidout=(-1);
trav_table_t *travt=NULL;
/*-------------------------------------------------------------------------
- * open the files
+ * open the files
*-------------------------------------------------------------------------
*/
if ((fidin=H5Fopen(fnamein,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){
@@ -224,7 +224,7 @@ out:
/*-------------------------------------------------------------------------
* Function: do_copy_objects
*
- * Purpose: duplicate all HDF5 objects in the file
+ * Purpose: duplicate all HDF5 objects in the file
*
* Return: 0, ok, -1 no
*
@@ -237,21 +237,21 @@ out:
*-------------------------------------------------------------------------
*/
-int do_copy_objects(hid_t fidin,
- hid_t fidout,
+int do_copy_objects(hid_t fidin,
+ hid_t fidout,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in=(-1); /* group ID */
- hid_t grp_out=(-1); /* 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 type_out=(-1); /* named type ID */
- hid_t dcpl_id=(-1); /* dataset creation property list ID */
- hid_t dcpl_out=(-1); /* dataset creation property list ID */
- hid_t space_id=(-1); /* space ID */
- hid_t ftype_id=(-1); /* file data type ID */
+ hid_t grp_in=(-1); /* group ID */
+ hid_t grp_out=(-1); /* 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 type_out=(-1); /* named type ID */
+ hid_t dcpl_id=(-1); /* dataset creation property list ID */
+ hid_t dcpl_out=(-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 */
void *buf=NULL; /* data buffer */
@@ -281,22 +281,22 @@ int do_copy_objects(hid_t fidin,
if (options->verbose)
printf(" %-10s %s\n", "group",travt->objs[i].name );
- if ((grp_out=H5Gcreate(fidout,travt->objs[i].name, 0))<0)
+ if ((grp_out=H5Gcreate(fidout,travt->objs[i].name, 0))<0)
goto error;
- if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0)
+ if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0)
goto error;
/*-------------------------------------------------------------------------
* copy attrs
*-------------------------------------------------------------------------
*/
- if (copy_attr(grp_in,grp_out,options)<0)
+ if (copy_attr(grp_in,grp_out,options)<0)
goto error;
-
- if (H5Gclose(grp_out)<0)
+
+ if (H5Gclose(grp_out)<0)
goto error;
- if (H5Gclose(grp_in)<0)
+ if (H5Gclose(grp_in)<0)
goto error;
@@ -308,15 +308,15 @@ int do_copy_objects(hid_t fidin,
*/
case H5G_DATASET:
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
+ if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
goto error;
- if ((space_id=H5Dget_space(dset_in))<0)
+ if ((space_id=H5Dget_space(dset_in))<0)
goto error;
- if ((ftype_id=H5Dget_type (dset_in))<0)
+ if ((ftype_id=H5Dget_type (dset_in))<0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
+ if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
goto error;
- if ((dcpl_out = H5Pcopy (dcpl_id))<0)
+ if ((dcpl_out = H5Pcopy (dcpl_id))<0)
goto error;
if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
goto error;
@@ -324,12 +324,12 @@ int do_copy_objects(hid_t fidin,
if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
goto error;
nelmts=1;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
nelmts*=dims[j];
-
+
if (options->verbose)
print_obj(dcpl_id,travt->objs[i].name );
-
+
if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
goto error;
@@ -340,7 +340,7 @@ int do_copy_objects(hid_t fidin,
* check for external files
*-------------------------------------------------------------------------
*/
- if ((next=H5Pget_external_count (dcpl_id))<0)
+ if ((next=H5Pget_external_count (dcpl_id))<0)
goto error;
if (next) {
@@ -348,8 +348,8 @@ int do_copy_objects(hid_t fidin,
}
/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
* 1) the external filters GZIP and SZIP might not be available
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
@@ -365,10 +365,10 @@ int do_copy_objects(hid_t fidin,
*/
if ( (H5T_REFERENCE!=H5Tget_class(mtype_id)))
{
-
+
/* get the storage size of the input dataset */
dsize_in=H5Dget_storage_size(dset_in);
-
+
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
@@ -382,7 +382,7 @@ int do_copy_objects(hid_t fidin,
}
if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* apply the filter
*-------------------------------------------------------------------------
@@ -391,7 +391,7 @@ int do_copy_objects(hid_t fidin,
goto error;
}/*nelmts*/
-
+
/*-------------------------------------------------------------------------
* create;
* disable error checking in case the dataset cannot be created with the
@@ -405,9 +405,9 @@ int do_copy_objects(hid_t fidin,
if (dset_out==FAIL)
{
- if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
+ if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
goto error;
-
+
if (options->verbose)
printf("Warning: Could not apply the filter to <%s>\n", travt->objs[i].name);
}
@@ -425,16 +425,16 @@ int do_copy_objects(hid_t fidin,
* copy attrs
*-------------------------------------------------------------------------
*/
- if (copy_attr(dset_in,dset_out,options)<0)
+ if (copy_attr(dset_in,dset_out,options)<0)
goto error;
/*close */
- if (H5Dclose(dset_out)<0)
+ if (H5Dclose(dset_out)<0)
goto error;
-
+
if (buf)
free(buf);
-
+
}/*H5T_STD_REF_OBJ*/
}/*can_read*/
@@ -443,19 +443,19 @@ int do_copy_objects(hid_t fidin,
* close
*-------------------------------------------------------------------------
*/
- if (H5Tclose(ftype_id)<0)
+ if (H5Tclose(ftype_id)<0)
goto error;
- if (H5Tclose(mtype_id)<0)
+ if (H5Tclose(mtype_id)<0)
goto error;
- if (H5Pclose(dcpl_id)<0)
+ if (H5Pclose(dcpl_id)<0)
goto error;
- if (H5Pclose(dcpl_out)<0)
+ if (H5Pclose(dcpl_out)<0)
goto error;
- if (H5Sclose(space_id)<0)
+ if (H5Sclose(space_id)<0)
goto error;
- if (H5Dclose(dset_in)<0)
+ if (H5Dclose(dset_in)<0)
goto error;
-
+
break;
/*-------------------------------------------------------------------------
@@ -464,25 +464,25 @@ int do_copy_objects(hid_t fidin,
*/
case H5G_TYPE:
- if ((type_in = H5Topen (fidin,travt->objs[i].name))<0)
+ if ((type_in = H5Topen (fidin,travt->objs[i].name))<0)
goto error;
- if ((type_out = H5Tcopy(type_in))<0)
+ if ((type_out = H5Tcopy(type_in))<0)
goto error;
- if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0)
+ if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0)
goto error;
/*-------------------------------------------------------------------------
* copy attrs
*-------------------------------------------------------------------------
*/
- if (copy_attr(type_in,type_out,options)<0)
+ if (copy_attr(type_in,type_out,options)<0)
goto error;
-
- if (H5Tclose(type_in)<0)
+
+ if (H5Tclose(type_in)<0)
goto error;
- if (H5Tclose(type_out)<0)
+ if (H5Tclose(type_out)<0)
goto error;
if (options->verbose)
@@ -500,12 +500,12 @@ int do_copy_objects(hid_t fidin,
{
H5G_stat_t statbuf;
char *targbuf=NULL;
-
+
if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0)
goto error;
-
+
targbuf = malloc(statbuf.linklen);
-
+
if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0)
goto error;
@@ -513,11 +513,11 @@ int do_copy_objects(hid_t fidin,
H5G_LINK_SOFT,
targbuf, /* current name of object */
travt->objs[i].name /* new name of object */
- )<0)
+ )<0)
goto error;
-
+
free(targbuf);
-
+
if (options->verbose)
printf(" %-10s %s\n","link",travt->objs[i].name );
@@ -530,31 +530,31 @@ int do_copy_objects(hid_t fidin,
break;
}
}
-
+
/*-------------------------------------------------------------------------
- * the root is a special case, we get an ID for the root group
+ * the root is a special case, we get an ID for the root group
* and copy its attributes using that ID
* it must be done last, because the attributes might contain references to
* objects in the object list
*-------------------------------------------------------------------------
*/
- if ((grp_out = H5Gopen(fidout,"/"))<0)
+ if ((grp_out = H5Gopen(fidout,"/"))<0)
goto error;
-
- if ((grp_in = H5Gopen(fidin,"/"))<0)
+
+ if ((grp_in = H5Gopen(fidin,"/"))<0)
goto error;
-
- if (copy_attr(grp_in,grp_out,options)<0)
+
+ if (copy_attr(grp_in,grp_out,options)<0)
goto error;
-
- if (H5Gclose(grp_out)<0)
+
+ if (H5Gclose(grp_out)<0)
goto error;
- if (H5Gclose(grp_in)<0)
+ if (H5Gclose(grp_in)<0)
goto error;
-
+
return 0;
-
+
error:
H5E_BEGIN_TRY {
H5Gclose(grp_in);
@@ -578,7 +578,7 @@ error:
/*-------------------------------------------------------------------------
* Function: copy_attr
*
- * Purpose: copy attributes located in LOC_IN, which is obtained either from
+ * Purpose: copy attributes located in LOC_IN, which is obtained either from
* loc_id = H5Gopen( fid, name);
* loc_id = H5Dopen( fid, name);
* loc_id = H5Topen( fid, name);
@@ -592,15 +592,15 @@ error:
*-------------------------------------------------------------------------
*/
-int copy_attr(hid_t loc_in,
- hid_t loc_out,
+int copy_attr(hid_t loc_in,
+ hid_t loc_out,
pack_opt_t *options
)
{
- 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 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 */
void *buf=NULL; /* data buffer */
@@ -611,44 +611,44 @@ int copy_attr(hid_t loc_in,
int n, j;
unsigned u;
- if ((n = H5Aget_num_attrs(loc_in))<0)
+ if ((n = H5Aget_num_attrs(loc_in))<0)
goto error;
-
+
for ( u = 0; u < (unsigned)n; u++)
{
- /* set data buffer to NULL each iteration
- we might not use it in the case of references
+ /* set data buffer to NULL each iteration
+ we might not use it in the case of references
*/
- buf=NULL;
+ buf=NULL;
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
*/
/* open attribute */
- if ((attr_id = H5Aopen_idx(loc_in, u))<0)
+ if ((attr_id = H5Aopen_idx(loc_in, u))<0)
goto error;
-
+
/* get name */
- if (H5Aget_name( attr_id, 255, name )<0)
+ if (H5Aget_name( attr_id, 255, name )<0)
goto error;
/* get the file datatype */
if ((ftype_id = H5Aget_type( attr_id )) < 0 )
goto error;
-
+
/* get the dataspace handle */
if ((space_id = H5Aget_space( attr_id )) < 0 )
goto error;
-
+
/* get dimensions */
if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 )
goto error;
-
+
nelmts=1;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
nelmts*=dims[j];
-
+
if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
goto error;
@@ -657,20 +657,20 @@ int copy_attr(hid_t loc_in,
/*-------------------------------------------------------------------------
* object references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- * this is done on a second sweep of the file that just copies
+ * we cannot just copy the buffers, but instead we recreate the reference
+ * this is done on a second sweep of the file that just copies
* the referenced objects
*-------------------------------------------------------------------------
*/
- if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ))
+ if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ))
{
-
-
+
+
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
*/
-
+
buf=(void *) HDmalloc((unsigned)(nelmts*msize));
if ( buf==NULL){
printf( "cannot read into memory\n" );
@@ -678,32 +678,32 @@ int copy_attr(hid_t loc_in,
}
if (H5Aread(attr_id,mtype_id,buf)<0)
goto error;
-
+
/*-------------------------------------------------------------------------
- * copy
+ * copy
*-------------------------------------------------------------------------
*/
-
+
if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
goto error;
if(H5Awrite(attr_out,mtype_id,buf)<0)
goto error;
-
+
/*close*/
- if (H5Aclose(attr_out)<0)
+ if (H5Aclose(attr_out)<0)
goto error;
-
-
+
+
if (buf)
free(buf);
-
-
+
+
} /*H5T_STD_REF_OBJ*/
-
+
if (options->verbose)
printf(" %-13s %s\n", "attr", name);
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -715,7 +715,7 @@ int copy_attr(hid_t loc_in,
if (H5Aclose(attr_id)<0) goto error;
} /* u */
-
+
return 0;
error:
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 28771a9..0b5ff2b 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -25,26 +25,26 @@
*
*-------------------------------------------------------------------------
*/
-static
+static
int aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
+ pack_opt_t *options, /* repack options */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest;
int result;
int i;
-
- for ( i=0; i<options->op_tbl->nelems; i++)
+
+ for ( i=0; i<options->op_tbl->nelems; i++)
{
if (strcmp(options->op_tbl->objs[i].path,name)==0)
{
*obj = options->op_tbl->objs[i];
return i;
}
-
+
pdest = strstr(name,options->op_tbl->objs[i].path);
result = (int)(pdest - name);
-
+
/* found at position 1, meaning without '/' */
if( pdest != NULL && result==1 )
{
@@ -52,7 +52,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */
return i;
}
}/*i*/
-
+
return -1;
}
@@ -79,11 +79,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
init_packobject(&tmp);
idx = aux_find_obj(name,options,&tmp);
-
+
/* name was on input */
if (idx>=0)
{
-
+
/* applying to all objects */
if (options->all_layout)
{
@@ -93,7 +93,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
{
case H5D_CHUNKED:
tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
+ for ( i=0; i<tmp.chunk.rank; i++)
tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
break;
default:
@@ -107,15 +107,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
{
case H5D_CHUNKED:
tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
+ for ( i=0; i<tmp.chunk.rank; i++)
tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i];
break;
default:
break;
}/*switch*/
-
+
}
-
+
/* applying to all objects */
if (options->all_filter)
{
@@ -126,29 +126,29 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
else
{
tmp.nfilters=options->op_tbl->objs[idx].nfilters;
- for ( i=0; i<tmp.nfilters; i++)
+ for ( i=0; i<tmp.nfilters; i++)
{
tmp.filter[i] = options->op_tbl->objs[idx].filter[i];
}
}
-
-
+
+
} /* if idx */
-
+
/* no input name */
else
{
-
+
if (options->all_filter)
{
/* assign the global filter */
tmp.nfilters=1;
tmp.filter[0]=options->filter_g;
}
-
-
+
+
if (options->all_layout)
{
/* assign the global layout info to the OBJ info */
@@ -157,21 +157,21 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
{
case H5D_CHUNKED:
tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
+ for ( i=0; i<tmp.chunk.rank; i++)
tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
break;
default:
break;
}/*switch*/
-
+
}
-
-
+
+
}
-
+
*obj = tmp;
return 1;
-
+
}
@@ -179,7 +179,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
/*-------------------------------------------------------------------------
* Function: apply_filters
*
- * Purpose: apply the filters in the object to the property list;
+ * Purpose: apply the filters in the object to the property list;
* do extra checking in the case of SZIP; delete all filters in the case
* of H5Z_FILTER_NONE present in the PACK_INFO_T filter array
*
@@ -197,7 +197,7 @@ int apply_filters(const char* name, /* object name from traverse list */
hid_t dcpl_id, /* dataset creation property list */
hid_t type_id, /* dataset datatype */
pack_opt_t *options) /* repack options */
-{
+{
int nfilters; /* number of filters in DCPL */
unsigned aggression; /* the deflate level */
hsize_t nelmts; /* number of elements in dataset */
@@ -206,31 +206,31 @@ int apply_filters(const char* name, /* object name from traverse list */
H5D_layout_t layout;
int i;
pack_info_t obj;
-
-
+
+
if (rank==0)
goto out;
-
+
/*-------------------------------------------------------------------------
* initialize the assigment object
*-------------------------------------------------------------------------
*/
init_packobject(&obj);
-
-
+
+
/*-------------------------------------------------------------------------
* find options
*-------------------------------------------------------------------------
*/
if (aux_assign_obj(name,options,&obj)==0)
return 0;
-
-
+
+
/* check for datasets too small */
if ((size=H5Tget_size(type_id))==0)
return 0;
nelmts=1;
- for (i=0; i<rank; i++)
+ for (i=0; i<rank; i++)
nelmts*=dims[i];
if (nelmts*size < options->threshold )
{
@@ -239,9 +239,9 @@ int apply_filters(const char* name, /* object name from traverse list */
name,(int)options->threshold);
return 0;
}
-
+
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
return -1;
/*-------------------------------------------------------------------------
* check if we have filters in the pipeline
@@ -250,7 +250,7 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
if (nfilters && obj.nfilters ) {
- if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
return -1;
}
@@ -262,9 +262,9 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
if (obj.layout == -1 )
{
- if ((layout = H5Pget_layout(dcpl_id))<0)
+ if ((layout = H5Pget_layout(dcpl_id))<0)
return -1;
-
+
if (layout==H5D_CHUNKED)
{
if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0)
@@ -278,23 +278,23 @@ int apply_filters(const char* name, /* object name from traverse list */
-
+
/*-------------------------------------------------------------------------
- * the type of filter and additional parameter
+ * the type of filter and additional parameter
* type can be one of the filters
* H5Z_FILTER_NONE 0, uncompress if compressed
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
* H5Z_FILTER_SHUFFLE 2 , shuffle the data
* H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- * H5Z_FILTER_SZIP 4 , szip compression
- * H5Z_FILTER_NBIT 5 , nbit compression
- * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
+ * H5Z_FILTER_SZIP 4 , szip compression
+ * H5Z_FILTER_NBIT 5 , nbit compression
+ * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
*-------------------------------------------------------------------------
*/
-
+
if (obj.nfilters)
{
-
+
/*-------------------------------------------------------------------------
* filters require CHUNK layout; if we do not have one define a default
*-------------------------------------------------------------------------
@@ -302,19 +302,19 @@ int apply_filters(const char* name, /* object name from traverse list */
if (obj.layout==-1)
{
obj.chunk.rank=rank;
- for (i=0; i<rank; i++)
+ for (i=0; i<rank; i++)
obj.chunk.chunk_lengths[i] = dims[i];
}
-
+
for ( i=0; i<obj.nfilters; i++)
{
switch (obj.filter[i].filtn)
{
default:
break;
-
+
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_DEFLATE:
@@ -325,31 +325,31 @@ int apply_filters(const char* name, /* object name from traverse list */
if(H5Pset_deflate(dcpl_id,aggression)<0)
return -1;
break;
-
+
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
+ * H5Z_FILTER_SZIP 4 , szip compression
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SZIP:
{
unsigned options_mask;
unsigned pixels_per_block;
-
+
pixels_per_block=obj.filter[i].cd_values[0];
if (obj.filter[i].szip_coding==0)
options_mask=H5_SZIP_NN_OPTION_MASK;
- else
+ else
options_mask=H5_SZIP_EC_OPTION_MASK;
-
+
/* set up for szip data */
if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0)
return -1;
- if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
+ if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
return -1;
-
+
}
break;
-
+
/*-------------------------------------------------------------------------
* H5Z_FILTER_SHUFFLE 2 , shuffle the data
*-------------------------------------------------------------------------
@@ -357,10 +357,10 @@ int apply_filters(const char* name, /* object name from traverse list */
case H5Z_FILTER_SHUFFLE:
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
- if (H5Pset_shuffle(dcpl_id)<0)
+ if (H5Pset_shuffle(dcpl_id)<0)
return -1;
break;
-
+
/*-------------------------------------------------------------------------
* H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
*-------------------------------------------------------------------------
@@ -368,7 +368,7 @@ int apply_filters(const char* name, /* object name from traverse list */
case H5Z_FILTER_FLETCHER32:
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
- if (H5Pset_fletcher32(dcpl_id)<0)
+ if (H5Pset_fletcher32(dcpl_id)<0)
return -1;
break;
/*----------- -------------------------------------------------------------
@@ -378,7 +378,7 @@ int apply_filters(const char* name, /* object name from traverse list */
case H5Z_FILTER_NBIT:
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
- if (H5Pset_nbit(dcpl_id)<0)
+ if (H5Pset_nbit(dcpl_id)<0)
return -1;
break;
/*----------- -------------------------------------------------------------
@@ -389,39 +389,39 @@ int apply_filters(const char* name, /* object name from traverse list */
aggression=obj.filter[i].cd_values[0];
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
- if (H5Pset_scaleoffset(dcpl_id,aggression,2)<0)
+ if (H5Pset_scaleoffset(dcpl_id,aggression,2)<0)
return -1;
break;
} /* switch */
}/*i*/
-
+
}
/*obj.nfilters*/
-
+
/*-------------------------------------------------------------------------
- * layout
+ * layout
*-------------------------------------------------------------------------
*/
-
+
if (obj.layout>=0)
{
/* a layout was defined */
- if (H5Pset_layout(dcpl_id, obj.layout)<0)
+ if (H5Pset_layout(dcpl_id, obj.layout)<0)
return -1;
-
+
if (H5D_CHUNKED==obj.layout) { /* set up chunk */
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
}
else if (H5D_COMPACT==obj.layout) {
- if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
return -1;
}
-
+
}
-
+
return 0;
-
+
out:
if (options->verbose)
printf("Warning: Filter could not be applied to <%s>\n",name);
@@ -440,7 +440,7 @@ out:
*-------------------------------------------------------------------------
*/
-int print_filters(hid_t dcpl_id)
+int print_filters(hid_t dcpl_id)
{
int nfilters; /* number of filters */
unsigned filt_flags; /* filter flags */
@@ -453,31 +453,31 @@ int print_filters(hid_t dcpl_id)
int i;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
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 */
-
+
f_name[sizeof(f_name)-1] = '\0';
sprintf(s, "Filter-%d:", i);
printf(" %-10s %s-%u %s {", s,
@@ -488,8 +488,8 @@ int print_filters(hid_t dcpl_id)
printf("%s%u", cd_num?", ":"", cd_values[cd_num]);
}
printf("}\n");
- }
-
+ }
+
return 0;
}
diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c
index 3f65e63..ab7e5b2 100644
--- a/tools/h5repack/h5repack_list.c
+++ b/tools/h5repack/h5repack_list.c
@@ -34,21 +34,21 @@
*
*-------------------------------------------------------------------------
*/
-int check_objects(const char* fname,
+int check_objects(const char* fname,
pack_opt_t *options)
{
- hid_t fid;
+ hid_t fid;
int i;
trav_table_t *travt=NULL;
/*-------------------------------------------------------------------------
- * open the file
+ * open the file
*-------------------------------------------------------------------------
*/
/* disable out reporting */
H5E_BEGIN_TRY {
-
+
/* Open the files */
if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){
printf("h5repack: <%s>: %s\n", fname, H5FOPENERROR );
@@ -74,18 +74,18 @@ int check_objects(const char* fname,
* compare with user supplied list
*-------------------------------------------------------------------------
*/
-
+
if (options->verbose)
{
printf("Opening file <%s>. Searching for objects to modify...\n",fname);
}
-
- 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;
if (options->verbose)
printf(" <%s>",name);
-
+
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name,travt)<0)
{
@@ -109,41 +109,41 @@ int check_objects(const char* fname,
int ppb=options->op_tbl->objs[i].filter->cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
- hid_t did;
- hid_t sid;
+ hid_t did;
+ hid_t sid;
if (options->op_tbl->objs[i].chunk.rank>0)
{
rank=options->op_tbl->objs[i].chunk.rank;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
csize*=(int)options->op_tbl->objs[i].chunk.chunk_lengths[j];
}
else
{
- if ((did=H5Dopen(fid,travt->objs[i].name))<0)
+ if ((did=H5Dopen(fid,travt->objs[i].name))<0)
goto out;
- if ((sid=H5Dget_space(did))<0)
+ if ((sid=H5Dget_space(did))<0)
goto out;
if ( (rank=H5Sget_simple_extent_ndims(sid))<0)
goto out;
HDmemset(dims, 0, sizeof dims);
if ( H5Sget_simple_extent_dims(sid,dims,NULL)<0)
goto out;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
csize*=(int)dims[j];
- if (H5Sclose(sid)<0)
+ if (H5Sclose(sid)<0)
goto out;
- if (H5Dclose(did)<0)
+ if (H5Dclose(did)<0)
goto out;
- }
-
+ }
+
if (csize < ppb )
{
printf("Warning: SZIP settins, chunk size is smaller than pixels per block...Exiting\n");
goto out;
}
-
-
+
+
}
break;
@@ -181,8 +181,8 @@ out:
*
*-------------------------------------------------------------------------
*/
-void print_objlist(const char *filename,
- int nobjects,
+void print_objlist(const char *filename,
+ int nobjects,
trav_info_t *info )
{
int i;
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 8771328..665f8e1 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -22,7 +22,7 @@ static void usage(void);
*
* Purpose: h5repack main program
*
- * Return: 1, error, 0, no error
+ * Return: 1, error, 0, no error
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
/* initialize options */
h5repack_init (&options,0);
- for ( i = 1; i < argc; i++)
+ for ( i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-h") == 0) {
usage();
@@ -56,14 +56,14 @@ int main(int argc, char **argv)
if (strcmp(argv[i], "-i") == 0) {
infile = argv[++i];
}
- else if (strcmp(argv[i], "-o") == 0) {
- outfile = argv[++i];
+ else if (strcmp(argv[i], "-o") == 0) {
+ outfile = argv[++i];
}
- else if (strcmp(argv[i], "-v") == 0) {
+ else if (strcmp(argv[i], "-v") == 0) {
options.verbose = 1;
}
- else if (strcmp(argv[i], "-f") == 0) {
-
+ else if (strcmp(argv[i], "-f") == 0) {
+
/* add the -f filter option */
if (h5repack_addfilter(argv[i+1],&options)<0)
exit(1);
@@ -71,17 +71,17 @@ int main(int argc, char **argv)
/* jump to next */
++i;
}
- else if (strcmp(argv[i], "-l") == 0) {
-
+ else if (strcmp(argv[i], "-l") == 0) {
+
/* parse the -l layout option */
if (h5repack_addlayout(argv[i+1],&options)<0)
exit(1);
-
+
/* jump to next */
++i;
}
- else if (strcmp(argv[i], "-m") == 0) {
+ else if (strcmp(argv[i], "-m") == 0) {
options.threshold = parse_number(argv[i+1]);
if ((int)options.threshold==-1) {
printf("Error: Invalid treshold size <%s>\n",argv[i+1]);
@@ -89,23 +89,23 @@ int main(int argc, char **argv)
}
++i;
}
-
- else if (strcmp(argv[i], "-e") == 0) {
+
+ else if (strcmp(argv[i], "-e") == 0) {
read_info(argv[++i],&options);
}
-
+
else if (argv[i][0] == '-') {
usage();
exit(1);
}
}
- if (infile == NULL || outfile == NULL)
+ if (infile == NULL || outfile == NULL)
{
usage();
exit(1);
}
-
+
/* pack it */
ret=h5repack(infile,outfile,&options);
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
*-------------------------------------------------------------------------
*/
-static
+static
void usage(void)
{
printf("h5repack -i input -o output [-h] [-v] [-f 'filter'] [-l 'layout'][-m number][-e file] \n");
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index d85e1f5..7bb6d10 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -31,21 +31,21 @@
void init_packobject(pack_info_t *obj)
{
int j, k;
-
+
strcpy(obj->path,"\0");
for ( j=0; j<H5_REPACK_MAX_NFILTERS; j++)
{
obj->filter[j].filtn = -1;
obj->filter[j].szip_coding = -1;
- for ( k=0; k<CDVALUES; k++)
+ for ( k=0; k<CDVALUES; k++)
obj->filter[j].cd_values[k] = -1;
}
obj->chunk.rank = -1;
obj->refobj_id = -1;
obj->layout = H5D_LAYOUT_ERROR;
obj->nfilters = 0;
-
-
+
+
}
/*-------------------------------------------------------------------------
@@ -58,7 +58,7 @@ void init_packobject(pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_filter(pack_opttbl_t *table,
+static void aux_tblinsert_filter(pack_opttbl_t *table,
int I,
filter_info_t filt)
{
@@ -83,14 +83,14 @@ static void aux_tblinsert_filter(pack_opttbl_t *table,
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_layout(pack_opttbl_t *table,
+static void aux_tblinsert_layout(pack_opttbl_t *table,
int I,
pack_info_t *pack)
{
int k;
-
+
table->objs[I].layout = pack->layout;
- if (H5D_CHUNKED==pack->layout)
+ if (H5D_CHUNKED==pack->layout)
{
/* -2 means the NONE option, remove chunking
and set the layout to contiguous */
@@ -103,7 +103,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table,
else
{
table->objs[I].chunk.rank = pack->chunk.rank;
- for (k = 0; k < pack->chunk.rank; k++)
+ for (k = 0; k < pack->chunk.rank; k++)
table->objs[I].chunk.chunk_lengths[k] = pack->chunk.chunk_lengths[k];
}
}
@@ -123,14 +123,14 @@ static void aux_tblinsert_layout(pack_opttbl_t *table,
static int aux_inctable(pack_opttbl_t *table, int n_objs )
{
int i;
-
+
table->size += n_objs;
table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs==NULL) {
printf("Error: not enough memory for options table\n");
return -1;
}
- for (i = table->nelems; i < table->size; i++)
+ for (i = table->nelems; i < table->size; i++)
{
init_packobject(&table->objs[i]);
}
@@ -155,7 +155,7 @@ int options_table_init( pack_opttbl_t **tbl )
printf("Error: not enough memory for options table\n");
return -1;
}
-
+
table->size = 30;
table->nelems = 0;
table->objs = (pack_info_t*) malloc(table->size * sizeof(pack_info_t));
@@ -163,12 +163,12 @@ int options_table_init( pack_opttbl_t **tbl )
printf("Error: not enough memory for options table\n");
return -1;
}
-
- for ( i=0; i<table->size; i++)
+
+ for ( i=0; i<table->size; i++)
{
init_packobject(&table->objs[i]);
}
-
+
*tbl = table;
return 0;
}
@@ -207,22 +207,22 @@ int options_add_layout( obj_list_t *obj_list,
pack_opttbl_t *table )
{
int i, j, I, added=0, found=0;
-
+
/* increase the size of the collection by N_OBJS if necessary */
- if (table->nelems+n_objs >= table->size)
+ if (table->nelems+n_objs >= table->size)
{
if (aux_inctable(table,n_objs)<0)
return -1;
}
-
+
/* search if this object is already in the table; "path" is the key */
if (table->nelems>0)
{
/* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++)
+ for (j = 0; j < n_objs; j++)
{
/* linear table search */
- for (i = 0; i < table->nelems; i++)
+ for (i = 0; i < table->nelems; i++)
{
/*already on the table */
if (strcmp(obj_list[j].obj,table->objs[i].path)==0)
@@ -242,47 +242,47 @@ int options_add_layout( obj_list_t *obj_list,
}
} /* if */
} /* i */
-
+
if (found==0)
{
/* keep the grow in a temp var */
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
/* cases where we have an already inserted name but there is a new name also
example:
- -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
- dset1 is already inserted, but dset2 must also be
+ -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
+ dset1 is already inserted, but dset2 must also be
*/
else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0)
{
/* keep the grow in a temp var */
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
- } /* j */
+ } /* j */
}
-
+
/* first time insertion */
else
{
/* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++)
+ for (j = 0; j < n_objs; j++)
{
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
}
-
+
table->nelems+= added;
-
+
return 0;
}
@@ -303,24 +303,24 @@ int options_add_filter(obj_list_t *obj_list,
filter_info_t filt,
pack_opttbl_t *table )
{
-
+
int i, j, I, added=0, found=0;
-
+
/* increase the size of the collection by N_OBJS if necessary */
- if (table->nelems+n_objs >= table->size)
+ if (table->nelems+n_objs >= table->size)
{
if (aux_inctable(table,n_objs)<0)
return -1;
}
-
+
/* search if this object is already in the table; "path" is the key */
if (table->nelems>0)
{
/* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++)
+ for (j = 0; j < n_objs; j++)
{
/* linear table search */
- for (i = 0; i < table->nelems; i++)
+ for (i = 0; i < table->nelems; i++)
{
/*already on the table */
if (strcmp(obj_list[j].obj,table->objs[i].path)==0)
@@ -331,11 +331,11 @@ int options_add_filter(obj_list_t *obj_list,
break;
} /* if */
} /* i */
-
+
if (found==0)
{
/* keep the grow in a temp var */
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
@@ -343,34 +343,34 @@ int options_add_filter(obj_list_t *obj_list,
/* cases where we have an already inserted name but there is a new name also
example:
-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
- dset1 is already inserted, but dset2 must also be
+ dset1 is already inserted, but dset2 must also be
*/
else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0)
{
/* keep the grow in a temp var */
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
}
- } /* j */
+ } /* j */
}
-
+
/* first time insertion */
else
{
/* go tru the supplied list of names */
- for (j = 0; j < n_objs; j++)
+ for (j = 0; j < n_objs; j++)
{
- I = table->nelems + added;
+ I = table->nelems + added;
added++;
strcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
}
}
-
+
table->nelems+= added;
-
+
return 0;
}
@@ -388,8 +388,8 @@ pack_info_t* options_get_object( const char *path,
pack_opttbl_t *table )
{
int i;
-
- for ( i = 0; i < table->nelems; i++)
+
+ for ( i = 0; i < table->nelems; i++)
{
/* found it */
if (strcmp(table->objs[i].path,path)==0)
@@ -397,7 +397,7 @@ pack_info_t* options_get_object( const char *path,
return (&table->objs[i]);
}
}
-
+
return NULL;
}
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 1fd61ca..7e82fde 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -36,9 +36,9 @@
* FLET, to apply the HDF5 checksum filter
* NBIT, to apply the HDF5 NBIT filter (NBIT compression)
* S+O, to apply the HDF5 scale+offset filter (compression)
- * NONE, to remove the filter
+ * NONE, to remove the filter
*
- * Examples:
+ * Examples:
* "GZIP=6"
* "A,B:NONE"
*
@@ -50,8 +50,8 @@
*/
-obj_list_t* parse_filter(const char *str,
- int *n_objs,
+obj_list_t* parse_filter(const char *str,
+ int *n_objs,
filter_info_t *filt,
pack_opt_t *options)
{
@@ -59,10 +59,10 @@ obj_list_t* parse_filter(const char *str,
char c;
size_t len=strlen(str);
int j, m, n, k, l, end_obj=-1, no_param=0;
- char sobj[MAX_NC_NAME];
+ char sobj[MAX_NC_NAME];
char scomp[10];
char stype[5];
- char smask[3];
+ char smask[3];
obj_list_t* obj_list=NULL;
unsigned pixels_per_block;
@@ -91,7 +91,7 @@ obj_list_t* parse_filter(const char *str,
/* apply to all objects */
options->all_filter=1;
}
-
+
n++;
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
@@ -106,7 +106,7 @@ obj_list_t* parse_filter(const char *str,
{
c = str[j];
sobj[k]=c;
- if ( c==',' || j==end_obj-1)
+ if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
strcpy(obj_list[n].obj,sobj);
@@ -130,7 +130,7 @@ obj_list_t* parse_filter(const char *str,
{
c = str[i];
scomp[k]=c;
- if ( c=='=' || i==len-1)
+ if ( c=='=' || i==len-1)
{
if ( c=='=') { /*one more parameter */
scomp[k]='\0'; /*cut space */
@@ -139,11 +139,11 @@ obj_list_t* parse_filter(const char *str,
SZIP=8,EC
SZIP=8,NN
*/
-
+
if (strcmp(scomp,"SZIP")==0)
{
l=-1; /* mask index check */
- for ( m=0,u=i+1; u<len; u++,m++)
+ for ( m=0,u=i+1; u<len; u++,m++)
{
if (str[u]==',')
{
@@ -159,7 +159,7 @@ obj_list_t* parse_filter(const char *str,
}
if (l==-1)
stype[m]=c;
- else
+ else
{
smask[l]=c;
l++;
@@ -168,7 +168,7 @@ obj_list_t* parse_filter(const char *str,
smask[l]='\0';
i=len-1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (strcmp(smask,"NN")==0)
+ if (strcmp(smask,"NN")==0)
filt->szip_coding=0;
else if (strcmp(smask,"EC")==0)
filt->szip_coding=1;
@@ -177,17 +177,17 @@ obj_list_t* parse_filter(const char *str,
printf("Input Error: szip mask must be 'NN' or 'EC' \n");
exit(1);
}
-
+
}
}
-
+
} /* u */
} /*if */
-
+
else
{
/* here we could have 1 or 2 digits */
- for ( m=0,u=i+1; u<len; u++,m++)
+ for ( m=0,u=i+1; u<len; u++,m++)
{
c = str[u];
if (!isdigit(c)){
@@ -202,7 +202,7 @@ obj_list_t* parse_filter(const char *str,
} /*if */
-
+
filt->cd_values[j++]=atoi(stype);
i+=m; /* jump */
}
@@ -313,7 +313,7 @@ obj_list_t* parse_filter(const char *str,
switch (filt->filtn)
{
-
+
case H5Z_FILTER_DEFLATE:
if (filt->cd_values[0]<0 || filt->cd_values[0]>9 ){
if (obj_list) free(obj_list);
@@ -321,8 +321,8 @@ obj_list_t* parse_filter(const char *str,
exit(1);
}
break;
-
-
+
+
case H5Z_FILTER_SZIP:
pixels_per_block=filt->cd_values[0];
if ((pixels_per_block%2)==1) {
@@ -385,7 +385,7 @@ const char* get_sfilter(H5Z_filter_t filtn)
exit(1);
}
return NULL;
-}
+}
/*-------------------------------------------------------------------------
@@ -393,14 +393,14 @@ const char* get_sfilter(H5Z_filter_t filtn)
*
* Purpose: read layout info
*
- * Return: a list of names, the number of names and its chunking info for
+ * Return: a list of names, the number of names and its chunking info for
* chunked. NULL, on error
* the layout type can be:
* CHUNK, to apply chunking layout
* CONTI, to apply continuous layout
* COMPA, to apply compact layout
*
- * Example:
+ * Example:
* "AA,B,CDE:CHUNK=10X10"
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
@@ -409,8 +409,8 @@ const char* get_sfilter(H5Z_filter_t filtn)
*
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_layout(const char *str,
- int *n_objs,
+obj_list_t* parse_layout(const char *str,
+ int *n_objs,
pack_info_t *pack, /* info about layout needed */
pack_opt_t *options)
{
@@ -419,7 +419,7 @@ obj_list_t* parse_layout(const char *str,
char c;
size_t len=strlen(str);
int j, n, k, end_obj=-1, c_index;
- char sobj[MAX_NC_NAME];
+ char sobj[MAX_NC_NAME];
char sdim[10];
char slayout[10];
@@ -427,7 +427,7 @@ obj_list_t* parse_layout(const char *str,
memset(sdim, '\0', sizeof(sdim));
memset(sobj, '\0', sizeof(sobj));
memset(slayout, '\0', sizeof(slayout));
-
+
/* check for the end of object list and number of objects */
for ( i=0, n=0; i<len; i++)
{
@@ -445,7 +445,7 @@ obj_list_t* parse_layout(const char *str,
if (end_obj==-1) { /* missing : chunk all */
options->all_layout=1;
}
-
+
n++;
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
@@ -460,7 +460,7 @@ obj_list_t* parse_layout(const char *str,
{
c = str[j];
sobj[k]=c;
- if ( c==',' || j==end_obj-1)
+ if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
strcpy(obj_list[n].obj,sobj);
@@ -481,11 +481,11 @@ obj_list_t* parse_layout(const char *str,
/* get layout info */
for ( j=end_obj+1, n=0; n<=5; j++,n++)
{
- if (n==5)
+ if (n==5)
{
slayout[n]='\0'; /*cut string */
if (strcmp(slayout,"COMPA")==0)
- pack->layout=H5D_COMPACT;
+ pack->layout=H5D_COMPACT;
else if (strcmp(slayout,"CONTI")==0)
pack->layout=H5D_CONTIGUOUS;
else if (strcmp(slayout,"CHUNK")==0)
@@ -501,7 +501,7 @@ obj_list_t* parse_layout(const char *str,
slayout[n]=c;
}
} /* j */
-
+
if ( pack->layout==H5D_CHUNKED )
{
@@ -510,7 +510,7 @@ obj_list_t* parse_layout(const char *str,
* get chunk info
*-------------------------------------------------------------------------
*/
- k=0;
+ k=0;
if (j>(int)len)
{
@@ -524,8 +524,8 @@ obj_list_t* parse_layout(const char *str,
c = str[i];
sdim[k]=c;
k++; /*increment sdim index */
-
- if (!isdigit(c) && c!='x'
+
+ if (!isdigit(c) && c!='x'
&& c!='N' && c!='O' && c!='N' && c!='E'
){
if (obj_list) free(obj_list);
@@ -533,11 +533,11 @@ obj_list_t* parse_layout(const char *str,
sdim,str);
exit(1);
}
-
- if ( c=='x' || i==len-1)
+
+ if ( c=='x' || i==len-1)
{
- if ( c=='x') {
- sdim[k-1]='\0';
+ if ( c=='x') {
+ sdim[k-1]='\0';
k=0;
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0) {
@@ -549,7 +549,7 @@ obj_list_t* parse_layout(const char *str,
c_index++;
}
else if (i==len-1) { /*no more parameters */
- sdim[k]='\0';
+ sdim[k]='\0';
k=0;
if (strcmp(sdim,"NONE")==0)
{
@@ -570,10 +570,10 @@ obj_list_t* parse_layout(const char *str,
} /*if c=='x' || i==len-1 */
} /*i*/
-
+
} /*H5D_CHUNKED*/
-
+
return obj_list;
}
@@ -600,7 +600,7 @@ int parse_number(char *str)
int n;
char c;
size_t len=strlen(str);
-
+
for ( i=0; i<len; i++)
{
c = str[i];
@@ -608,7 +608,7 @@ int parse_number(char *str)
return -1;
}
}
- str[i]='\0';
+ str[i]='\0';
n=atoi(str);
return n;
}
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 28c6c0b..99cd49f 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -19,14 +19,14 @@
#include "H5private.h"
#include "h5repack.h"
-static const char* MapIdToName(hid_t refobj_id,
+static const char* MapIdToName(hid_t refobj_id,
trav_table_t *travt);
static void close_obj(H5G_obj_t obj_type, hid_t obj_id);
-static int copy_refs_attr(hid_t loc_in,
- hid_t loc_out,
+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 */
@@ -35,7 +35,7 @@ static int copy_refs_attr(hid_t loc_in,
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
*
- * Purpose: duplicate all referenced HDF5 objects in the file
+ * Purpose: duplicate all referenced HDF5 objects in the file
* and create hard links
*
* Return: 0, ok, -1 no
@@ -47,19 +47,19 @@ static int copy_refs_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
+int do_copy_refobjs(hid_t fidin,
+ hid_t fidout,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- 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 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 */
@@ -72,7 +72,7 @@ int do_copy_refobjs(hid_t fidin,
* browse
*-------------------------------------------------------------------------
*/
-
+
for ( i = 0; i < travt->nobjs; i++)
{
switch ( travt->objs[i].type )
@@ -82,7 +82,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5G_GROUP:
-
+
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
@@ -92,37 +92,37 @@ int do_copy_refobjs(hid_t fidin,
{
for ( j=0; j<travt->objs[i].nlinks; j++)
{
- H5Glink(fidout,
+ H5Glink(fidout,
H5G_LINK_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
}
-
+
break;
-
+
/*-------------------------------------------------------------------------
* H5G_DATASET
*-------------------------------------------------------------------------
*/
case H5G_DATASET:
-
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
+
+ if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
goto error;
- if ((space_id=H5Dget_space(dset_in))<0)
+ if ((space_id=H5Dget_space(dset_in))<0)
goto error;
- if ((ftype_id=H5Dget_type (dset_in))<0)
+ if ((ftype_id=H5Dget_type (dset_in))<0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
+ if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
goto error;
if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
goto error;
if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
goto error;
nelmts=1;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
nelmts*=dims[j];
-
+
if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
goto error;
@@ -133,11 +133,11 @@ int do_copy_refobjs(hid_t fidin,
* check for external files
*-------------------------------------------------------------------------
*/
- if ((next=H5Pget_external_count (dcpl_id))<0)
+ if ((next=H5Pget_external_count (dcpl_id))<0)
goto error;
/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
* 1) the external filters GZIP and SZIP might not be available
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
@@ -152,10 +152,10 @@ int do_copy_refobjs(hid_t fidin,
/*-------------------------------------------------------------------------
* object references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
+ * we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
+ if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
{
H5G_obj_t obj_type;
hid_t refobj_id;
@@ -178,7 +178,7 @@ int do_copy_refobjs(hid_t fidin,
}
if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
goto error;
-
+
if ((obj_type = H5Rget_obj_type(dset_in,H5R_OBJECT,buf))<0)
goto error;
refbuf=HDmalloc((unsigned)nelmts*msize);
@@ -192,7 +192,7 @@ int do_copy_refobjs(hid_t fidin,
if ((refobj_id = H5Rdereference(dset_in,H5R_OBJECT,&buf[u]))<0)
continue;
} H5E_END_TRY;
- /* get the name. a valid name could only occur in the
+ /* get the name. a valid name could only occur in the
second traversal of the file */
if ((refname=MapIdToName(refobj_id,travt))!=NULL)
{
@@ -207,30 +207,30 @@ int do_copy_refobjs(hid_t fidin,
close_obj(obj_type,refobj_id);
}/* u */
}/*nelmts*/
-
+
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
+ if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
goto error;
if (nelmts) {
if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0)
goto error;
}
-
+
if (buf)
free(buf);
if (refbuf)
free(refbuf);
-
+
}/*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
* dataset region references
*-------------------------------------------------------------------------
*/
- else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
+ else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
{
H5G_obj_t obj_type;
hid_t refobj_id;
@@ -254,12 +254,12 @@ int do_copy_refobjs(hid_t fidin,
goto error;
if ((obj_type = H5Rget_obj_type(dset_in,H5R_DATASET_REGION,buf))<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
-
+
refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */
if ( refbuf==NULL){
printf( "cannot allocate memory\n" );
@@ -271,8 +271,8 @@ int do_copy_refobjs(hid_t fidin,
if ((refobj_id = H5Rdereference(dset_in,H5R_DATASET_REGION,&buf[u]))<0)
continue;
} H5E_END_TRY;
-
- /* get the name. a valid name could only occur in the
+
+ /* get the name. a valid name could only occur in the
second traversal of the file */
if ((refname=MapIdToName(refobj_id,travt))!=NULL)
{
@@ -282,7 +282,7 @@ int do_copy_refobjs(hid_t fidin,
/* create the reference, we need the space_id */
if (H5Rcreate(&refbuf[u],fidout,refname,H5R_DATASET_REGION,region_id)<0)
goto error;
- if (H5Sclose(region_id)<0)
+ if (H5Sclose(region_id)<0)
goto error;
if (options->verbose)
printf("object <%s> region reference created to <%s>\n",
@@ -292,18 +292,18 @@ int do_copy_refobjs(hid_t fidin,
close_obj(obj_type,refobj_id);
}/* u */
}/*nelmts*/
-
+
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
+ if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
goto error;
if (nelmts) {
if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0)
goto error;
}
-
+
if (buf)
free(buf);
if (refbuf)
@@ -317,19 +317,19 @@ int do_copy_refobjs(hid_t fidin,
*/
else
{
- if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0)
+ if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0)
goto error;
}
assert(dset_out!=FAIL);
-
+
/*-------------------------------------------------------------------------
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0)
+ if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* check for hard links
@@ -338,92 +338,92 @@ int do_copy_refobjs(hid_t fidin,
if (travt->objs[i].nlinks)
{
for ( j=0; j<travt->objs[i].nlinks; j++){
- H5Glink(fidout,
+ H5Glink(fidout,
H5G_LINK_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
}
- if (H5Dclose(dset_out)<0)
+ if (H5Dclose(dset_out)<0)
goto error;
}/*can_read*/
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
- if (H5Tclose(ftype_id)<0)
+
+ if (H5Tclose(ftype_id)<0)
goto error;
- if (H5Tclose(mtype_id)<0)
+ if (H5Tclose(mtype_id)<0)
goto error;
- 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_in)<0)
+ if (H5Dclose(dset_in)<0)
goto error;
-
+
break;
-
+
/*-------------------------------------------------------------------------
* H5G_TYPE
*-------------------------------------------------------------------------
*/
case H5G_TYPE:
-
- if ((type_in = H5Topen (fidin,travt->objs[i].name))<0)
+
+ if ((type_in = H5Topen (fidin,travt->objs[i].name))<0)
goto error;
-
- if (H5Tclose(type_in)<0)
+
+ if (H5Tclose(type_in)<0)
goto error;
-
+
break;
-
+
/*-------------------------------------------------------------------------
* H5G_LINK
*-------------------------------------------------------------------------
*/
-
+
case H5G_LINK:
-
+
/*nothing to do */
break;
-
+
default:
-
+
break;
}
}
-
-
-
+
+
+
/*-------------------------------------------------------------------------
- * the root is a special case, we get an ID for the root group
+ * the root is a special case, we get an ID for the root group
* and copy its attributes using that ID
* it must be done last, because the attributes might contain references to
* objects in the object list
*-------------------------------------------------------------------------
*/
-
- if ((grp_out = H5Gopen(fidout,"/"))<0)
+
+ if ((grp_out = H5Gopen(fidout,"/"))<0)
goto error;
-
- if ((grp_in = H5Gopen(fidin,"/"))<0)
+
+ if ((grp_in = H5Gopen(fidin,"/"))<0)
goto error;
-
- if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0)
+
+ if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0)
goto error;
-
- if (H5Gclose(grp_out)<0)
+
+ if (H5Gclose(grp_out)<0)
goto error;
- if (H5Gclose(grp_in)<0)
+ if (H5Gclose(grp_in)<0)
goto error;
-
+
return 0;
-
+
error:
H5E_BEGIN_TRY {
H5Gclose(grp_in);
@@ -437,7 +437,7 @@ error:
H5Tclose(type_in);
} H5E_END_TRY;
return -1;
-
+
}
@@ -445,7 +445,7 @@ error:
* Function: copy_refs_attr
*
* Purpose: duplicate all referenced HDF5 located in attributes
- * relative to LOC_IN, which is obtained either from
+ * relative to LOC_IN, which is obtained either from
* loc_id = H5Gopen( fid, name);
* loc_id = H5Dopen( fid, name);
* loc_id = H5Topen( fid, name);
@@ -459,17 +459,17 @@ error:
*-------------------------------------------------------------------------
*/
-static int copy_refs_attr(hid_t loc_in,
- hid_t loc_out,
+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 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 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 */
@@ -479,9 +479,9 @@ static int copy_refs_attr(hid_t loc_in,
int n, j;
unsigned u;
- if ((n = H5Aget_num_attrs(loc_in))<0)
+ if ((n = H5Aget_num_attrs(loc_in))<0)
goto error;
-
+
for ( u = 0; u < (unsigned)n; u++)
{
@@ -490,32 +490,32 @@ static int copy_refs_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
/* open attribute */
- if ((attr_id = H5Aopen_idx(loc_in, u))<0)
+ if ((attr_id = H5Aopen_idx(loc_in, u))<0)
goto error;
-
+
/* get name */
- if (H5Aget_name( attr_id, 255, name )<0)
+ if (H5Aget_name( attr_id, 255, name )<0)
goto error;
/* get the file datatype */
if ((ftype_id = H5Aget_type( attr_id )) < 0 )
goto error;
-
+
/* get the dataspace handle */
if ((space_id = H5Aget_space( attr_id )) < 0 )
goto error;
-
+
/* get dimensions */
if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 )
goto error;
-
+
/*-------------------------------------------------------------------------
* elements
*-------------------------------------------------------------------------
*/
nelmts=1;
- for (j=0; j<rank; j++)
+ for (j=0; j<rank; j++)
nelmts*=dims[j];
if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
@@ -526,10 +526,10 @@ static int copy_refs_attr(hid_t loc_in,
/*-------------------------------------------------------------------------
* object references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
+ * we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
+ if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
{
H5G_obj_t obj_type;
hid_t refobj_id;
@@ -537,7 +537,7 @@ static int copy_refs_attr(hid_t loc_in,
unsigned k;
const char* refname;
hobj_ref_t *buf=NULL;
-
+
/*-------------------------------------------------------------------------
* read input to memory
*-------------------------------------------------------------------------
@@ -552,7 +552,7 @@ static int copy_refs_attr(hid_t loc_in,
}
if (H5Aread(attr_id,mtype_id,buf)<0)
goto error;
-
+
if ((obj_type = H5Rget_obj_type(attr_id,H5R_OBJECT,buf))<0)
goto error;
refbuf=HDmalloc((unsigned)nelmts*msize);
@@ -566,7 +566,7 @@ static int copy_refs_attr(hid_t loc_in,
if ((refobj_id = H5Rdereference(attr_id,H5R_OBJECT,&buf[k]))<0)
goto error;
} H5E_END_TRY;
- /* get the name. a valid name could only occur in the
+ /* get the name. a valid name could only occur in the
second traversal of the file */
if ((refname=MapIdToName(refobj_id,travt))!=NULL)
{
@@ -579,34 +579,34 @@ static int copy_refs_attr(hid_t loc_in,
close_obj(obj_type,refobj_id);
}/* k */
}/*nelmts*/
-
+
/*-------------------------------------------------------------------------
- * copy
+ * copy
*-------------------------------------------------------------------------
*/
-
+
if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
goto error;
if (nelmts) {
if(H5Awrite(attr_out,mtype_id,refbuf)<0)
goto error;
}
-
- if (H5Aclose(attr_out)<0)
+
+ if (H5Aclose(attr_out)<0)
goto error;
if (refbuf)
free(refbuf);
if (buf)
free(buf);
-
+
}/*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
* dataset region references
*-------------------------------------------------------------------------
*/
- else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
+ else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
{
H5G_obj_t obj_type;
hid_t refobj_id;
@@ -619,8 +619,8 @@ static int copy_refs_attr(hid_t loc_in,
* read input to memory
*-------------------------------------------------------------------------
*/
-
- if (nelmts)
+
+ if (nelmts)
{
buf=(void *) HDmalloc((unsigned)(nelmts*msize));
if ( buf==NULL){
@@ -631,12 +631,12 @@ static int copy_refs_attr(hid_t loc_in,
goto error;
if ((obj_type = H5Rget_obj_type(attr_id,H5R_DATASET_REGION,buf))<0)
goto error;
-
+
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
-
+
refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */
if ( refbuf==NULL){
printf( "cannot allocate memory\n" );
@@ -648,7 +648,7 @@ static int copy_refs_attr(hid_t loc_in,
if ((refobj_id = H5Rdereference(attr_id,H5R_DATASET_REGION,&buf[k]))<0)
continue;
} H5E_END_TRY;
- /* get the name. a valid name could only occur in the
+ /* get the name. a valid name could only occur in the
second traversal of the file */
if ((refname=MapIdToName(refobj_id,travt))!=NULL)
{
@@ -658,7 +658,7 @@ static int copy_refs_attr(hid_t loc_in,
/* create the reference, we need the space_id */
if (H5Rcreate(&refbuf[k],fidout,refname,H5R_DATASET_REGION,region_id)<0)
goto error;
- if (H5Sclose(region_id)<0)
+ if (H5Sclose(region_id)<0)
goto error;
if (options->verbose)
printf("object <%s> region reference created to <%s>\n",name,refname);
@@ -666,19 +666,19 @@ static int copy_refs_attr(hid_t loc_in,
close_obj(obj_type,refobj_id);
}/* k */
}/*nelmts */
-
+
/*-------------------------------------------------------------------------
- * copy
+ * copy
*-------------------------------------------------------------------------
*/
-
+
if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
goto error;
if (nelmts) {
if(H5Awrite(attr_out,mtype_id,refbuf)<0)
goto error;
}
- if (H5Aclose(attr_out)<0)
+ if (H5Aclose(attr_out)<0)
goto error;
if (refbuf)
free(refbuf);
@@ -696,7 +696,7 @@ static int copy_refs_attr(hid_t loc_in,
if (H5Sclose(space_id)<0) goto error;
if (H5Aclose(attr_id)<0) goto error;
} /* u */
-
+
return 0;
error:
@@ -720,9 +720,9 @@ error:
static void close_obj(H5G_obj_t obj_type, hid_t obj_id)
{
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
- switch (obj_type)
+ switch (obj_type)
{
case H5G_GROUP:
H5Gclose(obj_id);
@@ -736,7 +736,7 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id)
default:
break;
}
- } H5E_END_TRY;
+ } H5E_END_TRY;
}
/*-------------------------------------------------------------------------
@@ -747,7 +747,7 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id)
*-------------------------------------------------------------------------
*/
-static const char* MapIdToName(hid_t refobj_id,
+static const char* MapIdToName(hid_t refobj_id,
trav_table_t *travt)
{
hid_t id;
@@ -769,18 +769,18 @@ static const char* MapIdToName(hid_t refobj_id,
/* linear search */
for ( i=0; i<travt->nobjs; i++)
{
- switch ( travt->objs[i].type )
+ switch ( travt->objs[i].type )
{
default:
break;
-
+
/*-------------------------------------------------------------------------
* H5G_DATASET
*-------------------------------------------------------------------------
*/
-
+
case H5G_DATASET:
-
+
if ((id = H5Dopen(fid,travt->objs[i].name))<0)
return NULL;
if(H5Gget_objinfo(id, ".", 0, &objstat) <0)
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);
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index a1dad92..f18bbc2 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -19,7 +19,7 @@
/*-------------------------------------------------------------------------
* Function: write_attr_in
*
- * Purpose: write attributes in LOC_ID (dataset, group, named datatype)
+ * Purpose: write attributes in LOC_ID (dataset, group, named datatype)
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -28,28 +28,28 @@
*-------------------------------------------------------------------------
*/
-
-void write_attr_in(hid_t loc_id,
+
+void write_attr_in(hid_t loc_id,
const char* dset_name, /* for saving reference to dataset*/
hid_t fid, /* for reference create */
int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
- typedef struct s_t
+ typedef struct s_t
{
char a;
double b;
} s_t;
- typedef enum
+ typedef enum
{
RED,
GREEN
} e_t;
hid_t attr_id;
- hid_t space_id;
- hid_t type_id;
+ hid_t space_id;
+ hid_t type_id;
herr_t status;
int val, i, j, k, n;
float f;
@@ -98,7 +98,7 @@ void write_attr_in(hid_t loc_id,
* 1D attributes
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
* H5T_STRING
*-------------------------------------------------------------------------
@@ -109,11 +109,11 @@ void write_attr_in(hid_t loc_id,
for (i=0; i<2; i++)
for (j=0; j<2; j++)
{
- buf1[i][j]='z';
+ buf1[i][j]='z';
}
}
- /*
- buf1[2][2]= {"ab","de"};
+ /*
+ buf1[2][2]= {"ab","de"};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
Attribute: <string> and <string>
@@ -139,8 +139,8 @@ void write_attr_in(hid_t loc_id,
for (i=0; i<2; i++)
buf2[i]=buf2[1]=0;
}
- /*
- buf2[2]= {1,2};
+ /*
+ buf2[2]= {1,2};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
Attribute: <bitfield> and <bitfield>
@@ -160,8 +160,8 @@ void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- /*
- buf2[2]= {1,2};
+ /*
+ buf2[2]= {1,2};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
Attribute: <opaque> and <opaque>
@@ -181,7 +181,7 @@ void write_attr_in(hid_t loc_id,
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
-
+
if (make_diffs)
{
for (i=0; i<2; i++)
@@ -189,9 +189,9 @@ void write_attr_in(hid_t loc_id,
buf3[i].a=0; buf3[i].b=0;
}
}
-
- /*
- buf3[2]= {{1,2},{3,4}};
+
+ /*
+ buf3[2]= {{1,2},{3,4}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
Attribute: <compound> and <compound>
@@ -208,7 +208,7 @@ void write_attr_in(hid_t loc_id,
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
make_attr(loc_id,1,dims,"compound",type_id,buf3);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -230,10 +230,10 @@ void write_attr_in(hid_t loc_id,
{
for (i=0; i<2; i++)
{
- buf45[i]=GREEN;
+ buf45[i]=GREEN;
}
}
- /*
+ /*
buf45[2]= {RED,RED};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
@@ -253,7 +253,7 @@ void write_attr_in(hid_t loc_id,
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
+
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
@@ -270,7 +270,7 @@ void write_attr_in(hid_t loc_id,
((int *)buf5[1].p)[0]=0;
((int *)buf5[1].p)[1]=0;
}
- /*
+ /*
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
position vlen of </g1> vlen of </g1> difference
@@ -301,10 +301,10 @@ void write_attr_in(hid_t loc_id,
for (i=0; i<2; i++)
for (j=0; j<3; j++)
{
- buf6[i][j]=0;
+ buf6[i][j]=0;
}
}
- /*
+ /*
buf6[2][3]= {{1,2,3},{4,5,6}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
@@ -331,12 +331,12 @@ position array of </g1> array of </g1> difference
{
for (i=0; i<2; i++)
{
- buf7[i]=0;
- buf8[i]=0;
+ buf7[i]=0;
+ buf8[i]=0;
}
}
- /*
- buf7[2]= {1,2};
+ /*
+ buf7[2]= {1,2};
buf8[2]= {1,2};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
@@ -367,7 +367,7 @@ position array of </g1> array of </g1> difference
memset(buf12, 'z', sizeof buf12);
}
- /*
+ /*
buf12[6][2]= {"ab","cd","ef","gh","ij","kl"};
$h5diff file7.h5 file6.h5 g1 g1 -v
Attribute: <string2D> and <string2D>
@@ -402,8 +402,8 @@ position array of </g1> array of </g1> difference
memset(buf22,0,sizeof buf22);
}
- /*
- buf22[3][2]= {{1,2},{3,4},{5,6}};
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Attribute: <bitfield2D> and <bitfield2D>
position bitfield2D of </g1> bitfield2D of </g1> difference
@@ -426,8 +426,8 @@ position array of </g1> array of </g1> difference
*-------------------------------------------------------------------------
*/
- /*
- buf22[3][2]= {{1,2},{3,4},{5,6}};
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Attribute: <opaque2D> and <opaque2D>
position opaque2D of </g1> opaque2D of </g1> difference
@@ -453,7 +453,7 @@ position array of </g1> array of </g1> difference
memset(buf32,0,sizeof buf32);
}
- /*
+ /*
buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Attribute: <opaque2D> and <opaque2D>
@@ -473,7 +473,7 @@ position array of </g1> array of </g1> difference
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
make_attr(loc_id,2,dims2,"compound2D",type_id,buf32);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -496,7 +496,7 @@ position array of </g1> array of </g1> difference
for (i=0; i<3; i++)
for (j=0; j<2; j++)
{
- if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
+ if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
}
/*
@@ -550,7 +550,7 @@ position enum2D of </g1> enum2D of </g1> difference
[ 2 1 ] 10 0 10
[ 2 1 ] 11 0 11
*/
-
+
space_id = H5Screate_simple(2,dims2,NULL);
type_id = H5Tvlen_create(H5T_NATIVE_INT);
attr_id = H5Acreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT);
@@ -571,8 +571,8 @@ position enum2D of </g1> enum2D of </g1> difference
{
memset(buf62,0,sizeof buf62);
}
- /*
- buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
+ /*
+ buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
$h5diff file7.h5 file6.h5 g1 g1 -v
Group: </g1> and </g1>
Attribute: <array2D> and <array2D>
@@ -636,7 +636,7 @@ position float2D of </g1> float2D of </g1> difference
make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72);
make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
-
+
/*-------------------------------------------------------------------------
* 3D attributes
*-------------------------------------------------------------------------
@@ -850,7 +850,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
make_attr(loc_id,3,dims3,"compound3D",type_id,buf33);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -920,7 +920,7 @@ position enum3D of </g1> enum3D of </g1> difference
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
+
/* Allocate and initialize VL dataset to write */
n=0;
for (i = 0; i < 4; i++) {
@@ -949,7 +949,7 @@ position vlen3D of </g1> vlen3D of </g1> difference
[ 1 0 1 ] 9 0 9
[ 1 1 0 ] 10 0 10
etc
-*/
+*/
space_id = H5Screate_simple(3,dims3,NULL);
type_id = H5Tvlen_create(H5T_NATIVE_INT);
attr_id = H5Acreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT);
@@ -1023,7 +1023,7 @@ etc
[ 1 1 0 ] 9 0 9
[ 1 1 1 ] 10 0 10
etc
-*/
+*/
make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
}
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 4f12c40..16962af 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -24,15 +24,15 @@
* Purpose: detects szip encoder, prints "yes" or "no" to stdout.
* Intended to be used in test scripts.
*
- * Return:
+ * Return:
*
- * Programmer:
+ * Programmer:
*
- * Date:
+ * Date:
*
* Comments:
*
- * Modifications:
+ * Modifications:
*
*-------------------------------------------------------------------------
*/
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 8781ae7..862257a 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -22,7 +22,7 @@ static void make_dset_reg_ref(hid_t loc_id);
/*-------------------------------------------------------------------------
* Function: write_dset_in
*
- * Purpose: write datasets in LOC_ID
+ * Purpose: write datasets in LOC_ID
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -31,28 +31,28 @@ static void make_dset_reg_ref(hid_t loc_id);
*-------------------------------------------------------------------------
*/
-
-void write_dset_in(hid_t loc_id,
+
+void write_dset_in(hid_t loc_id,
const char* dset_name, /* for saving reference to dataset*/
hid_t file_id,
int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
- typedef struct s_t
+ typedef struct s_t
{
char a;
double b;
} s_t;
- typedef enum
+ typedef enum
{
RED,
GREEN
} e_t;
hid_t dset_id;
- hid_t space_id;
- hid_t type_id;
+ hid_t space_id;
+ hid_t type_id;
hid_t plist_id;
herr_t status;
int val, i, j, k, n;
@@ -100,22 +100,22 @@ void write_dset_in(hid_t loc_id,
/*-------------------------------------------------------------------------
- * 1D
+ * 1D
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
* H5T_STRING
*-------------------------------------------------------------------------
*/
-
+
if (make_diffs)
{
for (i=0; i<2; i++)
for (j=0; j<2; j++)
{
- buf1[i][j]='z';
+ buf1[i][j]='z';
}
}
@@ -172,7 +172,7 @@ void write_dset_in(hid_t loc_id,
{
for (i=0; i<2; i++)
{
- buf45[i]=GREEN;
+ buf45[i]=GREEN;
}
}
@@ -181,7 +181,7 @@ void write_dset_in(hid_t loc_id,
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
write_dset(loc_id,1,dims,"compound",type_id,buf3);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -211,7 +211,7 @@ void write_dset_in(hid_t loc_id,
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
+
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
@@ -250,7 +250,7 @@ void write_dset_in(hid_t loc_id,
for (i=0; i<2; i++)
for (j=0; j<3; j++)
{
- buf6[i][j]=0;
+ buf6[i][j]=0;
}
}
@@ -267,8 +267,8 @@ void write_dset_in(hid_t loc_id,
{
for (i=0; i<2; i++)
{
- buf7[i]=0;
- buf8[i]=0;
+ buf7[i]=0;
+ buf8[i]=0;
}
}
@@ -277,7 +277,7 @@ void write_dset_in(hid_t loc_id,
/*-------------------------------------------------------------------------
- * 2D
+ * 2D
*-------------------------------------------------------------------------
*/
@@ -302,7 +302,7 @@ void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-
+
if (make_diffs)
{
memset(buf22,0,sizeof buf22);
@@ -336,7 +336,7 @@ void write_dset_in(hid_t loc_id,
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
write_dset(loc_id,2,dims2,"compound2D",type_id,buf32);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -380,7 +380,7 @@ void write_dset_in(hid_t loc_id,
else ((int *)buf52[i][j].p)[l] = n++;
}
}
-
+
space_id = H5Screate_simple(2,dims2,NULL);
type_id = H5Tvlen_create(H5T_NATIVE_INT);
dset_id = H5Dcreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT);
@@ -412,7 +412,7 @@ void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-
+
if (make_diffs)
{
memset(buf72,0,sizeof buf72);
@@ -435,9 +435,9 @@ void write_dset_in(hid_t loc_id,
write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
-
+
/*-------------------------------------------------------------------------
- * 3D
+ * 3D
*-------------------------------------------------------------------------
*/
@@ -513,7 +513,7 @@ void write_dset_in(hid_t loc_id,
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
write_dset(loc_id,3,dims3,"compound3D",type_id,buf33);
status = H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
@@ -545,7 +545,7 @@ void write_dset_in(hid_t loc_id,
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
+
/* Allocate and initialize VL dataset to write */
n=0;
for (i = 0; i < 4; i++) {
@@ -560,7 +560,7 @@ void write_dset_in(hid_t loc_id,
}
}
}
-
+
space_id = H5Screate_simple(3,dims3,NULL);
type_id = H5Tvlen_create(H5T_NATIVE_INT);
dset_id = H5Dcreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT);
@@ -618,7 +618,7 @@ void write_dset_in(hid_t loc_id,
/*-------------------------------------------------------------------------
* Function: make_dset_reg_ref
*
- * Purpose: write dataset region references
+ * Purpose: write dataset region references
*
*-------------------------------------------------------------------------
*/
@@ -646,52 +646,52 @@ static void make_dset_reg_ref(hid_t loc_id)
int *dwbuf; /* Buffer for writing numeric data to disk */
int i; /* counting variables */
herr_t ret; /* Generic return value */
-
+
/* Allocate write & read buffers */
wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
dwbuf=malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2);
-
+
/* Create dataspace for datasets */
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
-
+
/* Create a dataset */
dset2=H5Dcreate(loc_id,"dsetreg",H5T_NATIVE_UCHAR,sid2,H5P_DEFAULT);
-
+
for(i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++)
- dwbuf[i]=i*3;
-
+ dwbuf[i]=i*3;
+
/* Write selection to disk */
ret=H5Dwrite(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf);
-
+
/* Close Dataset */
ret = H5Dclose(dset2);
-
+
/* Create dataspace for the reference dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
-
+
/* Create a dataset */
dset1=H5Dcreate(loc_id,"refreg",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT);
-
+
/* Create references */
-
+
/* Select 6x6 hyperslab for first reference */
start[0]=2; start[1]=2;
stride[0]=1; stride[1]=1;
count[0]=6; count[1]=6;
block[0]=1; block[1]=1;
ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
-
+
/* Store dataset region */
ret = H5Rcreate(&wbuf[0],loc_id,"dsetreg",H5R_DATASET_REGION,sid2);
-
+
/* Write selection to disk */
ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
-
+
/* Close all objects */
ret = H5Sclose(sid1);
ret = H5Dclose(dset1);
ret = H5Sclose(sid2);
-
+
free(wbuf);
free(dwbuf);
-}
+}
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index bc80c5a..26dcfc7 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -40,7 +40,7 @@ int main (void)
{
pack_opt_t pack_options;
diff_opt_t diff_options;
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
memset(&diff_options, 0, sizeof (diff_opt_t));
@@ -54,10 +54,10 @@ int main (void)
goto error;
/*-------------------------------------------------------------------------
- * Format of the tests:
+ * Format of the tests:
*
- * 1) make a copy of the file with h5repack
- * 2) use the h5diff utility to compare the input and output file;
+ * 1) make a copy of the file with h5repack
+ * 2) use the h5diff utility to compare the input and output file;
* it returns RET==0 if the objects have the same data
*-------------------------------------------------------------------------
*/
@@ -101,7 +101,7 @@ int main (void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
PASSED();
-
+
/*-------------------------------------------------------------------------
* file with attributes
*-------------------------------------------------------------------------
@@ -157,7 +157,7 @@ int main (void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
* the remaining files differ in the dcpl's
@@ -191,7 +191,7 @@ int main (void)
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -220,7 +220,7 @@ int main (void)
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -232,7 +232,7 @@ int main (void)
TESTING(" adding szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
szip_can_encode = 1;
}
@@ -241,7 +241,7 @@ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
* test an individual object option
*-------------------------------------------------------------------------
*/
-
+
if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -273,7 +273,7 @@ if (szip_can_encode) {
*/
TESTING(" adding szip filter to all");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -287,7 +287,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
+
PASSED();
} else {
SKIPPED();
@@ -321,7 +321,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -349,14 +349,14 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
+
+ PASSED();
#else
SKIPPED();
#endif
-
+
TESTING(" adding checksum filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
@@ -380,8 +380,8 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
+
+ PASSED();
#else
SKIPPED();
#endif
@@ -391,7 +391,7 @@ TESTING(" addding shuffle filter to all");
*-------------------------------------------------------------------------
*/
-
+
TESTING(" adding checksum filter to all");
#ifdef H5_HAVE_FILTER_FLETCHER32
@@ -410,13 +410,13 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
+
+ PASSED();
#else
SKIPPED();
#endif
-
+
TESTING(" filter queue fletcher, shuffle, deflate, szip");
/*-------------------------------------------------------------------------
@@ -443,7 +443,7 @@ TESTING(" addding shuffle filter to all");
if (szip_can_encode) {
if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options)<0)
TEST_ERROR;
-}
+}
#endif
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -460,7 +460,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" adding layout chunked");
@@ -482,7 +482,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
* test all objects option
@@ -503,7 +503,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" adding layout contiguous");
@@ -524,7 +524,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" adding layout contiguous to all");
@@ -544,8 +544,8 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
+
+ PASSED();
TESTING(" adding layout compact");
@@ -566,7 +566,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" adding layout compact to all");
@@ -587,8 +587,8 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
-
- PASSED();
+
+ PASSED();
TESTING(" layout compact to contiguous conversion");
@@ -609,8 +609,8 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
-
+ PASSED();
+
TESTING(" layout compact to chunk conversion");
/*-------------------------------------------------------------------------
@@ -632,7 +632,7 @@ if (szip_can_encode) {
PASSED();
TESTING(" layout compact to compact conversion");
-
+
/*-------------------------------------------------------------------------
* layout compact to compact conversion
*-------------------------------------------------------------------------
@@ -649,8 +649,8 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
-
+ PASSED();
+
TESTING(" layout contiguous to compact conversion");
/*-------------------------------------------------------------------------
* layout contiguous to compact conversion
@@ -668,8 +668,8 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
-
+ PASSED();
+
TESTING(" layout contiguous to chunk conversion");
/*-------------------------------------------------------------------------
* layout contiguous to chunk conversion
@@ -687,7 +687,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" layout contiguous to contiguous conversion");
@@ -707,7 +707,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" layout chunked to compact conversion");
/*-------------------------------------------------------------------------
@@ -726,7 +726,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" layout chunked to contiguous conversion");
@@ -746,7 +746,7 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
TESTING(" layout chunked to chunk conversion");
/*-------------------------------------------------------------------------
@@ -765,9 +765,9 @@ if (szip_can_encode) {
TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
+
-
/*-------------------------------------------------------------------------
* the following tests assume the input files have filters
* FNAME7 "test_szip.h5"
@@ -778,10 +778,10 @@ if (szip_can_encode) {
*-------------------------------------------------------------------------
*/
-
+
TESTING(" copy of szip filter");
-
-#if defined (H5_HAVE_FILTER_SZIP)
+
+#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -804,7 +804,7 @@ if (szip_can_encode) {
TESTING(" removing szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -829,7 +829,7 @@ if (szip_can_encode) {
TESTING(" copy of deflate filter");
-
+
#ifdef H5_HAVE_FILTER_DEFLATE
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -864,7 +864,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -872,7 +872,7 @@ if (szip_can_encode) {
TESTING(" copy of shuffle filter");
-
+
#ifdef H5_HAVE_FILTER_SHUFFLE
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -889,7 +889,7 @@ if (szip_can_encode) {
#else
SKIPPED();
#endif
-
+
TESTING(" removing shuffle filter");
#ifdef H5_HAVE_FILTER_SHUFFLE
@@ -906,13 +906,13 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
TESTING(" copy of fletcher filter");
-
+
#ifdef H5_HAVE_FILTER_FLETCHER32
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -946,14 +946,14 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
-
+
TESTING(" copy of nbit filter");
-
+
#ifdef H5_HAVE_FILTER_NBIT
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -987,7 +987,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -1008,12 +1008,12 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
TESTING(" copy of scaleoffset filter");
-
+
#ifdef H5_HAVE_FILTER_SCALEOFFSET
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
@@ -1047,7 +1047,7 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
@@ -1068,13 +1068,13 @@ if (szip_can_encode) {
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
- PASSED();
+ PASSED();
#else
SKIPPED();
#endif
/*-------------------------------------------------------------------------
- * file with all filters
+ * file with all filters
* dset_all
* dset_deflate
* dset_szip
@@ -1082,7 +1082,7 @@ if (szip_can_encode) {
* dset_fletcher32
*-------------------------------------------------------------------------
*/
-
+
TESTING(" filter conversion from deflate to szip");
@@ -1140,7 +1140,7 @@ if (szip_can_encode) {
SKIPPED();
#endif
-
+
/*-------------------------------------------------------------------------
* test the NONE global option
*-------------------------------------------------------------------------
@@ -1168,17 +1168,17 @@ if (szip_can_encode) {
#else
SKIPPED();
#endif
-
-
+
+
/*-------------------------------------------------------------------------
* end
*-------------------------------------------------------------------------
*/
puts("All h5repack tests passed.");
-
+
return 0;
-
+
error:
puts("***** H5REPACK TESTS FAILED *****");
return 1;
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 608fdd9..9adecc7 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -42,7 +42,7 @@ int make_fill(hid_t loc_id);
/*-------------------------------------------------------------------------
* Function: make_testfiles
*
- * Purpose: make a test file with all types of HDF5 objects,
+ * Purpose: make a test file with all types of HDF5 objects,
* datatypes and filters
*
*-------------------------------------------------------------------------
@@ -54,7 +54,7 @@ int make_testfiles(void)
TESTING(" generating datasets");
/*-------------------------------------------------------------------------
- * create a file for general copy test
+ * create a file for general copy test
*-------------------------------------------------------------------------
*/
if((loc_id = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
@@ -187,11 +187,11 @@ int make_testfiles(void)
goto out;
if(H5Fclose(loc_id)<0)
return -1;
-
-
- PASSED();
- return 0;
-
+
+
+ PASSED();
+ return 0;
+
out:
H5Fclose(loc_id);
return -1;
@@ -202,7 +202,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_all_objects
*
- * Purpose: make a test file with all types of HDF5 objects, datatypes
+ * Purpose: make a test file with all types of HDF5 objects, datatypes
*
*-------------------------------------------------------------------------
*/
@@ -210,17 +210,17 @@ int make_all_objects(hid_t loc_id)
{
hid_t dset_id;
hid_t group_id;
- hid_t type_id;
+ hid_t type_id;
hid_t root_id;
hid_t space_id;
hsize_t dims[1]={2};
/* Compound datatype */
- typedef struct s_t
+ typedef struct s_t
{
int a;
float b;
} s_t;
-
+
/*-------------------------------------------------------------------------
* H5G_DATASET
*-------------------------------------------------------------------------
@@ -232,7 +232,7 @@ int make_all_objects(hid_t loc_id)
/*-------------------------------------------------------------------------
* H5G_GROUP
*-------------------------------------------------------------------------
- */
+ */
group_id = H5Gcreate(loc_id,"g1",0);
root_id = H5Gopen(loc_id, "/");
@@ -248,16 +248,16 @@ int make_all_objects(hid_t loc_id)
/* Commit compound datatype and close it */
H5Tcommit(loc_id, "type", type_id);
H5Tclose(type_id);
-
+
/*-------------------------------------------------------------------------
* H5G_LINK
*-------------------------------------------------------------------------
*/
-
+
H5Glink(loc_id, H5G_LINK_SOFT, "dset", "link");
/*-------------------------------------------------------------------------
- * write a series of datasetes
+ * write a series of datasetes
*-------------------------------------------------------------------------
*/
@@ -268,15 +268,15 @@ int make_all_objects(hid_t loc_id)
H5Gclose(group_id);
H5Gclose(root_id);
- return 0;
-
+ return 0;
+
}
/*-------------------------------------------------------------------------
* Function: make_attributes
*
- * Purpose: make a test file with all types of attributes
+ * Purpose: make a test file with all types of attributes
*
*-------------------------------------------------------------------------
*/
@@ -287,8 +287,8 @@ int make_attributes(hid_t loc_id)
hid_t root_id;
hid_t space_id;
hsize_t dims[1]={2};
-
-
+
+
/*-------------------------------------------------------------------------
* H5G_DATASET
*-------------------------------------------------------------------------
@@ -301,7 +301,7 @@ int make_attributes(hid_t loc_id)
/*-------------------------------------------------------------------------
* H5G_GROUP
*-------------------------------------------------------------------------
- */
+ */
group_id = H5Gcreate(loc_id,"g1",0);
root_id = H5Gopen(loc_id, "/");
@@ -319,8 +319,8 @@ int make_attributes(hid_t loc_id)
H5Gclose(group_id);
H5Gclose(root_id);
- return 0;
-
+ return 0;
+
}
/*-------------------------------------------------------------------------
@@ -336,7 +336,7 @@ int make_hlinks(hid_t loc_id)
hid_t group2_id;
hid_t group3_id;
hsize_t dims[2]={3,2};
- int buf[3][2]= {{1,1},{1,2},{2,2}};
+ int buf[3][2]= {{1,1},{1,2},{2,2}};
/*-------------------------------------------------------------------------
* create a dataset and some hard links to it
@@ -356,8 +356,8 @@ int make_hlinks(hid_t loc_id)
/*-------------------------------------------------------------------------
* create a group and some hard links to it
*-------------------------------------------------------------------------
- */
-
+ */
+
if ((group1_id = H5Gcreate(loc_id,"g1",0))<0)
return -1;
if ((group2_id = H5Gcreate(group1_id,"g2",0))<0)
@@ -369,13 +369,13 @@ int make_hlinks(hid_t loc_id)
return -1;
if (H5Glink2(group1_id, "g2", H5G_LINK_HARD, group3_id, "link1 to g2")<0)
return -1;
-
+
H5Gclose(group1_id);
H5Gclose(group2_id);
H5Gclose(group3_id);
- return 0;
-
+ return 0;
+
}
@@ -436,9 +436,9 @@ if (szip_can_encode) {
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -471,7 +471,7 @@ int make_deflate(hid_t loc_id)
buf[i][j]=n++;
}
}
-
+
/* create a space */
if((sid = H5Screate_simple(RANK, dims, NULL))<0)
return -1;
@@ -501,9 +501,9 @@ int make_deflate(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -550,7 +550,7 @@ int make_shuffle(hid_t loc_id)
*/
#if defined (H5_HAVE_FILTER_SHUFFLE)
/* set the shuffle filter */
- if (H5Pset_shuffle(dcpl)<0)
+ if (H5Pset_shuffle(dcpl)<0)
goto out;
if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0)
goto out;
@@ -564,9 +564,9 @@ int make_shuffle(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -613,10 +613,10 @@ int make_fletcher32(hid_t loc_id)
*/
#if defined (H5_HAVE_FILTER_FLETCHER32)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set the checksum filter */
- if (H5Pset_fletcher32(dcpl)<0)
+ if (H5Pset_fletcher32(dcpl)<0)
goto out;
if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0)
goto out;
@@ -630,9 +630,9 @@ int make_fletcher32(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -653,8 +653,8 @@ 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 dtid;
+ hid_t dsid;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -684,12 +684,12 @@ int make_nbit(hid_t loc_id)
#if defined (H5_HAVE_FILTER_NBIT)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
{
H5Tclose(dtid);
goto out;
}
- if (H5Pset_nbit(dcpl)<0)
+ if (H5Pset_nbit(dcpl)<0)
{
H5Tclose(dtid);
goto out;
@@ -706,7 +706,7 @@ int make_nbit(hid_t loc_id)
}
H5Dclose(dsid);
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
{
H5Tclose(dtid);
goto out;
@@ -732,9 +732,9 @@ int make_nbit(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -755,8 +755,8 @@ 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;
+ hid_t dtid;
+ hid_t dsid;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -781,12 +781,12 @@ int make_scaleoffset(hid_t loc_id)
#if defined (H5_HAVE_FILTER_NBIT)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
{
H5Tclose(dtid);
goto out;
}
- if (H5Pset_scaleoffset(dcpl,31,2)<0)
+ if (H5Pset_scaleoffset(dcpl,31,2)<0)
{
H5Tclose(dtid);
goto out;
@@ -824,9 +824,9 @@ int make_scaleoffset(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -847,8 +847,8 @@ int make_all(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
+ hid_t dtid;
+ hid_t dsid;
#if defined (H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=8;
@@ -875,16 +875,16 @@ int make_all(hid_t loc_id)
/* set up chunk */
if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
goto out;
-
+
#if defined (H5_HAVE_FILTER_SHUFFLE)
/* set the shuffle filter */
- if (H5Pset_shuffle(dcpl)<0)
+ if (H5Pset_shuffle(dcpl)<0)
goto out;
#endif
#if defined (H5_HAVE_FILTER_FLETCHER32)
/* set the checksum filter */
- if (H5Pset_fletcher32(dcpl)<0)
+ if (H5Pset_fletcher32(dcpl)<0)
goto out;
#endif
@@ -916,10 +916,10 @@ if (szip_can_encode) {
*/
#if defined (H5_HAVE_FILTER_FLETCHER32)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set the checksum filter */
- if (H5Pset_fletcher32(dcpl)<0)
+ if (H5Pset_fletcher32(dcpl)<0)
goto out;
if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0)
goto out;
@@ -933,7 +933,7 @@ if (szip_can_encode) {
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
@@ -951,10 +951,10 @@ if (szip_can_encode) {
*/
#if defined (H5_HAVE_FILTER_SHUFFLE)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set the shuffle filter */
- if (H5Pset_shuffle(dcpl)<0)
+ if (H5Pset_shuffle(dcpl)<0)
goto out;
if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0)
goto out;
@@ -966,7 +966,7 @@ if (szip_can_encode) {
*/
#if defined (H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set deflate data */
if(H5Pset_deflate(dcpl, 1)<0)
@@ -982,10 +982,10 @@ if (szip_can_encode) {
*/
#if defined (H5_HAVE_FILTER_NBIT)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
/* set the shuffle filter */
- if (H5Pset_nbit(dcpl)<0)
+ if (H5Pset_nbit(dcpl)<0)
goto out;
dtid = H5Tcopy(H5T_NATIVE_INT);
H5Tset_precision(dtid,(H5Tget_precision(dtid)-1));
@@ -1009,9 +1009,9 @@ if (szip_can_encode) {
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -1025,7 +1025,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_early
*
- * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
+ * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
*
*-------------------------------------------------------------------------
*/
@@ -1033,10 +1033,10 @@ int make_early(void)
{
hsize_t dims[1] ={3000};
hsize_t cdims[1]={30};
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t dset_id=-1;
- hid_t sid=-1;
- hid_t tid=-1;
+ hid_t sid=-1;
+ hid_t tid=-1;
hid_t dcpl=-1;
int i;
char name[10];
@@ -1046,7 +1046,7 @@ int make_early(void)
return -1;
if (H5Fclose(fid)<0)
goto out;
-
+
if ((sid = H5Screate_simple(1, dims, NULL))<0)
goto out;
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
@@ -1055,47 +1055,47 @@ int make_early(void)
goto out;
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY)<0)
goto out;
-
+
for (i=0; i<iter; i++)
{
if ((fid = H5Fopen(FNAME5,H5F_ACC_RDWR,H5P_DEFAULT))<0)
goto out;
if ((dset_id = H5Dcreate(fid,"early",H5T_NATIVE_DOUBLE,sid,dcpl))<0)
goto out;
- if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0)
+ if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0)
goto out;
sprintf(name,"%d", i);
- if ((H5Tcommit(fid,name,tid))<0)
+ if ((H5Tcommit(fid,name,tid))<0)
goto out;
- if (H5Tclose(tid)<0)
+ if (H5Tclose(tid)<0)
goto out;
- if (H5Dclose(dset_id)<0)
+ if (H5Dclose(dset_id)<0)
goto out;
- if (H5Gunlink(fid,"early")<0)
+ if (H5Gunlink(fid,"early")<0)
goto out;
if (H5Fclose(fid)<0)
goto out;
}
-
+
/*-------------------------------------------------------------------------
* do the same without close/opening the file and creating the dataset
*-------------------------------------------------------------------------
*/
-
+
if ((fid = H5Fcreate(FNAME6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
for (i=0; i<iter; i++)
{
- if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0)
+ if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0)
goto out;
sprintf(name,"%d", i);
- if ((H5Tcommit(fid,name,tid))<0)
+ if ((H5Tcommit(fid,name,tid))<0)
goto out;
- if (H5Tclose(tid)<0)
+ if (H5Tclose(tid)<0)
goto out;
}
-
+
if (H5Sclose(sid)<0)
goto out;
if (H5Pclose(dcpl)<0)
@@ -1103,9 +1103,9 @@ int make_early(void)
if (H5Fclose(fid)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Tclose(tid);
@@ -1201,9 +1201,9 @@ int make_layout(hid_t loc_id)
goto out;
if(H5Pclose(dcpl)<0)
goto out;
-
- return 0;
-
+
+ return 0;
+
out:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -1219,7 +1219,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make a file with an integer dataset with a fill value
*
- * Purpose: test copy of fill values
+ * Purpose: test copy of fill values
*
*-------------------------------------------------------------------------
*/
@@ -1229,9 +1229,9 @@ int make_fill(hid_t loc_id)
hid_t sid;
hid_t dcpl;
hsize_t dims[2]={3,2};
- int buf[3][2]= {{1,1},{1,2},{2,2}};
+ int buf[3][2]= {{1,1},{1,2},{2,2}};
int fillvalue=2;
-
+
/*-------------------------------------------------------------------------
* H5T_INTEGER, write a fill value
*-------------------------------------------------------------------------
@@ -1246,7 +1246,7 @@ int make_fill(hid_t loc_id)
H5Dclose(did);
H5Sclose(sid);
- return 0;
-
+ return 0;
+
}
diff --git a/tools/h5repack/testh5repack_util.c b/tools/h5repack/testh5repack_util.c
index f74b414..cad52d3 100644
--- a/tools/h5repack/testh5repack_util.c
+++ b/tools/h5repack/testh5repack_util.c
@@ -28,7 +28,7 @@
*/
int make_dset(hid_t loc_id,
const char *name,
- hid_t sid,
+ hid_t sid,
hid_t dcpl,
void *buf)
{
@@ -67,37 +67,37 @@ int make_dset(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
const char *dset_name,
- hid_t type_id,
+ hid_t type_id,
void *buf )
{
hid_t dset_id;
- hid_t space_id;
-
+ hid_t space_id;
+
/* Create a buf space */
if ((space_id = H5Screate_simple(rank,dims,NULL))<0)
return -1;
-
+
/* Create a dataset */
if ((dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT))<0)
return -1;
-
+
/* Write the buf */
if ( buf )
if (H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
return -1;
-
+
/* Close */
if (H5Dclose(dset_id)<0)
return -1;
if (H5Sclose(space_id)<0)
return -1;
-
+
return 0;
-
+
}
@@ -112,37 +112,37 @@ int write_dset( hid_t loc_id,
*
*-------------------------------------------------------------------------
*/
-
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
+
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
const char *attr_name,
- hid_t type_id,
+ hid_t type_id,
void *buf)
{
hid_t attr_id;
- hid_t space_id;
-
+ hid_t space_id;
+
/* create a space */
if ((space_id = H5Screate_simple(rank,dims,NULL))<0)
return -1;
-
+
/* create the attribute */
if ((attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT))<0)
goto out;
-
+
/* write the buffer */
if ( buf )
{
if (H5Awrite(attr_id,type_id,buf)<0)
goto out;
}
-
+
/* close */
H5Aclose(attr_id);
H5Sclose(space_id);
return 0;
-
+
out:
H5E_BEGIN_TRY {
H5Aclose(attr_id);