mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
810694e113
@ -26,11 +26,11 @@ set(PACKAGE "netCDF" CACHE STRING "")
|
||||
SET(NC_VERSION_MAJOR 4)
|
||||
SET(NC_VERSION_MINOR 3)
|
||||
SET(NC_VERSION_PATCH 3)
|
||||
SET(NC_VERSION_NOTE "-rc3")
|
||||
SET(NC_VERSION_NOTE "")
|
||||
SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
|
||||
SET(VERSION ${netCDF_VERSION})
|
||||
SET(NC_VERSION ${netCDF_VERSION})
|
||||
SET(netCDF_LIB_VERSION 7.2.0)
|
||||
SET(netCDF_LIB_VERSION 7.2.1)
|
||||
SET(netCDF_SO_VERSION 7)
|
||||
SET(PACKAGE_VERSION ${VERSION})
|
||||
|
||||
@ -662,7 +662,7 @@ IF(ENABLE_TESTS)
|
||||
FIND_PROGRAM(HOSTNAME_CMD NAMES hostname)
|
||||
IF(NOT MSVC)
|
||||
SET(HOSTNAME_ARG "-s")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(HOSTNAME_CMD)
|
||||
EXEC_PROGRAM(${HOSTNAME_CMD} ARGS "${HOSTNAME_ARG}" OUTPUT_VARIABLE HOSTNAME)
|
||||
SET(NC_CTEST_SITE "${HOSTNAME}" CACHE STRING "Hostname of test machine.")
|
||||
|
@ -38,7 +38,7 @@ PROJECT_NAME = netCDF-C
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.3.3-rc3
|
||||
PROJECT_NUMBER = 4.3.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -5,7 +5,9 @@ Release Notes {#RELEASE_NOTES}
|
||||
|
||||
This file contains a high-level description of this package's evolution. Releases are in reverse chronological order (most recent first). Note that, as of netcdf 4.2, the `netcdf-c++` and `netcdf-fortran` libraries have been separated into their own libraries.
|
||||
|
||||
## 4.3.3 Released TBD
|
||||
## 4.3.3 Released 2015-02-12
|
||||
|
||||
* Fixed bug resulting in error closing a valid netCDF-4 file with a dimension and a non-coordinate variable with the same name. [NCF-324](https://bugtracking.unidata.ucar.edu/browse/NCF-324)
|
||||
|
||||
* Enabled previously-disabled shell-script-based tests for Visual Studio when `bash` is detected.
|
||||
|
||||
|
@ -15,12 +15,12 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
|
||||
AC_PREREQ([2.59])
|
||||
|
||||
# Initialize with name, version, and support email address.
|
||||
AC_INIT([netCDF], [4.3.3-rc3], [support-netcdf@unidata.ucar.edu])
|
||||
AC_INIT([netCDF], [4.3.3], [support-netcdf@unidata.ucar.edu])
|
||||
|
||||
AC_SUBST([NC_VERSION_MAJOR]) NC_VERSION_MAJOR=4
|
||||
AC_SUBST([NC_VERSION_MINOR]) NC_VERSION_MINOR=3
|
||||
AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=3
|
||||
AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc3"
|
||||
AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE=""
|
||||
|
||||
#####
|
||||
# Set some variables used to generate a libnetcdf.settings file,
|
||||
|
@ -353,7 +353,7 @@ int nc4_find_dim(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T **dim, NC_GRP_INFO
|
||||
int nc4_find_var(NC_GRP_INFO_T *grp, const char *name, NC_VAR_INFO_T **var);
|
||||
int nc4_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len);
|
||||
int nc4_find_type(const NC_HDF5_FILE_INFO_T *h5, int typeid1, NC_TYPE_INFO_T **type);
|
||||
NC_TYPE_INFO_T *nc4_rec_find_nc_type(const NC_GRP_INFO_T *start_grp, hid_t target_nc_typeid);
|
||||
NC_TYPE_INFO_T *nc4_rec_find_nc_type(const NC_GRP_INFO_T *start_grp, nc_type target_nc_typeid);
|
||||
NC_TYPE_INFO_T *nc4_rec_find_hdf_type(NC_GRP_INFO_T *start_grp, hid_t target_hdf_typeid);
|
||||
NC_TYPE_INFO_T *nc4_rec_find_named_type(NC_GRP_INFO_T *start_grp, char *name);
|
||||
NC_TYPE_INFO_T *nc4_rec_find_equal_type(NC_GRP_INFO_T *start_grp, int ncid1, NC_TYPE_INFO_T *type);
|
||||
|
@ -38,11 +38,22 @@ nc__testurl(const char* path, char** basenamep)
|
||||
char* slash = (uri->file == NULL ? NULL : strrchr(uri->file, '/'));
|
||||
char* dot;
|
||||
if(slash == NULL) slash = (char*)path; else slash++;
|
||||
slash = nulldup(slash);
|
||||
dot = strrchr(slash, '.');
|
||||
if(dot != NULL && dot != slash) *dot = '\0';
|
||||
if(basenamep) *basenamep=slash ; else free(slash);
|
||||
ncurifree(uri);
|
||||
slash = nulldup(slash);
|
||||
|
||||
if(slash == NULL)
|
||||
dot = NULL;
|
||||
else
|
||||
dot = strrchr(slash, '.');
|
||||
|
||||
if(dot != NULL && dot != slash) *dot = '\0';
|
||||
|
||||
if(basenamep)
|
||||
*basenamep=slash;
|
||||
else {
|
||||
if(slash)
|
||||
free(slash);
|
||||
}
|
||||
ncurifree(uri);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -289,7 +300,7 @@ dapparamcheck(NCDAPCOMMON* nccomm, const char* key, const char* subkey)
|
||||
}
|
||||
|
||||
|
||||
/* This is NOT UNION */
|
||||
/* This is NOT UNION */
|
||||
int
|
||||
nclistconcat(NClist* l1, NClist* l2)
|
||||
{
|
||||
@ -324,7 +335,7 @@ nclistdeleteall(NClist* l, void* elem)
|
||||
found=1;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Collect the set of container nodes ending in "container"*/
|
||||
@ -556,7 +567,7 @@ daptopseq(CDFnode* seq)
|
||||
BOOL
|
||||
daptoplevel(CDFnode* node)
|
||||
{
|
||||
if(node->container == NULL
|
||||
if(node->container == NULL
|
||||
|| node->container->nctype != NC_Dataset) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -601,7 +612,7 @@ void
|
||||
dapexpandescapes(char *termstring)
|
||||
{
|
||||
char *s, *t, *endp;
|
||||
|
||||
|
||||
/* expand "\" escapes, e.g. "\t" to tab character;
|
||||
will only shorten string length, never increase it
|
||||
*/
|
||||
@ -725,7 +736,7 @@ dap_fetch(NCDAPCOMMON* nccomm, OClink conn, const char* ce,
|
||||
char* baseurl = ncuribuild(nccomm->oc.url,NULL,ext,0);
|
||||
if(ce == NULL)
|
||||
LOG1(NCLOGNOTE,"fetch: %s",baseurl);
|
||||
else
|
||||
else
|
||||
LOG2(NCLOGNOTE,"fetch: %s?%s",baseurl,ce);
|
||||
nullfree(baseurl);
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
@ -747,7 +758,7 @@ dap_fetch(NCDAPCOMMON* nccomm, OClink conn, const char* ce,
|
||||
fprintf(stderr,"fetch: dds:\n");
|
||||
oc_dumpnode(conn,*rootp);
|
||||
#endif
|
||||
|
||||
|
||||
/* Look at the HTTP return code */
|
||||
httpcode = oc_httpcode(conn);
|
||||
if(httpcode < 400) {
|
||||
@ -810,7 +821,7 @@ repairname(const char* name, const char* badchars)
|
||||
if(strchr(badchars,c) != NULL) {
|
||||
int digit;
|
||||
char newchar[4];
|
||||
newchar[0] = '%';
|
||||
newchar[0] = '%';
|
||||
digit = (c & 0xf0) >> 4;
|
||||
newchar[1] = hexdigits[digit];
|
||||
digit = (c & 0x0f);
|
||||
|
BIN
libncdap.tar.gz
BIN
libncdap.tar.gz
Binary file not shown.
@ -1007,17 +1007,17 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
{
|
||||
/* NC_CHAR attributes are written as a scalar in HDF5, of type
|
||||
* H5T_C_S1, of variable length. */
|
||||
if (att_ndims == 0)
|
||||
{
|
||||
if (!(dims[0] = H5Tget_size(file_typeid)))
|
||||
BAIL(NC_EATTMETA);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is really a string type! */
|
||||
att->nc_typeid = NC_STRING;
|
||||
dims[0] = att_npoints;
|
||||
}
|
||||
if (att_ndims == 0)
|
||||
{
|
||||
if (!(dims[0] = H5Tget_size(file_typeid)))
|
||||
BAIL(NC_EATTMETA);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is really a string type! */
|
||||
att->nc_typeid = NC_STRING;
|
||||
dims[0] = att_npoints;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1088,8 +1088,10 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
BAIL(NC_ENOMEM);
|
||||
|
||||
/* Read the fixed-len strings as one big block. */
|
||||
if (H5Aread(attid, att->native_hdf_typeid, contig_buf) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
if (H5Aread(attid, att->native_hdf_typeid, contig_buf) < 0) {
|
||||
free(contig_buf);
|
||||
BAIL(NC_EATTMETA);
|
||||
}
|
||||
|
||||
/* Copy strings, one at a time, into their new home. Alloc
|
||||
space for each string. The user will later free this
|
||||
@ -1097,9 +1099,11 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
cur = contig_buf;
|
||||
for (i = 0; i < att->len; i++)
|
||||
{
|
||||
if (!(att->stdata[i] = malloc(fixed_size)))
|
||||
BAIL(NC_ENOMEM);
|
||||
strncpy(att->stdata[i], cur, fixed_size);
|
||||
if (!(att->stdata[i] = malloc(fixed_size))) {
|
||||
free(contig_buf);
|
||||
BAIL(NC_ENOMEM);
|
||||
}
|
||||
strncpy(att->stdata[i], cur, fixed_size);
|
||||
cur += fixed_size;
|
||||
}
|
||||
|
||||
@ -1386,7 +1390,7 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name)
|
||||
/* Read each name and value defined in the enum. */
|
||||
for (i = 0; i < type->u.e.num_members; i++)
|
||||
{
|
||||
retval = NC_NOERR;
|
||||
|
||||
/* Get the name and value from HDF5. */
|
||||
if (!(member_name = H5Tget_member_name(hdf_typeid, i)))
|
||||
{
|
||||
@ -1427,9 +1431,9 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name)
|
||||
if(member_name != NULL)
|
||||
free(member_name);
|
||||
#endif
|
||||
if(value) free(value);
|
||||
if(retval) /* error exit from loop */
|
||||
return retval;
|
||||
if(value) free(value);
|
||||
if(retval) /* error exit from loop */
|
||||
return retval;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -464,7 +464,7 @@ nc4_find_type(const NC_HDF5_FILE_INFO_T *h5, nc_type typeid, NC_TYPE_INFO_T **ty
|
||||
}
|
||||
|
||||
/* Find the actual length of a dim by checking the length of that dim
|
||||
* in all variables that use it, in grp or children. *len must be
|
||||
* in all variables that use it, in grp or children. **len must be
|
||||
* initialized to zero before this function is called. */
|
||||
int
|
||||
nc4_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len)
|
||||
@ -1339,7 +1339,7 @@ nc4_reform_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, NC_DIM_INFO_T *dim)
|
||||
dim->coord_var = var;
|
||||
|
||||
/* Check if this variable used to be a coord. var */
|
||||
if (var->was_coord_var)
|
||||
if (var->was_coord_var && grp != NULL)
|
||||
{
|
||||
/* Reattach the scale everywhere it is used. */
|
||||
/* (Recall that netCDF dimscales are always 1-D) */
|
||||
|
@ -136,5 +136,5 @@ EXTRA_DIST += tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
|
||||
tst_ncgen4_diff.sh tst_ncgen4_cycle.sh ref_ctest.c ref_ctest64.c \
|
||||
ctest.c ctest64.c
|
||||
|
||||
CLEANFILES += results/*.nc results/*.dmp results/*.dmp2 tmp*.cdl
|
||||
CLEANFILES += results/*.nc results/*.dmp results/*.dmp2 tmp*.cdl tst_bug324.nc
|
||||
DISTCLEANFILES = results
|
||||
|
130
ncdump/dumplib.c
130
ncdump/dumplib.c
@ -226,7 +226,7 @@ sbuf_grow(safebuf_t *sb, size_t len) {
|
||||
}
|
||||
|
||||
/* Copy string s2 to safe buffer, growing if necessary */
|
||||
void
|
||||
void
|
||||
sbuf_cpy(safebuf_t *sb, const char *s2) {
|
||||
size_t s2len;
|
||||
assert(SAFEBUF_CHECK(sb));
|
||||
@ -238,7 +238,7 @@ sbuf_cpy(safebuf_t *sb, const char *s2) {
|
||||
}
|
||||
|
||||
/* Concatenate string s2 to end of string in safe buffer, growing if necessary */
|
||||
void
|
||||
void
|
||||
sbuf_cat(safebuf_t *sb, const char *s2) {
|
||||
size_t s2len;
|
||||
size_t res;
|
||||
@ -253,7 +253,7 @@ sbuf_cat(safebuf_t *sb, const char *s2) {
|
||||
|
||||
/* Concatenate string in safebuf s2 to end of string in safebuf s1,
|
||||
* growing if necessary */
|
||||
void
|
||||
void
|
||||
sbuf_catb(safebuf_t *s1, const safebuf_t *s2) {
|
||||
size_t s2len;
|
||||
size_t res;
|
||||
@ -268,7 +268,7 @@ sbuf_catb(safebuf_t *s1, const safebuf_t *s2) {
|
||||
}
|
||||
|
||||
/* Return length of string in sbuf */
|
||||
size_t
|
||||
size_t
|
||||
sbuf_len(const safebuf_t *sb) {
|
||||
assert(SAFEBUF_CHECK(sb));
|
||||
return sb->cl;
|
||||
@ -295,19 +295,19 @@ void
|
||||
set_formats(int float_digits, int double_digits)
|
||||
{
|
||||
int res;
|
||||
res = snprintf(float_var_fmt, strlen(float_var_fmt) + 1, "%%.%dg",
|
||||
res = snprintf(float_var_fmt, strlen(float_var_fmt) + 1, "%%.%dg",
|
||||
float_digits) + 1;
|
||||
assert(res <= sizeof(float_var_fmt));
|
||||
res = snprintf(double_var_fmt, strlen(double_var_fmt) + 1, "%%.%dg",
|
||||
res = snprintf(double_var_fmt, strlen(double_var_fmt) + 1, "%%.%dg",
|
||||
double_digits) + 1;
|
||||
assert(res <= sizeof(double_var_fmt));
|
||||
res = snprintf(float_att_fmt, strlen(float_att_fmt) + 1, "%%#.%dgf",
|
||||
res = snprintf(float_att_fmt, strlen(float_att_fmt) + 1, "%%#.%dgf",
|
||||
float_digits) + 1;
|
||||
assert(res <= sizeof(float_att_fmt));
|
||||
res = snprintf(float_attx_fmt, strlen(float_attx_fmt) + 1, "%%#.%dg",
|
||||
res = snprintf(float_attx_fmt, strlen(float_attx_fmt) + 1, "%%#.%dg",
|
||||
float_digits) + 1;
|
||||
assert(res <= sizeof(float_attx_fmt));
|
||||
res = snprintf(double_att_fmt, strlen(double_att_fmt) + 1, "%%#.%dg",
|
||||
res = snprintf(double_att_fmt, strlen(double_att_fmt) + 1, "%%#.%dg",
|
||||
double_digits) + 1;
|
||||
assert(res <= sizeof(double_att_fmt));
|
||||
}
|
||||
@ -324,7 +324,7 @@ has_c_format_att(
|
||||
#define C_FMT_NAME "C_format" /* name of C format attribute */
|
||||
#define MAX_CFMT_LEN 100 /* max length of C format attribute */
|
||||
static char cfmt[MAX_CFMT_LEN];
|
||||
|
||||
|
||||
/* we expect nc_inq_att to fail if there is no "C_format" attribute */
|
||||
int nc_stat = nc_inq_att(ncid, varid, "C_format", &cfmt_type, &cfmt_len);
|
||||
|
||||
@ -333,7 +333,7 @@ has_c_format_att(
|
||||
if (cfmt_type == NC_CHAR && cfmt_len != 0 && cfmt_len < MAX_CFMT_LEN) {
|
||||
int nc_stat = nc_get_att_text(ncid, varid, "C_format", cfmt);
|
||||
if(nc_stat != NC_NOERR) {
|
||||
fprintf(stderr, "Getting 'C_format' attribute %s\n",
|
||||
fprintf(stderr, "Getting 'C_format' attribute %s\n",
|
||||
nc_strerror(nc_stat));
|
||||
(void) fflush(stderr);
|
||||
}
|
||||
@ -344,7 +344,7 @@ has_c_format_att(
|
||||
case NC_ENOTATT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Inquiring about 'C_format' attribute %s\n",
|
||||
fprintf(stderr, "Inquiring about 'C_format' attribute %s\n",
|
||||
nc_strerror(nc_stat));
|
||||
(void) fflush(stderr);
|
||||
break;
|
||||
@ -413,7 +413,7 @@ get_fmt(
|
||||
/* If C_format attribute exists, return it */
|
||||
c_format_att = has_c_format_att(ncid, varid);
|
||||
if (c_format_att)
|
||||
return c_format_att;
|
||||
return c_format_att;
|
||||
return get_default_fmt(typeid);
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ max_typeid(int ncid) {
|
||||
maxtypes = NC_STRING; /* extra netCDF-4 primitive types */
|
||||
maxtypes += 4; /* user-defined classes */
|
||||
nuser = count_udtypes(ncid);
|
||||
if(nuser > 0)
|
||||
if(nuser > 0)
|
||||
maxtypes = NC_FIRSTUSERTYPEID + (nuser - 1);
|
||||
#endif
|
||||
max_type = maxtypes;
|
||||
@ -530,39 +530,39 @@ get_typeinfo ( int typeid ) {
|
||||
/* } */
|
||||
|
||||
|
||||
bool_t
|
||||
ncbyte_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncbyte_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(signed char* )v1p == *(signed char* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncchar_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncchar_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(char* )v1p == *(char* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncshort_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncshort_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(short* )v1p == *(short* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncint_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncint_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(int* )v1p == *(int* )v2p);
|
||||
}
|
||||
|
||||
#define absval(x) ( (x) < 0 ? -(x) : (x) )
|
||||
|
||||
/*
|
||||
/*
|
||||
* Return ( *(float* )v1p == *(float* )v2p);
|
||||
* except use floating epsilon to compare very close vals as equal
|
||||
* and handle IEEE NaNs and infinities.
|
||||
*/
|
||||
bool_t
|
||||
ncfloat_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncfloat_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
float v1 = *(float* )v1p;
|
||||
float v2 = *(float* )v2p;
|
||||
@ -577,13 +577,13 @@ ncfloat_val_equals(const nctype_t *this,
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Return ( *(double* )v1p == *(double* )v2p);
|
||||
* except use floating epsilon to compare very close vals as equal
|
||||
* and handle IEEE NaNs and infinities.
|
||||
*/
|
||||
bool_t
|
||||
ncdouble_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncdouble_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
double v1 = *(double* )v1p;
|
||||
double v2 = *(double* )v2p;
|
||||
@ -599,38 +599,38 @@ ncdouble_val_equals(const nctype_t *this,
|
||||
}
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
bool_t
|
||||
ncubyte_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncubyte_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(unsigned char* )v1p == *(unsigned char* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncushort_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncushort_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(unsigned short* )v1p == *(unsigned short* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncuint_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncuint_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(unsigned int* )v1p == *(unsigned int* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncint64_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncint64_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(long long* )v1p == *(long long* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncuint64_val_equals(const nctype_t *this,
|
||||
bool_t
|
||||
ncuint64_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
return ( *(unsigned long long* )v1p == *(unsigned long long* )v2p);
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncstring_val_equals(const nctype_t *this,
|
||||
ncstring_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
if (NULL == *((char **)v1p) && NULL == *((char **)v2p))
|
||||
return(1);
|
||||
@ -642,7 +642,7 @@ ncstring_val_equals(const nctype_t *this,
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncopaque_val_equals(const nctype_t *this,
|
||||
ncopaque_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
size_t nbytes = this->size;
|
||||
const char *c1p = (const char *) v1p;
|
||||
@ -656,7 +656,7 @@ ncopaque_val_equals(const nctype_t *this,
|
||||
}
|
||||
|
||||
bool_t
|
||||
ncvlen_val_equals(const nctype_t *this,
|
||||
ncvlen_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
size_t v1len = ((nc_vlen_t *)v1p)->len;
|
||||
size_t v2len = ((nc_vlen_t *)v2p)->len;
|
||||
@ -671,7 +671,7 @@ ncvlen_val_equals(const nctype_t *this,
|
||||
const char *v2dat = ((nc_vlen_t *)v2p)->p;
|
||||
size_t i;
|
||||
for(i = 0; i < v1len; i++) {
|
||||
if (base_val_equals(base_info, (const void *)v1dat,
|
||||
if (base_val_equals(base_info, (const void *)v1dat,
|
||||
(const void *)v2dat) != true)
|
||||
return false;
|
||||
v1dat += base_size;
|
||||
@ -684,7 +684,7 @@ ncvlen_val_equals(const nctype_t *this,
|
||||
/* Determine if two compound values are equal, by testing eqaulity of
|
||||
* each member field. */
|
||||
bool_t
|
||||
nccomp_val_equals(const nctype_t *this,
|
||||
nccomp_val_equals(const nctype_t *this,
|
||||
const void *v1p, const void *v2p) {
|
||||
int nfields = this->nfields;
|
||||
int fidx; /* field id */
|
||||
@ -694,7 +694,7 @@ nccomp_val_equals(const nctype_t *this,
|
||||
nc_type fid = this->fids[fidx]; /* field type id */
|
||||
nctype_t *finfo = get_typeinfo(fid);
|
||||
if(finfo->ranks == 0 || finfo->ranks[fidx] == 0) {
|
||||
if(! finfo->val_equals(finfo,
|
||||
if(! finfo->val_equals(finfo,
|
||||
(char *)v1p + offset, (char *)v2p + offset))
|
||||
return false;
|
||||
} else { /* this field is an array */
|
||||
@ -707,7 +707,7 @@ nccomp_val_equals(const nctype_t *this,
|
||||
v1elem = (char *)v1elem + finfo->size;
|
||||
v2elem = (char *)v1elem + finfo->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -882,7 +882,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
||||
char *sp;
|
||||
unsigned char uc;
|
||||
|
||||
slen = 3 + 5 * strlen(cp); /* need "'s around string, and extra space to escape control characters */
|
||||
slen = 3 + 5 * strlen(cp); /* need "'s around string, and extra space to escape control characters */
|
||||
sout = emalloc(slen);
|
||||
sp = sout;
|
||||
*sp++ = '"' ;
|
||||
@ -896,7 +896,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
||||
*sp++ = '\\';
|
||||
*sp++ = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
case '\n':
|
||||
*sp++ = '\\';
|
||||
*sp++ = 'n';
|
||||
break;
|
||||
@ -1010,7 +1010,7 @@ ncopaque_val_as_hex(size_t size, char *sout, const void *valp) {
|
||||
/* Convert an opaque value to a string, represented as hexadecimal
|
||||
* characters */
|
||||
int
|
||||
ncopaque_typ_tostring(const nctype_t *typ, safebuf_t *sfbf,
|
||||
ncopaque_typ_tostring(const nctype_t *typ, safebuf_t *sfbf,
|
||||
const void *valp) {
|
||||
char* sout = (char *) emalloc(2 * typ->size + strlen("0X") + 1);
|
||||
(void) ncopaque_val_as_hex(typ->size, sout, valp);
|
||||
@ -1464,16 +1464,16 @@ set_tostring_func(ncvar_t *varp) {
|
||||
varp->val_tostring = (val_tostring_func) nccomp_val_tostring;
|
||||
break;
|
||||
default:
|
||||
error("unrecognized class of user defined type: %d",
|
||||
error("unrecognized class of user defined type: %d",
|
||||
varp->tinfo->class);
|
||||
}
|
||||
}
|
||||
#endif /* USE_NETCDF4 */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize typelist with primitive types. For netCDF-3 only need primitive
|
||||
types. */
|
||||
/* Initialize typelist with primitive types. For netCDF-3 only need primitive
|
||||
types. */
|
||||
static void
|
||||
init_prim_types(int ncid) {
|
||||
nctype_t *tp;
|
||||
@ -1541,7 +1541,7 @@ init_prim_types(int ncid) {
|
||||
* variables in one group may be declared using types in a
|
||||
* different group. For netCDF-3, this is just the info about
|
||||
* primitive types.
|
||||
*/
|
||||
*/
|
||||
void
|
||||
init_types(int ncid) {
|
||||
#ifdef USE_NETCDF4
|
||||
@ -1573,8 +1573,8 @@ init_types(int ncid) {
|
||||
|
||||
tinfo = (nctype_t *) emalloc(sizeof(nctype_t));
|
||||
|
||||
NC_CHECK( nc_inq_user_type(ncid, typeids[t], type_name, &tinfo->size,
|
||||
&tinfo->base_tid, &tinfo->nfields,
|
||||
NC_CHECK( nc_inq_user_type(ncid, typeids[t], type_name, &tinfo->size,
|
||||
&tinfo->base_tid, &tinfo->nfields,
|
||||
&tinfo->class) );
|
||||
tinfo->tid = typeids[t];
|
||||
tinfo->ncid = ncid;
|
||||
@ -1615,7 +1615,7 @@ init_types(int ncid) {
|
||||
int i;
|
||||
sides = NULL;
|
||||
NC_CHECK( nc_inq_compound_field(ncid, tinfo->tid, fidx, NULL,
|
||||
&offset, &ftype, &rank,
|
||||
&offset, &ftype, &rank,
|
||||
sides) );
|
||||
if(rank > 0) sides = (int *) emalloc(rank * sizeof(int));
|
||||
NC_CHECK( nc_inq_compound_field(ncid, tinfo->tid, fidx, NULL,
|
||||
@ -1646,7 +1646,7 @@ init_types(int ncid) {
|
||||
error("bad class: %d", tinfo->class);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
typeadd(tinfo);
|
||||
}
|
||||
free(typeids);
|
||||
@ -1722,7 +1722,7 @@ iscoordvar(int ncid, int varid)
|
||||
}
|
||||
NC_CHECK( nc_inq_varname(ncid, varid, varname) );
|
||||
NC_CHECK( nc_inq_varndims(ncid, varid, &varndims) );
|
||||
|
||||
|
||||
for (dimid = 0; dimid < ndims; dimid++) {
|
||||
if (strcmp(dims[dimid].name, varname) == 0 && varndims == 1) {
|
||||
is_coord = 1;
|
||||
@ -1745,7 +1745,7 @@ is_user_defined_type(nc_type type) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Return name of type in user-allocated space, whether built-in
|
||||
* primitive type or user-defined type. Note: name must have enough
|
||||
* space allocated to hold type name.
|
||||
@ -1764,7 +1764,7 @@ get_type_name(int ncid, nc_type type, char *name)
|
||||
#endif /* USE_NETCDF4 */
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Print type name with CDL escapes for special characters. locid is
|
||||
* the id of the group in which the type is referenced, which is
|
||||
* needed to determine whether an absolute type name must be printed.
|
||||
@ -1814,7 +1814,7 @@ print_type_name(int locid, int typeid) {
|
||||
}
|
||||
stat = nc_inq_grp_parent(curlocid, &parent_groupid);
|
||||
} while (stat != NC_ENOGRP && stat != NC_ENOTNC4);
|
||||
|
||||
|
||||
if (type_inherited == 0) {
|
||||
char *gname = nctypes[typeid]->grps;
|
||||
print_name(gname);
|
||||
@ -1830,7 +1830,7 @@ print_type_name(int locid, int typeid) {
|
||||
* use by is_unlim_dim() function. If ncid is a subgroup of a netCDF
|
||||
* dataset, the table will still be initialized for the whole dataset
|
||||
* in which the subgroup resides. */
|
||||
static int
|
||||
static int
|
||||
init_is_unlim(int ncid, int **is_unlim_p)
|
||||
{
|
||||
int num_grps; /* total number of groups */
|
||||
@ -1901,9 +1901,10 @@ is_unlim_dim(int ncid, int dimid) {
|
||||
#ifdef USE_NETCDF4
|
||||
static int *is_unlim = NULL; /* gets allocated by init_is_unlim() */
|
||||
if(for_ncid == UNLIM_NOT_INITIALIZED) {
|
||||
NC_CHECK( init_is_unlim(ncid, &is_unlim) );
|
||||
for_ncid = ncid;
|
||||
NC_CHECK( init_is_unlim(ncid, &is_unlim) );
|
||||
for_ncid = ncid;
|
||||
}
|
||||
assert(is_unlim);
|
||||
result = is_unlim[dimid]; /* 0 if fixed, 1 if unlimited size */
|
||||
#else
|
||||
static int unlimdimid;
|
||||
@ -1915,4 +1916,3 @@ is_unlim_dim(int ncid, int dimid) {
|
||||
#endif /* USE_NETCDF4 */
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -76,14 +76,14 @@ main(int argc, char **argv)
|
||||
if ( nc_inq_var(ncid, h_id, NULL, &h_type, &h_rank, h_dims, &h_natts) ) ERR;
|
||||
if ( h_type != NC_DOUBLE || h_rank != RANK_H || h_natts != 0 ) ERR;
|
||||
{
|
||||
double lat_data[RANK_LAT];
|
||||
double lat_data[LEN_LAT];
|
||||
size_t start[RANK_LAT] = {0} ;
|
||||
size_t count[1] = {LEN_LAT};
|
||||
if ( nc_get_vara(ncid, lat_id, start, count, lat_data) ) ERR;
|
||||
if ( lat_data[0] != -45.0 || lat_data[1] != 45.0 ) ERR;
|
||||
}
|
||||
{
|
||||
double h_data[RANK_H];
|
||||
double h_data[LEN_H];
|
||||
size_t start[RANK_H] = {0} ;
|
||||
size_t count[1] = {LEN_H};
|
||||
if ( nc_get_vara(ncid, h_id, start, count, h_data) ) ERR;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -205,6 +206,7 @@ main(
|
||||
derror("Invalid format, try classic, 64-bit offset, netCDF-4, or netCDF-4 classic model");
|
||||
return 2;
|
||||
}
|
||||
free(kind_name);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
|
@ -222,6 +222,8 @@ ocset_flags_perlink(OCstate* state)
|
||||
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USERPWD);
|
||||
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_PROXY);
|
||||
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USE_SSL);
|
||||
if(stat != OC_NOERR)
|
||||
return stat;
|
||||
|
||||
/* Following are always set */
|
||||
ocset_curlflag(state, CURLOPT_FOLLOWLOCATION);
|
||||
@ -248,7 +250,10 @@ oc_set_curl_options(OCstate* state)
|
||||
struct OCCURLFLAG* ocflag = NULL;
|
||||
|
||||
hostport = occombinehostport(state->uri);
|
||||
if(hostport == NULL) hostport = "";
|
||||
if(hostport == NULL) {
|
||||
hostport = (char*)malloc(sizeof(char)*1);
|
||||
*hostport = "";
|
||||
}
|
||||
|
||||
store = &ocglobalstate.rc.ocrc;
|
||||
triple = store->triples;
|
||||
@ -256,7 +261,7 @@ oc_set_curl_options(OCstate* state)
|
||||
/* Assume that the triple store has been properly sorted */
|
||||
for(i=0;i<store->ntriples;i++,triple++) {
|
||||
size_t hostlen = strlen(triple->host);
|
||||
const char* flagname;
|
||||
const char* flagname;
|
||||
|
||||
if(ocstrncmp("CURL.",triple->key,5) != 0) continue; /* not a curl flag */
|
||||
/* do hostport prefix comparison */
|
||||
@ -270,7 +275,7 @@ oc_set_curl_options(OCstate* state)
|
||||
stat = ocset_curlopt(state,ocflag->flag,cvt(triple->value,ocflag->type));
|
||||
}
|
||||
done:
|
||||
if(hostport && hostport != "") free(hostport);
|
||||
if(hostport && *hostport != "") free(hostport);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user