Skip to content
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

fixed true/false definition and added missing h5_interm_group example #5092

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HDF5Examples/C/TUTR/C_sourcefiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set (examples
h5_chunk_read
h5_compound
h5_group
h5_interm_group
h5_select
h5_attribute
h5_mount
Expand Down
8 changes: 4 additions & 4 deletions HDF5Examples/C/TUTR/h5_interm_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ main(void)
/*
* Check if group /G1 exists in the file.
*/
if (H5Lexists(file, "/G1", H5P_DEFAULT) != FALSE)
if (H5Lexists(file, "/G1", H5P_DEFAULT) != false)
printf("Group /G1 exists in the file\n");

/*
Expand All @@ -64,13 +64,13 @@ main(void)
/* Next commented call causes error stack to be printed out; the next one
* works fine; is it a bug or a feature? EIP 04-25-07
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should address the comment!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior is documented, so we should remove the comment:

If name includes either a relative path or an absolute path to the target link, intermediate steps along the path must be verified before the existence of the target link can be safely checked. If the path is not verified, and an intermediate element of the path does not exist, the API will fail.

That said, as this behavior seems to demand attention, as evidenced by workarounds (https://gist.github.com/jzrake/3025642), we should look into handling this use case.

*/
/* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=TRUE) { */
if (H5Lexists(g1_id, "G2", H5P_DEFAULT) != TRUE) {
/* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=true) { */
if (H5Lexists(g1_id, "G2", H5P_DEFAULT) != true) {

grp_crt_plist = H5Pcreate(H5P_LINK_CREATE);

/* Set flag for intermediate group creation */
status = H5Pset_create_intermediate_group(grp_crt_plist, TRUE);
status = H5Pset_create_intermediate_group(grp_crt_plist, true);
g3_id = H5Gcreate2(g1_id, "G2/G3", grp_crt_plist, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(g3_id);
}
Expand Down
Loading