Skip to content

Commit

Permalink
HDF5: fix build with libhdf5 1.13.2 and 1.13.3 (fixes OSGeo#6657)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and psharma-gdal committed Nov 27, 2023
1 parent 2ccd813 commit f763ebd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gdal/frmts/hdf5/hdf5vfl.h
Expand Up @@ -48,6 +48,13 @@ extern "C" int CPL_DLL GDALIsInGlobalDestructor(void);
#define HDF5_1_13_OR_LATER
#endif

// HDF5 >= 1.13.2
#ifdef H5FD_CLASS_VERSION
# if H5FD_CLASS_VERSION != 1
# error "HDF5_vsil_g needs to be adapted to the new layout of H5FD_class_t. Look at ${hdf5_prefix}/include/H5FDdevelop.h"
# endif
#endif

static std::mutex gMutex;
static hid_t hFileDriver = -1;

Expand Down Expand Up @@ -75,6 +82,9 @@ static void HDF5VFLUnloadFileDriver();

/* See https://support.hdfgroup.org/HDF5/doc/TechNotes/VFL.html */
static const H5FD_class_t HDF5_vsil_g = {
#ifdef H5FD_CLASS_VERSION
H5FD_CLASS_VERSION,
#endif
#ifdef HDF5_1_13_OR_LATER
/* value: 513 has been reserved with hdfgroup and is registered at:
* https://portal.hdfgroup.org/pages/viewpage.action?pageId=74188097 */
Expand Down Expand Up @@ -109,6 +119,12 @@ static const H5FD_class_t HDF5_vsil_g = {
nullptr, /* get_handle */
HDF5_vsil_read, /* read */
HDF5_vsil_write, /* write */
#if H5FD_CLASS_VERSION == 1
nullptr, /* read_vector */
nullptr, /* write_vector */
nullptr, /* read_selection */
nullptr, /* write_selection */
#endif
nullptr, /* flush */
HDF5_vsil_truncate, /* truncate */
nullptr, /* lock */
Expand Down

0 comments on commit f763ebd

Please sign in to comment.