-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inconsistent documentation of get_name functions #4715
Changes from 4 commits
b259967
f2f1396
55e1a89
fe2879e
42c6500
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -719,11 +719,10 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *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 | ||
* be larger than the BUFSIZE argument. | ||
* Return: Success: Number of characters in the comment. The value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably go the other way as in "Number of characters in the comment, excluding the NUL terminator character." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jhendersonHDF I missed this, I'll put it in one of my next PRs. |
||
* returned may be larger than the BUFSIZE argument. | ||
* | ||
* Failure: Negative | ||
* Failure: Negative | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1949,6 +1949,7 @@ test_deprec(hid_t fapl, bool new_format) | |
hsize_t num_objs; /* Number of objects in a group */ | ||
char filename[1024]; | ||
char tmpstr[1024]; | ||
int len = 0; /* Length of comment */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. len should probably be a size_t There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. H5Gget_comment returns int. I casted len to size_t for strcmp after checking for error. |
||
|
||
if (new_format) | ||
TESTING("backwards compatibility (w/new group format)"); | ||
|
@@ -1968,12 +1969,21 @@ test_deprec(hid_t fapl, bool new_format) | |
FAIL_STACK_ERROR; | ||
|
||
/* Test H5Gset and get comment */ | ||
|
||
if (H5Gset_comment(file_id, "group1", "comment") < 0) | ||
FAIL_STACK_ERROR; | ||
if (H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) | ||
if ((len = H5Gget_comment(file_id, "group1", 0, NULL)) < 0) | ||
FAIL_STACK_ERROR; | ||
|
||
/* Returned length should be the same as strlen of the comment */ | ||
if ((size_t)len != strlen("comment")) | ||
FAIL_STACK_ERROR; | ||
|
||
/* Get and verify the comment */ | ||
if (H5Gget_comment(file_id, "group1", (size_t)len + 1, tmpstr) < 0) | ||
FAIL_STACK_ERROR; | ||
if (strcmp(tmpstr, "comment") != 0) | ||
TEST_ERROR; | ||
FAIL_STACK_ERROR; | ||
|
||
/* Create links using H5Glink and H5Glink2 */ | ||
if (H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "Index (0-based) of attribute to retrieve"