h5fget_name_f: No way to obtain filename length from Fortran #824
Labels
Component - Fortran
Fortran wrappers
Priority - 1. High 🔼
These are important issues that should be resolved in the next release
Type - Bug / Bugfix
Please report security issues to [email protected] instead of creating an issue on GitHub
The documentation of h5fget_name says: "If the length of the name, which determines the required value of size, is unknown, a preliminary H5Fget_name call can be made by setting name to NULL. The return value of this call will be the size of the filename; that value plus one (1) can then be assigned to size for a second H5Fget_name call, which will retrieve the actual name. "
However, this does not work from Fortran. Passing a null (unassociated in Fortran parlance) pointer to an ordinary (non-pointer, non allocatable) dummy argument is not allowed in the Fortran standard. If one tries to do so anyway, the current implementation does not obtain the size as expected, because h5fget_name_c allocates a new buffer for the filename anyway. As a result, there is no way to obtain the length of the filename using the Fortran API.
The text was updated successfully, but these errors were encountered: