diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-02 15:31:30 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-02 15:31:30 (GMT) |
commit | d100f26a7ccb397e746ec1a3f97ec91fc8a4b978 (patch) | |
tree | 21bcbcad62293bf9c40bf3d9d3307d219b970d24 /tools | |
parent | ee3fbc240d7715f54a395d2ace95caa318214651 (diff) | |
download | hdf5-d100f26a7ccb397e746ec1a3f97ec91fc8a4b978.zip hdf5-d100f26a7ccb397e746ec1a3f97ec91fc8a4b978.tar.gz hdf5-d100f26a7ccb397e746ec1a3f97ec91fc8a4b978.tar.bz2 |
[svn-r8788] Purpose:
bug fix
Description:
the original code that showed a name for HARDLINK was reassigning that name to a name
made in the dump traversal (made by concatenation by nested objects)
Solution:
removed this reassigmnet
now the name showed after HARDLINK is always the first name found for that object
(this object is printed once interely; subsequent printings show the word HARDLINK
and the first name )
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dump.c | 13 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 208 | ||||
-rw-r--r-- | tools/testfiles/tattr-2.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/thlink-1.ddl | 6 | ||||
-rw-r--r-- | tools/testfiles/thlink-2.ddl | 4 | ||||
-rw-r--r-- | tools/testfiles/thlink-3.ddl | 4 | ||||
-rw-r--r-- | tools/testfiles/thlink-4.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tloop-1.ddl | 4 |
8 files changed, 136 insertions, 113 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 5f7eabc..96544d8 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1185,7 +1185,7 @@ dump_selected_attr(hid_t loc_id, const char *name) dump_oid(attr_id); if (display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, 0); + dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); H5Tclose(type); H5Sclose(space); @@ -1470,10 +1470,7 @@ dump_all(hid_t group, const char *name, void * op_data) goto done; } else { dset_table->objs[i].displayed = 1; - strcat(tmp, "/"); - strcat(tmp, name); - free(dset_table->objs[i].objname); - dset_table->objs[i].objname = HDstrdup(tmp); + } } @@ -1608,8 +1605,7 @@ dump_group(hid_t gid, const char *name) indentation(indent); printf("%s \"%s\"\n", HARDLINK, group_table->objs[i].objname); } else { - free(group_table->objs[i].objname); - group_table->objs[i].objname = HDstrdup(prefix); + group_table->objs[i].displayed = 1; H5Aiterate(gid, NULL, dump_attr, NULL); H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); @@ -2814,8 +2810,7 @@ handle_datasets(hid_t fid, char *dset, void *data) end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); } else { - free(dset_table->objs[idx].objname); - dset_table->objs[idx].objname = HDstrdup(dset); + dset_table->objs[idx].displayed = 1; dump_dataset(dsetid, dset, sset); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index c860ce0..665b242 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -70,10 +70,10 @@ #define FILE42 "tnamed_dtype_attr.h5" #define FILE43 "tvldtypes5.h5" #define FILE44 "tfilters.h5" +/* FILE45 not defined in this version */ #define FILE46 "tfcontents1.h5" #define FILE47 "tfcontents2.h5" -#define FILE48 "tfdriver1.h5" -#define FILE49 "tfdriver2.h5" +#define FILE48 "tfvalues.h5" /*------------------------------------------------------------------------- @@ -4676,8 +4676,6 @@ static void gent_filters(void) ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); assert(ret>=0); - - /*------------------------------------------------------------------------- * make an external dataset *------------------------------------------------------------------------- @@ -4685,59 +4683,11 @@ static void gent_filters(void) make_external(fid); /*------------------------------------------------------------------------- - * make datasets with fill value combinations - * H5D_FILL_TIME_IFSET - *------------------------------------------------------------------------- - */ - ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); - assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - - ret=make_dset(fid,"fill_time_ifset",sid,dcpl,buf1); - assert(ret>=0); - -/*------------------------------------------------------------------------- - * H5D_FILL_TIME_ALLOC - *------------------------------------------------------------------------- - */ - ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); - assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - - ret=make_dset(fid,"fill_time_alloc",sid,dcpl,buf1); - assert(ret>=0); - -/*------------------------------------------------------------------------- - * H5D_FILL_TIME_NEVER - *------------------------------------------------------------------------- - */ - ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - - ret=make_dset(fid,"fill_time_never",sid,dcpl,buf1); - assert(ret>=0); - -/*------------------------------------------------------------------------- * H5D_ALLOC_TIME_EARLY *------------------------------------------------------------------------- */ - - ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); - assert(ret>=0); - ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - ret=make_dset(fid,"alloc_time_early",sid,dcpl,buf1); assert(ret>=0); @@ -4747,10 +4697,6 @@ static void gent_filters(void) */ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - ret=make_dset(fid,"alloc_time_incr",sid,dcpl,buf1); assert(ret>=0); @@ -4760,10 +4706,6 @@ static void gent_filters(void) */ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); assert(ret>=0); - - ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); - assert(ret>=0); - ret=make_dset(fid,"alloc_time_late",sid,dcpl,buf1); assert(ret>=0); @@ -4934,7 +4876,6 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) return(SUCCEED); } - /*------------------------------------------------------------------------- * Function: gent_fcontents * @@ -4946,53 +4887,67 @@ static void gent_fcontents(void) { hid_t fid; /* file id */ hid_t gid1; /* group ID */ - hid_t gid2; /* group ID */ - hid_t gid3; /* group ID */ hid_t tid; /* datatype ID */ hsize_t dims[1]={4}; int buf[4]={1,2,3,4}; int ret; - + + /* create a file */ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid>=0); + write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf); + /*------------------------------------------------------------------------- * links *------------------------------------------------------------------------- */ - /* soft link to "dset" */ - ret=H5Glink (fid, H5G_LINK_SOFT, "dset", "softlink"); + + /* hard link to "dset" */ + gid1 = H5Gcreate (fid, "/g1", 0); + H5Glink (gid1, H5G_LINK_HARD, "/dset", "dset1"); + H5Gclose(gid1); + + + /* hard link to "dset" */ + gid1 = H5Gcreate (fid, "/g2", 0); + H5Glink (gid1, H5G_LINK_HARD, "/dset", "dset2"); + H5Gclose(gid1); + + + /* hard link to "g2" */ + gid1 = H5Gopen(fid, "/g1"); + H5Glink (gid1, H5G_LINK_HARD, "/g2", "g1.1"); + H5Gclose(gid1); + + + /* hard link to "dset" */ + ret=H5Glink (fid, H5G_LINK_HARD, "/dset", "dset3"); assert(ret>=0); + /* hard link to "dset" */ - ret=H5Glink (fid, H5G_LINK_HARD, "dset", "dset1"); + ret=H5Glink (fid, H5G_LINK_HARD, "/dset", "dset4"); assert(ret>=0); + /* soft link to itself */ ret=H5Glink (fid, H5G_LINK_SOFT, "mylink", "mylink"); assert(ret>=0); -/*------------------------------------------------------------------------- - * groups - *------------------------------------------------------------------------- - */ - gid1 = H5Gcreate(fid,"g1",0); - gid2 = H5Gcreate(gid1,"g2",0); - gid3 = H5Gcreate(gid2,"g3",0); - write_dset(gid3,1,dims,"dset",H5T_NATIVE_INT,buf); - ret = H5Gclose(gid1); - assert(ret>=0); - ret = H5Gclose(gid2); - assert(ret>=0); - ret = H5Gclose(gid3); + + /* soft link to "dset" */ + ret=H5Glink (fid, H5G_LINK_SOFT, "/dset", "softlink"); assert(ret>=0); + + /*------------------------------------------------------------------------- - * datatypes + * datatypes *------------------------------------------------------------------------- */ tid=H5Tcopy(H5T_NATIVE_INT); @@ -5001,6 +4956,7 @@ static void gent_fcontents(void) ret=H5Tclose(tid); assert(ret>=0); + /* no name datatype */ tid=H5Tcopy(H5T_NATIVE_INT); ret=H5Tcommit(fid, "mytype2", tid); @@ -5011,30 +4967,105 @@ static void gent_fcontents(void) ret=H5Tclose(tid); assert(ret>=0); + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ + ret=H5Fclose(fid); assert(ret>=0); + /* create a file for the bootblock test */ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid>=0); + ret=H5Fclose(fid); assert(ret>=0); } - /*------------------------------------------------------------------------- - * Function: gent_fdrivers + * Function: gent_fvalues * - * Purpose: file drivers test + * Purpose: generate a file for the fill values test * *------------------------------------------------------------------------- */ +static void gent_fvalues(void) +{ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + hsize_t dims[1]={4}; + int buf[4]={1,2,3,4}; + int ret, fillval = -99; + + /* create a file */ + fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); + + /* create a space */ + sid = H5Screate_simple(1, dims, NULL); + + /* create a dataset creation property list; the same DCPL is used for all dsets */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + +/*------------------------------------------------------------------------- + * make datasets with fill value combinations + * H5D_FILL_TIME_IFSET + *------------------------------------------------------------------------- + */ + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); + assert(ret>=0); + + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + ret=make_dset(fid,"fill_time_ifset",sid,dcpl,buf); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * H5D_FILL_TIME_ALLOC + *------------------------------------------------------------------------- + */ + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); + assert(ret>=0); + + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + ret=make_dset(fid,"fill_time_alloc",sid,dcpl,buf); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * H5D_FILL_TIME_NEVER + *------------------------------------------------------------------------- + */ + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); + assert(ret>=0); + + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + ret=make_dset(fid,"fill_time_never",sid,dcpl,buf); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret=H5Sclose(sid); + assert(ret>=0); + ret=H5Pclose(dcpl); + assert(ret>=0); + ret=H5Fclose(fid); + assert(ret>=0); +} + +#ifdef LATER static void gent_fdrivers(void) { hid_t fid; /* file id */ @@ -5048,22 +5079,19 @@ static void gent_fdrivers(void) assert(ret>=0); /* create a file */ - fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); assert(fid>=0); ret=H5Fclose(fid); assert(ret>=0); - - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret=H5Pclose(fapl); assert(ret>=0); - - } +#endif /*------------------------------------------------------------------------- * Function: main @@ -5132,8 +5160,8 @@ int main(void) gent_named_dtype_attr(); gent_filters(); + gent_fvalues(); gent_fcontents(); - gent_fdrivers(); return 0; } diff --git a/tools/testfiles/tattr-2.ddl b/tools/testfiles/tattr-2.ddl index 6e1e37d..195b9ab 100644 --- a/tools/testfiles/tattr-2.ddl +++ b/tools/testfiles/tattr-2.ddl @@ -6,15 +6,15 @@ ATTRIBUTE "/attr1" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 24 ) / ( 24 ) } DATA { - 97, 116, 116, 114, 105, 98, 117, 116, 101, 32, 111, 102, 32, 114, 111, - 111, 116, 32, 103, 114, 111, 117, 112, 0 + (0): 97, 116, 116, 114, 105, 98, 117, 116, 101, 32, 111, 102, 32, 114, + (14): 111, 111, 116, 32, 103, 114, 111, 117, 112, 0 } } ATTRIBUTE "/attr4" { DATATYPE H5T_STD_I32BE DATASPACE SCALAR DATA { - 100 + (0): 100 } } ATTRIBUTE "/attr5" { @@ -26,7 +26,7 @@ ATTRIBUTE "/attr5" { } DATASPACE SCALAR DATA { - "string attribute" + (0): "string attribute" } } } diff --git a/tools/testfiles/thlink-1.ddl b/tools/testfiles/thlink-1.ddl index fd9b0bd..4f50e80 100644 --- a/tools/testfiles/thlink-1.ddl +++ b/tools/testfiles/thlink-1.ddl @@ -12,16 +12,16 @@ GROUP "/" { } GROUP "g1" { DATASET "dset2" { - HARDLINK "/g2/dset1" + HARDLINK "/dset1" } GROUP "g1.1" { DATASET "dset3" { - HARDLINK "/g2/dset1" + HARDLINK "/dset1" } } } GROUP "g2" { - HARDLINK "/g2/g1/g1.1" + HARDLINK "/g1/g1.1" } } } diff --git a/tools/testfiles/thlink-2.ddl b/tools/testfiles/thlink-2.ddl index 0ff0eec..829dbd6 100644 --- a/tools/testfiles/thlink-2.ddl +++ b/tools/testfiles/thlink-2.ddl @@ -10,9 +10,9 @@ DATASET "/g1/dset2" { } } DATASET "/dset1" { - HARDLINK "/g1/dset2" + HARDLINK "/dset1" } DATASET "/g1/g1.1/dset3" { - HARDLINK "/g1/dset2" + HARDLINK "/dset1" } } diff --git a/tools/testfiles/thlink-3.ddl b/tools/testfiles/thlink-3.ddl index a41dbc1..d4b9d39 100644 --- a/tools/testfiles/thlink-3.ddl +++ b/tools/testfiles/thlink-3.ddl @@ -10,9 +10,9 @@ DATASET "/g1/g1.1/dset3" { } } DATASET "/g1/dset2" { - HARDLINK "/g1/g1.1/dset3" + HARDLINK "/dset1" } DATASET "/dset1" { - HARDLINK "/g1/g1.1/dset3" + HARDLINK "/dset1" } } diff --git a/tools/testfiles/thlink-4.ddl b/tools/testfiles/thlink-4.ddl index 00c2a3a..4a06500 100644 --- a/tools/testfiles/thlink-4.ddl +++ b/tools/testfiles/thlink-4.ddl @@ -12,7 +12,7 @@ GROUP "/g1" { } GROUP "g1.1" { DATASET "dset3" { - HARDLINK "/g1/dset2" + HARDLINK "/dset1" } } } diff --git a/tools/testfiles/tloop-1.ddl b/tools/testfiles/tloop-1.ddl index c3d842a..8313887 100644 --- a/tools/testfiles/tloop-1.ddl +++ b/tools/testfiles/tloop-1.ddl @@ -6,12 +6,12 @@ GROUP "/" { GROUP "g1" { GROUP "g1.1" { GROUP "g2.1" { - HARDLINK "/g2/g1" + HARDLINK "/g1" } } } GROUP "g2" { - HARDLINK "/g2/g1/g1.1" + HARDLINK "/g1/g1.1" } } } |