diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-20 04:36:27 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-20 04:36:27 (GMT) |
commit | e51e5cea3f3a6d412202f39b2834901ee375caa1 (patch) | |
tree | fac34f56c495b7af8cb2702cea0f8db8954395ac /tools | |
parent | 8a9eb9fdcdbb01f18d40ad100ce38ba1d5515a26 (diff) | |
download | hdf5-e51e5cea3f3a6d412202f39b2834901ee375caa1.zip hdf5-e51e5cea3f3a6d412202f39b2834901ee375caa1.tar.gz hdf5-e51e5cea3f3a6d412202f39b2834901ee375caa1.tar.bz2 |
[svn-r18303] Description:
Bring r18302 from trunk to 1.8 branch:
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:
Mac OS X/32 10.6.2 (amazon) w/debug & production
(h5committested on trunk)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dump.c | 112 |
1 files changed, 84 insertions, 28 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ba753e1..0b47cf7 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 */ } @@ -5861,10 +5893,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; @@ -5925,10 +5965,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) { @@ -6583,10 +6631,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); |