Merge pull request #2888 from derobins/1_10_api_fix

Fix for H5Literate() callback versioning
This commit is contained in:
Ward Fisher 2024-03-14 10:22:28 -06:00 committed by GitHub
commit 0f7558c7d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,21 +45,23 @@ with the H5Lvisit function call
*/
herr_t
op_func (hid_t g_id, const char *name,
#if H5_VERSION_GE(1,12,0)
const H5L_info2_t *info,
#else
const H5L_info_t *info,
#endif
void *op_data)
{
hid_t id;
H5I_type_t obj_type;
strcpy((char *)op_data, name);
#if H5_VERSION_GE(1,12,0)
if ((id = H5Oopen_by_token(g_id, info->u.token)) < 0) ERR;
#else
#if H5_VERSION_LE(1, 10, 11) || defined(H5_USE_110_API_DEFAULT) || defined(H5_USE_18_API_DEFAULT) || defined(H5_USE_16_API_DEFAULT)
/* This library is either 1.10.11 (the last 1.10 release) or earlier
* OR this is a later version of the library built with a 1.10 or
* earlier API (earlier versions did not define their own USE
* API symbol).
*/
if ((id = H5Oopen_by_addr(g_id, info->u.address)) < 0) ERR;
#else
/* HDF5 1.12 switched from addresses to tokens to better support the VOL */
if ((id = H5Oopen_by_token(g_id, info->u.token)) < 0) ERR;
#endif
/* Using H5Ovisit is really slow. Use H5Iget_type for a fast