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

Add tests for H5R get name APIs #4657

Merged
merged 11 commits into from
Aug 12, 2024
2 changes: 0 additions & 2 deletions fortran/src/H5Rff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,6 @@ END FUNCTION H5Rget_attr_name
c_name(1:1)(1:1) = C_NULL_CHAR
name_len = H5Rget_attr_name(ref_ptr, c_name, 1_SIZE_T)
IF(name_len.LT.0_SIZE_T) hdferr = H5I_INVALID_HID_F
! Don't include the NULL term in the size
name_len = name_len - 1
Copy link
Contributor

@brtnfld brtnfld Jul 29, 2024

Choose a reason for hiding this comment

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

To clarify, H5Rget_attr_name returned length does not include the NULL character now with this PR? If that is the case, the doxygen doc needs to be updated as it says it does include NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ELSE
l = INT(LEN(name)+1,SIZE_T)
IF(H5Rget_attr_name(ref_ptr, c_name, l) .LT. 0_SIZE_T)THEN
Expand Down
2 changes: 1 addition & 1 deletion src/H5Rint.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
buf[copy_len] = '\0';
}

ret_value = (ssize_t)(attr_name_len + 1);
ret_value = (ssize_t)(attr_name_len);

FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_attr_name() */
Expand Down
Loading
Loading