diff options
Diffstat (limited to 'tools')
33 files changed, 185 insertions, 479 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index cbe67a3..4ef6bdf 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -628,7 +628,6 @@ usage(const char *prog) fprintf(stdout, "\n"); } - /*------------------------------------------------------------------------- * Function: print_datatype * @@ -957,7 +956,6 @@ print_datatype(hid_t type,unsigned in_group) } - /*------------------------------------------------------------------------- * Function: dump_datatype * @@ -2036,7 +2034,6 @@ dump_oid(hid_t oid) printf("%s %s %d %s\n", OBJID, BEGIN, oid, END); } - /*------------------------------------------------------------------------- * Function: dump_comment * @@ -2429,7 +2426,6 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indent -= COL; indentation(indent + COL); printf("%s\n",END); - } /*------------------------------------------------------------------------- @@ -2453,27 +2449,15 @@ dump_fcpl(hid_t fid) 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 */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int super; /* superblock version # */ - int freelist; /* free list version # */ - int stab; /* symbol table entry version # */ - int shhdr; /* shared object header version # */ -#else unsigned super; /* superblock version # */ unsigned freelist; /* free list version # */ unsigned stab; /* symbol table entry version # */ unsigned shhdr; /* shared object header version # */ -#endif hid_t fdriver; /* file driver */ char dname[15]; /* buffer to store driver name */ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int sym_ik; /* symbol table B-tree initial 'K' value */ - int istore_ik; /* indexed storage B-tree initial 'K' value */ -#else - unsigned sym_ik; /* symbol table B-tree initial 'K' value */ - unsigned istore_ik; /* indexed storage B-tree initial 'K' value */ -#endif + unsigned sym_ik; /* symbol table B-tree internal 'K' value */ + unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ fcpl=H5Fget_create_plist(fid); H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); @@ -2492,19 +2476,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", (int)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); @@ -2550,7 +2534,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); /*------------------------------------------------------------------------- @@ -2609,10 +2593,6 @@ static void dump_fcontents(hid_t fid) } - - - - /*------------------------------------------------------------------------- * Function: set_output_file * @@ -2756,7 +2736,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++; @@ -3285,7 +3265,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; @@ -3487,11 +3467,9 @@ main(int argc, const char *argv[]) H5Giterate(fid, "/", NULL, fill_ref_path_table, NULL); H5Gclose(gid); - if (doxml) { /* initialize XML */ - /* reset prefix! */ strcpy(prefix, ""); @@ -3743,290 +3721,6 @@ print_enum(hid_t type) printf("\n%*s <empty>", indent + 4, ""); } -#if 0 - -/* - * XML support - */ - -/* - * XML needs a table to look up a path name for an object - * reference. - * - * This table stores mappings of reference -> path - * for all objects in the file that may be the target of - * an object reference. - * - * The 'path' is an absolute path by which the object - * can be accessed. When an object has > 1 such path, - * only one will be used in the table, with no particular - * method of selecting which one. - */ - - -ref_path_table_entry_t *ref_path_table = NULL; /* the table */ - -/*------------------------------------------------------------------------- - * Function: ref_path_table_lookup - * - * Purpose: Looks up a table entry given a path name. - * Used during construction of the table. - * - * Return: The table entre (pte) or NULL if not in the - * table. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static ref_path_table_entry_t * -ref_path_table_lookup(const char *thepath) -{ - H5G_stat_t sb; - ref_path_table_entry_t *pte = ref_path_table; - - if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) { - /* fatal error ? */ - return NULL; - } - - while(pte!=NULL) { - if (sb.objno==pte->statbuf.objno) - return pte; - pte = pte->next; - } - - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: ref_path_table_put - * - * Purpose: Enter the 'obj' with 'path' in the table if - * not already there. - * Create an object reference, pte, and store them - * in the table. - * - * Return: The object reference for the object. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static ref_path_table_entry_t * -ref_path_table_put(hid_t obj, const char *path) -{ - 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; - - /* if not found, then make new entry */ - - pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { - /* fatal error? */ - return NULL; - } - - pte->obj = obj; - - pte->apath = HDstrdup(path); - - if(H5Gget_objinfo(thefile, path, TRUE, &pte->statbuf)<0) { - /* fatal error? */ - free(pte); - return NULL; - } - - pte->next = ref_path_table; - ref_path_table = pte; - - return pte; -} - -/* - * counter used to disambiguate multiple instances of same object. - */ -static int xid = 1; - -static int get_next_xid() { - return xid++; -} - -/* - * This counter is used to create fake object ID's - * The idea is to set it to the largest possible offest, which - * minimizes the chance of collision with a real object id. - * - */ -haddr_t fake_xid = HADDR_MAX; -static haddr_t -get_fake_xid () { - return (fake_xid--); -} - -/* - * for an object that does not have an object id (e.g., soft link), - * create a table entry with a fake object id as the key. - */ - -static ref_path_table_entry_t * -ref_path_table_gen_fake(const char *path) -{ - 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; - } - - /* if not found, then make new entry */ - - 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; - - memset(&pte->statbuf,0,sizeof(H5G_stat_t)); - pte->statbuf.objno = get_fake_xid(); - - pte->apath = HDstrdup(path); - - pte->next = ref_path_table; - ref_path_table = pte; - - return pte; -} - -/*------------------------------------------------------------------------- - * Function: lookup_ref_path - * - * Purpose: Lookup the path to the object with refernce 'ref'. - * - * Return: Return a path to the object, or NULL if not found. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -char * -lookup_ref_path(hobj_ref_t ref) -{ - ref_path_table_entry_t *pte = ref_path_table; - - while(pte!=NULL) { - if (ref==pte->statbuf.objno) - return pte->apath; - pte = pte->next; - } - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: fill_ref_path_table - * - * Purpose: Called by interator to create references for - * all objects and enter them in the table. - * - * Return: Error status. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) -{ - hid_t obj; - char *tmp; - H5G_stat_t statbuf; - ref_path_table_entry_t *pte; - char *thepath; - - H5Gget_objinfo(group, name, FALSE, &statbuf); - tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (tmp == NULL) - return FAIL; - - thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (thepath == NULL) { - free(tmp); - return FAIL; - } - - strcpy(tmp, prefix); - - strcpy(thepath, prefix); - strcat(thepath, "/"); - strcat(thepath, name); - - switch (statbuf.type) { - case H5G_DATASET: - if ((obj = H5Dopen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Dclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_GROUP: - if ((obj = H5Gopen(group, name)) >= 0) { - strcat(strcat(prefix, "/"), name); - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL); - strcpy(prefix, tmp); - } - H5Gclose(obj); - } else { - error_msg(progname, "unable to dump group \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_TYPE: - if ((obj = H5Topen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Tclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - default: - break; - } - - free(tmp); - free(thepath); - return 0; -} - -#endif /* * create a string suitable for and XML NCNAME. Uses the @@ -4040,21 +3734,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_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return 0; } else { return 1; @@ -4062,9 +3752,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_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return 0; } else { return 1; @@ -4072,7 +3761,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } - sprintf(os, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return(0); } @@ -4793,7 +4482,7 @@ xml_dump_dataspace(hid_t space) default: printf("<!-- unknown dataspace -->\n"); } - + indentation(indent + COL); printf("</%sDataspace>\n", xmlnsprefix); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b2a5208..26521c6 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -272,9 +272,9 @@ static void gent_dataset(void) dset2[i][j] = 0.0001*j+i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + H5Sclose(space); H5Dclose(dataset); - H5Fclose(fid); } @@ -382,10 +382,10 @@ static void gent_attribute(void) H5Tset_size(type, 17); attr = H5Acreate (root, "attr5", type, space, H5P_DEFAULT); H5Awrite(attr, type, string); + + H5Tclose(type); H5Sclose(space); H5Aclose(attr); - - H5Tclose(type); H5Gclose(root); H5Fclose(fid); } @@ -1358,7 +1358,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; @@ -1657,11 +1657,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 */ @@ -1724,7 +1724,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); @@ -3077,7 +3077,7 @@ static void gent_char(void) * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * - * Return: + * Return: void * * Programmer: pvn@ncsa.uiuc.edu * @@ -3517,7 +3517,7 @@ static void write_attr_in(hid_t loc_id, * * Purpose: write datasets in LOC_ID * - * Return: + * Return: void * * Programmer: pvn@ncsa.uiuc.edu * @@ -3984,8 +3984,8 @@ static void write_dset_in(hid_t loc_id, static void gent_attr_all(void) { - hid_t file_id; - hid_t dset_id; + hid_t file_id; + hid_t dset_id; hid_t group_id; hid_t group2_id; hid_t root_id; @@ -4432,8 +4432,6 @@ int make_dset(hid_t loc_id, - - /*------------------------------------------------------------------------- * Function: make_external * @@ -4806,7 +4804,6 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) return(SUCCEED); } - /*------------------------------------------------------------------------- * Function: gent_fcontents * @@ -5258,8 +5255,6 @@ static void gent_aindices(void) } - - /*------------------------------------------------------------------------- * Function: main * @@ -5322,3 +5317,4 @@ int main(void) return 0; } + diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 24fa908..6efc47c 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -112,7 +112,7 @@ TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets TOOLTEST tdset-1.ddl tdset.h5 # test for displaying selected datasets -TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 tdset.h5 +TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 # test for displaying attributes TOOLTEST tattr-1.ddl tattr.h5 diff --git a/tools/h5dump/testh5dumpxml.sh b/tools/h5dump/testh5dumpxml.sh index 6af3836..c2fa23f 100755 --- a/tools/h5dump/testh5dumpxml.sh +++ b/tools/h5dump/testh5dumpxml.sh @@ -62,8 +62,13 @@ TOOLTEST() { $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err cat $actual_err >> $actual - - if $CMP $expect $actual; then + + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then echo " PASSED" else echo "*FAILED*" 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 d78e28c..7d3301b 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 20378e5..ad54e5e 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 ab88f4d..75f4a64 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/h5ls.c b/tools/h5ls/h5ls.c index 1514ca6..9ddabab 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\ @@ -1356,6 +1356,10 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) /* null dataspace */ puts(" null"); break; + default: + /* Unknown dataspace type */ + puts(" unknown"); + break; } /* Data type */ @@ -2022,7 +2026,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; @@ -2061,7 +2064,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; @@ -2087,19 +2090,19 @@ main (int argc, const char *argv[]) } 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")) { @@ -2113,14 +2116,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]) { @@ -2129,7 +2132,7 @@ main (int argc, const char *argv[]) switch (*s) { case '?': case 'h': /* --help */ - usage(progname); + usage(); leave(0); case 'a': /* --address */ address_g = TRUE; @@ -2169,12 +2172,12 @@ main (int argc, const char *argv[]) hexdump_g = TRUE; break; default: - usage(progname); + usage(); leave(1); } } } else { - usage(progname); + usage(); leave(1); } } @@ -2182,7 +2185,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); } diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 4120b4d..5d6a9c3 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -27,7 +27,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \ ## Test programs and scripts. ## -TEST_PROGS=h5repacktst +TEST_PROGS=h5repacktst TEST_SCRIPTS=./h5repack.sh PRIV_PROGS=testh5repack_detect_szip diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 14779c5..09d83b9 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -243,6 +243,7 @@ int h5repack_addlayout(const char* str, static int check_options(pack_opt_t *options) { int i, k, j, has_cp=0, has_ck=0; + char slayout[30]; /*------------------------------------------------------------------------- * objects to layout @@ -252,7 +253,22 @@ static int check_options(pack_opt_t *options) { printf("Objects to modify layout are...\n"); if (options->all_layout==1) { - printf(" Apply layout to all\n "); + switch (options->layout_g) + { + case H5D_COMPACT: + strcpy(slayout,"compact"); + break; + case H5D_CONTIGUOUS: + strcpy(slayout,"contiguous"); + break; + case H5D_CHUNKED: + strcpy(slayout,"chunked"); + break; + default: + strcpy(slayout,"unknown"); + break; + } + printf(" Apply %s layout to all\n", slayout); if (H5D_CHUNKED==options->layout_g) { printf("with dimension ["); for ( j = 0; j < options->chunk_g.rank; j++) @@ -336,7 +352,6 @@ static int check_options(pack_opt_t *options) has_cp=1; - } /* j */ } /* i */ @@ -345,6 +360,8 @@ static int check_options(pack_opt_t *options) is present with other objects\n"); return -1; } + + return 0; } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 9a73919..42b6701 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -142,7 +142,7 @@ int copy_objects(const char* fnamein, pack_opt_t *options) { hid_t fidin; - hid_t fidout; + hid_t fidout=(-1); trav_table_t *travt=NULL; /*------------------------------------------------------------------------- @@ -215,9 +215,6 @@ out: return -1; } - - - /*------------------------------------------------------------------------- * Function: do_copy_objects * @@ -239,17 +236,17 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* group ID */ - hid_t grp_out; /* group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t type_out; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t dcpl_out; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* group ID */ + hid_t grp_out=(-1); /* group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t type_out=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t dcpl_out=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -258,7 +255,6 @@ int do_copy_objects(hid_t fidin, hsize_t dsize_in; /* input dataset size before filter */ int next; /* external files */ int i, j; - int wrote=0; /*------------------------------------------------------------------------- * copy the suppplied object list @@ -418,7 +414,6 @@ int do_copy_objects(hid_t fidin, if (dsize_in && nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - wrote=1; } /*------------------------------------------------------------------------- * copy attrs diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index f594763..43b7dcc 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -73,15 +73,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis pack_info_t *obj /*OUT*/) /* info about object to filter */ { - int index, i; + int idx, i; pack_info_t tmp; init_packobject(&tmp); - index = aux_find_obj(name,options,&tmp); + idx = aux_find_obj(name,options,&tmp); /* name was on input */ - if (index>=0) + if (idx>=0) { /* applying to all objects */ @@ -102,13 +102,13 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } else { - tmp.layout = options->op_tbl->objs[index].layout; + tmp.layout = options->op_tbl->objs[idx].layout; switch (tmp.layout) { case H5D_CHUNKED: - tmp.chunk.rank = options->op_tbl->objs[index].chunk.rank; + tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[index].chunk.chunk_lengths[i]; + tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; default: break; @@ -125,15 +125,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } /* if all */ else { - tmp.nfilters=options->op_tbl->objs[index].nfilters; + tmp.nfilters=options->op_tbl->objs[idx].nfilters; for ( i=0; i<tmp.nfilters; i++) { - tmp.filter[i] = options->op_tbl->objs[index].filter[i]; + tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; } } - } /* if index */ + } /* if idx */ /* no input name */ diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 38b8bc0..3f65e63 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -168,7 +168,6 @@ out: - /*------------------------------------------------------------------------- * Function: print_objlist * diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 6bca10e..d9c5e3a 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -187,4 +187,3 @@ void usage(void) } - diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index f093d12..28c6c0b 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -52,15 +52,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* read group ID */ - hid_t grp_out; /* write group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* read group ID */ + hid_t grp_out=(-1); /* write group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 9e6514f..4f12c40 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -38,14 +38,14 @@ */ -void main(void) +int main(void) { #ifdef H5_HAVE_FILTER_SZIP - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - printf("yes\n"); - exit(1); - } + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + printf("yes\n"); + return(1); + } #endif /* H5_HAVE_FILTER_SZIP */ - printf("no\n"); - exit(0); + printf("no\n"); + return(0); } diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 4666753..299c044 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -638,7 +638,7 @@ static void make_dset_reg_ref(hid_t loc_id) hid_t sid2; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index 6149bd9..65a1c4a 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -27,7 +27,9 @@ int make_attributes(hid_t loc_id); int make_hlinks(hid_t loc_id); int make_early(void); int make_layout(hid_t loc_id); +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id); +#endif /* H5_HAVE_FILTER_SZIP */ int make_deflate(hid_t loc_id); int make_shuffle(hid_t loc_id); int make_fletcher32(hid_t loc_id); @@ -113,12 +115,14 @@ int make_testfiles(void) * create a file with the SZIP filter *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) return -1; if (make_szip(loc_id)<0) goto out; if(H5Fclose(loc_id)<0) return -1; +#endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- * create a file with the deflate filter @@ -362,6 +366,7 @@ int make_hlinks(hid_t loc_id) * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -372,9 +377,7 @@ int make_szip(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; -#if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; -#endif for (i=n=0; i<DIM1; i++){ for (j=0; j<DIM2; j++){ @@ -396,7 +399,6 @@ int make_szip(hid_t loc_id) *------------------------------------------------------------------------- */ /* Make sure encoding is enabled */ -#if defined (H5_HAVE_FILTER_SZIP) if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_can_encode = 1; } @@ -409,7 +411,6 @@ if (szip_can_encode) { } else { /* WARNING? SZIP is decoder only, can't generate test files */ } -#endif if(H5Sclose(sid)<0) goto out; @@ -425,6 +426,7 @@ out: } H5E_END_TRY; return -1; } +#endif /* H5_HAVE_FILTER_SZIP */ @@ -633,8 +635,10 @@ int make_all(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ +#if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; +#endif /* H5_HAVE_FILTER_SZIP */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index c271f21..592b016 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_t 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 b4ec0b5..4a29259 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -238,7 +238,6 @@ hsize_t diff_datum(void *_mem1, - hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, @@ -373,5 +372,4 @@ hsize_t diff_ullong(unsigned char *mem1, - #endif /* H5DIFF_H__ */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 6008278..f1c4a74 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3027,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) ) { @@ -3084,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) ) { @@ -3170,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/h5tools.c b/tools/lib/h5tools.c index 801f83c..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; @@ -692,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*/ @@ -744,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); /* @@ -856,7 +862,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, 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*/ @@ -873,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 */ @@ -994,7 +1000,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, 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; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 93f926e..9254359 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; diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 3370409..9c816cd 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -94,7 +94,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 *------------------------------------------------------------------------- @@ -172,7 +172,6 @@ int h5tools_can_encode( H5Z_filter_t filtn) int have_szip=0; int have_shuffle=0; int have_fletcher=0; - herr_t status; unsigned int filter_config_flags; #ifdef H5_HAVE_FILTER_DEFLATE @@ -193,7 +192,7 @@ int h5tools_can_encode( H5Z_filter_t filtn) /* user defined filter */ default: return 0; - break; + case H5Z_FILTER_DEFLATE: if (!have_deflate) { @@ -205,7 +204,8 @@ int h5tools_can_encode( H5Z_filter_t filtn) { return 0; } - status =H5Zget_filter_info(filtn, &filter_config_flags); + 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 (???) */ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 7dcccad..b607d7d 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -41,7 +41,6 @@ extern char *progname; extern int d_status; - ref_path_table_entry_t *ref_path_table = NULL; /* the table */ /*------------------------------------------------------------------------- @@ -65,10 +64,9 @@ ref_path_table_lookup(const char *thepath) H5G_stat_t sb; ref_path_table_entry_t *pte = ref_path_table; - if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) { + if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) /* fatal error ? */ return NULL; - } while(pte!=NULL) { if (sb.objno==pte->statbuf.objno) @@ -108,10 +106,9 @@ ref_path_table_put(hid_t obj, const char *path) /* if not found, then make new entry */ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { + if (pte == NULL) /* fatal error? */ return NULL; - } pte->obj = obj; @@ -158,21 +155,19 @@ get_fake_xid () { ref_path_table_entry_t * ref_path_table_gen_fake(const char *path) { - 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) { + if (pte != NULL) return pte; - } /* if not found, then make new entry */ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { + if (pte == NULL) /* fatal error? */ return NULL; - } pte->obj = (hid_t)-1; @@ -259,9 +254,8 @@ 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); @@ -286,9 +280,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 2f5fa83..f4a5941 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -19,7 +19,6 @@ typedef struct ref_path_table_entry_t { hid_t obj; - hobj_ref_t *obj_ref; char *apath; H5G_stat_t statbuf; struct ref_path_table_entry_t *next; @@ -29,7 +28,6 @@ typedef struct ref_path_table_entry_t { extern "C" { #endif - char* lookup_ref_path(hobj_ref_t ref); herr_t fill_ref_path_table(hid_t, const char *, void *); int get_next_xid(void); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index 53a3505..1ef2579 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -45,3 +45,4 @@ h5tools_get_native_type(hid_t type) return(p_type); } + diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index e2e6364..9257bb3 100755 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -247,14 +247,13 @@ if test "x$do_compile" = "xyes"; then fi fi - if test "x$do_link" = "xyes"; then shared_link="" # conditionnaly link with the hl library if test "X$HL" = "Xhl"; then libraries=" $libraries -lhdf5_hl -lhdf5 " else - libraries=" $libraries -lhdf5 " + libraries=" $libraries -lhdf5 " fi link_args="$link_args -L${libdir}" diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 487d1e9..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) { @@ -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/misc/h5repart.c b/tools/misc/h5repart.c index 2c72852..0518a76 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -208,8 +208,7 @@ main (int argc, char *argv[]) int dst_is_family; /*is dst name a family name? */ int dst_membno=0; /*destination member number */ -#ifdef WIN32 - +#if defined(WIN32) && ! defined (__MWERKS__) _int64 left_overs=0; /*amount of zeros left over */ _int64 src_offset=0; /*offset in source member */ _int64 dst_offset=0; /*offset in destination member */ diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl index 8bb18f2..93c961c 100644 --- a/tools/testfiles/tdset-2.ddl +++ b/tools/testfiles/tdset-2.ddl @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5dump -H -d dset1 -d /dset2 tdset.h5' +Expected output for 'h5dump -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5' ############################# HDF5 "tdset.h5" { DATASET "dset1" { @@ -10,4 +10,7 @@ DATASET "/dset2" { DATATYPE H5T_IEEE_F64BE DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) } } +DATASET "dset3" { + } } +h5dump error: unable to open dataset "dset3" |