mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b3746cdc14
23
.travis.yml
Normal file
23
.travis.yml
Normal file
@ -0,0 +1,23 @@
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
before_install:
|
||||
# Get CMake >=2.8.8, HDF5 >= 1.8.6
|
||||
# - sudo add-apt-repository -y ppa:amcg/netcdf-parallel
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y -qq libcurl4-openssl-dev m4 wget autoconf libtool clang
|
||||
- wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/hdf5-1.8.14.tar.bz2
|
||||
- sudo mv hdf5-1.8.14.tar.bz2 /usr/local
|
||||
- pushd /usr/local
|
||||
- sudo tar -jxf hdf5-1.8.14.tar.bz2
|
||||
- popd
|
||||
|
||||
before_script:
|
||||
- autoreconf -if
|
||||
- ./configure
|
||||
|
||||
script:
|
||||
- make
|
||||
- LD_LIBRARY_PATH=/usr/local/lib make check
|
@ -987,7 +987,8 @@ IF(NOT MSVC)
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
MACRO(GEN_m4 filename)
|
||||
IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
|
||||
# IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
|
||||
IF(NC_M4)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c
|
||||
COMMAND ${NC_M4}
|
||||
|
@ -1,6 +1,8 @@
|
||||
Unidata NetCDF
|
||||
==============
|
||||
|
||||
[![Build Status](https://travis-ci.org/Unidata/netcdf-c.svg?branch=master)](https://travis-ci.org/Unidata/netcdf-c)
|
||||
|
||||
<a href="https://scan.coverity.com/projects/157">
|
||||
<img alt="Coverity Scan Build Status"
|
||||
src="https://scan.coverity.com/projects/157/badge.svg"/>
|
||||
@ -32,7 +34,7 @@ data in heterogeneous networking environments and for writing
|
||||
application software that does not depend on application-specific
|
||||
formats. For information about a variety of analysis and display
|
||||
packages that have been developed to analyze and display data in
|
||||
netCDF form, see
|
||||
netCDF form, see
|
||||
|
||||
* http://www.unidata.ucar.edu/netcdf/software.html
|
||||
|
||||
@ -43,7 +45,7 @@ For more information about netCDF, see the netCDF Web page at
|
||||
You can obtain a copy of the latest released version of netCDF software
|
||||
from
|
||||
|
||||
* http://github.com/Unidata/netcdf-c
|
||||
* http://github.com/Unidata/netcdf-c
|
||||
* http://github.com/Unidata/netcdf-fortran
|
||||
* http://github.com/Unidata/netcdf-cxx4
|
||||
* http://github.com/Unidata/netcdf4-python
|
||||
@ -62,7 +64,7 @@ The netCDF-3 C and FORTRAN-77 interfaces are documented in man(1)
|
||||
pages at
|
||||
|
||||
* http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3.html
|
||||
* http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3f.html
|
||||
* http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3f.html
|
||||
|
||||
User's Guides are also available in several forms from the same
|
||||
location.
|
||||
|
363
libsrc/attr.c
363
libsrc/attr.c
@ -1,6 +1,4 @@
|
||||
#line 5 "../../libsrc/attr.m4"
|
||||
/* Do not edit this file. It is produced from the corresponding .m4 source */
|
||||
#line 7
|
||||
/*
|
||||
* Copyright 1996, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
@ -115,7 +113,7 @@ new_NC_attr(
|
||||
free(name);
|
||||
if(strp == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
attrp = new_x_NC_attr(strp, type, nelems);
|
||||
if(attrp == NULL)
|
||||
{
|
||||
@ -134,7 +132,8 @@ dup_NC_attr(const NC_attr *rattrp)
|
||||
rattrp->type, rattrp->nelems);
|
||||
if(attrp == NULL)
|
||||
return NULL;
|
||||
(void) memcpy(attrp->xvalue, rattrp->xvalue, rattrp->xsz);
|
||||
if(attrp->xvalue != NULL && rattrp->xvalue != NULL)
|
||||
(void) memcpy(attrp->xvalue, rattrp->xvalue, rattrp->xsz);
|
||||
return attrp;
|
||||
}
|
||||
|
||||
@ -176,7 +175,7 @@ void
|
||||
free_NC_attrarrayV(NC_attrarray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
@ -265,7 +264,7 @@ incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
|
||||
(ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_attr *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
|
||||
|
||||
ncap->value = vp;
|
||||
ncap->nalloc += NC_ARRAY_GROWBY;
|
||||
}
|
||||
@ -362,7 +361,7 @@ NC_findattr(const NC_attrarray *ncap, const char *uname)
|
||||
/*
|
||||
* Look up by ncid, varid and name, return NULL if not found
|
||||
*/
|
||||
static int
|
||||
static int
|
||||
NC_lookupattr(int ncid,
|
||||
int varid,
|
||||
const char *name, /* attribute name */
|
||||
@ -424,7 +423,7 @@ NC3_inq_attname(int ncid, int varid, int attnum, char *name)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
NC3_inq_attid(int ncid, int varid, const char *name, int *attnump)
|
||||
{
|
||||
int status;
|
||||
@ -441,7 +440,7 @@ NC3_inq_attid(int ncid, int varid, const char *name, int *attnump)
|
||||
ncap = NC_attrarray0(ncp, varid);
|
||||
if(ncap == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
|
||||
|
||||
attrpp = NC_findattr(ncap, name);
|
||||
if(attrpp == NULL)
|
||||
@ -577,7 +576,7 @@ NC3_del_att(int ncid, int varid, const char *uname)
|
||||
char *name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NC_ENOMEM;
|
||||
|
||||
|
||||
/* sortof inline NC_findattr() */
|
||||
slen = strlen(name);
|
||||
|
||||
@ -612,704 +611,367 @@ NC3_del_att(int ncid, int varid, const char *uname)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
#line 673
|
||||
|
||||
static int
|
||||
#line 674
|
||||
ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type)
|
||||
#line 674
|
||||
{
|
||||
#line 674
|
||||
switch(type) {
|
||||
#line 674
|
||||
case NC_CHAR:
|
||||
#line 674
|
||||
return NC_ECHAR;
|
||||
#line 674
|
||||
case NC_BYTE:
|
||||
#line 674
|
||||
return ncx_pad_putn_schar_uchar(xpp, nelems, tp);
|
||||
#line 674
|
||||
case NC_SHORT:
|
||||
#line 674
|
||||
return ncx_pad_putn_short_uchar(xpp, nelems, tp);
|
||||
#line 674
|
||||
case NC_INT:
|
||||
#line 674
|
||||
return ncx_putn_int_uchar(xpp, nelems, tp);
|
||||
#line 674
|
||||
case NC_FLOAT:
|
||||
#line 674
|
||||
return ncx_putn_float_uchar(xpp, nelems, tp);
|
||||
#line 674
|
||||
case NC_DOUBLE:
|
||||
#line 674
|
||||
return ncx_putn_double_uchar(xpp, nelems, tp);
|
||||
#line 674
|
||||
default:
|
||||
#line 674
|
||||
assert("ncx_pad_putn_Iuchar invalid type" == 0);
|
||||
#line 674
|
||||
}
|
||||
#line 674
|
||||
return NC_EBADTYPE;
|
||||
#line 674
|
||||
}
|
||||
#line 674
|
||||
|
||||
static int
|
||||
#line 675
|
||||
ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type)
|
||||
#line 675
|
||||
{
|
||||
#line 675
|
||||
switch(type) {
|
||||
#line 675
|
||||
case NC_CHAR:
|
||||
#line 675
|
||||
return NC_ECHAR;
|
||||
#line 675
|
||||
case NC_BYTE:
|
||||
#line 675
|
||||
return ncx_pad_getn_schar_uchar(xpp, nelems, tp);
|
||||
#line 675
|
||||
case NC_SHORT:
|
||||
#line 675
|
||||
return ncx_pad_getn_short_uchar(xpp, nelems, tp);
|
||||
#line 675
|
||||
case NC_INT:
|
||||
#line 675
|
||||
return ncx_getn_int_uchar(xpp, nelems, tp);
|
||||
#line 675
|
||||
case NC_FLOAT:
|
||||
#line 675
|
||||
return ncx_getn_float_uchar(xpp, nelems, tp);
|
||||
#line 675
|
||||
case NC_DOUBLE:
|
||||
#line 675
|
||||
return ncx_getn_double_uchar(xpp, nelems, tp);
|
||||
#line 675
|
||||
default:
|
||||
#line 675
|
||||
assert("ncx_pad_getn_Iuchar invalid type" == 0);
|
||||
#line 675
|
||||
}
|
||||
#line 675
|
||||
return NC_EBADTYPE;
|
||||
#line 675
|
||||
}
|
||||
#line 675
|
||||
|
||||
|
||||
static int
|
||||
#line 677
|
||||
ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type)
|
||||
#line 677
|
||||
{
|
||||
#line 677
|
||||
switch(type) {
|
||||
#line 677
|
||||
case NC_CHAR:
|
||||
#line 677
|
||||
return NC_ECHAR;
|
||||
#line 677
|
||||
case NC_BYTE:
|
||||
#line 677
|
||||
return ncx_pad_putn_schar_schar(xpp, nelems, tp);
|
||||
#line 677
|
||||
case NC_SHORT:
|
||||
#line 677
|
||||
return ncx_pad_putn_short_schar(xpp, nelems, tp);
|
||||
#line 677
|
||||
case NC_INT:
|
||||
#line 677
|
||||
return ncx_putn_int_schar(xpp, nelems, tp);
|
||||
#line 677
|
||||
case NC_FLOAT:
|
||||
#line 677
|
||||
return ncx_putn_float_schar(xpp, nelems, tp);
|
||||
#line 677
|
||||
case NC_DOUBLE:
|
||||
#line 677
|
||||
return ncx_putn_double_schar(xpp, nelems, tp);
|
||||
#line 677
|
||||
default:
|
||||
#line 677
|
||||
assert("ncx_pad_putn_Ischar invalid type" == 0);
|
||||
#line 677
|
||||
}
|
||||
#line 677
|
||||
return NC_EBADTYPE;
|
||||
#line 677
|
||||
}
|
||||
#line 677
|
||||
|
||||
static int
|
||||
#line 678
|
||||
ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type)
|
||||
#line 678
|
||||
{
|
||||
#line 678
|
||||
switch(type) {
|
||||
#line 678
|
||||
case NC_CHAR:
|
||||
#line 678
|
||||
return NC_ECHAR;
|
||||
#line 678
|
||||
case NC_BYTE:
|
||||
#line 678
|
||||
return ncx_pad_getn_schar_schar(xpp, nelems, tp);
|
||||
#line 678
|
||||
case NC_SHORT:
|
||||
#line 678
|
||||
return ncx_pad_getn_short_schar(xpp, nelems, tp);
|
||||
#line 678
|
||||
case NC_INT:
|
||||
#line 678
|
||||
return ncx_getn_int_schar(xpp, nelems, tp);
|
||||
#line 678
|
||||
case NC_FLOAT:
|
||||
#line 678
|
||||
return ncx_getn_float_schar(xpp, nelems, tp);
|
||||
#line 678
|
||||
case NC_DOUBLE:
|
||||
#line 678
|
||||
return ncx_getn_double_schar(xpp, nelems, tp);
|
||||
#line 678
|
||||
default:
|
||||
#line 678
|
||||
assert("ncx_pad_getn_Ischar invalid type" == 0);
|
||||
#line 678
|
||||
}
|
||||
#line 678
|
||||
return NC_EBADTYPE;
|
||||
#line 678
|
||||
}
|
||||
#line 678
|
||||
|
||||
|
||||
static int
|
||||
#line 680
|
||||
ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type)
|
||||
#line 680
|
||||
{
|
||||
#line 680
|
||||
switch(type) {
|
||||
#line 680
|
||||
case NC_CHAR:
|
||||
#line 680
|
||||
return NC_ECHAR;
|
||||
#line 680
|
||||
case NC_BYTE:
|
||||
#line 680
|
||||
return ncx_pad_putn_schar_short(xpp, nelems, tp);
|
||||
#line 680
|
||||
case NC_SHORT:
|
||||
#line 680
|
||||
return ncx_pad_putn_short_short(xpp, nelems, tp);
|
||||
#line 680
|
||||
case NC_INT:
|
||||
#line 680
|
||||
return ncx_putn_int_short(xpp, nelems, tp);
|
||||
#line 680
|
||||
case NC_FLOAT:
|
||||
#line 680
|
||||
return ncx_putn_float_short(xpp, nelems, tp);
|
||||
#line 680
|
||||
case NC_DOUBLE:
|
||||
#line 680
|
||||
return ncx_putn_double_short(xpp, nelems, tp);
|
||||
#line 680
|
||||
default:
|
||||
#line 680
|
||||
assert("ncx_pad_putn_Ishort invalid type" == 0);
|
||||
#line 680
|
||||
}
|
||||
#line 680
|
||||
return NC_EBADTYPE;
|
||||
#line 680
|
||||
}
|
||||
#line 680
|
||||
|
||||
static int
|
||||
#line 681
|
||||
ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type)
|
||||
#line 681
|
||||
{
|
||||
#line 681
|
||||
switch(type) {
|
||||
#line 681
|
||||
case NC_CHAR:
|
||||
#line 681
|
||||
return NC_ECHAR;
|
||||
#line 681
|
||||
case NC_BYTE:
|
||||
#line 681
|
||||
return ncx_pad_getn_schar_short(xpp, nelems, tp);
|
||||
#line 681
|
||||
case NC_SHORT:
|
||||
#line 681
|
||||
return ncx_pad_getn_short_short(xpp, nelems, tp);
|
||||
#line 681
|
||||
case NC_INT:
|
||||
#line 681
|
||||
return ncx_getn_int_short(xpp, nelems, tp);
|
||||
#line 681
|
||||
case NC_FLOAT:
|
||||
#line 681
|
||||
return ncx_getn_float_short(xpp, nelems, tp);
|
||||
#line 681
|
||||
case NC_DOUBLE:
|
||||
#line 681
|
||||
return ncx_getn_double_short(xpp, nelems, tp);
|
||||
#line 681
|
||||
default:
|
||||
#line 681
|
||||
assert("ncx_pad_getn_Ishort invalid type" == 0);
|
||||
#line 681
|
||||
}
|
||||
#line 681
|
||||
return NC_EBADTYPE;
|
||||
#line 681
|
||||
}
|
||||
#line 681
|
||||
|
||||
|
||||
static int
|
||||
#line 683
|
||||
ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type)
|
||||
#line 683
|
||||
{
|
||||
#line 683
|
||||
switch(type) {
|
||||
#line 683
|
||||
case NC_CHAR:
|
||||
#line 683
|
||||
return NC_ECHAR;
|
||||
#line 683
|
||||
case NC_BYTE:
|
||||
#line 683
|
||||
return ncx_pad_putn_schar_int(xpp, nelems, tp);
|
||||
#line 683
|
||||
case NC_SHORT:
|
||||
#line 683
|
||||
return ncx_pad_putn_short_int(xpp, nelems, tp);
|
||||
#line 683
|
||||
case NC_INT:
|
||||
#line 683
|
||||
return ncx_putn_int_int(xpp, nelems, tp);
|
||||
#line 683
|
||||
case NC_FLOAT:
|
||||
#line 683
|
||||
return ncx_putn_float_int(xpp, nelems, tp);
|
||||
#line 683
|
||||
case NC_DOUBLE:
|
||||
#line 683
|
||||
return ncx_putn_double_int(xpp, nelems, tp);
|
||||
#line 683
|
||||
default:
|
||||
#line 683
|
||||
assert("ncx_pad_putn_Iint invalid type" == 0);
|
||||
#line 683
|
||||
}
|
||||
#line 683
|
||||
return NC_EBADTYPE;
|
||||
#line 683
|
||||
}
|
||||
#line 683
|
||||
|
||||
static int
|
||||
#line 684
|
||||
ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type)
|
||||
#line 684
|
||||
{
|
||||
#line 684
|
||||
switch(type) {
|
||||
#line 684
|
||||
case NC_CHAR:
|
||||
#line 684
|
||||
return NC_ECHAR;
|
||||
#line 684
|
||||
case NC_BYTE:
|
||||
#line 684
|
||||
return ncx_pad_getn_schar_int(xpp, nelems, tp);
|
||||
#line 684
|
||||
case NC_SHORT:
|
||||
#line 684
|
||||
return ncx_pad_getn_short_int(xpp, nelems, tp);
|
||||
#line 684
|
||||
case NC_INT:
|
||||
#line 684
|
||||
return ncx_getn_int_int(xpp, nelems, tp);
|
||||
#line 684
|
||||
case NC_FLOAT:
|
||||
#line 684
|
||||
return ncx_getn_float_int(xpp, nelems, tp);
|
||||
#line 684
|
||||
case NC_DOUBLE:
|
||||
#line 684
|
||||
return ncx_getn_double_int(xpp, nelems, tp);
|
||||
#line 684
|
||||
default:
|
||||
#line 684
|
||||
assert("ncx_pad_getn_Iint invalid type" == 0);
|
||||
#line 684
|
||||
}
|
||||
#line 684
|
||||
return NC_EBADTYPE;
|
||||
#line 684
|
||||
}
|
||||
#line 684
|
||||
|
||||
|
||||
static int
|
||||
#line 686
|
||||
ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type)
|
||||
#line 686
|
||||
{
|
||||
#line 686
|
||||
switch(type) {
|
||||
#line 686
|
||||
case NC_CHAR:
|
||||
#line 686
|
||||
return NC_ECHAR;
|
||||
#line 686
|
||||
case NC_BYTE:
|
||||
#line 686
|
||||
return ncx_pad_putn_schar_float(xpp, nelems, tp);
|
||||
#line 686
|
||||
case NC_SHORT:
|
||||
#line 686
|
||||
return ncx_pad_putn_short_float(xpp, nelems, tp);
|
||||
#line 686
|
||||
case NC_INT:
|
||||
#line 686
|
||||
return ncx_putn_int_float(xpp, nelems, tp);
|
||||
#line 686
|
||||
case NC_FLOAT:
|
||||
#line 686
|
||||
return ncx_putn_float_float(xpp, nelems, tp);
|
||||
#line 686
|
||||
case NC_DOUBLE:
|
||||
#line 686
|
||||
return ncx_putn_double_float(xpp, nelems, tp);
|
||||
#line 686
|
||||
default:
|
||||
#line 686
|
||||
assert("ncx_pad_putn_Ifloat invalid type" == 0);
|
||||
#line 686
|
||||
}
|
||||
#line 686
|
||||
return NC_EBADTYPE;
|
||||
#line 686
|
||||
}
|
||||
#line 686
|
||||
|
||||
static int
|
||||
#line 687
|
||||
ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type)
|
||||
#line 687
|
||||
{
|
||||
#line 687
|
||||
switch(type) {
|
||||
#line 687
|
||||
case NC_CHAR:
|
||||
#line 687
|
||||
return NC_ECHAR;
|
||||
#line 687
|
||||
case NC_BYTE:
|
||||
#line 687
|
||||
return ncx_pad_getn_schar_float(xpp, nelems, tp);
|
||||
#line 687
|
||||
case NC_SHORT:
|
||||
#line 687
|
||||
return ncx_pad_getn_short_float(xpp, nelems, tp);
|
||||
#line 687
|
||||
case NC_INT:
|
||||
#line 687
|
||||
return ncx_getn_int_float(xpp, nelems, tp);
|
||||
#line 687
|
||||
case NC_FLOAT:
|
||||
#line 687
|
||||
return ncx_getn_float_float(xpp, nelems, tp);
|
||||
#line 687
|
||||
case NC_DOUBLE:
|
||||
#line 687
|
||||
return ncx_getn_double_float(xpp, nelems, tp);
|
||||
#line 687
|
||||
default:
|
||||
#line 687
|
||||
assert("ncx_pad_getn_Ifloat invalid type" == 0);
|
||||
#line 687
|
||||
}
|
||||
#line 687
|
||||
return NC_EBADTYPE;
|
||||
#line 687
|
||||
}
|
||||
#line 687
|
||||
|
||||
|
||||
static int
|
||||
#line 689
|
||||
ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type)
|
||||
#line 689
|
||||
{
|
||||
#line 689
|
||||
switch(type) {
|
||||
#line 689
|
||||
case NC_CHAR:
|
||||
#line 689
|
||||
return NC_ECHAR;
|
||||
#line 689
|
||||
case NC_BYTE:
|
||||
#line 689
|
||||
return ncx_pad_putn_schar_double(xpp, nelems, tp);
|
||||
#line 689
|
||||
case NC_SHORT:
|
||||
#line 689
|
||||
return ncx_pad_putn_short_double(xpp, nelems, tp);
|
||||
#line 689
|
||||
case NC_INT:
|
||||
#line 689
|
||||
return ncx_putn_int_double(xpp, nelems, tp);
|
||||
#line 689
|
||||
case NC_FLOAT:
|
||||
#line 689
|
||||
return ncx_putn_float_double(xpp, nelems, tp);
|
||||
#line 689
|
||||
case NC_DOUBLE:
|
||||
#line 689
|
||||
return ncx_putn_double_double(xpp, nelems, tp);
|
||||
#line 689
|
||||
default:
|
||||
#line 689
|
||||
assert("ncx_pad_putn_Idouble invalid type" == 0);
|
||||
#line 689
|
||||
}
|
||||
#line 689
|
||||
return NC_EBADTYPE;
|
||||
#line 689
|
||||
}
|
||||
#line 689
|
||||
|
||||
static int
|
||||
#line 690
|
||||
ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type)
|
||||
#line 690
|
||||
{
|
||||
#line 690
|
||||
switch(type) {
|
||||
#line 690
|
||||
case NC_CHAR:
|
||||
#line 690
|
||||
return NC_ECHAR;
|
||||
#line 690
|
||||
case NC_BYTE:
|
||||
#line 690
|
||||
return ncx_pad_getn_schar_double(xpp, nelems, tp);
|
||||
#line 690
|
||||
case NC_SHORT:
|
||||
#line 690
|
||||
return ncx_pad_getn_short_double(xpp, nelems, tp);
|
||||
#line 690
|
||||
case NC_INT:
|
||||
#line 690
|
||||
return ncx_getn_int_double(xpp, nelems, tp);
|
||||
#line 690
|
||||
case NC_FLOAT:
|
||||
#line 690
|
||||
return ncx_getn_float_double(xpp, nelems, tp);
|
||||
#line 690
|
||||
case NC_DOUBLE:
|
||||
#line 690
|
||||
return ncx_getn_double_double(xpp, nelems, tp);
|
||||
#line 690
|
||||
default:
|
||||
#line 690
|
||||
assert("ncx_pad_getn_Idouble invalid type" == 0);
|
||||
#line 690
|
||||
}
|
||||
#line 690
|
||||
return NC_EBADTYPE;
|
||||
#line 690
|
||||
}
|
||||
#line 690
|
||||
|
||||
|
||||
#ifdef IGNORE
|
||||
static int
|
||||
#line 693
|
||||
ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type)
|
||||
#line 693
|
||||
{
|
||||
#line 693
|
||||
switch(type) {
|
||||
#line 693
|
||||
case NC_CHAR:
|
||||
#line 693
|
||||
return NC_ECHAR;
|
||||
#line 693
|
||||
case NC_BYTE:
|
||||
#line 693
|
||||
return ncx_pad_putn_schar_long(xpp, nelems, tp);
|
||||
#line 693
|
||||
case NC_SHORT:
|
||||
#line 693
|
||||
return ncx_pad_putn_short_long(xpp, nelems, tp);
|
||||
#line 693
|
||||
case NC_INT:
|
||||
#line 693
|
||||
return ncx_putn_int_long(xpp, nelems, tp);
|
||||
#line 693
|
||||
case NC_FLOAT:
|
||||
#line 693
|
||||
return ncx_putn_float_long(xpp, nelems, tp);
|
||||
#line 693
|
||||
case NC_DOUBLE:
|
||||
#line 693
|
||||
return ncx_putn_double_long(xpp, nelems, tp);
|
||||
#line 693
|
||||
default:
|
||||
#line 693
|
||||
assert("ncx_pad_putn_Ilong invalid type" == 0);
|
||||
#line 693
|
||||
}
|
||||
#line 693
|
||||
return NC_EBADTYPE;
|
||||
#line 693
|
||||
}
|
||||
#line 693
|
||||
|
||||
static int
|
||||
#line 694
|
||||
ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type)
|
||||
#line 694
|
||||
{
|
||||
#line 694
|
||||
switch(type) {
|
||||
#line 694
|
||||
case NC_CHAR:
|
||||
#line 694
|
||||
return NC_ECHAR;
|
||||
#line 694
|
||||
case NC_BYTE:
|
||||
#line 694
|
||||
return ncx_pad_getn_schar_long(xpp, nelems, tp);
|
||||
#line 694
|
||||
case NC_SHORT:
|
||||
#line 694
|
||||
return ncx_pad_getn_short_long(xpp, nelems, tp);
|
||||
#line 694
|
||||
case NC_INT:
|
||||
#line 694
|
||||
return ncx_getn_int_long(xpp, nelems, tp);
|
||||
#line 694
|
||||
case NC_FLOAT:
|
||||
#line 694
|
||||
return ncx_getn_float_long(xpp, nelems, tp);
|
||||
#line 694
|
||||
case NC_DOUBLE:
|
||||
#line 694
|
||||
return ncx_getn_double_long(xpp, nelems, tp);
|
||||
#line 694
|
||||
default:
|
||||
#line 694
|
||||
assert("ncx_pad_getn_Ilong invalid type" == 0);
|
||||
#line 694
|
||||
}
|
||||
#line 694
|
||||
return NC_EBADTYPE;
|
||||
#line 694
|
||||
}
|
||||
#line 694
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
#line 697
|
||||
ncx_pad_putn_Ilonglong(void **xpp, size_t nelems, const longlong *tp, nc_type type)
|
||||
#line 697
|
||||
{
|
||||
#line 697
|
||||
switch(type) {
|
||||
#line 697
|
||||
case NC_CHAR:
|
||||
#line 697
|
||||
return NC_ECHAR;
|
||||
#line 697
|
||||
case NC_BYTE:
|
||||
#line 697
|
||||
return ncx_pad_putn_schar_longlong(xpp, nelems, tp);
|
||||
#line 697
|
||||
case NC_SHORT:
|
||||
#line 697
|
||||
return ncx_pad_putn_short_longlong(xpp, nelems, tp);
|
||||
#line 697
|
||||
case NC_INT:
|
||||
#line 697
|
||||
return ncx_putn_int_longlong(xpp, nelems, tp);
|
||||
#line 697
|
||||
case NC_FLOAT:
|
||||
#line 697
|
||||
return ncx_putn_float_longlong(xpp, nelems, tp);
|
||||
#line 697
|
||||
case NC_DOUBLE:
|
||||
#line 697
|
||||
return ncx_putn_double_longlong(xpp, nelems, tp);
|
||||
#line 697
|
||||
default:
|
||||
#line 697
|
||||
assert("ncx_pad_putn_Ilonglong invalid type" == 0);
|
||||
#line 697
|
||||
}
|
||||
#line 697
|
||||
return NC_EBADTYPE;
|
||||
#line 697
|
||||
}
|
||||
#line 697
|
||||
|
||||
static int
|
||||
#line 698
|
||||
ncx_pad_getn_Ilonglong(const void **xpp, size_t nelems, longlong *tp, nc_type type)
|
||||
#line 698
|
||||
{
|
||||
#line 698
|
||||
switch(type) {
|
||||
#line 698
|
||||
case NC_CHAR:
|
||||
#line 698
|
||||
return NC_ECHAR;
|
||||
#line 698
|
||||
case NC_BYTE:
|
||||
#line 698
|
||||
return ncx_pad_getn_schar_longlong(xpp, nelems, tp);
|
||||
#line 698
|
||||
case NC_SHORT:
|
||||
#line 698
|
||||
return ncx_pad_getn_short_longlong(xpp, nelems, tp);
|
||||
#line 698
|
||||
case NC_INT:
|
||||
#line 698
|
||||
return ncx_getn_int_longlong(xpp, nelems, tp);
|
||||
#line 698
|
||||
case NC_FLOAT:
|
||||
#line 698
|
||||
return ncx_getn_float_longlong(xpp, nelems, tp);
|
||||
#line 698
|
||||
case NC_DOUBLE:
|
||||
#line 698
|
||||
return ncx_getn_double_longlong(xpp, nelems, tp);
|
||||
#line 698
|
||||
default:
|
||||
#line 698
|
||||
assert("ncx_pad_getn_Ilonglong invalid type" == 0);
|
||||
#line 698
|
||||
}
|
||||
#line 698
|
||||
return NC_EBADTYPE;
|
||||
#line 698
|
||||
}
|
||||
#line 698
|
||||
|
||||
|
||||
|
||||
@ -1399,10 +1061,10 @@ NC3_put_att(
|
||||
if(!NC_indef(ncp)) {
|
||||
const size_t xsz = ncx_len_NC_attrV(type, nelems);
|
||||
attrp = *attrpp; /* convenience */
|
||||
|
||||
|
||||
if(xsz > attrp->xsz) return NC_ENOTINDEFINE;
|
||||
/* else, we can reuse existing without redef */
|
||||
|
||||
|
||||
attrp->xsz = xsz;
|
||||
attrp->type = type;
|
||||
attrp->nelems = nelems;
|
||||
@ -1411,7 +1073,7 @@ NC3_put_att(
|
||||
void *xp = attrp->xvalue;
|
||||
status = dispatchput(&xp, nelems, (const void*)value, type, memtype);
|
||||
}
|
||||
|
||||
|
||||
set_NC_hdirty(ncp);
|
||||
|
||||
if(NC_doHsync(ncp)) {
|
||||
@ -1512,4 +1174,3 @@ NC3_get_att(
|
||||
status = NC_EBADTYPE;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ new_NC_attr(
|
||||
free(name);
|
||||
if(strp == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
attrp = new_x_NC_attr(strp, type, nelems);
|
||||
if(attrp == NULL)
|
||||
{
|
||||
@ -137,7 +137,8 @@ dup_NC_attr(const NC_attr *rattrp)
|
||||
rattrp->type, rattrp->nelems);
|
||||
if(attrp == NULL)
|
||||
return NULL;
|
||||
(void) memcpy(attrp->xvalue, rattrp->xvalue, rattrp->xsz);
|
||||
if(attrp->xvalue != NULL && rattrp->xvalue != NULL)
|
||||
(void) memcpy(attrp->xvalue, rattrp->xvalue, rattrp->xsz);
|
||||
return attrp;
|
||||
}
|
||||
|
||||
@ -179,7 +180,7 @@ void
|
||||
free_NC_attrarrayV(NC_attrarray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
@ -268,7 +269,7 @@ incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
|
||||
(ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_attr *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
|
||||
|
||||
ncap->value = vp;
|
||||
ncap->nalloc += NC_ARRAY_GROWBY;
|
||||
}
|
||||
@ -365,7 +366,7 @@ NC_findattr(const NC_attrarray *ncap, const char *uname)
|
||||
/*
|
||||
* Look up by ncid, varid and name, return NULL if not found
|
||||
*/
|
||||
static int
|
||||
static int
|
||||
NC_lookupattr(int ncid,
|
||||
int varid,
|
||||
const char *name, /* attribute name */
|
||||
@ -427,7 +428,7 @@ NC3_inq_attname(int ncid, int varid, int attnum, char *name)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
NC3_inq_attid(int ncid, int varid, const char *name, int *attnump)
|
||||
{
|
||||
int status;
|
||||
@ -444,7 +445,7 @@ NC3_inq_attid(int ncid, int varid, const char *name, int *attnump)
|
||||
ncap = NC_attrarray0(ncp, varid);
|
||||
if(ncap == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
|
||||
|
||||
attrpp = NC_findattr(ncap, name);
|
||||
if(attrpp == NULL)
|
||||
@ -580,7 +581,7 @@ NC3_del_att(int ncid, int varid, const char *uname)
|
||||
char *name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NC_ENOMEM;
|
||||
|
||||
|
||||
/* sortof inline NC_findattr() */
|
||||
slen = strlen(name);
|
||||
|
||||
@ -784,10 +785,10 @@ NC3_put_att(
|
||||
if(!NC_indef(ncp)) {
|
||||
const size_t xsz = ncx_len_NC_attrV(type, nelems);
|
||||
attrp = *attrpp; /* convenience */
|
||||
|
||||
|
||||
if(xsz > attrp->xsz) return NC_ENOTINDEFINE;
|
||||
/* else, we can reuse existing without redef */
|
||||
|
||||
|
||||
attrp->xsz = xsz;
|
||||
attrp->type = type;
|
||||
attrp->nelems = nelems;
|
||||
@ -796,7 +797,7 @@ NC3_put_att(
|
||||
void *xp = attrp->xvalue;
|
||||
status = dispatchput(&xp, nelems, (const void*)value, type, memtype);
|
||||
}
|
||||
|
||||
|
||||
set_NC_hdirty(ncp);
|
||||
|
||||
if(NC_doHsync(ncp)) {
|
||||
@ -897,4 +898,3 @@ NC3_get_att(
|
||||
status = NC_EBADTYPE;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ static void
|
||||
rctrim(char* text)
|
||||
{
|
||||
char* p = text;
|
||||
size_t len = strlen(text);
|
||||
size_t len = 0;
|
||||
int i;
|
||||
/* locate first non-trimchar */
|
||||
for(;*p;p++) {
|
||||
|
Loading…
Reference in New Issue
Block a user