From 24f2310b1284c569ea277be00f57248bfd306378 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 1 Nov 2007 13:24:08 -0500 Subject: [svn-r14229] Description: Change H5O[gs]et_comment to H5O[gs]et_comment_by_name and re-add simpler forms of H5O[gs]et_comment. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode --- c++/src/H5CommonFG.cpp | 24 ++++++------ fortran/src/H5Gf.c | 12 +++--- src/H5Gdeprec.c | 4 +- src/H5O.c | 90 +++++++++++++++++++++++++++++++++++++++++--- src/H5Opublic.h | 8 ++-- test/dsets.c | 4 +- test/links.c | 4 +- test/stab.c | 4 +- test/trefer.c | 4 +- test/tunicode.c | 8 ++-- tools/h5dump/h5dump.c | 2 +- tools/h5dump/h5dumpgentest.c | 36 +++++++++--------- tools/h5ls/h5ls.c | 2 +- 13 files changed, 141 insertions(+), 61 deletions(-) diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index bcdc3c6..8386e03 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -455,10 +455,10 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const //-------------------------------------------------------------------------- void CommonFG::setComment( const char* name, const char* comment ) const { - herr_t ret_value = H5Oset_comment( getLocId(), name, comment, H5P_DEFAULT ); + herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); if( ret_value < 0 ) { - throwException("setComment", "H5Oset_comment failed"); + throwException("setComment", "H5Oset_comment_by_name failed"); } } @@ -483,10 +483,10 @@ void CommonFG::setComment( const H5std_string& name, const H5std_string& comment //-------------------------------------------------------------------------- void CommonFG::removeComment(const char* name) const { - herr_t ret_value = H5Oset_comment(getLocId(), name, NULL, H5P_DEFAULT); + herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); if( ret_value < 0 ) { - throwException("removeComment", "H5Oset_comment failed"); + throwException("removeComment", "H5Oset_comment_by_name failed"); } } @@ -517,23 +517,23 @@ H5std_string CommonFG::getComment (const H5std_string& name) const // temporary C-string for the object's comment char* comment_C = new char[bufsize+1]; - herr_t ret_value = H5Oget_comment(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT); + herr_t ret_value = H5Oget_comment_by_name(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT); // if the actual length of the comment is longer than the anticipated - // value, then call H5Oget_comment again with the correct value + // value, then call H5Oget_comment_by_name again with the correct value if (ret_value > bufsize) { bufsize = ret_value; delete []comment_C; comment_C = new char[bufsize+1]; - ret_value = H5Oget_comment(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT); + ret_value = H5Oget_comment_by_name(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT); } - // if H5Oget_comment returns SUCCEED, return the string comment, + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, // otherwise, throw an exception if( ret_value < 0 ) { - throwException("getComment", "H5Oget_comment failed"); + throwException("getComment", "H5Oget_comment_by_name failed"); } H5std_string comment = H5std_string(comment_C); delete []comment_C; @@ -555,12 +555,12 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // temporary C-string for the object's comment char* comment_C = new char[bufsize+1]; - herr_t ret_value = H5Oget_comment( getLocId(), name, comment_C, bufsize, H5P_DEFAULT ); + herr_t ret_value = H5Oget_comment_by_name( getLocId(), name, comment_C, bufsize, H5P_DEFAULT ); - // if H5Oget_comment returns SUCCEED, return the string comment + // if H5Oget_comment_by_name returns SUCCEED, return the string comment if( ret_value < 0 ) { - throwException("getComment", "H5Oget_comment failed"); + throwException("getComment", "H5Oget_comment_by_name failed"); } H5std_string comment = H5std_string(comment_C); delete []comment_C; diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 27b6682..0316c03 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -560,7 +560,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5gset_comment_c - * Purpose: Call H5Gset_comment to set comments for the specified object + * Purpose: Call H5Oset_comment_by_name to set comments for the specified object * Inputs: loc_id - identifier of file or group * name - name of object whose comment is to be set or reset * namelen - the name lenghth @@ -588,9 +588,9 @@ nh5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, goto DONE; /* - * Call H5Gset_comment function + * Call H5Oset_comment_by_name function */ - if(H5Oset_comment((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0) + if(H5Oset_comment_by_name((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0) goto DONE; ret_value = 0; @@ -604,7 +604,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5gget_comment_c - * Purpose: Call H5Gget_comment to retrieve comments for the specified object + * Purpose: Call H5Oget_comment_by_name to retrieve comments for the specified object * Inputs: loc_id - identifier of file or group * name - name of object whose comment is to be set or reset * namelen - the name lenghth @@ -640,9 +640,9 @@ nh5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, } /* end if */ /* - * Call H5Gget_comment function + * Call H5Oget_comment_by_name function */ - if(H5Oget_comment((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0) + if(H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0) goto DONE; /* diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 76542dd..52b607d 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -639,7 +639,7 @@ done: * one comment at a time. Passing NULL for the COMMENT argument * will remove the comment property from the object. * - * Note: Deprecated in favor of H5Oset_comment + * Note: Deprecated in favor of H5Oset_comment/H5Oset_comment_by_name * * Return: Non-negative on success/Negative on failure * @@ -680,7 +680,7 @@ done: * have a comment value then no bytes are copied to the BUF * buffer. * - * Note: Deprecated in favor of H5Oget_comment + * Note: Deprecated in favor of H5Oget_comment/H5Oget_comment_by_name * * Return: Success: Number of characters in the comment counting * the null terminator. The value returned may diff --git a/src/H5O.c b/src/H5O.c index 681413e..15cafc5 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -42,6 +42,7 @@ #include "H5Fpkg.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ #include "H5MFprivate.h" /* File memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared object header messages */ @@ -673,13 +674,52 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Oset_comment(hid_t loc_id, const char *name, const char *comment, - hid_t lapl_id) +H5Oset_comment(hid_t obj_id, const char *comment) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Oset_comment, FAIL) + H5TRACE2("e", "i*s", obj_id, comment); + + /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oset_comment() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oset_comment_by_name + * + * Purpose: Gives the specified object a comment. The COMMENT string + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. + * + * Note: Deprecated in favor of using attributes on objects + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * August 30 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, + hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(H5Oset_comment_by_name, FAIL) H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id); /* Check args */ @@ -699,7 +739,7 @@ H5Oset_comment(hid_t loc_id, const char *name, const char *comment, done: FUNC_LEAVE_API(ret_value) -} /* end H5Oset_comment() */ +} /* end H5Oset_comment_by_name() */ /*------------------------------------------------------------------------- @@ -719,13 +759,51 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Oget_comment(hid_t loc_id, const char *name, char *comment, size_t bufsize, - hid_t lapl_id) +H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5G_loc_t loc; /* Location of group */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Oget_comment, FAIL) + H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); + + /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* Retrieve the object's comment */ + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_comment() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_comment_by_name + * + * Purpose: Retrieve comment for an object. + * + * Return: Success: Number of bytes in the comment including the + * null terminator. Zero if the object has no + * comment. + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * August 30 2007 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, + hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + ssize_t ret_value; /* Return value */ + + FUNC_ENTER_API(H5Oget_comment_by_name, FAIL) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ @@ -745,7 +823,7 @@ H5Oget_comment(hid_t loc_id, const char *name, char *comment, size_t bufsize, done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_comment() */ +} /* end H5Oget_comment_by_name() */ /*------------------------------------------------------------------------- diff --git a/src/H5Opublic.h b/src/H5Opublic.h index c3ce1b6..6ddd565 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -153,10 +153,12 @@ H5_DLL herr_t H5Oincr_refcount(hid_t object_id); H5_DLL herr_t H5Odecr_refcount(hid_t object_id); H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); -H5_DLL herr_t H5Oset_comment(hid_t loc_id, const char *name, +H5_DLL herr_t H5Oset_comment(hid_t obj_id, const char *comment); +H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id); -H5_DLL ssize_t H5Oget_comment(hid_t loc_id, const char *name, char *comment, - size_t bufsize, hid_t lapl_id); +H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); +H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, + char *comment, size_t bufsize, hid_t lapl_id); H5_DLL herr_t H5Oclose(hid_t object_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. diff --git a/test/dsets.c b/test/dsets.c index d7bfe8f..8719441 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -214,7 +214,7 @@ test_create(hid_t file) if(H5Dclose(dataset) < 0) goto error; /* Add a comment to the dataset */ - status = H5Oset_comment(file, DSET_DEFAULT_NAME, "This is a dataset", H5P_DEFAULT); + status = H5Oset_comment_by_name(file, DSET_DEFAULT_NAME, "This is a dataset", H5P_DEFAULT); if(status < 0) goto error; /* @@ -6437,7 +6437,7 @@ main(void) /* Cause the library to emit initial messages */ if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Oset_comment(grp, ".", "Causes diagnostic messages to be emitted", H5P_DEFAULT) < 0) + if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0) goto error; if(H5Gclose(grp) < 0) goto error; diff --git a/test/links.c b/test/links.c index 8a8ab3a..0a164d9 100644 --- a/test/links.c +++ b/test/links.c @@ -3316,8 +3316,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Test H5Gset and get comment */ - if(H5Oset_comment(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_comment(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(buf, "comment")) TEST_ERROR /* Test H5*open */ diff --git a/test/stab.c b/test/stab.c index 6f5a18b..732ac5b 100644 --- a/test/stab.c +++ b/test/stab.c @@ -111,7 +111,7 @@ test_misc(hid_t fapl, hbool_t new_format) if((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((g2 = H5Gcreate2(g1, "sub_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((g3 = H5Gcreate2(fid, "test_1b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oset_comment(g3, ".", "hello world", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oset_comment(g3, "hello world") < 0) TEST_ERROR if(H5Gclose(g1) < 0) TEST_ERROR if(H5Gclose(g2) < 0) TEST_ERROR if(H5Gclose(g3) < 0) TEST_ERROR @@ -120,7 +120,7 @@ test_misc(hid_t fapl, hbool_t new_format) if((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0) TEST_ERROR if((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0) TEST_ERROR if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_comment(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR if(HDstrcmp(comment, "hello world")) { H5_FAILED(); puts(" Read the wrong comment string from the group."); diff --git a/test/trefer.c b/test/trefer.c index e3ffd76..70ad2e7 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -111,7 +111,7 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Gcreate2"); /* Set group's comment */ - ret = H5Oset_comment(group, ".", write_comment, H5P_DEFAULT); + ret = H5Oset_comment(group, write_comment); CHECK(ret, FAIL, "H5Oset_comment"); /* Create a dataset (inside Group1) */ @@ -250,7 +250,7 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Rdereference"); /* Get group's comment */ - ret = H5Oget_comment(group, ".", read_comment, (size_t)10, H5P_DEFAULT); + ret = H5Oget_comment(group, read_comment, (size_t)10); CHECK(ret, FAIL, "H5Oget_comment"); /* Check for correct comment value */ diff --git a/test/tunicode.c b/test/tunicode.c index a5f1309..767928e 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -398,10 +398,10 @@ void test_objnames(hid_t fid, const char* string) /* Set a comment on the group to test that we can access the group * Also test that UTF-8 comments can be read. */ - ret = H5Oset_comment(fid, string, string, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oset_comment"); - ret = H5Oget_comment(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment"); + ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oset_comment_by_name"); + ret = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_comment_by_name"); ret = H5Gclose(grp_id); CHECK(ret, FAIL, "H5Gclose"); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index db17563..dcc6663 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2379,7 +2379,7 @@ dump_comment(hid_t obj_id) char comment[50]; comment[0] = '\0'; - H5Oget_comment(obj_id, ".", comment, sizeof(comment), H5P_DEFAULT); + H5Oget_comment(obj_id, comment, sizeof(comment)); if(comment[0]) { indentation(indent); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 63e8d05..516a740 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -1662,7 +1662,7 @@ static void gent_objref(void) group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Set group's comment */ - H5Oset_comment(group, ".", write_comment, H5P_DEFAULT); + H5Oset_comment(group, write_comment); /* Create a dataset (inside Group1) */ dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2882,51 +2882,51 @@ gent_group_comments(void) /* / */ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g1", "Comment for group /g1", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g1", "Comment for group /g1", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g2", "Comment for group /g2", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g2", "Comment for group /g2", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g3", "Comment for group /g3", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g3", "Comment for group /g3", H5P_DEFAULT); H5Gclose(group); /* /g1 */ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g1/g1.1", "Comment for group /g1/g1.1", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g1/g1.1", "Comment for group /g1/g1.1", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g1/g1.2", "Comment for group /g1/g1.2", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g1/g1.2", "Comment for group /g1/g1.2", H5P_DEFAULT); H5Gclose(group); /* /g2 */ group = H5Gcreate2(fid, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g2/g2.1", "Comment for group /g2/g2.1", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g2/g2.1", "Comment for group /g2/g2.1", H5P_DEFAULT); H5Gclose(group); /* /g3 */ group = H5Gcreate2(fid, "/g3/g3.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g3/g3.1", "Comment for group /g3/g3.1", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g3/g3.1", "Comment for group /g3/g3.1", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g3/g3.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g3/g3.2", "Comment for group /g3/g3.2", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g3/g3.2", "Comment for group /g3/g3.2", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g3/g3.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g3/g3.3", "Comment for group /g3/g3.3", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g3/g3.3", "Comment for group /g3/g3.3", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g3/g3.4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g3/g3.4", "Comment for group /g3/g3.4", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g3/g3.4", "Comment for group /g3/g3.4", H5P_DEFAULT); H5Gclose(group); /* /g2/g2.1 */ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g2/g2.1/g2.1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g2/g2.1/g2.1.2", "Comment for group /g2/g2.1/g2.1.2", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.2", "Comment for group /g2/g2.1/g2.1.2", H5P_DEFAULT); H5Gclose(group); group = H5Gcreate2(fid, "/g2/g2.1/g2.1.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Oset_comment(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT); + H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT); H5Gclose(group); H5Fclose(fid); @@ -4658,7 +4658,7 @@ static void gent_filters(void) ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1); assert(ret >= 0); - ret = H5Oset_comment(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); + ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); assert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS); @@ -4667,7 +4667,7 @@ static void gent_filters(void) ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1); assert(ret >= 0); - ret = H5Oset_comment(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); + ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); assert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CHUNKED); @@ -4679,7 +4679,7 @@ static void gent_filters(void) ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1); assert(ret >= 0); - ret = H5Oset_comment(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); + ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); assert(ret >= 0); /*------------------------------------------------------------------------- @@ -4906,7 +4906,7 @@ static void gent_filters(void) ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); assert(ret >= 0); - ret = H5Oset_comment(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); + ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); assert(ret >= 0); ret = H5Tclose(tid); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 19cfe58..2c56cb5 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1810,7 +1810,7 @@ list(hid_t group, const char *name, const H5L_info_t *linfo, void *_iter) /* Object comment */ comment[0] = '\0'; - H5Oget_comment(group, name, comment, sizeof(comment), H5P_DEFAULT); + H5Oget_comment_by_name(group, name, comment, sizeof(comment), H5P_DEFAULT); HDstrcpy(comment + sizeof(comment) - 4, "..."); if(comment[0]) { printf(" %-10s \"", "Comment:"); -- cgit v0.12