summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dump.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-20 04:29:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-20 04:29:08 (GMT)
commit2bcb812832616669fc2b34dba25e32f6304b5c46 (patch)
tree86fe443eb4f925bf5afb6662c1007b10d3b6435f /tools/h5dump/h5dump.c
parent0c39a78927ae1e4b7471f96743a8cf5dd30350b0 (diff)
downloadhdf5-2bcb812832616669fc2b34dba25e32f6304b5c46.zip
hdf5-2bcb812832616669fc2b34dba25e32f6304b5c46.tar.gz
hdf5-2bcb812832616669fc2b34dba25e32f6304b5c46.tar.bz2
[svn-r18302] Description:
Tweak allocation of attribute tables created from densely stored attributes to allow for better cleanup on errors (like when the type of corruption from Bz#1755 is encountered). Also, add some code to h5dump to display an error message when the attribute iteration for an object fails. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools/h5dump/h5dump.c')
-rw-r--r--tools/h5dump/h5dump.c112
1 files changed, 84 insertions, 28 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3af66ee..3156ba6 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2005,10 +2005,18 @@ dump_named_datatype(hid_t tid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */
- if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
indent -= COL;
@@ -2123,10 +2131,18 @@ dump_group(hid_t gid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
@@ -2146,10 +2162,18 @@ dump_group(hid_t gid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
@@ -2254,10 +2278,18 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
}
@@ -5876,10 +5908,18 @@ xml_dump_group(hid_t gid, const char *name)
/* 1. do all the attributes of the group */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
if(isRoot && unamedtype) {
unsigned u;
@@ -5940,10 +5980,18 @@ xml_dump_group(hid_t gid, const char *name)
/* 1. do all the attributes of the group */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
if(isRoot && unamedtype) {
@@ -6598,10 +6646,18 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
indent -= COL;
tempi = H5Dget_storage_size(did);