diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-07-13 16:31:52 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-07-13 16:31:52 (GMT) |
commit | 8d05b733b91f4d74d191b5fd7138024e9546c66e (patch) | |
tree | 8e93814c8b299db65c8cd3397161a66a61657c6c /tools/h5dump | |
parent | d9ba5c234c9971b67f6922ee85cabb638fc0e186 (diff) | |
download | hdf5-8d05b733b91f4d74d191b5fd7138024e9546c66e.zip hdf5-8d05b733b91f4d74d191b5fd7138024e9546c66e.tar.gz hdf5-8d05b733b91f4d74d191b5fd7138024e9546c66e.tar.bz2 |
[svn-r22572] Re-Merge attr name with slash changes from trunk
Tested: localinux with cmake
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tools/h5dump/errfiles/tattr-3.err | 2 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 15 |
3 files changed, 13 insertions, 6 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index abd3091..e85773a 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -1102,7 +1102,7 @@ IF (BUILD_TESTING) # test for displaying attributes ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5) # test for displaying the selected attributes of string type and scalar space - ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) + ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) # test for header and error messages ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) # test for displaying attributes in shared datatype (also in group and dataset) diff --git a/tools/h5dump/errfiles/tattr-3.err b/tools/h5dump/errfiles/tattr-3.err index c52c861..ce8ddda 100644 --- a/tools/h5dump/errfiles/tattr-3.err +++ b/tools/h5dump/errfiles/tattr-3.err @@ -5,4 +5,4 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5O_attr_open_by_name(): can't locate attribute: 'attr' major: Attribute minor: Object not found -h5dump error: unable to open attribute "/attr" +h5dump error: unable to open attribute "attr" diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 5db4103..ee6de5e 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1306,7 +1306,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe /* find the last / */ while(j >= 0) { - if (attr[j] == '/') + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1341,9 +1341,12 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = attr + j + 1; + //attr_name = attr + j + 1; + // need to replace escape characters + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); - /* Open the object with the attribute */ + + /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1384,7 +1387,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe attr_data_output = display_attr_data; h5dump_type_table = type_table; - h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr, attr_id, display_ai, display_char); + h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); h5dump_type_table = NULL; if(attr_id < 0) { @@ -1397,6 +1400,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe } /* end if */ HDfree(obj_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1404,6 +1408,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); |