summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:48:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:48:45 (GMT)
commit615a1fc7ec94b1c2f23fe3595033181afbf5a9e3 (patch)
tree6bc13879c04b7e71f2b45b7670ad150a9b3dfffa /tools/h5repack
parent313102f942252d948f5eb0e9b2246f295b3b9c76 (diff)
downloadhdf5-615a1fc7ec94b1c2f23fe3595033181afbf5a9e3.zip
hdf5-615a1fc7ec94b1c2f23fe3595033181afbf5a9e3.tar.gz
hdf5-615a1fc7ec94b1c2f23fe3595033181afbf5a9e3.tar.bz2
[svn-r11888] Purpose:
Code cleanup Description: Check in some of the code cleanups from working on the external link support. (This doesn't include any of the external link features) Platforms tested: FreeBSD 4.11 (sleipnir) Mac OSX.4 (amazon) Linux 2.4
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/h5repack.h76
-rw-r--r--tools/h5repack/h5repack_copy.c2
-rw-r--r--tools/h5repack/h5repack_filters.c26
-rw-r--r--tools/h5repack/h5repack_main.c17
-rw-r--r--tools/h5repack/h5repack_opttable.c1
-rw-r--r--tools/h5repack/h5repack_parse.c17
-rw-r--r--tools/h5repack/testh5repack_attr.c1
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c1
-rw-r--r--tools/h5repack/testh5repack_dset.c1
-rw-r--r--tools/h5repack/testh5repack_main.c1
-rw-r--r--tools/h5repack/testh5repack_make.c3
-rw-r--r--tools/h5repack/testh5repack_util.c1
12 files changed, 46 insertions, 101 deletions
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index f8ea1db..dae857e 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -29,7 +29,6 @@
#define MAX_NC_NAME 256 /* max length of a name */
#define MAX_VAR_DIMS 32 /* max per variable dimensions */
-
/*-------------------------------------------------------------------------
* data structures for command line options
*-------------------------------------------------------------------------
@@ -44,7 +43,7 @@ typedef struct {
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
@@ -247,78 +246,7 @@ obj_list_t* parse_layout(const char *str,
const char* get_sfilter (H5Z_filter_t filtn);
int parse_number(char *str);
-/*-------------------------------------------------------------------------
- * tests
- *-------------------------------------------------------------------------
- */
-
-#define FNAME0 "test0.h5"
-#define FNAME0OUT "test0.out.h5"
-#define FNAME1 "test1.h5"
-#define FNAME1OUT "test1.out.h5"
-#define FNAME2 "test2.h5"
-#define FNAME2OUT "test2.out.h5"
-#define FNAME3 "test3.h5"
-#define FNAME3OUT "test3.out.h5"
-#define FNAME4 "test4.h5"
-#define FNAME4OUT "test4.out.h5"
-#define FNAME5 "test5.h5"
-#define FNAME5OUT "test5.out.h5"
-#define FNAME6 "test6.h5"
-#define FNAME7 "test_szip.h5"
-#define FNAME8 "test_deflate.h5"
-#define FNAME9 "test_shuffle.h5"
-#define FNAME10 "test_fletcher32.h5"
-#define FNAME11 "test_all.h5"
-#define FNAME7OUT "test_szip.out.h5"
-#define FNAME8OUT "test_deflate.out.h5"
-#define FNAME9OUT "test_shuffle.out.h5"
-#define FNAME10OUT "test_fletcher32.out.h5"
-#define FNAME11OUT "test_all.out.h5"
-
-int make_testfiles(void);
-
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *dset_name,
- hid_t type_id,
- void *buf );
-int write_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t type_id,
- void *buf);
-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,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t file_id,
- int make_diffs /* flag to modify data buffers */);
-
-
-
-/*-------------------------------------------------------------------------
- * tests utils
- *-------------------------------------------------------------------------
- */
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t dcpl,
- void *buf);
-
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t type_id,
- void *buf);
-
-
#endif /* H5REPACK_H__ */
+
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 94d1e09..1f5d37e 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -507,7 +507,7 @@ int do_copy_objects(hid_t fidin,
default:
if (options->verbose)
printf(" %-10s %s\n","User defined object",travt->objs[i].name);
- break;
+ goto error;
}
}
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index b87a713..a6a94db 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -147,8 +147,6 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
tmp.nfilters=1;
tmp.filter[0]=options->filter_g;
}
-
-
if (options->all_layout)
{
/* assign the global layout info to the OBJ info */
@@ -163,10 +161,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
default:
break;
}/*switch*/
-
}
-
-
}
*obj = tmp;
@@ -199,7 +194,6 @@ int apply_filters(const char* name, /* object name from traverse list */
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 */
size_t size; /* size of datatype in bytes */
hsize_t chsize[64]; /* chunk size in elements */
@@ -207,6 +201,7 @@ int apply_filters(const char* name, /* object name from traverse list */
int i;
pack_info_t obj;
+
if (rank==0)
goto out;
@@ -275,8 +270,7 @@ int apply_filters(const char* name, /* object name from traverse list */
}
}
-
- /*-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
* the type of filter and additional parameter
* type can be one of the filters
* H5Z_FILTER_NONE 0, uncompress if compressed
@@ -313,12 +307,16 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_DEFLATE:
- aggression=obj.filter[i].cd_values[0];
- /* set up for deflated data */
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
- return -1;
- if(H5Pset_deflate(dcpl_id,aggression)<0)
- return -1;
+ {
+ unsigned aggression; /* the deflate level */
+
+ aggression = obj.filter[i].cd_values[0];
+ /* set up for deflated data */
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if(H5Pset_deflate(dcpl_id,aggression)<0)
+ return -1;
+ }
break;
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 5294134..7c1fab7 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -136,9 +136,12 @@ void usage(void)
printf("-i input Input HDF5 File\n");
printf("-o output Output HDF5 File\n");
printf("[-h] Print usage message\n");
- printf("[-v] Verbose mode. Print output (list of objects, filters, warnings)\n");
+ printf("[-v] Verbose mode. Print more output (list of objects,\n");
+ printf(" filters, warnings)\n");
printf("[-f 'filter'] Filter type: 'filter' is a string with the format\n");
+ printf("\n");
printf(" <list of objects> : <name of filter> = <filter parameters>\n");
+ printf("\n");
printf(" <list of objects> is a comma separated list of object names\n");
printf(" meaning apply compression only to those objects.\n");
printf(" if no object names are specified, the filter is applied to all objects\n");
@@ -152,9 +155,13 @@ void usage(void)
printf(" SHUF (no parameter)\n");
printf(" FLET (no parameter)\n");
printf(" GZIP=<deflation level> from 1-9\n");
- printf(" SZIP=<pixels per block,coding> (pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN')\n");
+ printf(" SZIP=<pixels per block,coding>\n");
+ printf(" (pixels per block is a even number in 2-32 and coding method\n");
+ printf(" is 'EC' or 'NN')\n");
printf("[-l 'layout'] Layout type. 'layout' is a string with the format\n");
+ printf("\n");
printf(" <list of objects> : <layout type>\n");
+ printf("\n");
printf(" <list of objects> is a comma separated list of object names,\n");
printf(" meaning that layout information is supplied for those objects.\n");
printf(" if no object names are specified, the layout is applied to all objects\n");
@@ -167,8 +174,9 @@ void usage(void)
printf(" <dim_1 x dim_2 x ... dim_n>\n");
printf("\n");
printf("-e file File with the -f and -l options (only filter and layout flags)\n");
- printf("-m number Do not apply the filter to objects which size in bytes is smaller than number.\n");
- printf(" If no size is specified a minimum of 1024 bytes is assumed.\n");
+ printf("-m size Do not apply the filter to objects which size in bytes\n");
+ printf(" is smaller than number. If no size is specified a minimum of\n");
+ printf(" 1024 bytes is assumed.\n");
printf("\n");
printf("Examples of use:\n");
printf("\n");
@@ -186,4 +194,3 @@ void usage(void)
printf("\n");
}
-
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 7bb6d10..1b043ce 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -17,7 +17,6 @@
#include "h5repack.h"
-
/*-------------------------------------------------------------------------
* Function: init_packobject
*
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 64691ba..961f401 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -133,11 +133,13 @@ obj_list_t* parse_filter(const char *str,
if ( c=='=') { /*one more parameter */
scomp[k]='\0'; /*cut space */
- /*SZIP is a special case , it can be
- SZIP=8,EC
- SZIP=8,NN
- */
-
+/*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ * szip has the format SZIP=<pixels per block,coding>
+ * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
+ * example SZIP=8,NN
+ *-------------------------------------------------------------------------
+ */
if (strcmp(scomp,"SZIP")==0)
{
l=-1; /* mask index check */
@@ -182,6 +184,11 @@ obj_list_t* parse_filter(const char *str,
} /* u */
} /*if */
+/*-------------------------------------------------------------------------
+ * all other filters
+ *-------------------------------------------------------------------------
+ */
+
else
{
/* here we could have 1 or 2 digits */
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index f18bbc2..7635cf2 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
* Function: write_attr_in
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 16962af..095910e 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,6 +16,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 862257a..c345028 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
static void make_dset_reg_ref(hid_t loc_id);
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index 1876f9c..5398c14 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
#include "h5diff.h"
#if 0
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index d25864b..3437682 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
#define DIM1 40
#define DIM2 20
@@ -896,7 +897,7 @@ int make_layout(hid_t loc_id)
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- char name[5];
+ char name[6];
for (i=n=0; i<DIM1; i++){
diff --git a/tools/h5repack/testh5repack_util.c b/tools/h5repack/testh5repack_util.c
index cad52d3..63b8b1d 100644
--- a/tools/h5repack/testh5repack_util.c
+++ b/tools/h5repack/testh5repack_util.c
@@ -14,6 +14,7 @@
#include "hdf5.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
* Function: make_dset