summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:32:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:32:06 (GMT)
commit37232bd4f0f8199f956c823cdff72ece2ca9aa16 (patch)
tree38e37f7208355500b7f223e90bf014424c63300b /tools
parent20146575aaeead9e05af73977dee863de63bf50f (diff)
downloadhdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.zip
hdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.tar.gz
hdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.tar.bz2
[svn-r9729] Purpose:
Bug Fix/Code Cleanup/Doc Cleanup/Optimization/Branch Sync :-) Description: Generally speaking, this is the "signed->unsigned" change to selections. However, in the process of merging code back, things got stickier and stickier until I ended up doing a big "sync the two branches up" operation. So... I brought back all the "infrastructure" fixes from the development branch to the release branch (which I think were actually making some improvement in performance) as well as fixed several bugs which had been fixed in one branch, but not the other. I've also tagged the repository before making this checkin with the label "before_signed_unsigned_changes". Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel & fphdf5 FreeBSD 4.10 (sleipnir) w/threadsafe FreeBSD 4.10 (sleipnir) w/backward compatibility Solaris 2.7 (arabica) w/"purify options" Solaris 2.8 (sol) w/FORTRAN & C++ AIX 5.x (copper) w/parallel & FORTRAN IRIX64 6.5 (modi4) w/FORTRAN Linux 2.4 (heping) w/FORTRAN & C++ Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/gifconv/Makefile.in3
-rw-r--r--tools/h5dump/h5dump.c266
-rw-r--r--tools/h5dump/h5dumpgentest.c58
-rw-r--r--tools/h5dump/testh5dump.sh.in29
-rwxr-xr-xtools/h5import/Makefile.in2
-rwxr-xr-xtools/h5import/h5import.c92
-rwxr-xr-xtools/h5import/h5import.h4
-rw-r--r--tools/h5jam/getub.c4
-rw-r--r--tools/h5jam/h5jam.c4
-rw-r--r--tools/h5jam/h5jamgentest.c17
-rw-r--r--tools/h5jam/h5unjam.c4
-rw-r--r--tools/h5jam/tellub.c16
-rw-r--r--tools/h5ls/Makefile.in3
-rw-r--r--tools/h5ls/h5ls.c75
-rw-r--r--tools/h5repack/Makefile.in10
-rw-r--r--tools/h5repack/h5repack.c3
-rw-r--r--tools/h5repack/h5repack.h2
-rwxr-xr-xtools/h5repack/h5repack.sh.in13
-rw-r--r--tools/h5repack/h5repack_copy.c27
-rw-r--r--tools/h5repack/h5repack_filters.c18
-rw-r--r--tools/h5repack/h5repack_refs.c18
-rw-r--r--tools/h5repack/testh5repack_dset.c2
-rw-r--r--tools/h5repack/testh5repack_main.c46
-rw-r--r--tools/h5repack/testh5repack_make.c36
-rw-r--r--tools/lib/h5diff.c12
-rw-r--r--tools/lib/h5diff.h1
-rw-r--r--tools/lib/h5diff_array.c28
-rw-r--r--tools/lib/h5diff_attr.c2
-rw-r--r--tools/lib/h5tools.c43
-rw-r--r--tools/lib/h5tools.h7
-rw-r--r--tools/lib/h5tools_filters.c95
-rw-r--r--tools/lib/h5tools_ref.c150
-rw-r--r--tools/lib/h5tools_ref.h6
-rw-r--r--tools/lib/h5tools_str.c4
-rw-r--r--tools/lib/h5trav.c1
-rw-r--r--tools/misc/Makefile.in6
-rwxr-xr-xtools/misc/h5cc.in8
-rw-r--r--tools/misc/h5debug.c7
-rw-r--r--tools/testfiles/help-1.ls1
-rw-r--r--tools/testfiles/help-2.ls1
-rw-r--r--tools/testfiles/help-3.ls1
41 files changed, 615 insertions, 510 deletions
diff --git a/tools/gifconv/Makefile.in b/tools/gifconv/Makefile.in
index 1c5fd3c..79c3552 100644
--- a/tools/gifconv/Makefile.in
+++ b/tools/gifconv/Makefile.in
@@ -1,4 +1,3 @@
-## HDF5 Library Makefile(.in)
##
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
@@ -12,6 +11,8 @@
## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
##
+## HDF5 Library Makefile(.in)
+##
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e9803b3..0a7f408 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -22,7 +22,6 @@
#include "h5trav.h"
-
/* module-scoped variables */
const char *progname = "h5dump";
@@ -56,7 +55,6 @@ static int display_fi = FALSE; /*file index */
static int display_ai = TRUE; /*array index */
static int display_escape = FALSE; /*escape non printable characters */
-
/**
** Added for XML **
**/
@@ -78,6 +76,9 @@ static hid_t h5_fileaccess(void);
static void dump_oid(hid_t oid);
static void print_enum(hid_t type);
static herr_t dump_all(hid_t group, const char *name, void *op_data);
+#ifdef LATER
+static void check_compression(hid_t);
+#endif /* LATER */
static int xml_name_to_XID(const char *, char *, int , int );
static h5dump_t dataformat = {
@@ -467,7 +468,6 @@ static void dump_comment(hid_t obj_id);
static void dump_fcpl(hid_t fid);
static void dump_fcontents(hid_t fid);
-
/* XML format: same interface, alternative output */
static void xml_dump_group(hid_t, const char *);
@@ -1007,20 +1007,22 @@ dump_dataspace(hid_t space)
hsize_t size[H5DUMP_MAX_RANK];
hsize_t maxsize[H5DUMP_MAX_RANK];
int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
int i;
indentation(indent + COL);
printf("%s ", dump_header_format->dataspacebegin);
- if (H5Sis_simple(space)) {
- if (ndims == 0) {
+ switch (space_type) {
+ case H5S_SCALAR:
/* scalar dataspace */
HDfprintf(stdout, "%s %s",
- dump_header_format->dataspacedescriptionbegin, SCALAR);
- } else {
+ dump_header_format->dataspacedescriptionbegin, S_SCALAR);
+ break;
+ case H5S_SIMPLE:
/* simple dataspace */
HDfprintf(stdout, "%s %s { %s %Hu",
- dump_header_format->dataspacedescriptionbegin, SIMPLE,
+ dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
dump_header_format->dataspacedimbegin, size[0]);
for (i = 1; i < ndims; i++)
@@ -1043,9 +1045,14 @@ dump_dataspace(hid_t space)
HDfprintf(stdout, ", %Hu", maxsize[i]);
printf(" %s }", dump_header_format->dataspacedimend);
- }
- } else {
- printf("%s not yet implemented %s\n", BEGIN, END);
+
+ break;
+ case H5S_COMPLEX:
+ printf("%s not yet implemented %s\n", BEGIN, END);
+ break;
+ case H5S_NO_CLASS:
+ default:
+ printf("%s unknown dataspace %s\n", BEGIN, END);
}
end_obj(dump_header_format->dataspaceend,
@@ -1544,7 +1551,6 @@ dump_named_datatype(hid_t type, const char *name)
dump_header_format->datatypeblockend);
}
-
/*-------------------------------------------------------------------------
* Function: dump_group
*
@@ -1851,6 +1857,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
int status = -1;
void *buf;
hid_t space, type, p_type;
+ H5S_class_t space_type;
int ndims, i;
hsize_t size[64], nelmts = 1, alloc_size;
int depth;
@@ -1929,61 +1936,65 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
H5Tclose(f_type);
} else {
- char string_prefix[64];
- h5dump_t string_dataformat;
-
/* need to call h5tools_dump_mem for the attribute data */
- type = H5Aget_type(obj_id);
- p_type = h5tools_get_native_type(type);
-
space = H5Aget_space(obj_id);
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ space_type = H5Sget_simple_extent_type(space);
+ if(space_type == H5S_NO_CLASS || space_type == H5S_COMPLEX) {
+ status = SUCCEED;
+ } else {
+ char string_prefix[64];
+ h5dump_t string_dataformat;
- for (i = 0; i < ndims; i++)
- nelmts *= size[i];
+ type = H5Aget_type(obj_id);
+ p_type = h5tools_get_native_type(type);
- alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
- assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
-
- buf = malloc((size_t)alloc_size);
- assert(buf);
-
- if (H5Aread(obj_id, p_type, buf) >= 0){
- if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
- /*
- * Print 1-byte integer data as an ASCII character string
- * instead of integers if the `-r' or `--string' command-line
- * option was given.
- *
- * We don't want to modify the global dataformat, so make a
- * copy of it instead.
- */
- string_dataformat = *outputformat;
- string_dataformat.idx_fmt = " ";
- string_dataformat.line_multi_new = 1;
- string_dataformat.line_1st = " %s\"";
- string_dataformat.line_pre = " %s";
- string_dataformat.line_cont = " %s";
- string_dataformat.str_repeat = 8;
- string_dataformat.ascii = TRUE;
- string_dataformat.elmt_suf1 = "";
- string_dataformat.elmt_suf2 = "";
- string_dataformat.line_indent = "";
- strcpy(string_prefix, string_dataformat.line_pre);
- strcat(string_prefix, "\"");
- string_dataformat.line_pre = string_prefix;
- string_dataformat.line_suf = "\"";
- outputformat = &string_dataformat;
- }
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
- status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type,
- space, buf, depth);
- }
-
- free(buf);
- H5Tclose(p_type);
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
+
+ alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
+ assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+
+ buf = malloc((size_t)alloc_size);
+ assert(buf);
+
+ if (H5Aread(obj_id, p_type, buf) >= 0)
+ if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
+ /*
+ * Print 1-byte integer data as an ASCII character string
+ * instead of integers if the `-r' or `--string' command-line
+ * option was given.
+ *
+ * We don't want to modify the global dataformat, so make a
+ * copy of it instead.
+ */
+ string_dataformat = *outputformat;
+ string_dataformat.idx_fmt = " ";
+ string_dataformat.line_multi_new = 1;
+ string_dataformat.line_1st = " %s\"";
+ string_dataformat.line_pre = " %s";
+ string_dataformat.line_cont = " %s";
+ string_dataformat.str_repeat = 8;
+ string_dataformat.ascii = TRUE;
+ string_dataformat.elmt_suf1 = "";
+ string_dataformat.elmt_suf2 = "";
+ string_dataformat.line_indent = "";
+ strcpy(string_prefix, string_dataformat.line_pre);
+ strcat(string_prefix, "\"");
+ string_dataformat.line_pre = string_prefix;
+ string_dataformat.line_suf = "\"";
+ outputformat = &string_dataformat;
+ }
+
+ status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type,
+ space, buf, depth);
+
+ free(buf);
+ H5Tclose(p_type);
+ H5Tclose(type);
+ }
H5Sclose(space);
- H5Tclose(type);
}
if (status == FAIL) {
@@ -2071,7 +2082,7 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
h5tools_context_t ctx; /*print context */
size_t size;
void *buf=NULL;
- int nelmts=1;
+ hsize_t nelmts=1;
h5dump_t *outputformat = &dataformat;
hid_t n_type;
@@ -2189,8 +2200,8 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
printf("%s %s\n", EXTERNAL, BEGIN);
/*start indent */
indent += COL;
- for ( i=0; i<next; i++) {
- H5Pget_external(dcpl_id,i,sizeof(name),name,&offset,&size);
+ for ( j=0; j<(unsigned)next; j++) {
+ H5Pget_external(dcpl_id,j,sizeof(name),name,&offset,&size);
indentation(indent + COL);
HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset);
}
@@ -2345,15 +2356,18 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
H5Pget_fill_time(dcpl_id, &ft);
switch ( ft )
{
- case H5D_FILL_TIME_ALLOC:
- printf("%s", "H5D_FILL_TIME_ALLOC\n");
- break;
- case H5D_FILL_TIME_NEVER:
- printf("%s", "H5D_FILL_TIME_NEVER\n");
- break;
- case H5D_FILL_TIME_IFSET:
- printf("%s", "H5D_FILL_TIME_IFSET\n");
- break;
+ case H5D_FILL_TIME_ALLOC:
+ printf("%s", "H5D_FILL_TIME_ALLOC\n");
+ break;
+ case H5D_FILL_TIME_NEVER:
+ printf("%s", "H5D_FILL_TIME_NEVER\n");
+ break;
+ case H5D_FILL_TIME_IFSET:
+ printf("%s", "H5D_FILL_TIME_IFSET\n");
+ break;
+ default:
+ assert(0);
+ break;
}
indentation(indent + COL);
printf("%s ", "VALUE ");
@@ -2385,15 +2399,18 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
H5Pget_alloc_time(dcpl_id, &at);
switch (at)
{
- case H5D_ALLOC_TIME_EARLY:
- printf("%s", "H5D_ALLOC_TIME_EARLY\n");
- break;
- case H5D_ALLOC_TIME_INCR:
- printf("%s", "H5D_ALLOC_TIME_INCR\n");
- break;
- case H5D_ALLOC_TIME_LATE:
- printf("%s", "H5D_ALLOC_TIME_LATE\n");
- break;
+ case H5D_ALLOC_TIME_EARLY:
+ printf("%s", "H5D_ALLOC_TIME_EARLY\n");
+ break;
+ case H5D_ALLOC_TIME_INCR:
+ printf("%s", "H5D_ALLOC_TIME_INCR\n");
+ break;
+ case H5D_ALLOC_TIME_LATE:
+ printf("%s", "H5D_ALLOC_TIME_LATE\n");
+ break;
+ default:
+ assert(0);
+ break;
}
/* end indent */
indent -= COL;
@@ -2417,24 +2434,25 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
static void
dump_fcpl(hid_t fid)
{
-#ifdef H5_WANT_H5_V1_4_COMPAT
- int sym_lk;
-#else
- unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
-#endif
- int istore_ik; /* indexed storage B-tree initial 'K' value */
hid_t fcpl; /* file creation property list ID */
hid_t fapl; /* file access property list ID */
hsize_t userblock; /* userblock size retrieved from FCPL */
size_t off_size; /* size of offsets in the file */
size_t len_size; /* size of lengths in the file */
- int sym_ik; /* symbol table B-tree initial 'K' value */
- int super; /* superblock version # */
- int freelist; /* free list version # */
- int stab; /* symbol table entry version # */
- int shhdr; /* shared object header version # */
+ unsigned super; /* superblock version # */
+ unsigned freelist; /* free list version # */
+ unsigned stab; /* symbol table entry version # */
+ unsigned shhdr; /* shared object header version # */
hid_t fdriver; /* file driver */
char dname[15]; /* buffer to store driver name */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int sym_lk;
+ int sym_ik; /* symbol table B-tree internal 'K' value */
+#else
+ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
+ unsigned sym_ik; /* symbol table B-tree internal 'K' value */
+#endif
+ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
fcpl=H5Fget_create_plist(fid);
H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
@@ -2453,19 +2471,19 @@ dump_fcpl(hid_t fid)
*/
printf("%s %s\n",SUPER_BLOCK, BEGIN);
indentation(indent + COL);
- printf("%s %d\n","SUPERBLOCK_VERSION", super);
+ printf("%s %u\n","SUPERBLOCK_VERSION", super);
indentation(indent + COL);
- printf("%s %d\n","FREELIST_VERSION", freelist);
+ printf("%s %u\n","FREELIST_VERSION", freelist);
indentation(indent + COL);
- printf("%s %d\n","SYMBOLTABLE_VERSION", stab);
+ printf("%s %u\n","SYMBOLTABLE_VERSION", stab);
indentation(indent + COL);
- printf("%s %d\n","OBJECTHEADER_VERSION", shhdr);
+ printf("%s %u\n","OBJECTHEADER_VERSION", shhdr);
indentation(indent + COL);
HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long_long)off_size);
indentation(indent + COL);
HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long_long)len_size);
indentation(indent + COL);
- printf("%s %d\n","BTREE_RANK", sym_ik);
+ printf("%s %u\n","BTREE_RANK", sym_ik);
indentation(indent + COL);
printf("%s %d\n","BTREE_LEAF", sym_lk);
@@ -2511,7 +2529,7 @@ dump_fcpl(hid_t fid)
indentation(indent + COL);
printf("%s %s\n","FILE_DRIVER", dname);
indentation(indent + COL);
- printf("%s %d\n","ISTORE_K", istore_ik);
+ printf("%s %u\n","ISTORE_K", istore_ik);
printf("%s\n",END);
/*-------------------------------------------------------------------------
@@ -2715,7 +2733,7 @@ parse_subset_params(char *dset)
*brace++ = '\0';
s = calloc(1, sizeof(struct subset_t));
- s->start = (hssize_t *)parse_hsize_list(brace);
+ s->start = parse_hsize_list(brace);
while (*brace && *brace != ';')
brace++;
@@ -3248,7 +3266,7 @@ parse_start:
*/
do {
switch ((char)opt) {
- case 's': free(s->start); s->start = (hssize_t *)parse_hsize_list(opt_arg); break;
+ case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break;
case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break;
case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break;
case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break;
@@ -3717,21 +3735,17 @@ int
xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
{
ref_path_table_entry_t *r;
- char *os;
if (outlen < 22) return 1;
- os = outstr;
-
r = ref_path_table_lookup(str);
if (r == NULL) {
if (strlen(str) == 0) {
r = ref_path_table_lookup("/");
if (r == NULL) {
if (gen) {
- sprintf(os," "); /* ?? */
r = ref_path_table_gen_fake(str);
- sprintf(os,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
+ sprintf(outstr,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
return 0;
} else {
return 1;
@@ -3739,9 +3753,8 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
} else {
if (gen) {
- sprintf(os," "); /* ?? */
r = ref_path_table_gen_fake(str);
- sprintf(os,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
+ sprintf(outstr,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
return 0;
} else {
return 1;
@@ -3749,7 +3762,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- sprintf(os,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
+ sprintf(outstr,"xid_%lu-%lu",r->statbuf.objno[0],r->statbuf.objno[1]);
return(0);
}
@@ -4415,17 +4428,20 @@ xml_dump_dataspace(hid_t space)
hsize_t maxsize[H5DUMP_MAX_RANK];
int ndims =
H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
int i;
indentation(indent + COL);
printf("<%sDataspace>\n", xmlnsprefix);
- if (H5Sis_simple(space)) {
- indentation(indent + COL + COL);
+ indentation(indent + COL + COL);
- if (ndims == 0) {
+ switch (space_type) {
+ case H5S_SCALAR:
/* scalar dataspace (just a tag, no XML attrs. defined */
printf("<%sScalarDataspace />\n",xmlnsprefix);
- } else {
+
+ break;
+ case H5S_SIMPLE:
/* simple dataspace */
/* <hdf5:SimpleDataspace Ndims="nd"> */
printf("<%sSimpleDataspace Ndims=\"%d\">\n",xmlnsprefix, ndims);
@@ -4449,14 +4465,19 @@ xml_dump_dataspace(hid_t space)
}
indentation(indent + COL + COL);
printf("</%sSimpleDataspace>\n", xmlnsprefix );
- }
- } else {
- printf("<!-- not yet implemented -->\n");
+
+ break;
+ case H5S_COMPLEX:
+ printf("<!-- not yet implemented -->\n");
+
+ break;
+ case H5S_NO_CLASS:
+ default:
+ printf("<!-- unknown dataspace -->\n");
}
indentation(indent + COL);
printf("</%sDataspace>\n", xmlnsprefix);
-
}
/*-------------------------------------------------------------------------
@@ -5069,7 +5090,7 @@ xml_print_refs(hid_t did, int source)
ssiz = H5Sget_simple_extent_npoints(space);
for (i = 0; i < ssiz; i++) {
- path = lookup_ref_path(refbuf);
+ path = lookup_ref_path(*refbuf);
indentation(indent + COL);
if (!path) {
@@ -5276,7 +5297,7 @@ check_filters(hid_t dcpl)
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
- filter = H5Pget_filter(dcpl, i, &flags,
+ filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
(size_t *) &cd_nelmts,
cd_values, 120, namebuf);
if (filter == H5Z_FILTER_DEFLATE) {
@@ -5356,7 +5377,7 @@ char * name;
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- path = lookup_ref_path(buf);
+ path = lookup_ref_path(*(hobj_ref_t *)buf);
indentation(indent);
printf("<%sDataFromFile>\n",xmlnsprefix);
@@ -5413,7 +5434,7 @@ char * name;
case H5T_ENUM:
indentation(indent);
printf("<%sDataFromFile>\n",xmlnsprefix);
- name = H5Tget_member_name(type, *(int *)buf);
+ name = H5Tget_member_name(type, *(unsigned *)buf);
indentation(indent);
printf("\"%s\"\n",name);
indentation(indent);
@@ -5846,9 +5867,6 @@ xml_print_enum(hid_t type)
}
-
-
-
/*-------------------------------------------------------------------------
* Function: h5_fileaccess
*
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index ef4cddd..55fa489 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -1,4 +1,4 @@
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
@@ -92,7 +92,6 @@ static int
write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
hid_t type_id, void *buf );
-
/* a filter operation callback function */
static size_t
myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts,
@@ -1357,7 +1356,7 @@ static void gent_str2(void)
hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
hid_t fxdlenstr, fxdlenstr2, memtype;
hsize_t dims[1], size[1], stride[1], count[1], block[1];
-hssize_t start[1];
+hsize_t start[1];
int i;
@@ -1656,11 +1655,11 @@ static void gent_datareg(void)
sid2; /* Dataspace ID #2 */
hsize_t dims1[] = {SPACE1_DIM1},
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 */
- hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
@@ -1723,7 +1722,7 @@ static void gent_datareg(void)
coord1[7][0]=9; coord1[7][1]=0;
coord1[8][0]=7; coord1[8][1]=1;
coord1[9][0]=3; coord1[9][1]=3;
- H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
H5Sget_select_npoints(sid2);
@@ -4079,6 +4078,8 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
*
* Purpose: utility function to create and write a dataset in LOC_ID
*
+ * Return:
+ *
* Programmer: pvn@ncsa.uiuc.edu
*
* Date: May 27, 2003
@@ -4099,23 +4100,16 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
/* Create a dataset */
dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT);
- assert (dset_id >= 0);
/* Write the buf */
if ( buf )
- {
status = H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf);
- assert (status >= 0);
- }
/* Close */
status = H5Dclose(dset_id);
- assert (status >= 0);
-
status = H5Sclose(space_id);
- assert (status >= 0);
- return 1;
+ return status;
}
@@ -4443,6 +4437,7 @@ make_external(hid_t fid)
H5Pclose(dcpl);
assert(ret>=0);
}
+
/*-------------------------------------------------------------------------
* Function: gent_filters
*
@@ -4456,10 +4451,10 @@ static void gent_filters(void)
hid_t dcpl; /* dataset creation property list */
hid_t sid; /* dataspace ID */
hid_t tid; /* datatype ID */
-#if defined (H5_HAVE_FILTER_SZIP)
+#ifdef H5_HAVE_FILTER_SZIP
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=4;
-#endif
+#endif /* H5_HAVE_FILTER_SZIP */
hsize_t dims1[RANK] = {DIM1,DIM2};
hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf1[DIM1][DIM2];
@@ -4529,7 +4524,8 @@ static void gent_filters(void)
* SZIP
*-------------------------------------------------------------------------
*/
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#ifdef H5_HAVE_FILTER_SZIP
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
/* remove the filters from the dcpl */
ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL);
assert(ret>=0);
@@ -4540,7 +4536,8 @@ static void gent_filters(void)
ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1);
assert(ret>=0);
-#endif
+ }
+#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
* GZIP
@@ -4609,12 +4606,14 @@ static void gent_filters(void)
assert(ret>=0);
#endif
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#ifdef H5_HAVE_FILTER_SZIP
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
/* set szip data */
ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
assert(ret>=0);
-#endif
+ }
+#endif /* H5_HAVE_FILTER_SZIP */
#if defined (H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
@@ -5054,7 +5053,7 @@ static void gent_string(void)
hid_t str_tid; /* datatype ID */
hid_t did; /* dataset ID */
char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
- char *buf2[SPACE1_DIM1]= {
+ const char *buf2[SPACE1_DIM1]= {
"Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
"conceived in liberty\n and dedicated to the proposition that all men are created equal.",
"Now we are engaged\n in a great civil war,",
@@ -5204,9 +5203,7 @@ static void gent_aindices(void)
write_dset(gid[5],3,dims3,"3d",H5T_NATIVE_INT,buf3);
for (i=0; i<6; i++)
H5Gclose(gid[i]);
-
-
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -5233,32 +5230,23 @@ int main(void)
gent_compound_dt();
gent_all();
gent_loop();
-
gent_dataset2();
gent_compound_dt2();
gent_loop2();
gent_many();
-
gent_str();
gent_str2();
-
gent_enum();
-
gent_objref();
gent_datareg();
-
gent_nestcomp();
-
gent_opaque();
-
gent_bitfields();
-
gent_vldatatypes();
gent_vldatatypes2();
gent_vldatatypes3();
gent_vldatatypes4();
gent_vldatatypes5();
-
gent_array1();
gent_array2();
gent_array3();
@@ -5266,19 +5254,15 @@ int main(void)
gent_array5();
gent_array6();
gent_array7();
-
gent_empty();
gent_group_comments();
gent_split_file();
gent_family();
gent_multi();
-
gent_large_objname();
gent_vlstr();
gent_char();
-
gent_attr_all();
-
gent_compound_complex();
gent_named_dtype_attr();
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 2414e04..ccb3f31 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -90,13 +90,13 @@ TOOLTEST() {
}
-
# Print a "SKIP" message
SKIP() {
- TESTING $DUMPER $@
- echo " -SKIP-"
+ TESTING $DUMPER $@
+ echo " -SKIP-"
}
-
+
+
##############################################################################
##############################################################################
@@ -253,46 +253,45 @@ TOOLTEST tindicesyes.ddl taindices.h5
TOOLTEST tindicesno.ddl -y taindices.h5
-
# tests for filters
# SZIP
option="-H -p -d szip tfilters.h5"
if test $USE_FILTER_SZIP != "yes"; then
- SKIP $option
+ SKIP $option
else
- TOOLTEST tszip.ddl $option
+TOOLTEST tszip.ddl $option
fi
# deflate
option="-H -p -d deflate tfilters.h5"
if test $USE_FILTER_DEFLATE != "yes"; then
- SKIP $option
+ SKIP $option
else
- TOOLTEST tdeflate.ddl $option
+ TOOLTEST tdeflate.ddl $option
fi
# shuffle
option="-H -p -d shuffle tfilters.h5"
if test $USE_FILTER_SHUFFLE != "yes"; then
- SKIP $option
+ SKIP $option
else
- TOOLTEST tshuffle.ddl $option
+ TOOLTEST tshuffle.ddl $option
fi
# fletcher32
option="-H -p -d fletcher32 tfilters.h5"
if test $USE_FILTER_FLETCHER32 != "yes"; then
- SKIP $option
+ SKIP $option
else
- TOOLTEST tfletcher32.ddl $option
+ TOOLTEST tfletcher32.ddl $option
fi
# all
option="-H -p -d all tfilters.h5"
-if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes"; then SKIP $option
+if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $option
else
TOOLTEST tallfilters.ddl $option
fi
# user defined
TOOLTEST tuserfilter.ddl -H -p -d myfilter tfilters.h5
-
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."
diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in
index 73d4f13..cd16af8 100755
--- a/tools/h5import/Makefile.in
+++ b/tools/h5import/Makefile.in
@@ -1,4 +1,3 @@
-## HDF5 Library Makefile(.in)
##
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
@@ -12,6 +11,7 @@
## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
##
+## HDF5 Library Makefile(.in)
##
top_srcdir=@top_srcdir@
top_builddir=../..
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 28020d5..ff1622d 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -1837,18 +1837,18 @@ setDefaultValues(struct Input *in, int count)
}
hid_t
-createOutputDataType(struct Input in)
+createOutputDataType(struct Input *in)
{
hid_t new_type = (-1);
const char *err1 = "Invalid value for output class.\n";
- switch (in.outputClass)
+ switch (in->outputClass)
{
case 0:
- switch (in.outputArchitecture)
+ switch (in->outputArchitecture)
{
case 0: /* NATIVE */
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 8:
new_type = H5Tcopy (H5T_NATIVE_CHAR);
@@ -1869,10 +1869,10 @@ createOutputDataType(struct Input in)
break;
case 1: /* STD */
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 8:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_I8BE);
@@ -1885,7 +1885,7 @@ createOutputDataType(struct Input in)
break;
case 16:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_I16BE);
@@ -1898,7 +1898,7 @@ createOutputDataType(struct Input in)
break;
case 32:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_I32BE);
@@ -1911,7 +1911,7 @@ createOutputDataType(struct Input in)
break;
case 64:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_I64BE);
@@ -1929,10 +1929,10 @@ createOutputDataType(struct Input in)
break;
case 1:
- switch (in.outputArchitecture)
+ switch (in->outputArchitecture)
{
case 0:
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 32:
new_type = H5Tcopy (H5T_NATIVE_FLOAT);
@@ -1949,10 +1949,10 @@ createOutputDataType(struct Input in)
break;
case 2:
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 32:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_IEEE_F32BE);
@@ -1965,7 +1965,7 @@ createOutputDataType(struct Input in)
break;
case 64:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_IEEE_F64BE);
@@ -1983,10 +1983,10 @@ createOutputDataType(struct Input in)
break;
case 2:
- switch (in.outputArchitecture)
+ switch (in->outputArchitecture)
{
case 0:
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 8:
new_type = H5Tcopy (H5T_NATIVE_UCHAR);
@@ -2007,10 +2007,10 @@ createOutputDataType(struct Input in)
break;
case 1:
- switch(in.outputSize)
+ switch(in->outputSize)
{
case 8:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_U8BE);
@@ -2023,7 +2023,7 @@ createOutputDataType(struct Input in)
break;
case 16:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_U16BE);
@@ -2036,7 +2036,7 @@ createOutputDataType(struct Input in)
break;
case 32:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_U32BE);
@@ -2049,7 +2049,7 @@ createOutputDataType(struct Input in)
break;
case 64:
- switch(in.outputByteOrder)
+ switch(in->outputByteOrder)
{
case 0:
new_type = H5Tcopy (H5T_STD_U64BE);
@@ -2079,16 +2079,16 @@ createOutputDataType(struct Input in)
}
hid_t
-createInputDataType(struct Input in)
+createInputDataType(struct Input *in)
{
hid_t new_type = (-1);
const char *err1 = "Invalid value for input class.\n";
- switch (in.inputClass)
+ switch (in->inputClass)
{
case 0:
case 4:
- switch(in.inputSize)
+ switch(in->inputSize)
{
case 8:
new_type = H5Tcopy (H5T_NATIVE_CHAR);
@@ -2111,7 +2111,7 @@ createInputDataType(struct Input in)
case 1:
case 2:
case 3:
- switch(in.inputSize)
+ switch(in->inputSize)
{
case 32:
new_type = H5Tcopy (H5T_NATIVE_FLOAT);
@@ -2128,7 +2128,7 @@ createInputDataType(struct Input in)
case 6:
case 7:
- switch(in.inputSize)
+ switch(in->inputSize)
{
case 8:
new_type = H5Tcopy (H5T_NATIVE_UCHAR);
@@ -2165,8 +2165,6 @@ process(struct Options *opt)
hid_t intype, outtype;
hid_t proplist;
hsize_t numOfElements = 1;
- H5E_auto_t func;
- void *client_data;
int j,k;
const char *err1 = "Error creating HDF output file: %s.\n";
@@ -2175,18 +2173,16 @@ process(struct Options *opt)
const char *err4 = "Error in creating or opening external file.\n";
const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
const char *err6 = "Error in writing the output data set.\n";
- H5Eget_auto(&func, &client_data);
-
- /* disable error reporting */
- H5Eset_auto(NULL, NULL);
- if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL)
- {
- (void) fprintf(stderr, err1, opt->outfile);
- return (-1);
- }
- /*enable error reporting */
- H5Eset_auto(func, client_data);
+
+ H5E_BEGIN_TRY {
+ if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) {
+ if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL)
+ {
+ (void) fprintf(stderr, err1, opt->outfile);
+ return (-1);
+ }
+ }
+ } H5E_END_TRY;
for (k = 0; k < opt->fcount; k++)
{
@@ -2209,11 +2205,8 @@ process(struct Options *opt)
for (j=0; j<in->rank;j++)
numOfElements *= in->sizeOfDimension[j];
- /* store error reporting parameters */
- H5Eget_auto(&func, &client_data);
-
/* disable error reporting */
- H5Eset_auto(NULL, NULL);
+ H5E_BEGIN_TRY {
/* create parent groups */
if (in->path.count > 1)
@@ -2241,11 +2234,11 @@ process(struct Options *opt)
}
/*enable error reporting */
- H5Eset_auto(func, client_data);
+ } H5E_END_TRY;
/*create data type */
- intype = createInputDataType(*in);
- outtype = createOutputDataType(*in);
+ intype = createInputDataType(in);
+ outtype = createOutputDataType(in);
/* create property list */
proplist = H5Pcreate (H5P_DATASET_CREATE);
@@ -2285,10 +2278,9 @@ process(struct Options *opt)
{
dataspace = H5Screate_simple(in->rank, in->sizeOfDimension, NULL);
}
- H5Eget_auto(&func, &client_data);
/* disable error reporting */
- H5Eset_auto(NULL, NULL);
+ H5E_BEGIN_TRY {
/* create data set */
if ((dataset = H5Dcreate(handle, in->path.group[j], outtype, dataspace, proplist)) < 0)
{
@@ -2300,7 +2292,7 @@ process(struct Options *opt)
}
/*enable error reporting */
- H5Eset_auto(func, client_data);
+ } H5E_END_TRY;
/* write dataset */
if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0)
diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h
index 2f968b7..353e548 100755
--- a/tools/h5import/h5import.h
+++ b/tools/h5import/h5import.h
@@ -215,8 +215,8 @@ static int readIntegerData(FILE **strm, struct Input *in);
static int readFloatData(FILE **strm, struct Input *in);
static int allocateIntegerStorage(struct Input *in);
static int allocateFloatStorage(struct Input *in);
-hid_t createOutputDataType(struct Input in);
-hid_t createInputDataType(struct Input in);
+hid_t createOutputDataType(struct Input *in);
+hid_t createInputDataType(struct Input *in);
static int readUIntegerData(FILE **strm, struct Input *in);
static int allocateUIntegerStorage(struct Input *in);
static int validateConfigurationParameters(struct Input * in);
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index 58e9fe8..01756a5 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -27,7 +27,7 @@ void parse_command_line (int argc, const char *argv[]);
#define TRUE 1
#define FALSE 0
-static char *progname="getub";
+static const char *progname="getub";
char *nbytes = NULL;
static const char *s_opts = "c:"; /* add more later ? */
@@ -153,7 +153,7 @@ main (int argc, const char *argv[])
res = HDread (fd, buf, (unsigned)size);
- if (res < size)
+ if (res < (long)size)
{
if (buf)
free (buf);
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index 487a0a4..783434b 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.c
@@ -442,7 +442,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
}
else
{
- nchars = HDread (infid, buf, howmuch);
+ nchars = HDread (infid, buf, (unsigned)howmuch);
}
if (nchars <= 0)
@@ -498,7 +498,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
hsize_t
compute_user_block_size (hsize_t ublock_size)
{
- ssize_t where = 512;
+ hsize_t where = 512;
if (ublock_size == 0)
return 0;
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index 7f6342f..2d5f253 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -262,12 +262,13 @@ hsize_t dims[2];
int data[2][2], dset1[10][10], dset2[20];
char buf[512];
int i, j;
+unsigned u;
float dset2_1[10], dset2_2[3][5];
int fd;
char *bp;
create_plist = H5Pcreate(H5P_FILE_CREATE);
- H5Pset_userblock(create_plist,512);
+ H5Pset_userblock(create_plist,(hsize_t)512);
fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
/* create groups */
@@ -390,8 +391,8 @@ char *bp;
/* fill buf with pattern */
memset(buf,'\0',512);
bp = buf;
- for (i = 0; i < strlen(pattern); i++) {
- *bp++ = pattern[i%10];
+ for (u = 0; u < strlen(pattern); u++) {
+ *bp++ = pattern[u%10];
}
HDwrite(fd,buf,512);
@@ -411,7 +412,7 @@ int fd;
char *bp;
create_plist = H5Pcreate(H5P_FILE_CREATE);
- H5Pset_userblock(create_plist,1024);
+ H5Pset_userblock(create_plist,(hsize_t)1024);
fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
/* create groups */
@@ -543,14 +544,14 @@ char *bp;
close(fd);
}
-void
-create_textfile(char *name, off_t size) {
+static void
+create_textfile(const char *name, size_t size) {
char *buf;
int fd;
-int i;
+size_t i;
char *bp;
- fd = creat(name,0777);
+ fd = creat(name,(mode_t)0777);
if (fd < 0) {
/* panic */
}
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index 05ef606..a22bb03 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -100,7 +100,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
-void
+static void
parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
@@ -268,7 +268,7 @@ main(int argc, const char *argv[])
/* copy from usize to end of file into h5fid,
* starting at end of user block if present
*/
- copy_to_file( ifid, h5fid, (ssize_t) usize, (fsize - (ssize_t)usize) );
+ copy_to_file( ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize) );
close(ufid);
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index 3b21aff..24a04d4 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -79,7 +79,7 @@ usage (const char *prog)
*-------------------------------------------------------------------------
*/
-void
+static void
parse_command_line (int argc, const char *argv[])
{
int opt = FALSE;
@@ -122,7 +122,7 @@ parse_command_line (int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-void
+int
main (int argc, const char *argv[])
{
char *ifname;
@@ -144,7 +144,7 @@ main (int argc, const char *argv[])
{
error_msg (progname, "missing file name\n");
usage (progname);
- exit (EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
ifname = strdup (argv[opt_ind]);
@@ -154,7 +154,7 @@ main (int argc, const char *argv[])
if (testval <= 0)
{
error_msg (progname, "Input HDF5 file is not HDF \"%s\"\n", ifname);
- exit (EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -162,7 +162,7 @@ main (int argc, const char *argv[])
if (ifile < 0)
{
error_msg (progname, "Can't open input HDF5 file \"%s\"\n", ifname);
- exit (EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
plist = H5Fget_create_plist (ifile);
@@ -170,14 +170,14 @@ main (int argc, const char *argv[])
{
error_msg (progname, "Can't get file creation plist for file \"%s\"\n",
ifname);
- exit (EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
status = H5Pget_userblock (plist, &usize);
if (status < 0)
{
error_msg (progname, "Can't get user block for file \"%s\"\n", ifname);
- exit (EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
printf ("%ld\n", (long) usize);
@@ -185,5 +185,5 @@ main (int argc, const char *argv[])
H5Pclose (plist);
H5Fclose (ifile);
- exit (EXIT_SUCCESS);
+ return (EXIT_SUCCESS);
}
diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in
index 0ecf657..40fd20a 100644
--- a/tools/h5ls/Makefile.in
+++ b/tools/h5ls/Makefile.in
@@ -1,4 +1,3 @@
-## HDF5 Library Makefile(.in)
##
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
@@ -12,6 +11,8 @@
## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
##
+## HDF5 Library Makefile(.in)
+##
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index a77a3bc..f3b5d3a 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -80,7 +80,7 @@ static char *fix_name(const char *path, const char *base);
hid_t thefile;
char *prefix;
-char *progname;
+const char *progname="h5ls";
int d_status;
@@ -99,7 +99,7 @@ int d_status;
*-------------------------------------------------------------------------
*/
static void
-usage (const char *progname)
+usage (void)
{
fprintf(stderr, "\
usage: %s [OPTIONS] [OBJECTS...]\n\
@@ -117,6 +117,7 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
-wN, --width=N Set the number of columns of output\n\
-v, --verbose Generate more verbose output\n\
-V, --version Print version number and exit\n\
+ --vfd=DRIVER Use the specified virtual file driver\n\
-x, --hexdump Show raw data in hexadecimal format\n\
\n\
OBJECTS\n\
@@ -1328,26 +1329,38 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data)
hsize_t temp_need;
void *buf;
h5dump_t info;
+ H5S_class_t space_type;
printf(" Attribute: ");
n = display_string(stdout, attr_name, TRUE);
printf("%*s", MAX(0, 9-n), "");
+
if ((attr = H5Aopen_name(obj, attr_name))) {
space = H5Aget_space(attr);
type = H5Aget_type(attr);
/* Data space */
ndims = H5Sget_simple_extent_dims(space, size, NULL);
- if (0==ndims) {
- puts(" scalar");
- } else {
- printf(" {");
- for (i=0; i<ndims; i++) {
- HDfprintf(stdout, "%s%Hu", i?", ":"", size[i]);
- nelmts *= size[i];
- }
- puts("}");
- }
+ space_type = H5Sget_simple_extent_type(space);
+ switch (space_type) {
+ case H5S_SCALAR:
+ /* scalar dataspace */
+ puts(" scalar");
+ break;
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ printf(" {");
+ for (i=0; i<ndims; i++) {
+ HDfprintf(stdout, "%s%Hu", i?", ":"", size[i]);
+ nelmts *= size[i];
+ }
+ puts("}");
+ break;
+ default:
+ /* Unknown dataspace type */
+ puts(" unknown");
+ break;
+ }
/* Data type */
printf(" Type: ");
@@ -1441,11 +1454,13 @@ dataset_list1(hid_t dset)
hsize_t max_size[64]; /* maximum dataset dimensions */
hid_t space; /* data space */
int ndims; /* dimensionality */
+ H5S_class_t space_type; /* type of dataspace */
int i;
/* Information that goes on the same row as the name. The name has
* already been printed. */
space = H5Dget_space(dset);
+ space_type = H5Sget_simple_extent_type(space);
ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
printf (" {");
for (i=0; i<ndims; i++) {
@@ -1456,7 +1471,7 @@ dataset_list1(hid_t dset)
HDfprintf(stdout, "/%Hu", max_size[i]);
}
}
- if (0==ndims) printf("SCALAR");
+ if (space_type==H5S_SCALAR) printf("SCALAR");
putchar('}');
H5Sclose (space);
@@ -1541,7 +1556,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
/* Print information about external strorage */
if ((nf = H5Pget_external_count(dcpl))>0) {
for (i=0, max_len=0; i<nf; i++) {
- H5Pget_external(dcpl, i, sizeof(f_name), f_name, NULL, NULL);
+ H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL);
n = display_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
}
@@ -1554,7 +1569,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
for (i=0; i<max_len; i++) putchar('-');
putchar('\n');
for (i=0, total=0; i<nf; i++) {
- if (H5Pget_external(dcpl, i, sizeof(f_name), f_name, &f_offset,
+ if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset,
&f_size)<0) {
HDfprintf(stdout,
" #%03d %10Hu %10s %10s ***ERROR*** %s\n",
@@ -1582,7 +1597,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
if ((nf = H5Pget_nfilters(dcpl))>0) {
for (i=0; i<nf; i++) {
cd_nelmts = NELMTS(cd_values);
- filt_id = H5Pget_filter(dcpl, i, &filt_flags, &cd_nelmts,
+ filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name);
f_name[sizeof(f_name)-1] = '\0';
sprintf(s, "Filter-%d:", i);
@@ -1603,7 +1618,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
printf("\n");
/* Print address information */
- if (address_g) H5Ddebug(dset, 0);
+ if (address_g) H5Ddebug(dset);
/* Close stuff */
H5Tclose(type);
@@ -2005,7 +2020,6 @@ main (int argc, const char *argv[])
{
hid_t file=-1, root=-1;
char *fname=NULL, *oname=NULL, *x;
- const char *progname="h5ls";
const char *s = NULL;
char *rest, *container=NULL;
int argno;
@@ -2013,6 +2027,7 @@ main (int argc, const char *argv[])
iter_t iter;
static char root_name[] = "/";
char drivername[50];
+ const char *preferred_driver=NULL;
/* Initialize h5tools lib */
h5tools_init();
@@ -2043,7 +2058,7 @@ main (int argc, const char *argv[])
argno++;
break;
} else if (!strcmp(argv[argno], "--help")) {
- usage(progname);
+ usage();
leave(0);
} else if (!strcmp(argv[argno], "--address")) {
address_g = TRUE;
@@ -2064,22 +2079,24 @@ main (int argc, const char *argv[])
simple_output_g = TRUE;
} else if (!strcmp(argv[argno], "--string")) {
string_g = TRUE;
+ } else if (!strncmp(argv[argno], "--vfd=", 6)) {
+ preferred_driver = argv[argno]+6;
} else if (!strncmp(argv[argno], "--width=", 8)) {
width_g = (int)strtol(argv[argno]+8, &rest, 0);
if (width_g<=0 || *rest) {
- usage(progname);
+ usage();
leave(1);
}
} else if (!strcmp(argv[argno], "--width")) {
if (argno+1>=argc) {
- usage(progname);
+ usage();
leave(1);
} else {
s = argv[++argno];
}
width_g = (int)strtol(s, &rest, 0);
if (width_g<=0 || *rest) {
- usage(progname);
+ usage();
leave(1);
}
} else if (!strcmp(argv[argno], "--verbose")) {
@@ -2093,14 +2110,14 @@ main (int argc, const char *argv[])
if (argv[argno][2]) {
s = argv[argno]+2;
} else if (argno+1>=argc) {
- usage(progname);
+ usage();
leave(1);
} else {
s = argv[++argno];
}
width_g = (int)strtol(s, &rest, 0);
if (width_g<=0 || *rest) {
- usage(progname);
+ usage();
leave(1);
}
} else if ('-'!=argv[argno][1]) {
@@ -2109,7 +2126,7 @@ main (int argc, const char *argv[])
switch (*s) {
case '?':
case 'h': /* --help */
- usage(progname);
+ usage();
leave(0);
case 'a': /* --address */
address_g = TRUE;
@@ -2149,12 +2166,12 @@ main (int argc, const char *argv[])
hexdump_g = TRUE;
break;
default:
- usage(progname);
+ usage();
leave(1);
}
}
} else {
- usage(progname);
+ usage();
leave(1);
}
}
@@ -2162,7 +2179,7 @@ main (int argc, const char *argv[])
/* If no arguments remain then print a usage message (instead of doing
* absolutely nothing ;-) */
if (argno>=argc) {
- usage(progname);
+ usage();
leave(1);
}
@@ -2189,7 +2206,7 @@ main (int argc, const char *argv[])
file = -1;
while (fname && *fname) {
- file = h5tools_fopen(fname, NULL, drivername, sizeof drivername, argc, argv);
+ file = h5tools_fopen(fname, preferred_driver, drivername, sizeof drivername, argc, argv);
if (file>=0) {
if (verbose_g) {
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 73601d4..5d6a9c3 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -29,7 +29,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \
##
TEST_PROGS=h5repacktst
TEST_SCRIPTS=./h5repack.sh
-
+PRIV_PROGS=testh5repack_detect_szip
## These are our main targets: library and tools.
##
@@ -37,7 +37,7 @@ LIBHDF5=$(top_builddir)/src/libhdf5.la
LIBTOOLS=../lib/libh5tools.la
PUB_PROGS=h5repack
-PROGS=$(PUB_PROGS) $(TEST_PROGS)
+PROGS=$(PUB_PROGS) $(TEST_PROGS) $(PRIV_PROGS)
## Source and object files for the library; do not install
##
@@ -53,9 +53,10 @@ DISTCLEAN=h5repack.sh
## Source and object files for programs...
##
PROG_SRC=h5repack.c h5repack_copy.c h5repack_filters.c h5repack_refs.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c h5repack_verify.c testh5repack_attr.c testh5repack_dset.c testh5repack_main.c testh5repack_make.c testh5repack_util.c
-PROG_OBJ=$(PROG_SRC:.c=.lo)
OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_list.lo h5repack_main.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo
TEST_OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo testh5repack_attr.lo testh5repack_dset.lo testh5repack_main.lo testh5repack_make.lo testh5repack_util.lo
+DETECT_OBJS=testh5repack_detect_szip.lo
+PROG_OBJ=$(PROG_SRC:.c=.lo) $(DETECT_OBJS)
PRIVATE_HDR=
@@ -79,5 +80,8 @@ h5repack: $(OBJS)
h5repacktst: $(TEST_OBJS)
@$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+testh5repack_detect_szip: $(DETECT_OBJS)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(DETECT_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+
@CONCLUDE@
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 2710226..09d83b9 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -264,6 +264,9 @@ static int check_options(pack_opt_t *options)
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) {
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index e99888e..e4de4d3 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -21,7 +21,6 @@
#include "h5diff.h"
#include "h5tools.h"
-
#define H5FOPENERROR "unable to open file"
#define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/
@@ -252,6 +251,7 @@ int parse_number(char *str);
* tests
*-------------------------------------------------------------------------
*/
+
#define FNAME0 "test0.h5"
#define FNAME0OUT "test0.out.h5"
#define FNAME1 "test1.h5"
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index a65cb37..a21d608 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -14,8 +14,6 @@
#
# Tests for the h5repack tool
-# Determine if SZIP has the encoder available
-USE_FILTER_SZIP_ENCODER="@USE_FILTER_SZIP_ENCODER@"
USE_FILTER_SZIP="@USE_FILTER_SZIP@"
USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
@@ -28,6 +26,9 @@ H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary
H5DIFF=../h5diff/h5diff # The h5diff tool name
H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+H5DETECTSZIP=testh5repack_detect_szip # The tool name
+H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP # The path of the tool binary
+
nerrors=0
verbose=yes
@@ -123,8 +124,12 @@ TOOLTEST()
# See which filters are usable (and skip tests for filters we
# don't have). Do this by searching H5pubconf.h to see which
# filters are defined.
-# A filter value of 3 means the filter can read and write, 2
-# is read-only, 1 is write-only, and 0 is not present.
+
+# detect whether the encoder is present.
+USE_FILTER_SZIP_ENCODER="no";
+if test $USE_FILTER_SZIP = "yes"; then
+USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN`
+fi
# copy files (these files have no filters; test2.h5 has copied references that h5diff detects)
TOOLTEST test0.h5
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index a0fd1c9..c1ae54a 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -128,7 +128,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;
/*-------------------------------------------------------------------------
@@ -222,17 +222,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 */
@@ -241,7 +241,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
@@ -401,7 +400,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
@@ -557,7 +555,6 @@ error:
}
-
/*-------------------------------------------------------------------------
* Function: copy_attr
*
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 844ee5e..5d815c9 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_refs.c b/tools/h5repack/h5repack_refs.c
index dedad6b..748eca4 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_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_main.c b/tools/h5repack/testh5repack_main.c
index caa4ac9..6729174 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -40,6 +40,9 @@ int main (void)
{
pack_opt_t pack_options;
diff_opt_t diff_options;
+#if defined (H5_HAVE_FILTER_SZIP)
+ int szip_can_encode = 0;
+#endif
memset(&diff_options, 0, sizeof (diff_opt_t));
memset(&pack_options, 0, sizeof (pack_opt_t));
@@ -229,13 +232,17 @@ int main (void)
TESTING(" adding szip filter");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_can_encode = 1;
+}
/*-------------------------------------------------------------------------
* test an individual object option
*-------------------------------------------------------------------------
*/
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options)<0)
@@ -252,6 +259,9 @@ int main (void)
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
@@ -263,7 +273,8 @@ int main (void)
*/
TESTING(" adding szip filter to all");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("SZIP=8,NN",&pack_options)<0)
@@ -278,6 +289,9 @@ TESTING(" adding szip filter to all");
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
@@ -425,9 +439,11 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
#endif
-#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (szip_can_encode) {
if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options)<0)
TEST_ERROR;
+}
#endif
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -765,7 +781,8 @@ TESTING(" addding shuffle filter to all");
TESTING(" copy of szip filter");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME7,FNAME7OUT,&pack_options)<0)
@@ -778,13 +795,17 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
TESTING(" removing szip filter");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset_szip:NONE",&pack_options)<0)
@@ -799,6 +820,9 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
@@ -941,10 +965,11 @@ TESTING(" addding shuffle filter to all");
TESTING(" filter conversion from deflate to szip");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) \
+#if defined (H5_HAVE_FILTER_SZIP) \
&& defined (H5_HAVE_FILTER_DEFLATE) \
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options)<0)
@@ -959,16 +984,20 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
TESTING(" filter conversion from szip to deflate");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) \
+#if defined (H5_HAVE_FILTER_SZIP) \
&& defined (H5_HAVE_FILTER_DEFLATE) \
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
+if (szip_can_encode) {
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0)
@@ -983,6 +1012,9 @@ TESTING(" addding shuffle filter to all");
TEST_ERROR;
PASSED();
+} else {
+ SKIPPED();
+}
#else
SKIPPED();
#endif
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 3cf7c11..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,6 +377,7 @@ int make_szip(hid_t loc_id)
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
+ int szip_can_encode = 0;
for (i=n=0; i<DIM1; i++){
for (j=0; j<DIM2; j++){
@@ -393,13 +399,18 @@ int make_szip(hid_t loc_id)
*-------------------------------------------------------------------------
*/
/* Make sure encoding is enabled */
-#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_can_encode = 1;
+}
+if (szip_can_encode) {
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
goto out;
if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0)
goto out;
-#endif
+} else {
+ /* WARNING? SZIP is decoder only, can't generate test files */
+}
if(H5Sclose(sid)<0)
goto out;
@@ -415,6 +426,7 @@ out:
} H5E_END_TRY;
return -1;
}
+#endif /* H5_HAVE_FILTER_SZIP */
@@ -623,12 +635,17 @@ 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];
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++){
@@ -657,10 +674,17 @@ int make_all(hid_t loc_id)
goto out;
#endif
-#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_can_encode = 1;
+}
+if (szip_can_encode) {
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0)
goto out;
+} else {
+ /* WARNING? SZIP is decoder only, can't generate test data using szip */
+}
#endif
#if defined (H5_HAVE_FILTER_DEFLATE)
@@ -692,7 +716,8 @@ int make_all(hid_t loc_id)
*-------------------------------------------------------------------------
*/
/* Make sure encoding is enabled */
-#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP)
+#if defined (H5_HAVE_FILTER_SZIP)
+if (szip_can_encode) {
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
goto out;
@@ -701,6 +726,9 @@ int make_all(hid_t loc_id)
goto out;
if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0)
goto out;
+} else {
+ /* WARNING? SZIP is decoder only, can't generate test dataset */
+}
#endif
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index f5ba995..c48998f 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -55,7 +55,7 @@ hsize_t h5diff(const char *fname1,
int nobjects1, nobjects2;
trav_info_t *info1=NULL;
trav_info_t *info2=NULL;
- hid_t file1_id, file2_id;
+ hid_t file1_id=(-1), file2_id=(-1);
hsize_t nfound=0;
if (options->m_quiet &&
@@ -414,10 +414,10 @@ hsize_t diff( hid_t file1_id,
diff_opt_t *options,
H5G_obj_t1 type )
{
- hid_t type1_id;
- hid_t type2_id;
- hid_t grp1_id;
- hid_t grp2_id;
+ hid_t type1_id=(-1);
+ hid_t type2_id=(-1);
+ hid_t grp1_id=(-1);
+ hid_t grp2_id=(-1);
int ret;
H5G_stat_t sb1;
H5G_stat_t sb2;
@@ -436,7 +436,7 @@ hsize_t diff( hid_t file1_id,
/* always print name */
if (options->m_verbose)
{
- if (print_objname(options,1))
+ if (print_objname(options,(hsize_t)1))
printf( "Dataset: <%s> and <%s>\n",path1,path2);
nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 4caf60f..bb24fe0 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -337,7 +337,6 @@ hsize_t diff_long(unsigned char *mem1,
const char *obj2,
int *ph);
-
hsize_t diff_ulong(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 1265864..0e222dd 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -18,11 +18,7 @@
/* local functions */
-#ifdef H5_WANT_H5_V1_4_COMPAT
-static void close_obj(int obj_type, hid_t obj_id);
-#else /* H5_WANT_H5_V1_4_COMPAT */
-static void close_obj(H5G_obj_t obj_type, hid_t obj_id);
-#endif /* H5_WANT_H5_V1_4_COMPAT */
+static void close_obj(H5G_obj_t1 obj_type, hid_t obj_id);
static int diff_region(hid_t region1_id, hid_t region2_id);
static hbool_t is_zero(const void *_mem, size_t size);
@@ -258,13 +254,8 @@ hsize_t diff_datum(void *_mem1,
size_t size;
int iszero1;
int iszero2;
-#ifdef H5_WANT_H5_V1_4_COMPAT
- int obj1_type;
- int obj2_type;
-#else /* H5_WANT_H5_V1_4_COMPAT */
- H5G_obj_t obj1_type;
- H5G_obj_t obj2_type;
-#endif /* H5_WANT_H5_V1_4_COMPAT */
+ H5G_obj_t1 obj1_type;
+ H5G_obj_t1 obj2_type;
hid_t obj1_id;
hid_t obj2_id;
H5G_stat_t sb1;
@@ -1723,13 +1714,8 @@ is_zero(const void *_mem, size_t size)
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_4_COMPAT
static
-void close_obj(int obj_type, hid_t obj_id)
-#else /* H5_WANT_H5_V1_4_COMPAT */
-static
-void close_obj(H5G_obj_t obj_type, hid_t obj_id)
-#endif /* H5_WANT_H5_V1_4_COMPAT */
+void close_obj(H5G_obj_t1 obj_type, hid_t obj_id)
{
switch (obj_type) {
@@ -3041,7 +3027,7 @@ hsize_t diff_long(unsigned char *mem1,
memcpy(&temp1_long, mem1, sizeof(long));
memcpy(&temp2_long, mem2, sizeof(long));
- if (labs(temp1_long-temp2_long) > options->delta)
+ if (labs(temp1_long-temp2_long) > (long)options->delta)
{
if ( print_data(options) )
{
@@ -3098,7 +3084,7 @@ hsize_t diff_long(unsigned char *mem1,
memcpy(&temp2_long, mem2, sizeof(long));
if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent &&
- labs(temp1_long-temp2_long) > options->delta )
+ labs(temp1_long-temp2_long) > (long)options->delta )
{
if ( print_data(options) )
{
@@ -3184,7 +3170,7 @@ hsize_t diff_ulong(unsigned char *mem1,
memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- if (labs(temp1_ulong-temp2_ulong) > options->delta)
+ if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta)
{
if ( print_data(options) )
{
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 675f3a1..fb4343f 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -12,9 +12,9 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include "h5tools.h"
#include "h5diff.h"
#include "H5private.h"
-#include "h5tools.h"
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 74e4e8c..60377c0 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -168,7 +168,13 @@ h5tools_close(void)
*-------------------------------------------------------------------------
*/
static hid_t
-h5tools_get_fapl(const char *driver, unsigned *drivernum, int argc, const char *argv[])
+h5tools_get_fapl(const char *driver, unsigned *drivernum,
+#ifdef H5_HAVE_PARALLEL
+int argc, const char *argv[]
+#else /* H5_HAVE_PARALLEL */
+int UNUSED argc, const char UNUSED *argv[]
+#endif /* H5_HAVE_PARALLEL */
+)
{
hid_t fapl = H5P_DEFAULT;
@@ -180,6 +186,9 @@ h5tools_get_fapl(const char *driver, unsigned *drivernum, int argc, const char *
} else if (!strcmp(driver, drivernames[FAMILY_IDX])) {
/* FAMILY Driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS))>=0) {
+ /* Set member size to be 0 to indicate the current first member size
+ * is the member size.
+ */
H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT);
if(drivernum)
@@ -689,7 +698,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
herr_t ret; /*the value to return */
hid_t f_space; /*file data space */
int i; /*counters */
- hssize_t zero = 0; /*vector of zeros */
+ hsize_t zero = 0; /*vector of zeros */
unsigned int flags; /*buffer extent flags */
hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/
@@ -741,10 +750,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
count--) {
/* calculate the potential number of elements we're going to print */
H5Sselect_hyperslab(f_space, H5S_SELECT_SET,
- (hssize_t*)sset->start,
- (hsize_t*)sset->stride,
- (hsize_t*)sset->count,
- (hsize_t*)sset->block);
+ sset->start,
+ sset->stride,
+ sset->count,
+ sset->block);
sm_nelmts = H5Sget_select_npoints(f_space);
/*
@@ -850,10 +859,10 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
hid_t p_type, int indentlevel)
{
hid_t f_space; /*file data space */
- hsize_t elmtno; /*counter */
- int i; /*counter */
+ hsize_t elmtno; /*counter */
+ int i; /*counter */
int carry; /*counter carry value */
- hssize_t zero[8]; /*vector of zeros */
+ hsize_t zero[8]; /*vector of zeros */
unsigned int flags; /*buffer extent flags */
hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/
@@ -870,7 +879,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
hid_t sm_space; /*stripmine data space */
/* Hyperslab info */
- hssize_t hs_offset[H5S_MAX_RANK];/*starting offset */
+ hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */
hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
hsize_t hs_nelmts; /*elements in request */
@@ -987,12 +996,11 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
/* Calculate the next hyperslab offset */
-
for (i = ctx.ndims, carry = 1; i > 0 && carry; --i) {
ctx.p_min_idx[i - 1] = ctx.p_max_idx[i - 1];
hs_offset[i - 1] += hs_size[i - 1];
- if (hs_offset[i - 1] == (hssize_t)total_size[i - 1])
+ if (hs_offset[i - 1] == total_size[i - 1])
hs_offset[i - 1] = 0;
else
carry = 0;
@@ -1037,7 +1045,7 @@ static int
h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
hid_t type, hid_t space, void *mem, int indentlevel)
{
- int i; /*counters */
+ int i; /*counters */
hsize_t nelmts; /*total selected elmts */
h5tools_context_t ctx; /*printing context */
@@ -1126,6 +1134,7 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
hid_t f_space;
hid_t p_type = _p_type;
hid_t f_type;
+ H5S_class_t space_type;
int status = FAIL;
h5dump_t info_dflt;
@@ -1155,15 +1164,18 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
/* Check the data space */
f_space = H5Dget_space(dset);
+ space_type = H5Sget_simple_extent_type(f_space);
+
/* Print the data */
- if (H5Sis_simple(f_space) > 0) {
+ if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) {
if (!sset)
status = h5tools_dump_simple_dset(rawdatastream, info, dset, p_type,
indentlevel);
else
status = h5tools_dump_simple_subset(rawdatastream, info, dset, p_type,
sset, indentlevel);
- }
+ } else /* space is H5S_NULL */
+ status = SUCCEED;
/* Close the dataspace */
H5Sclose(f_space);
@@ -1215,3 +1227,4 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type,
return h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem,
indentlevel);
}
+
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index f43941f..d5603f7 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -419,7 +419,7 @@ typedef struct h5tools_context_t {
/* a structure to hold the subsetting particulars for a dataset */
struct subset_t {
- hssize_t *start;
+ hsize_t *start;
hsize_t *stride;
hsize_t *count;
hsize_t *block;
@@ -463,8 +463,8 @@ extern FILE *rawdatastream; /*output stream for raw data */
#define NLINK "NLINK"
#define OBJID "OBJECTID"
#define OBJNO "OBJNO"
-#define SCALAR "SCALAR"
-#define SIMPLE "SIMPLE"
+#define S_SCALAR "SCALAR"
+#define S_SIMPLE "SIMPLE"
#define SOFTLINK "SOFTLINK"
#define STORAGELAYOUT "STORAGELAYOUT"
#define START "START"
@@ -508,5 +508,6 @@ extern void h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid
extern int h5tools_canreadf(const char* name,
hid_t dcpl_id);
+extern int h5tools_can_encode(H5Z_filter_t filtn);
#endif /* H5TOOLS_H__ */
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 3c0cb25..11ebae7 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -82,7 +82,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
switch (filtn)
{
-
/*-------------------------------------------------------------------------
* user defined filter
*-------------------------------------------------------------------------
@@ -91,7 +90,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
if (name)
print_warning(name,"user defined");
return 0;
- break;
+
/*-------------------------------------------------------------------------
* H5Z_FILTER_DEFLATE 1 , deflation like gzip
*-------------------------------------------------------------------------
@@ -147,5 +146,95 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
}
+/*-------------------------------------------------------------------------
+ * Function: h5tools_canwritef
+ *
+ * Purpose: check if the filter is available and can write data.
+ * At this time, all filters that are available can write data,
+ * except SZIP, which may be configured decoder-only.
+ *
+ * Return: 1, can write, 0, cannot, -1 error
+ *
+ * Programmer:
+ *
+ * Date: October 5, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5tools_can_encode( H5Z_filter_t filtn)
+{
-
+ int have_deflate=0; /* assume initially we do not have filters */
+ int have_szip=0;
+ int have_shuffle=0;
+ int have_fletcher=0;
+ unsigned int filter_config_flags;
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ have_deflate=1;
+#endif
+#ifdef H5_HAVE_FILTER_SZIP
+ have_szip=1;
+#endif
+#ifdef H5_HAVE_FILTER_SHUFFLE
+ have_shuffle=1;
+#endif
+#ifdef H5_HAVE_FILTER_FLETCHER32
+ have_fletcher=1;
+#endif
+
+ switch (filtn)
+ {
+ /* user defined filter */
+ default:
+ return 0;
+
+ case H5Z_FILTER_DEFLATE:
+ if (!have_deflate)
+ {
+ return 0;
+ }
+ break;
+ case H5Z_FILTER_SZIP:
+ if (!have_szip)
+ {
+ return 0;
+ }
+ if(H5Zget_filter_info(filtn, &filter_config_flags)<0)
+ return -1;
+ if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ /* filter present but neither encode nor decode is supported (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ /* decoder only: read but not write */
+ return 0;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ /* encoder only: write but not read (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ return 1;
+ }
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ if (!have_shuffle)
+ {
+ return 0;
+ }
+ break;
+ case H5Z_FILTER_FLETCHER32:
+ if (!have_fletcher)
+ {
+ return 0;
+ }
+ break;
+ }/*switch*/
+
+ return 1;
+}
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 4506994..87df63e 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -41,8 +41,7 @@ extern char *progname;
extern int d_status;
-struct ref_path_table_entry_t *ref_path_table = NULL; /* the table */
-int npte = 0; /* number of entries in the table */
+ref_path_table_entry_t *ref_path_table = NULL; /* the table */
/*-------------------------------------------------------------------------
* Function: ref_path_table_lookup
@@ -59,36 +58,22 @@ int npte = 0; /* number of entries in the table */
*
*-------------------------------------------------------------------------
*/
-struct ref_path_table_entry_t *
+ref_path_table_entry_t *
ref_path_table_lookup(const char *thepath)
{
- int i;
- hobj_ref_t *ref;
- herr_t status;
- struct ref_path_table_entry_t *pte = ref_path_table;
+ hobj_ref_t ref;
+ ref_path_table_entry_t *pte = ref_path_table;
if (ref_path_table == NULL)
return NULL;
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
-
- if (ref == NULL) {
+ if ( H5Rcreate(&ref, thefile, thepath, H5R_OBJECT, -1) < 0)
/* fatal error ? */
return NULL;
- }
-
- status = H5Rcreate(ref, thefile, thepath, H5R_OBJECT, -1);
- if (status < 0) {
- /* fatal error ? */
- return NULL;
- }
-
- for (i = 0; i < npte; i++) {
- if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
+ while(pte!=NULL) {
+ if(ref==pte->obj_ref)
return pte;
- }
-
pte = pte->next;
}
@@ -111,64 +96,43 @@ ref_path_table_lookup(const char *thepath)
*
*-------------------------------------------------------------------------
*/
-hobj_ref_t *
+ref_path_table_entry_t *
ref_path_table_put(hid_t obj, const char *path)
{
- hobj_ref_t *ref;
- H5G_stat_t *sb;
- herr_t status;
- struct ref_path_table_entry_t *pte;
+ ref_path_table_entry_t *pte;
/* look up 'obj'. If already in table, return */
pte = ref_path_table_lookup(path);
if (pte != NULL)
- return pte->obj_ref;
+ return pte;
/* if not found, then make new entry */
- pte = (struct ref_path_table_entry_t *)
- malloc(sizeof(struct ref_path_table_entry_t));
- if (pte == NULL) {
+ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t));
+ if (pte == NULL)
/* fatal error? */
return NULL;
- }
pte->obj = obj;
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
- if (ref == NULL) {
- /* fatal error? */
- free(pte);
- return NULL;
- }
- status = H5Rcreate(ref, thefile, path, H5R_OBJECT, -1);
- if (status < 0) {
+ if ( H5Rcreate(&pte->obj_ref, thefile, path, H5R_OBJECT, -1) < 0) {
/* fatal error? */
- free(ref);
free(pte);
return NULL;
}
- pte->obj_ref = ref;
-
pte->apath = HDstrdup(path);
- sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
- if (sb == NULL) {
+ if(H5Gget_objinfo(thefile, path, TRUE, &pte->statbuf)<0) {
/* fatal error? */
free(pte);
return NULL;
}
- H5Gget_objinfo(thefile, path, TRUE, sb);
-
- memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
pte->next = ref_path_table;
ref_path_table = pte;
- npte++;
-
- return ref;
+ return pte;
}
/*
@@ -197,66 +161,46 @@ get_fake_xid () {
* create a table entry with a fake object id as the key.
*/
-struct ref_path_table_entry_t *
+ref_path_table_entry_t *
ref_path_table_gen_fake(const char *path)
{
- union {
- hobj_ref_t rr;
- char cc[16];
- unsigned long ll[2];
- } uu;
- hobj_ref_t *ref;
- H5G_stat_t *sb;
- struct ref_path_table_entry_t *pte;
+ union {
+ hobj_ref_t rr;
+ char cc[16];
+ unsigned long ll[2];
+ } uu;
+ H5G_stat_t sb;
+ ref_path_table_entry_t *pte;
/* look up 'obj'. If already in table, return */
pte = ref_path_table_lookup(path);
- if (pte != NULL) {
+ if (pte != NULL)
return pte;
- }
/* if not found, then make new entry */
- pte = (struct ref_path_table_entry_t *)
- malloc(sizeof(struct ref_path_table_entry_t));
- if (pte == NULL) {
+ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t));
+ if (pte == NULL)
/* fatal error? */
return NULL;
- }
pte->obj = (hid_t)-1;
- sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
- if (sb == NULL) {
- /* fatal error? */
- free(pte);
- return NULL;
- }
- sb->objno[0] = (unsigned long)get_fake_xid();
- sb->objno[1] = (unsigned long)get_fake_xid();
+ sb.objno[0] = (unsigned long)get_fake_xid();
+ sb.objno[1] = (unsigned long)get_fake_xid();
- memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
+ memcpy(&pte->statbuf,&sb,sizeof(H5G_stat_t));
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
- if (ref == NULL) {
- free(pte);
- return NULL;
- }
-
- uu.ll[0] = sb->objno[0];
- uu.ll[1] = sb->objno[1];
-
- memcpy((char *)ref,(char *)&uu.rr,sizeof(ref));
+ uu.ll[0] = sb.objno[0];
+ uu.ll[1] = sb.objno[1];
- pte->obj_ref = ref;
+ memcpy(&pte->obj_ref,(char *)&uu.rr,sizeof(pte->obj_ref));
pte->apath = HDstrdup(path);
pte->next = ref_path_table;
ref_path_table = pte;
- npte++;
-
return pte;
}
@@ -273,24 +217,14 @@ ref_path_table_gen_fake(const char *path)
*
*-------------------------------------------------------------------------
*/
-char*
-lookup_ref_path(hobj_ref_t * ref)
+char *
+lookup_ref_path(hobj_ref_t ref)
{
- int i;
- struct ref_path_table_entry_t *pte = NULL;
+ ref_path_table_entry_t *pte = ref_path_table;
- if (ref_path_table == NULL)
- return NULL;
-
- pte = ref_path_table;
- if (pte == NULL) {
- /* fatal -- not initialized? */
- return NULL;
- }
- for (i = 0; i < npte; i++) {
- if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
+ while(pte!=NULL) {
+ if (ref==pte->obj_ref)
return pte->apath;
- }
pte = pte->next;
}
return NULL;
@@ -316,7 +250,7 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data)
hid_t obj;
char *tmp;
H5G_stat_t statbuf;
- struct ref_path_table_entry_t *pte;
+ ref_path_table_entry_t *pte;
char *thepath;
H5Gget_objinfo(group, name, FALSE, &statbuf);
@@ -342,12 +276,11 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data)
case H5G_DATASET:
if ((obj = H5Dopen(group, name)) >= 0) {
pte = ref_path_table_lookup(thepath);
- if (pte == NULL) {
+ if (pte == NULL)
ref_path_table_put(obj, thepath);
- }
H5Dclose(obj);
} else {
- error_msg(progname, "unable to get dataset \"%s\"\n", name);
+ error_msg(progname, "unable to get dataset \"%s\"\n", name);
d_status = EXIT_FAILURE;
}
break;
@@ -369,9 +302,8 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data)
case H5G_TYPE:
if ((obj = H5Topen(group, name)) >= 0) {
pte = ref_path_table_lookup(thepath);
- if (pte == NULL) {
+ if (pte == NULL)
ref_path_table_put(obj, thepath);
- }
H5Tclose(obj);
} else {
error_msg(progname, "unable to get dataset \"%s\"\n", name);
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index 5df2d38..35c1ce3 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -19,7 +19,7 @@
typedef struct ref_path_table_entry_t {
hid_t obj;
- hobj_ref_t *obj_ref;
+ hobj_ref_t obj_ref;
char *apath;
H5G_stat_t statbuf;
struct ref_path_table_entry_t *next;
@@ -29,12 +29,12 @@ typedef struct ref_path_table_entry_t {
extern "C" {
#endif
-char* lookup_ref_path(hobj_ref_t * ref);
+char* lookup_ref_path(hobj_ref_t ref);
herr_t fill_ref_path_table(hid_t, const char *, void *);
int get_next_xid(void);
haddr_t get_fake_xid (void);
struct ref_path_table_entry_t *ref_path_table_lookup(const char *);
-hobj_ref_t *ref_path_table_put(hid_t, const char *);
+ref_path_table_entry_t *ref_path_table_put(hid_t obj, const char *path);
struct ref_path_table_entry_t *ref_path_table_gen_fake(const char *);
#ifdef __cplusplus
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 1bf3ec0..6e48190 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -885,8 +885,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
h5tools_str_append(str, info->obj_format,
sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]);
- /* Print name */
- path = lookup_ref_path(vp);
+ /* Print name */
+ path = lookup_ref_path(*(hobj_ref_t *)vp);
if (path) {
h5tools_str_append(str, " ");
h5tools_str_append(str, path);
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index babbac0..52916d7 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -511,7 +511,6 @@ int traverse( hid_t loc_id,
default:
- printf(" %-10s %s\n", "User defined object", path );
break;
}
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 4028d57..11a1806 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -1,4 +1,3 @@
-## HDF5 Library Makefile(.in)
##
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
@@ -12,6 +11,7 @@
## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
##
+## HDF5 Library Makefile(.in)
##
top_srcdir=@top_srcdir@
top_builddir=../..
@@ -35,7 +35,7 @@ LIBTOOLS=../lib/libh5tools.la
LIBHDF5=$(top_builddir)/src/libhdf5.la
## h5cc is generated by configure. Remove it only when distclean.
-BUILD_PROGS=h5debug h5redeploy h5repart @PDB2HDF@
+BUILD_PROGS=h5debug h5redeploy h5repart @PDB2HDF@
PUB_PROGS=h5cc $(BUILD_PROGS)
PROGS=$(BUILD_PROGS) $(TEST_PROGS)
DISTCLEAN=h5cc
@@ -48,7 +48,7 @@ PUB_LIB=
## Source and object files for programs...
##
-PROG_SRC=h5debug.c h5repart.c pdb2hdf.c
+PROG_SRC=h5debug.c h5repart.c pdb2hdf.c
PROG_OBJ=$(PROG_SRC:.c=.lo)
PRIVATE_HDR=
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 5a157b1..9257bb3 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -278,8 +278,8 @@ if test "x$do_link" = "xyes"; then
fi
if test "x$USE_SHARED_LIB" != "xyes"; then
- # The "-lhdf5" & "-lhdf5_hl" flag is in here already...This is a static compile,
- # though, so change it to the static version (.a) of the library.
+ # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static
+ # compile though, so change it to the static version (.a) of the library.
new_libraries=""
for lib in $libraries; do
case "$lib" in
@@ -288,8 +288,8 @@ if test "x$do_link" = "xyes"; then
;;
-lhdf5_hl)
new_libraries="$new_libraries ${libdir}/libhdf5_hl.a"
- ;;
- *)
+ ;;
+ *)
new_libraries="$new_libraries $lib"
;;
esac
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index e215036..466279c 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -69,7 +69,8 @@ main(int argc, char *argv[])
H5F_t *f;
haddr_t addr=0, extra=0;
uint8_t sig[16];
- int i, ndims;
+ int i;
+ unsigned ndims;
herr_t status = SUCCEED;
if (argc == 1) {
@@ -129,7 +130,7 @@ main(int argc, char *argv[])
/*
* Debug the boot block.
*/
- status = H5F_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
+ status = H5F_debug(f, H5P_DATASET_XFER_DEFAULT, stdout, 0, VCOL);
} else if (!HDmemcmp(sig, H5HL_MAGIC, H5HL_SIZEOF_MAGIC)) {
/*
@@ -163,7 +164,7 @@ main(int argc, char *argv[])
break;
case H5B_ISTORE_ID:
- ndims = (int)extra;
+ ndims = (unsigned)extra;
status = H5D_istore_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims);
break;
diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls
index 3fc1a7d..94a9976 100644
--- a/tools/testfiles/help-1.ls
+++ b/tools/testfiles/help-1.ls
@@ -16,6 +16,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
OBJECTS
diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls
index 5b68c4d..ee7de9e 100644
--- a/tools/testfiles/help-2.ls
+++ b/tools/testfiles/help-2.ls
@@ -16,6 +16,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
OBJECTS
diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls
index 4d1e103..65c0bd8 100644
--- a/tools/testfiles/help-3.ls
+++ b/tools/testfiles/help-3.ls
@@ -16,6 +16,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-wN, --width=N Set the number of columns of output
-v, --verbose Generate more verbose output
-V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
-x, --hexdump Show raw data in hexadecimal format
OBJECTS