mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
It turns out the the type H5FD_class_t was changed
between HDF5 versions 1.8 and 1.10. So modify H5FDhttp.c to be conditional on the HDF5 major+minor version from H5public.h
This commit is contained in:
parent
84c2bc0d78
commit
a7fa2d8d95
@ -342,7 +342,7 @@ NC_omodeinfer(int cmode, NCmodel* model)
|
||||
}
|
||||
}
|
||||
/* Ignore following flags for now */
|
||||
#if 0 /* keep lgtm happy
|
||||
#if 0 /* keep lgtm happy */
|
||||
if(fIsSet(cmode,NC_CLASSIC_MODEL)) {}
|
||||
if(fIsSet(cmode,NC_DISKLESS)) {}
|
||||
#endif
|
||||
|
@ -46,6 +46,17 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
Define a simple #ifdef test for the version of H5FD_class_t we are using
|
||||
*/
|
||||
#if H5_VERS_MAJOR == 1
|
||||
#if H5_VERS_MINOR < 10
|
||||
#define H5FDCLASS1 1
|
||||
#endif
|
||||
#else
|
||||
#error "Cannot determine version of H5FD_class_t"
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_WIN32_API
|
||||
/* The following two defines must be before any windows headers are included */
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
@ -120,7 +131,6 @@ typedef struct H5FD_http_t {
|
||||
HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A))
|
||||
|
||||
/* Prototypes */
|
||||
static herr_t H5FD_http_term(void);
|
||||
static H5FD_t *H5FD_http_open(const char *name, unsigned flags,
|
||||
hid_t fapl_id, haddr_t maxaddr);
|
||||
static herr_t H5FD_http_close(H5FD_t *lf);
|
||||
@ -129,22 +139,34 @@ static herr_t H5FD_http_query(const H5FD_t *_f1, unsigned long *flags);
|
||||
static haddr_t H5FD_http_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
|
||||
static haddr_t H5FD_http_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
|
||||
static herr_t H5FD_http_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
|
||||
static haddr_t H5FD_http_get_eof(const H5FD_t *_file, H5FD_mem_t type);
|
||||
static herr_t H5FD_http_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
|
||||
static herr_t H5FD_http_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
|
||||
size_t size, void *buf);
|
||||
static herr_t H5FD_http_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
|
||||
size_t size, const void *buf);
|
||||
|
||||
/* The H5FD_class_t structure has different versions */
|
||||
#ifdef H5FDCLASS1
|
||||
static haddr_t H5FD_http_get_eof(const H5FD_t *_file);
|
||||
static herr_t H5FD_http_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing);
|
||||
static herr_t H5FD_http_lock(H5FD_t *_file, unsigned char* old, unsigned lock_type, hbool_t last);
|
||||
static herr_t H5FD_unlock)(H5FD_t *file, unsigned char *oid, hbool_t last);
|
||||
#else
|
||||
static herr_t H5FD_http_term(void);
|
||||
static haddr_t H5FD_http_get_eof(const H5FD_t *_file, H5FD_mem_t type);
|
||||
static herr_t H5FD_http_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
|
||||
static herr_t H5FD_http_lock(H5FD_t *_file, hbool_t rw);
|
||||
static herr_t H5FD_http_unlock(H5FD_t *_file);
|
||||
#endif
|
||||
|
||||
/* Beware, not same as H5FD_HTTP_g */
|
||||
static const H5FD_class_t H5FD_http_g = {
|
||||
"http", /* name */
|
||||
MAXADDR, /* maxaddr */
|
||||
H5F_CLOSE_WEAK, /* fc_degree */
|
||||
#ifndef HDF5CLASS1
|
||||
H5FD_http_term, /* terminate */
|
||||
#endif
|
||||
NULL, /* sb_size */
|
||||
NULL, /* sb_encode */
|
||||
NULL, /* sb_decode */
|
||||
@ -169,10 +191,10 @@ static const H5FD_class_t H5FD_http_g = {
|
||||
H5FD_http_read, /* read */
|
||||
H5FD_http_write, /* write */
|
||||
H5FD_http_flush, /* flush */
|
||||
NULL, /* truncate */
|
||||
NULL, /* truncate */
|
||||
H5FD_http_lock, /* lock */
|
||||
H5FD_http_unlock, /* unlock */
|
||||
H5FD_FLMAP_DICHOTOMY /* fl_map */
|
||||
H5FD_FLMAP_DICHOTOMY /* fl_map */
|
||||
};
|
||||
|
||||
|
||||
@ -215,6 +237,7 @@ H5FD_http_init(void)
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef H5FDCLASS1
|
||||
static herr_t
|
||||
H5FD_http_term(void)
|
||||
{
|
||||
@ -223,6 +246,7 @@ H5FD_http_term(void)
|
||||
|
||||
return 0;
|
||||
} /* end H5FD_http_term() */
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -562,20 +586,24 @@ H5FD_http_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static haddr_t
|
||||
#ifdef H5FDCLASS1
|
||||
H5FD_http_get_eof(const H5FD_t *_file)
|
||||
#else
|
||||
H5FD_http_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type)
|
||||
#endif
|
||||
{
|
||||
const H5FD_http_t *file = (const H5FD_http_t *)_file;
|
||||
|
||||
#ifndef H5FDCLASS1
|
||||
/* Quiet the compiler */
|
||||
type = type;
|
||||
#endif
|
||||
|
||||
/* Clear the error stack */
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
|
||||
/* Quiet the compiler */
|
||||
type = type;
|
||||
|
||||
return(file->eof);
|
||||
} /* end H5FD_http_get_eof() */
|
||||
|
||||
@ -760,34 +788,21 @@ H5FD_http_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
#ifdef H5FDCLASS1
|
||||
H5FD_http_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
|
||||
#else
|
||||
H5FD_http_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing)
|
||||
{
|
||||
#if 0
|
||||
H5FD_http_t *file = (H5FD_http_t*)_file;
|
||||
static const char *func = "H5FD_http_flush"; /* Function Name for error reporting */
|
||||
#endif
|
||||
{
|
||||
|
||||
#ifndef H5FDCLASS1
|
||||
/* Quiet the compiler */
|
||||
dxpl_id = dxpl_id;
|
||||
#endif
|
||||
|
||||
/* Clear the error stack */
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
|
||||
/* Do nothing for S2 */
|
||||
#if 0
|
||||
/* Only try to flush the file if we have write access */
|
||||
if(file->write_access) {
|
||||
if(!closing) {
|
||||
if(fflush(file->fp) < 0)
|
||||
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
|
||||
|
||||
/* Reset last file I/O information */
|
||||
file->pos = HADDR_UNDEF;
|
||||
file->op = H5FD_HTTP_OP_UNKNOWN;
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
} /* end H5FD_http_flush() */
|
||||
|
||||
@ -808,11 +823,23 @@ H5FD_http_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
#ifdef H5FDCLASS1
|
||||
H5FD_http_lock(H5FD_t *_file, unsigned char* old, unsigned lock_type, hbool_t last)
|
||||
#else
|
||||
H5FD_http_lock(H5FD_t *_file, hbool_t rw)
|
||||
#endif
|
||||
{
|
||||
/* Clear the error stack */
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
|
||||
#ifdef H5FDCLASS1
|
||||
/* Quiet the compiler */
|
||||
lock_type = lock_type;
|
||||
last = last;
|
||||
#else
|
||||
rw = rw;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
} /* end H5FD_http_lock() */
|
||||
|
||||
@ -832,11 +859,21 @@ H5FD_http_lock(H5FD_t *_file, hbool_t rw)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
#ifdef H5FDCLASS1
|
||||
static herr_t H5FD_unlock)(H5FD_t *file, /*UNUSED*/unsigned char *oid, /*UNUSED*/ hbool_t last)
|
||||
#else
|
||||
H5FD_http_unlock(H5FD_t *_file)
|
||||
#endif
|
||||
{
|
||||
/* Clear the error stack */
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
|
||||
/* Quiet the compiler */
|
||||
#ifdef H5FDCLASS1
|
||||
oid = oid;
|
||||
last = last;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
} /* end H5FD_http_unlock() */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user