Unify definition of NC_DISPATCH_VERSION

re: Issue

The netcdf dispatch table version was defined in several places.
Modify to only require defining it in CMakeLists.txt and configure.ac.

Fix entailed the following changes:
* Up the NC_DISPATCH_VERSION from 2 to 3 in configure.ac and CMakeLists.txt
* Create include/netcdf_dispatch.h.in and use it to configure include/netcdf_dispatch.h
* For CMAKE, make it search CMAKE_CURRENT_BINARY_DIR so code can locate the configured netcdf_dispatch.h
* Add entry to config.h.cmake.in for NC_DISPATCH_VERSION
* Move NCerror from include/ncdispatch.h to libdap2/nccomon.h
* Fix an API problem re nchttp.h
* Fix a conversion warning in libdispatch/dinfermodel.c
This commit is contained in:
Dennis Heimbigner 2021-01-31 21:40:08 -07:00
parent f23fe5f6d3
commit 7a44ae9184
12 changed files with 28 additions and 26 deletions

View File

@ -37,7 +37,7 @@ SET(PACKAGE_VERSION ${VERSION})
# Version of the dispatch table. This must match the value in
# configure.ac.
SET(NC_DISPATCH_VERSION 2)
SET(NC_DISPATCH_VERSION 3)
# Get system configuration, Use it to determine osname, os release, cpu. These
# will be used when committing to CDash.
@ -163,8 +163,6 @@ SET(EXTRA_DEPS "")
# Set CTest Properties
################################
ENABLE_TESTING()
INCLUDE(CTest)
@ -262,6 +260,7 @@ ENDIF()
#####
# System inspection checks
#####
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/oc2)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libsrc)
@ -2177,6 +2176,13 @@ configure_file(
${netCDF_SOURCE_DIR}/include/netcdf_meta.h.in
${netCDF_BINARY_DIR}/include/netcdf_meta.h @ONLY)
#####
# Create 'netcdf_dispatch.h' include file.
#####
configure_file(
${netCDF_SOURCE_DIR}/include/netcdf_dispatch.h.in
${netCDF_BINARY_DIR}/include/netcdf_dispatch.h @ONLY NEWLINE_STYLE LF)
#####
# Build test_common.sh
#####

View File

@ -457,6 +457,9 @@ with zip */
/* Add extra properties to _NCProperties attribute */
#cmakedefine NCPROPERTIES_EXTRA ${NCPROPERTIES_EXTRA}
/* Idspatch table version */
#cmakedefine NC_DISPATCH_VERSION ${NC_DISPATCH_VERSION}
/* no IEEE float on this platform */
#cmakedefine NO_IEEE_FLOAT 1

View File

@ -1667,7 +1667,9 @@ AX_SET_META([NC_HAS_MULTIFILTERS],[$has_multifilters],[yes])
# applications like PIO can determine whether they have an appropriate
# dispatch table to submit. If this is changed, make sure the value in
# CMakeLists.txt also changes to match.
AC_SUBST([NC_DISPATCH_VERSION], [2])
AC_SUBST([NC_DISPATCH_VERSION], [3])
AC_DEFINE_UNQUOTED([NC_DISPATCH_VERSION], [${NC_DISPATCH_VERSION}], [Dispatch table version.])
#####
# End netcdf_meta.h definitions.
@ -1701,6 +1703,7 @@ AC_CONFIG_FILES([Makefile
libnetcdf.settings
postinstall.sh
include/netcdf_meta.h
include/netcdf_dispatch.h
include/Makefile
h5_test/Makefile
hdf4_test/Makefile

View File

@ -29,4 +29,4 @@ if ENABLE_BYTERANGE
noinst_HEADERS += nchttp.h
endif
EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in
EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in netcdf_dispatch.in

View File

@ -80,9 +80,6 @@
#define ATOMICTYPEMAX3 NC_DOUBLE
#define ATOMICTYPEMAX5 NC_UINT64
/* Define an alias for int to indicate an error return */
typedef int NCerror;
#if !defined HDF5_PARALLEL && !defined USE_PNETCDF
typedef int MPI_Comm;
typedef int MPI_Info;

View File

@ -22,7 +22,7 @@ typedef struct NC_HTTP_STATE {
NCbytes* buf;
} NC_HTTP_STATE;
extern int nc_http_open(const char* objecturl, NC_HTTP_STATE** state, size64_t* lenp);
extern int nc_http_open(const char* objecturl, NC_HTTP_STATE** state, long long* lenp);
extern int nc_http_size(NC_HTTP_STATE* state, const char* url, size64_t* sizep);
extern int nc_http_read(NC_HTTP_STATE* state, const char* url, size64_t start, size64_t count, NCbytes* buf);
extern int nc_http_close(NC_HTTP_STATE* state);

View File

@ -25,7 +25,9 @@
/* This is the version of the dispatch table. It should be changed
* when new functions are added to the dispatch table. */
#define NC_DISPATCH_VERSION 3
#ifndef NC_DISPATCH_VERSION
#define NC_DISPATCH_VERSION @NC_DISPATCH_VERSION@
#endif /*NC_DISPATCH_VERSION*/
/* This is the dispatch table, with a pointer to each netCDF
* function. */

View File

@ -32,6 +32,7 @@
#include "oc.h"
#include "ncdap.h"
#include "nccommon.h"
#include "dapdebug.h"
#include "daputil.h"
@ -47,7 +48,6 @@ struct NCsegment;
/**************************************************/
#include "nccommon.h"
#include "getvara.h"
#include "constraints.h"

View File

@ -17,6 +17,9 @@
#define FALSE 0
#endif
/* Define an alias for int to indicate an error return */
typedef int NCerror;
#ifndef nullfree
#define nullfree(m) {if((m)!=NULL) {free(m);} else {}}
#endif

View File

@ -71,18 +71,6 @@ extern int dsp_close(ND4dsp* dsp);
/* DSP API */
extern int dsp_open(const char* path, ND4dsp** dspp);
/*
extern NCerror dapbuildvaraprojection(CDFnode*,
const size_t* startp, const size_t* countp, const ptrdiff_t* stridep,
struct DCEprojection** projectionlist);
extern NCerror NCD4_getvarx(int ncid, int varid,
const size_t *startp,
const size_t *countp,
const ptrdiff_t *stridep,
void *data,
nc_type dsttype0);
*/
#endif
/**************************************************/

View File

@ -68,7 +68,7 @@ Trace(const char* fcn)
*/
int
nc_http_open(const char* objecturl, NC_HTTP_STATE** statep, size64_t* filelenp)
nc_http_open(const char* objecturl, NC_HTTP_STATE** statep, long long* filelenp)
{
int stat = NC_NOERR;
int i;

View File

@ -44,7 +44,7 @@ struct MagicFile {
struct NCURI* uri;
int omode;
NCmodel* model;
fileoffset_t filelen;
long long filelen;
int use_parallel;
void* parameters; /* !NULL if inmemory && !diskless */
FILE* fp;
@ -965,7 +965,7 @@ check_file_type(const char *path, int omode, int use_parallel,
if((status = openmagic(&magicinfo))) goto done;
/* Verify we have a large enough file */
if(magicinfo.filelen < MAGIC_NUMBER_LEN)
if(magicinfo.filelen < (long long)MAGIC_NUMBER_LEN)
{status = NC_ENOTNC; goto done;}
if((status = readmagic(&magicinfo,0L,magic)) != NC_NOERR) {
status = NC_ENOTNC;