Commit b15fd1d7 authored by David Thompson's avatar David Thompson
Browse files

COMP: Back out NetCDF update to keep tonight's dashboards green.

parent d7474998
......@@ -8,7 +8,7 @@ SET(netcdf_SRCS
error.c
libvers.c
nc.c
posixio.c
ncio.c
ncx.c
putget.c
string.c
......@@ -257,12 +257,6 @@ IF(VTK_LIBRARY_PROPERTIES)
ENDIF(VTK_LIBRARY_PROPERTIES)
IF(NOT VTK_INSTALL_NO_LIBRARIES)
IF(NOT VTK_INSTALL_BIN_DIR_CM24)
SET(VTK_INSTALL_BIN_DIR_CM24 ${CMAKE_INSTALL_PREFIX}/bin)
ENDIF(NOT VTK_INSTALL_BIN_DIR_CM24)
IF(NOT VTK_INSTALL_LIB_DIR_CM24)
SET(VTK_INSTALL_LIB_DIR_CM24 ${CMAKE_INSTALL_PREFIX}/lib)
ENDIF(NOT VTK_INSTALL_LIB_DIR_CM24)
INSTALL(TARGETS vtkNetCDF
RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
......
......@@ -50,7 +50,7 @@ ncx_len_NC_attrV(nc_type type, size_t nelems)
case NC_DOUBLE:
return ncx_len_double(nelems);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
/* default */
assert("ncx_len_NC_attr bad type" == 0);
......@@ -720,7 +720,7 @@ ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_uchar(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Iuchar invalid type" == 0);
return NC_EBADTYPE;
......@@ -743,7 +743,7 @@ ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_uchar(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Iuchar invalid type" == 0);
return NC_EBADTYPE;
......@@ -767,7 +767,7 @@ ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_schar(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Ischar invalid type" == 0);
return NC_EBADTYPE;
......@@ -790,7 +790,7 @@ ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_schar(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Ischar invalid type" == 0);
return NC_EBADTYPE;
......@@ -814,7 +814,7 @@ ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_short(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Ishort invalid type" == 0);
return NC_EBADTYPE;
......@@ -837,7 +837,7 @@ ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_short(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Ishort invalid type" == 0);
return NC_EBADTYPE;
......@@ -861,7 +861,7 @@ ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_int(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Iint invalid type" == 0);
return NC_EBADTYPE;
......@@ -884,7 +884,7 @@ ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_int(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Iint invalid type" == 0);
return NC_EBADTYPE;
......@@ -908,7 +908,7 @@ ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_long(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Ilong invalid type" == 0);
return NC_EBADTYPE;
......@@ -931,7 +931,7 @@ ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_long(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Ilong invalid type" == 0);
return NC_EBADTYPE;
......@@ -955,7 +955,7 @@ ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_float(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Ifloat invalid type" == 0);
return NC_EBADTYPE;
......@@ -978,7 +978,7 @@ ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_float(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Ifloat invalid type" == 0);
return NC_EBADTYPE;
......@@ -1002,7 +1002,7 @@ ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type)
case NC_DOUBLE:
return ncx_putn_double_double(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_putn_Idouble invalid type" == 0);
return NC_EBADTYPE;
......@@ -1025,7 +1025,7 @@ ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type)
case NC_DOUBLE:
return ncx_getn_double_double(xpp, nelems, tp);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_pad_getn_Idouble invalid type" == 0);
return NC_EBADTYPE;
......
......@@ -99,7 +99,7 @@ find_NC_Udim(const NC_dimarray *ncap, NC_dim **dimpp)
{
/*EMPTY*/
}
if((size_t)dimid >= ncap->nelems)
if(dimid >= (int)ncap->nelems)
return(-1); /* not found */
/* else, normal return */
if(dimpp != NULL)
......
......@@ -6,7 +6,7 @@
/*LINTLIBRARY*/
#include "ncconfig.h"
#include "ncconfig.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
......@@ -80,7 +80,7 @@ nc_strerror(int err)
if(err == EVMSERR)
{
return vms_strerror(err);
}
}
/* else */
#endif /* vms */
......@@ -98,69 +98,69 @@ nc_strerror(int err)
case NC_NOERR:
return "No error";
case NC_EBADID:
return "NetCDF: Not a valid ID";
return "Not a netCDF id";
case NC_ENFILE:
return "NetCDF: Too many files open";
return "Too many netCDF files open";
case NC_EEXIST:
return "NetCDF: File exists && NC_NOCLOBBER";
return "netCDF file exists && NC_NOCLOBBER";
case NC_EINVAL:
return "NetCDF: Invalid argument";
return "Invalid argument";
case NC_EPERM:
return "NetCDF: Write to read only";
return "Write to read only";
case NC_ENOTINDEFINE:
return "NetCDF: Operation not allowed in data mode";
return "Operation not allowed in data mode";
case NC_EINDEFINE:
return "NetCDF: Operation not allowed in define mode";
return "Operation not allowed in define mode";
case NC_EINVALCOORDS:
return "NetCDF: Index exceeds dimension bound";
return "Index exceeds dimension bound";
case NC_EMAXDIMS:
return "NetCDF: NC_MAX_DIMS exceeded";
return "NC_MAX_DIMS exceeded";
case NC_ENAMEINUSE:
return "NetCDF: String match to name in use";
return "String match to name in use";
case NC_ENOTATT:
return "NetCDF: Attribute not found";
return "Attribute not found";
case NC_EMAXATTS:
return "NetCDF: NC_MAX_ATTRS exceeded";
return "NC_MAX_ATTRS exceeded";
case NC_EBADTYPE:
return "NetCDF: Not a valid data type or _FillValue type mismatch";
return "Not a netCDF data type or _FillValue type mismatch";
case NC_EBADDIM:
return "NetCDF: Invalid dimension ID or name";
return "Invalid dimension id or name";
case NC_EUNLIMPOS:
return "NetCDF: NC_UNLIMITED in the wrong index";
return "NC_UNLIMITED in the wrong index";
case NC_EMAXVARS:
return "NetCDF: NC_MAX_VARS exceeded";
return "NC_MAX_VARS exceeded";
case NC_ENOTVAR:
return "NetCDF: Variable not found";
return "Variable not found";
case NC_EGLOBAL:
return "NetCDF: Action prohibited on NC_GLOBAL varid";
return "Action prohibited on NC_GLOBAL varid";
case NC_ENOTNC:
return "NetCDF: Unknown file format";
return "Not a netCDF file";
case NC_ESTS:
return "NetCDF: In Fortran, string too short";
return "In Fortran, string too short";
case NC_EMAXNAME:
return "NetCDF: NC_MAX_NAME exceeded";
return "NC_MAX_NAME exceeded";
case NC_EUNLIMIT:
return "NetCDF: NC_UNLIMITED size already in use";
return "NC_UNLIMITED size already in use";
case NC_ENORECVARS:
return "NetCDF: nc_rec op when there are no record vars";
return "nc_rec op when there are no record vars";
case NC_ECHAR:
return "NetCDF: Attempt to convert between text & numbers";
return "Attempt to convert between text & numbers";
case NC_EEDGE:
return "NetCDF: Start+count exceeds dimension bound";
return "Start+count exceeds dimension bound";
case NC_ESTRIDE:
return "NetCDF: Illegal stride";
return "Illegal stride";
case NC_EBADNAME:
return "NetCDF: Name contains illegal characters";
return "Attribute or variable name contains illegal characters";
case NC_ERANGE:
return "NetCDF: Numeric conversion not representable";
return "Numeric conversion not representable";
case NC_ENOMEM:
return "NetCDF: Memory allocation (malloc) failure";
return "Memory allocation (malloc) failure";
case NC_EVARSIZE:
return "NetCDF: One or more variable sizes violate format constraints";
return "One or more variable sizes violate format constraints";
case NC_EDIMSIZE:
return "NetCDF: Invalid dimension size";
return "Invalid dimension size";
case NC_ETRUNC:
return "NetCDF: File likely truncated or possibly corrupted";
return "File likely truncated or possibly corrupted";
}
/* default */
return unknown;
......
......@@ -48,13 +48,8 @@ blksize(int fd)
struct ffsw sw;
if (fffcntl(fd, FC_STAT, &sb, &sw) > -1)
{
#ifdef __crayx1
if(sb.st_blksize > 0)
return (size_t) sb.st_blksize;
#else
if(sb.st_oblksize > 0)
return (size_t) sb.st_oblksize;
#endif
}
/* else, silent in the face of error */
return (size_t) 32768;
......@@ -109,14 +104,14 @@ fgrow2(const int fd, const off_t len)
const char dumb = 0;
/* we don't use ftruncate() due to problem with FAT32 file systems */
/* cache current position */
const off_t pos = ffseek(fd, 0, SEEK_CUR);
const off_t pos = lseek(fd, 0, SEEK_CUR);
if(pos < 0)
return errno;
if (ffseek(fd, len-1, SEEK_SET) < 0)
if (lseek(fd, len-1, SEEK_SET) < 0)
return errno;
if(ffwrite(fd, (void *)&dumb, sizeof(dumb)) < 0)
if(write(fd, &dumb, sizeof(dumb)) < 0)
return errno;
if (ffseek(fd, pos, SEEK_SET) < 0)
if (lseek(fd, pos, SEEK_SET) < 0)
return errno;
}
return ENOERR;
......@@ -392,12 +387,7 @@ ncio_ffio_global_test(const char *ControlString)
static int
ncio_ffio_sync(ncio *const nciop)
{
#ifdef __crayx1
struct ffsw stat;
if(ffflush(nciop->fd,&stat) < 0)
#else
if(ffflush(nciop->fd) < 0)
#endif
return errno;
return ENOERR;
}
......@@ -518,22 +508,15 @@ ncio_new(const char *path, int ioflags)
* check errno for the netCDF error value
*/
/* prototype fortran subroutines */
#ifdef __crayx1
void ASNQFILE(const char *filename, const char *attribute, int *istat, int flen, int alen);
void ASNFILE(const char *filename, const char *attribute, int *istat, int flen, int alen);
#else
void ASNQFILE(_fcd filename, _fcd attribute, int *istat);
void ASNFILE(_fcd filename, _fcd attribute, int *istat);
#endif
#define BUFLEN 256
static const char *
ncio_ffio_assign(const char *filename) {
static char buffer[BUFLEN];
int istat;
#ifndef __crayx1
_fcd fnp, fbp;
#endif
char *envstr;
char *xtra_assign;
char emptystr='\0';
......@@ -543,15 +526,11 @@ ncio_ffio_assign(const char *filename) {
errno = ENOERR;
/* set up Fortran character pointers */
#ifdef __crayx1
ASNQFILE(filename, buffer, &istat, strlen(filename)+1, BUFLEN);
#else
fnp = _cptofcd((char *)filename, strlen(filename));
fbp = _cptofcd(buffer, BUFLEN);
/* see if the user has "assigned" to this file */
ASNQFILE(fnp, fbp, &istat);
#endif
if (istat == 0) { /* user has already specified an assign */
return buffer;
} else if (istat > 0 || istat < -1) { /* error occured */
......@@ -577,12 +556,8 @@ ncio_ffio_assign(const char *filename) {
return (const char *) NULL;
}
(void) sprintf(buffer,"-F %s %s", envstr,xtra_assign);
#ifdef __crayx1
ASNFILE(filename, buffer, &istat, strlen(filename)+1, strlen(buffer)+1);
#else
fbp = _cptofcd(buffer, strlen(buffer));
ASNFILE(fnp, fbp, &istat);
#endif
if (istat == 0) { /* success */
return buffer;
} else { /* error */
......
......@@ -4,7 +4,7 @@
*/
/* Id */
#include "ncconfig.h"
#include "ncconfig.h"
#include "netcdf.h"
/*
......@@ -25,3 +25,13 @@ nc_inq_libvers(void)
}
#endif /* USE_NETCDF4*/
#if MAKE_PROGRAM /* TEST JIG */
#include <stdio.h>
main()
{
(void) printf("Version: %s\n", nc_inq_libvers());
return 0;
}
#endif
......@@ -175,7 +175,7 @@ nc_cktype(nc_type type)
case NC_DOUBLE:
return(NC_NOERR);
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
;
}
return(NC_EBADTYPE);
}
......@@ -201,7 +201,7 @@ ncx_howmany(nc_type type, size_t xbufsize)
case NC_DOUBLE:
return xbufsize/X_SIZEOF_DOUBLE;
case NC_NAT:
break; /* Some compilers complain if enums are missing from a switch */
break;
}
assert("ncx_howmany: Bad type" == 0);
return(0);
......@@ -220,7 +220,7 @@ NC_begins(NC *ncp,
{
size_t ii;
int sizeof_off_t;
off_t index;
off_t index = 0;
NC_var **vpp;
NC_var *last = NULL;
......@@ -242,12 +242,12 @@ NC_begins(NC *ncp,
/* only (re)calculate begin_var if there is not sufficient space in header
or start of non-record variables is not aligned as requested by valign */
if ((size_t)ncp->begin_var < ncp->xsz + h_minfree ||
ncp->begin_var != D_RNDUP(ncp->begin_var, v_align) )
if ( ncp->begin_var < (off_t)(ncp->xsz + h_minfree) ||
ncp->begin_var != (off_t)D_RNDUP(ncp->begin_var, v_align) )
{
index = (off_t) ncp->xsz;
ncp->begin_var = D_RNDUP(index, v_align);
if(ncp->begin_var < index + (off_t)h_minfree)
if ( ncp->begin_var < (off_t)(index + h_minfree) )
{
ncp->begin_var = D_RNDUP(index + (off_t)h_minfree, v_align);
}
......@@ -277,11 +277,11 @@ fprintf(stderr, " VAR %d %s: %ld\n", ii, (*vpp)->name->cp, (long)index);
/* only (re)calculate begin_rec if there is not sufficient
space at end of non-record variables or if start of record
variables is not aligned as requested by r_align */
if (ncp->begin_rec < index + (off_t)v_minfree ||
ncp->begin_rec != D_RNDUP(ncp->begin_rec, r_align) )
if (ncp->begin_rec < (off_t)(index + v_minfree) ||
ncp->begin_rec != (off_t)D_RNDUP(ncp->begin_rec, r_align) )
{
ncp->begin_rec = D_RNDUP(index, r_align);
if(ncp->begin_rec < index + (off_t)v_minfree)
if ( ncp->begin_rec < (off_t)(index + v_minfree) )
{
ncp->begin_rec = D_RNDUP(index + (off_t)v_minfree, r_align);
}
......@@ -339,7 +339,7 @@ fprintf(stderr, " REC %d %s: %ld\n", ii, (*vpp)->name->cp, (long)index);
int
read_numrecs(NC *ncp)
{
int status;
int status = NC_NOERR;
const void *xp = NULL;
size_t nrecs = NC_get_numrecs(ncp);
......@@ -374,7 +374,7 @@ read_numrecs(NC *ncp)
int
write_numrecs(NC *ncp)
{
int status;
int status = NC_NOERR;
void *xp = NULL;
assert(!NC_readonly(ncp));
......@@ -406,7 +406,7 @@ write_numrecs(NC *ncp)
static int
read_NC(NC *ncp)
{
int status;
int status = NC_NOERR;
free_NC_dimarrayV(&ncp->dims);
free_NC_attrarrayV(&ncp->attrs);
......@@ -427,7 +427,7 @@ read_NC(NC *ncp)
static int
write_NC(NC *ncp)
{
int status;
int status = NC_NOERR;
assert(!NC_readonly(ncp));
......@@ -487,7 +487,7 @@ fillerup(NC *ncp)
continue;
}
status = fill_NC_var(ncp, *varpp, (*varpp)->len, 0);
status = fill_NC_var(ncp, *varpp, 0);
if(status != NC_NOERR)
break;
}
......@@ -502,44 +502,29 @@ static int
fill_added_recs(NC *gnu, NC *old)
{
NC_var ** const gnu_varpp = (NC_var **)gnu->vars.value;
/* NC_var *const *const gnu_end = &gnu_varpp[gnu->vars.nelems]; */
const int old_nrecs = (int) NC_get_numrecs(old);
int recno = 0;
NC_var **vpp = gnu_varpp;
NC_var *const *const end = &vpp[gnu->vars.nelems];
int numrecvars = 0;
NC_var *recvarp;
/* Determine if there is only one record variable. If so, we
must treat as a special case because there's no record padding */
for(; vpp < end; vpp++) {
if(IS_RECVAR(*vpp)) {
recvarp = *vpp;
numrecvars++;
}
}
for(; recno < old_nrecs; recno++)
{
int varid = (int)old->vars.nelems;
for(; varid < (int)gnu->vars.nelems; varid++)
{
const NC_var *const gnu_varp = *(gnu_varpp + varid);
if(!IS_RECVAR(gnu_varp))
{
int varid = (int)old->vars.nelems;
for(; varid < (int)gnu->vars.nelems; varid++)
{
const NC_var *const gnu_varp = *(gnu_varpp + varid);
if(!IS_RECVAR(gnu_varp))
{
/* skip non-record variables */
continue;
}
/* else */
{
size_t varsize = numrecvars == 1 ? gnu->recsize : gnu_varp->len;
const int status = fill_NC_var(gnu, gnu_varp, varsize, recno);
if(status != NC_NOERR)
return status;
}
}
/* skip non-record variables */
continue;
}
/* else */
{
const int status = fill_NC_var(gnu, gnu_varp, recno);
if(status != NC_NOERR)
return status;
}
}
}
return NC_NOERR;
}
......@@ -561,7 +546,7 @@ fill_added(NC *gnu, NC *old)
}
/* else */
{
const int status = fill_NC_var(gnu, gnu_varp, gnu_varp->len, 0);
const int status = fill_NC_var(gnu, gnu_varp, 0);
if(status != NC_NOERR)
return status;
}
......@@ -769,7 +754,7 @@ NC_endef(NC *ncp,
size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align)
{
int status;
int status = NC_NOERR;
assert(!NC_readonly(ncp));
assert(NC_indef(ncp));
......@@ -878,7 +863,7 @@ NC_calcsize(NC *ncp, off_t *calcsizep)
NC_var **vpp = (NC_var **)ncp->vars.value;
NC_var *const *const end = &vpp[ncp->vars.nelems];
NC_var *last_fix = NULL; /* last "non-record" var */
NC_var *last_rec; /* last "record" var */
NC_var *last_rec = NULL; /* last "record" var */
/*NC_var *last_var;*/
int status;
int numrecvars = 0; /* number of record variables */
......@@ -890,24 +875,24 @@ NC_calcsize(NC *ncp, off_t *calcsizep)
}
for( /*NADA*/; vpp < end; vpp++) {
status = NC_var_shape(*vpp, &ncp->dims);
if(status != NC_NOERR)
return status;
if(IS_RECVAR(*vpp)) {
last_rec = *vpp;
numrecvars++;
} else {
last_fix = *vpp;
}
status = NC_var_shape(*vpp, &ncp->dims);
if(status != NC_NOERR)
return status;
if(IS_RECVAR(*vpp)) {
last_rec = *vpp;
numrecvars++;
} else {
last_fix = *vpp;
}
}
if(numrecvars == 0) {
assert(last_fix != NULL);
*calcsizep = last_fix->begin + last_fix->len;
/*last_var = last_fix;*/
assert(last_fix != NULL);
*calcsizep = last_fix->begin + last_fix->len;
/*last_var = last_fix;*/
} else { /* we have at least one record variable */
*calcsizep = ncp->begin_rec + ncp->numrecs * ncp->recsize;
/*last_var = last_rec;*/
*calcsizep = ncp->begin_rec + ncp->numrecs * ncp->recsize;
/*last_var = last_rec;*/
}