summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/Makefile.in2
-rw-r--r--tools/h5repack/h5repack.c21
-rw-r--r--tools/h5repack/h5repack_copy.c29
-rw-r--r--tools/h5repack/h5repack_filters.c18
-rw-r--r--tools/h5repack/h5repack_list.c1
-rw-r--r--tools/h5repack/h5repack_main.c1
-rw-r--r--tools/h5repack/h5repack_refs.c18
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c14
-rw-r--r--tools/h5repack/testh5repack_dset.c2
-rw-r--r--tools/h5repack/testh5repack_make.c12
10 files changed, 66 insertions, 52 deletions
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 4120b4d..5d6a9c3 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -27,7 +27,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \
## Test programs and scripts.
##
-TEST_PROGS=h5repacktst
+TEST_PROGS=h5repacktst
TEST_SCRIPTS=./h5repack.sh
PRIV_PROGS=testh5repack_detect_szip
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 14779c5..09d83b9 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -243,6 +243,7 @@ int h5repack_addlayout(const char* str,
static int check_options(pack_opt_t *options)
{
int i, k, j, has_cp=0, has_ck=0;
+ char slayout[30];
/*-------------------------------------------------------------------------
* objects to layout
@@ -252,7 +253,22 @@ static int check_options(pack_opt_t *options)
{
printf("Objects to modify layout are...\n");
if (options->all_layout==1) {
- printf(" Apply layout to all\n ");
+ switch (options->layout_g)
+ {
+ case H5D_COMPACT:
+ strcpy(slayout,"compact");
+ break;
+ case H5D_CONTIGUOUS:
+ strcpy(slayout,"contiguous");
+ break;
+ case H5D_CHUNKED:
+ strcpy(slayout,"chunked");
+ break;
+ default:
+ strcpy(slayout,"unknown");
+ break;
+ }
+ 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++)
@@ -336,7 +352,6 @@ static int check_options(pack_opt_t *options)
has_cp=1;
-
} /* j */
} /* i */
@@ -345,6 +360,8 @@ static int check_options(pack_opt_t *options)
is present with other objects\n");
return -1;
}
+
+
return 0;
}
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 9a73919..42b6701 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -142,7 +142,7 @@ int copy_objects(const char* fnamein,
pack_opt_t *options)
{
hid_t fidin;
- hid_t fidout;
+ hid_t fidout=(-1);
trav_table_t *travt=NULL;
/*-------------------------------------------------------------------------
@@ -215,9 +215,6 @@ out:
return -1;
}
-
-
-
/*-------------------------------------------------------------------------
* Function: do_copy_objects
*
@@ -239,17 +236,17 @@ int do_copy_objects(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in; /* group ID */
- hid_t grp_out; /* group ID */
- hid_t dset_in; /* read dataset ID */
- hid_t dset_out; /* write dataset ID */
- hid_t type_in; /* named type ID */
- hid_t type_out; /* named type ID */
- hid_t dcpl_id; /* dataset creation property list ID */
- hid_t dcpl_out; /* dataset creation property list ID */
- hid_t space_id; /* space ID */
- hid_t ftype_id; /* file data type ID */
- hid_t mtype_id; /* memory 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 */
hsize_t nelmts; /* number of elements in dataset */
@@ -258,7 +255,6 @@ int do_copy_objects(hid_t fidin,
hsize_t dsize_in; /* input dataset size before filter */
int next; /* external files */
int i, j;
- int wrote=0;
/*-------------------------------------------------------------------------
* copy the suppplied object list
@@ -418,7 +414,6 @@ int do_copy_objects(hid_t fidin,
if (dsize_in && nelmts) {
if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
goto error;
- wrote=1;
}
/*-------------------------------------------------------------------------
* copy attrs
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index f594763..43b7dcc 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -73,15 +73,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- int index, i;
+ int idx, i;
pack_info_t tmp;
init_packobject(&tmp);
- index = aux_find_obj(name,options,&tmp);
+ idx = aux_find_obj(name,options,&tmp);
/* name was on input */
- if (index>=0)
+ if (idx>=0)
{
/* applying to all objects */
@@ -102,13 +102,13 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
}
else
{
- tmp.layout = options->op_tbl->objs[index].layout;
+ tmp.layout = options->op_tbl->objs[idx].layout;
switch (tmp.layout)
{
case H5D_CHUNKED:
- tmp.chunk.rank = options->op_tbl->objs[index].chunk.rank;
+ tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[index].chunk.chunk_lengths[i];
+ tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i];
break;
default:
break;
@@ -125,15 +125,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
} /* if all */
else
{
- tmp.nfilters=options->op_tbl->objs[index].nfilters;
+ tmp.nfilters=options->op_tbl->objs[idx].nfilters;
for ( i=0; i<tmp.nfilters; i++)
{
- tmp.filter[i] = options->op_tbl->objs[index].filter[i];
+ tmp.filter[i] = options->op_tbl->objs[idx].filter[i];
}
}
- } /* if index */
+ } /* if idx */
/* no input name */
diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c
index 38b8bc0..3f65e63 100644
--- a/tools/h5repack/h5repack_list.c
+++ b/tools/h5repack/h5repack_list.c
@@ -168,7 +168,6 @@ out:
-
/*-------------------------------------------------------------------------
* Function: print_objlist
*
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 6bca10e..d9c5e3a 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -187,4 +187,3 @@ void usage(void)
}
-
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index f093d12..28c6c0b 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -52,15 +52,15 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in; /* read group ID */
- hid_t grp_out; /* write group ID */
- hid_t dset_in; /* read dataset ID */
- hid_t dset_out; /* write dataset ID */
- hid_t type_in; /* named type ID */
- hid_t dcpl_id; /* dataset creation property list ID */
- hid_t space_id; /* space ID */
- hid_t ftype_id; /* file data type ID */
- hid_t mtype_id; /* memory 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 */
int rank; /* rank of dataset */
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 9e6514f..4f12c40 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -38,14 +38,14 @@
*/
-void main(void)
+int main(void)
{
#ifdef H5_HAVE_FILTER_SZIP
- if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
- printf("yes\n");
- exit(1);
- }
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ printf("yes\n");
+ return(1);
+ }
#endif /* H5_HAVE_FILTER_SZIP */
- printf("no\n");
- exit(0);
+ printf("no\n");
+ return(0);
}
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 4666753..299c044 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -638,7 +638,7 @@ static void make_dset_reg_ref(hid_t loc_id)
hid_t sid2; /* Dataspace ID #2 */
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 6149bd9..65a1c4a 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -27,7 +27,9 @@ int make_attributes(hid_t loc_id);
int make_hlinks(hid_t loc_id);
int make_early(void);
int make_layout(hid_t loc_id);
+#ifdef H5_HAVE_FILTER_SZIP
int make_szip(hid_t loc_id);
+#endif /* H5_HAVE_FILTER_SZIP */
int make_deflate(hid_t loc_id);
int make_shuffle(hid_t loc_id);
int make_fletcher32(hid_t loc_id);
@@ -113,12 +115,14 @@ int make_testfiles(void)
* create a file with the SZIP filter
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_FILTER_SZIP
if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
if (make_szip(loc_id)<0)
goto out;
if(H5Fclose(loc_id)<0)
return -1;
+#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
* create a file with the deflate filter
@@ -362,6 +366,7 @@ int make_hlinks(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_FILTER_SZIP
int make_szip(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -372,9 +377,7 @@ int make_szip(hid_t loc_id)
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
-#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
-#endif
for (i=n=0; i<DIM1; i++){
for (j=0; j<DIM2; j++){
@@ -396,7 +399,6 @@ int make_szip(hid_t loc_id)
*-------------------------------------------------------------------------
*/
/* Make sure encoding is enabled */
-#if defined (H5_HAVE_FILTER_SZIP)
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
szip_can_encode = 1;
}
@@ -409,7 +411,6 @@ if (szip_can_encode) {
} else {
/* WARNING? SZIP is decoder only, can't generate test files */
}
-#endif
if(H5Sclose(sid)<0)
goto out;
@@ -425,6 +426,7 @@ out:
} H5E_END_TRY;
return -1;
}
+#endif /* H5_HAVE_FILTER_SZIP */
@@ -633,8 +635,10 @@ int make_all(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
hid_t sid; /* dataspace ID */
+#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;
+#endif /* H5_HAVE_FILTER_SZIP */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];