diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 18 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 55 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 5 |
3 files changed, 67 insertions, 11 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 3ba8e9d..e6a1bf1 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -35,9 +35,9 @@ const char *progname = "h5dump"; int d_status = EXIT_SUCCESS; static int unamedtype = 0; /* shared data type with no name */ -static size_t prefix_len = 1024; +extern size_t prefix_len; static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -char *prefix; +extern char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ static const dump_header *dump_header_format; @@ -825,7 +825,7 @@ print_datatype(hid_t type,unsigned in_group) if (H5Tequal(tmp_type, str_type)) { printf("H5T_C_S1;\n"); goto done; - } + } /* If not equal to C variable-length string, check Fortran type. */ H5Tclose(str_type); @@ -3734,15 +3734,15 @@ print_enum(hid_t type) for (j = 0; j < dst_size; j++) printf("%02x", value[i * dst_size + j]); } else if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value+i*dst_size; HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *) ((void *)copy))); } else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value+i*dst_size; HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d", *((long_long *) ((void *)copy))); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b01d87a..ab3b69e 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -77,6 +77,7 @@ #define FILE48 "tfvalues.h5" #define FILE49 "tstr3.h5" #define FILE50 "taindices.h5" +#define FILE51 "tlonglinks.h5" @@ -195,6 +196,9 @@ typedef struct s1_t { /* Name of dataset to create in datafile */ #define F43_DSETNAME "Dataset" +/* "File 51" macros */ +#define F51_MAX_NAME_LEN ((64*1024)+1024) + static void gent_group(void) { hid_t fid, group; @@ -5310,6 +5314,56 @@ static void gent_aindices(void) assert(ret>=0); } +/*------------------------------------------------------------------------- + * Function: gent_longlinks + * + * Purpose: make file with very long names for objects + * + *------------------------------------------------------------------------- + */ +static void gent_longlinks(void) +{ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ + + /* Create files */ + fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid >= 0); + + /* Create group with short name in file (used as target for hard links) */ + gid=H5Gcreate(fid, "grp1", (size_t)0); + assert(gid >= 0); + + /* Construct very long file name */ + objname = HDmalloc((size_t)(F51_MAX_NAME_LEN + 1)); + assert(objname); + for(u = 0; u < F51_MAX_NAME_LEN; u++) + objname[u] = 'a'; + objname[F51_MAX_NAME_LEN] = '\0'; + + /* Create hard link to existing object */ + assert(H5Glink2(fid, "grp1", H5G_LINK_HARD, fid, objname) >= 0); + + /* Create soft link to existing object */ + objname[0] = 'b'; + assert(H5Glink2(fid, "grp1", H5G_LINK_SOFT, fid, objname) >= 0); + + /* Create group with long name in existing group */ + gid2=H5Gcreate(gid, objname, (size_t)0); + assert(gid2 >= 0); + + /* Close objects */ + assert(H5Gclose(gid2) >= 0); + assert(H5Gclose(gid) >= 0); + assert(H5Fclose(fid) >= 0); + + /* Release memory */ + HDfree(objname); +} + /*------------------------------------------------------------------------- * Function: main @@ -5369,6 +5423,7 @@ int main(void) gent_fcontents(); gent_string(); gent_aindices(); + gent_longlinks(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 5cd2e46..75cc68a 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -311,6 +311,9 @@ TOOLTEST tuserfilter.ddl -H -p -d myfilter tfilters.h5 # test for displaying dataset and attribute of null space TOOLTEST tnullspace.ddl tnullspace.h5 +# test for displaying objects with very long names +TOOLTEST tlonglinks.ddl tlonglinks.h5 + if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." @@ -318,5 +321,3 @@ fi exit $nerrors - - |