summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-04-03 19:51:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-04-03 19:51:14 (GMT)
commit0fb88ded47762bcafdd4317a3cd48f4c706a011c (patch)
treef46e14f62d1c6f3ebd1fb9aab18fab97509782bd /tools
parentd53775c9468afe01b058e59db8dfc7a4d79f0340 (diff)
downloadhdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.zip
hdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.tar.gz
hdf5-0fb88ded47762bcafdd4317a3cd48f4c706a011c.tar.bz2
[svn-r13580] Description:
Add version # and flags to external link format (as fields in a single byte), in order to accomodate future changes/expansions. Tested on: Mac OS X/32 10.4.9 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c60
-rw-r--r--tools/h5ls/h5ls.c10
-rw-r--r--tools/lib/h5trav.c58
-rw-r--r--tools/testfiles/tall.h5bin9968 -> 9968 bytes
-rw-r--r--tools/testfiles/tboot1.ddl2
-rw-r--r--tools/testfiles/textlink.h5bin936 -> 936 bytes
-rw-r--r--tools/testfiles/tfcontents1.h5bin7426 -> 7426 bytes
-rw-r--r--tools/testfiles/tmany.h5bin18536 -> 18536 bytes
-rw-r--r--tools/testfiles/tudlink.h5bin904 -> 904 bytes
-rw-r--r--tools/testfiles/twithub.h5bin10592 -> 10592 bytes
-rw-r--r--tools/testfiles/twithub513.h5bin11056 -> 11056 bytes
11 files changed, 59 insertions, 71 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0af6d5d..555334a 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1544,25 +1544,26 @@ dump_all(hid_t group, const char *name, void * op_data)
case H5G_UDLINK:
{
indentation(indent);
- switch(linfo.type)
- {
+ switch(linfo.type) {
case H5L_TYPE_EXTERNAL:
{
char *targbuf;
- char *filename;
- char *targname;
+
targbuf = HDmalloc(statbuf.linklen);
HDassert(targbuf);
- if (!doxml) {
- begin_obj(dump_header_format->extlinkbegin, name,
- dump_header_format->extlinkblockbegin);
- }
- if (H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
+ if(!doxml) {
+ begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin);
+ } /* end if */
+
+ if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
error_msg(progname, "unable to get external link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
} else {
- if(H5Lunpack_elink_val(targbuf, statbuf.linklen, &filename, &targname) < 0) {
+ const char *filename;
+ const char *targname;
+
+ if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) {
error_msg(progname, "unable to unpack external link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -2963,7 +2964,7 @@ parse_hsize_list(const char *h_list)
p_list = calloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if (isdigit(*ptr)) {
+ if(isdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)atof(ptr);
@@ -3214,8 +3215,6 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
{
H5G_stat_t statbuf;
H5L_info_t linfo;
- char * elink_file;
- char * elink_path;
if(H5Gget_objinfo(fid, links, FALSE, &statbuf) < 0) {
error_msg(progname, "unable to get obj info from \"%s\"\n", links);
@@ -3247,25 +3246,26 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
dump_header_format->udlinkblockbegin);
indentation(COL);
switch(linfo.type) {
- case H5L_TYPE_EXTERNAL:
- begin_obj(dump_header_format->extlinkbegin, links,
+ case H5L_TYPE_EXTERNAL:
+ begin_obj(dump_header_format->extlinkbegin, links,
dump_header_format->extlinkblockbegin);
- if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
- if(H5Lunpack_elink_val(buf, statbuf.linklen, &elink_file, &elink_path)>=0) {
- indentation(COL);
- printf("LINKCLASS %d\n", linfo.type);
- indentation(COL);
- printf("TARGETFILE \"%s\"\n", elink_file);
- indentation(COL);
- printf("TARGETPATH \"%s\"\n", elink_path);
- } else {
- error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n",
- links);
- d_status = EXIT_FAILURE;
- }
+ if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
+ const char *elink_file;
+ const char *elink_path;
+
+ if(H5Lunpack_elink_val(buf, statbuf.linklen, NULL, &elink_file, &elink_path)>=0) {
+ indentation(COL);
+ printf("LINKCLASS %d\n", linfo.type);
+ indentation(COL);
+ printf("TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ printf("TARGETPATH \"%s\"\n", elink_path);
+ } else {
+ error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ d_status = EXIT_FAILURE;
+ }
} else {
- error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n",
- links);
+ error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n", links);
d_status = EXIT_FAILURE;
}
end_obj(dump_header_format->extlinkend,
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 63b5115..6d0da89 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1775,14 +1775,13 @@ udlink_open(hid_t location, const char *name)
{
H5L_info_t linfo;
char * buf = NULL;
- char * filename = NULL;
- char * path = NULL;
+ const char * filename;
+ const char * path;
if(H5Lget_info(location, name, &linfo, H5P_DEFAULT) < 0)
return -1;
- switch(linfo.type)
- {
+ switch(linfo.type) {
/* For external links, try to display info for the object it points to */
case H5L_TYPE_EXTERNAL:
if((buf = HDmalloc(linfo.u.val_size)) == NULL)
@@ -1790,7 +1789,7 @@ udlink_open(hid_t location, const char *name)
if(H5Lget_val(location, name, buf, linfo.u.val_size, H5P_DEFAULT) < 0)
goto error;
- if(H5Lunpack_elink_val(buf, linfo.u.val_size, &filename, &path) < 0) goto error;
+ if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &filename, &path) < 0) goto error;
HDfputs("file: ", stdout);
HDfputs(filename, stdout);
HDfputs(" path: ", stdout);
@@ -1800,6 +1799,7 @@ udlink_open(hid_t location, const char *name)
default:
HDfputs("cannot follow UD links", stdout);
}
+
return 0;
error:
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 8abdf55..3646827 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -665,32 +665,29 @@ static int traverse( hid_t loc_id,
H5Lget_info( loc_id, path, &linkbuf, H5P_DEFAULT);
} H5E_END_TRY;
- if(linkbuf.type == H5L_TYPE_EXTERNAL)
- {
- if (statbuf.linklen>0)
- {
- char *targbuf;
- char *objname;
-
- targbuf = HDmalloc(statbuf.linklen);
- assert(targbuf);
- H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf);
- H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &objname);
- if (print)
- printf(" %-10s %s -> %s %s\n", "ext link", path, targbuf, objname);
- free(targbuf);
- }
- else
- {
- if (print)
- printf(" %-10s %s ->\n", "udlink", path);
- }
- }
- else /* Unknown user-defined type */
- {
- if (print)
- printf(" %-10s %s ->\n", "UD link type", path);
- }
+ if(linkbuf.type == H5L_TYPE_EXTERNAL) {
+ if(statbuf.linklen > 0) {
+ char *targbuf;
+ const char *filename;
+ const char *objname;
+
+ targbuf = HDmalloc(statbuf.linklen);
+ assert(targbuf);
+ H5Gget_linkval(loc_id, path, statbuf.linklen, targbuf);
+ H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &objname);
+ if(print)
+ printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
+ free(targbuf);
+ } /* end if */
+ else {
+ if(print)
+ printf(" %-10s %s ->\n", "udlink", path);
+ } /* end else */
+ } /* end if */
+ else { /* Unknown user-defined type */
+ if(print)
+ printf(" %-10s %s ->\n", "UD link type", path);
+ } /* end else */
}
break;
@@ -718,12 +715,3 @@ static int traverse( hid_t loc_id,
return inserted_objs;
}
-
-
-
-
-
-
-
-
-
diff --git a/tools/testfiles/tall.h5 b/tools/testfiles/tall.h5
index 8e377ff..918aeee 100644
--- a/tools/testfiles/tall.h5
+++ b/tools/testfiles/tall.h5
Binary files differ
diff --git a/tools/testfiles/tboot1.ddl b/tools/testfiles/tboot1.ddl
index df1a85e..9a7cafc 100644
--- a/tools/testfiles/tboot1.ddl
+++ b/tools/testfiles/tboot1.ddl
@@ -17,7 +17,7 @@ USER_BLOCK {
USERBLOCK_SIZE 0
}
DATASET "dset" {
- DATATYPE H5T_STD_I32LE
+ DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
}
}
diff --git a/tools/testfiles/textlink.h5 b/tools/testfiles/textlink.h5
index 44857dc..a5ec3e6 100644
--- a/tools/testfiles/textlink.h5
+++ b/tools/testfiles/textlink.h5
Binary files differ
diff --git a/tools/testfiles/tfcontents1.h5 b/tools/testfiles/tfcontents1.h5
index 5fd6f79..c16ee4d 100644
--- a/tools/testfiles/tfcontents1.h5
+++ b/tools/testfiles/tfcontents1.h5
Binary files differ
diff --git a/tools/testfiles/tmany.h5 b/tools/testfiles/tmany.h5
index 82ce3e0..10e29d6 100644
--- a/tools/testfiles/tmany.h5
+++ b/tools/testfiles/tmany.h5
Binary files differ
diff --git a/tools/testfiles/tudlink.h5 b/tools/testfiles/tudlink.h5
index 4c4e494..5dc0c707 100644
--- a/tools/testfiles/tudlink.h5
+++ b/tools/testfiles/tudlink.h5
Binary files differ
diff --git a/tools/testfiles/twithub.h5 b/tools/testfiles/twithub.h5
index 4402107..4bc1833 100644
--- a/tools/testfiles/twithub.h5
+++ b/tools/testfiles/twithub.h5
Binary files differ
diff --git a/tools/testfiles/twithub513.h5 b/tools/testfiles/twithub513.h5
index be1b87b..0eac208 100644
--- a/tools/testfiles/twithub513.h5
+++ b/tools/testfiles/twithub513.h5
Binary files differ