Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ This file contains a high-level description of this package's evolution. Release

## 4.9.4 - TBD

* Clean up minor problems with DAP2/DAP4 code. Part of the splitting of PR [Github #3068](https://github.com/Unidata/netcdf-c/pull/3068). See [Github #3092](https://github.com/Unidata/netcdf-c/pull/3092) for more information.
* Clean up the S3 API for all non-libnczarr code. This continues the splitting of PR [Github #3068](https://github.com/Unidata/netcdf-c/pull/3068).
See [Github #3090](https://github.com/Unidata/netcdf-c/pull/3090) for more information.
* Step 1 in splitting PR [Github #3068](https://github.com/Unidata/netcdf-c/pull/3068). Update ncjson.[ch] and ncproplist.[ch]. Also fix references to old API. Also fix include/netcdf_ncjson.h and include/netcdf_proplist.h builds. See [Github #3086](https://github.com/Unidata/netcdf-c/pull/3086) for more information.
* Provide an auxilliary function, `ncaux_parse_provenance()`, that allows users to parse the _NCProperties attribute into a collection of character pointers. See [Github #3088](https://github.com/Unidata/netcdf-c/pull/3088) for more information.
* Step 2 in splitting PR [Github #3068](https://github.com/Unidata/netcdf-c/pull/3068). Fix a namespace problem in tinyxml2.cpp. Note that this is a visual studio problem hence use of _MSC_VER. Also turn off DAP4 tests against Hyrax server until DAP4 spec problems are fixed. See [Github #3089](https://github.com/Unidata/netcdf-c/pull/3089) for more information.


## 4.9.3 - February 7, 2025

## Known Issues
Expand Down
2 changes: 1 addition & 1 deletion libdap2/ncd2dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ fprintf(stderr,"\n");
NCattribute* att = (NCattribute*)nclistget(var->attributes,j);
char* val = NULL;
/* Check for _FillValue/Variable mismatch */
if(strcmp(att->name,"_FillValue")==0) {
if(strcmp(att->name,NC_FillValue)==0) {
/* Special case var is byte, fillvalue is int16 and
unsignedattr == 0;
This exception is needed because DAP2 byte type
Expand Down
7 changes: 5 additions & 2 deletions libdap4/d4http.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
nclog(NCLOGWARN,"WriteMemoryCallback: zero sized chunk");
/* Optimize for reading potentially large dods datasets */
while(!ncbytesavail(buf,realsize)) {
/* double the size of the packet */
ncbytessetalloc(buf,2*ncbytesalloc(buf));
/* double the size of the packet (unless the buf is empty) */
if(ncbytesalloc(buf) == 0)
ncbytessetalloc(buf,1024);
else
ncbytessetalloc(buf,2*ncbytesalloc(buf));
}
ncbytesappendn(buf, ptr, realsize);
#ifdef PROGRESS
Expand Down
2 changes: 1 addition & 1 deletion libdap4/d4meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ compileAttrValues(NCD4meta* builder, NCD4node* attr, void** memoryp, NClist* blo
memset((void*)&converter,0,sizeof(converter));

/* Deal with _FillValue */
if(container->sort == NCD4_VAR && strcmp(attr->name,"_FillValue")==0) {
if(container->sort == NCD4_VAR && strcmp(attr->name,NC_FillValue)==0) {
/* Verify or fix or ignore or fail on type mismatch */
if(container->basetype != basetype) {/* _FillValue/Variable type mismatch */
int compatible = isfilltypecompatible(container->basetype, basetype);
Expand Down
68 changes: 40 additions & 28 deletions libdap4/d4parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ static const struct KEYWORDINFO {
};
typedef struct KEYWORDINFO KEYWORDINFO;

static const struct ATOMICTYPEINFO {
/* Warning do not make const because sort will modify */
static struct ATOMICTYPEINFO {
char* name; nc_type type; size_t size;
} atomictypeinfo[] = {
/* Keep in sorted order for binary search */
/* Will be sorted on first use */
/* Use lower case for canonical comparison, but keep proper name here */
{"Byte",NC_BYTE,sizeof(char)},
{"Char",NC_CHAR,sizeof(char)},
Expand All @@ -85,8 +86,9 @@ static const struct ATOMICTYPEINFO {
{"UInt64",NC_UINT64,sizeof(unsigned long long)},
{"UInt8",NC_UBYTE,sizeof(unsigned char)},
{"Url",NC_STRING,sizeof(char*)},
{NULL,NC_NAT,0}
};
#define NCD4_NATOMICTYPES (sizeof(atomictypeinfo)/sizeof(struct ATOMICTYPEINFO))
static int atomictypessorted = 0;

/***************************************************/

Expand Down Expand Up @@ -116,7 +118,7 @@ static NCD4node* getOpaque(NCD4parser*, ncxml_t varxml, NCD4node* group);
static int getValueStrings(NCD4parser*, NCD4node*, ncxml_t xattr, NClist*);
static int isReserved(const char* name);
static const KEYWORDINFO* keyword(const char* name);
static NCD4node* lookupAtomicType(NClist*, const char* name);
static NCD4node* lookupAtomicType(NClist*,const char* name);
static NCD4node* lookFor(NClist* elems, const char* name, NCD4sort sort);
static NCD4node* lookupFQN(NCD4parser*, const char* sfqn, NCD4sort);
static int lookupFQNList(NCD4parser*, NClist* fqn, NCD4sort sort, NCD4node** result);
Expand Down Expand Up @@ -764,6 +766,7 @@ parseMaps(NCD4parser* parser, NCD4node* var, ncxml_t xml)
int ret = NC_NOERR;
ncxml_t x;

NC_UNUSED(parser);
for(x=ncxml_child(xml, "Map");x!= NULL;x=ncxml_next(x,"Map")) {
char* fqn;
fqn = ncxml_attr(x,"name");
Expand Down Expand Up @@ -937,6 +940,8 @@ static int
getValueStrings(NCD4parser* parser, NCD4node* type, ncxml_t xattr, NClist* svalues)
{
char* s;
NC_UNUSED(parser);
NC_UNUSED(type);
/* See first if we have a "value" xml attribute */
s = ncxml_attr(xattr,"value");
if(s != NULL)
Expand Down Expand Up @@ -1249,7 +1254,7 @@ defineBytestringType(NCD4parser* parser)
if(ret != NC_NOERR) goto done;
SETNAME(bstring,"_bytestring");
bstring->opaque.size = 0;
bstring->basetype = lookupAtomicType(parser,"UInt8");
bstring->basetype = lookupAtomicType(parser->meta->atomictypes,"UInt8");
PUSH(parser->metadata->root->types,bstring);
parser->metadata->_bytestring = bstring;
} else
Expand All @@ -1259,16 +1264,25 @@ defineBytestringType(NCD4parser* parser)
}
#endif

static int atisort(const void* a, const void* b)
{
return strcasecmp(((struct ATOMICTYPEINFO*)a)->name,((struct ATOMICTYPEINFO*)b)->name);
}

static int
defineAtomicTypes(NCD4meta* meta, NClist* list)
{
int ret = NC_NOERR;
NCD4node* node;
const struct ATOMICTYPEINFO* ati;
size_t i;

if(list == NULL)
return THROW(NC_EINTERNAL);
for(ati=atomictypeinfo;ati->name;ati++) {
if(list == NULL) return THROW(NC_EINTERNAL);
if(!atomictypessorted) {
qsort((void*)atomictypeinfo, NCD4_NATOMICTYPES,sizeof(struct ATOMICTYPEINFO),atisort);
atomictypessorted = 1;
}
for(i=0;i<NCD4_NATOMICTYPES;i++) {
const struct ATOMICTYPEINFO* ati = &atomictypeinfo[i];
if((ret=makeNodeStatic(meta,NULL,NCD4_TYPE,ati->type,&node))) goto done;
SETNAME(node,ati->name);
PUSH(list,node);
Expand All @@ -1277,29 +1291,26 @@ defineAtomicTypes(NCD4meta* meta, NClist* list)
return THROW(ret);
}

static int
aticmp(const void* a, const void* b)
{
const char* name = (const char*)a;
NCD4node** nodebp = (NCD4node**)b;
return strcasecmp(name,(*nodebp)->name);
}

/* Binary search the set of set of atomictypes */
static NCD4node*
lookupAtomicType(NClist* atomictypes, const char* name)
{
size_t n = nclistlength(atomictypes);
if (n == 0) return NULL;
size_t L = 0;
size_t R = n - 1;
NCD4node* p;

for(;;) {
if(L > R) break;
size_t m = (L + R) / 2;
p = (NCD4node*)nclistget(atomictypes,m);
int cmp = strcasecmp(p->name,name);
if(cmp == 0)
return p;
if(cmp < 0)
L = (m + 1);
else /*cmp > 0*/
R = (m - 1);
}
return NULL;
void* match = NULL;
size_t ntypes = 0;
NCD4node** types = NULL;
assert(atomictypessorted && nclistlength(atomictypes) > 0);
ntypes = nclistlength(atomictypes);
types = (NCD4node**)atomictypes->content;
match = bsearch((void*)name,(void*)types,ntypes,sizeof(NCD4node*),aticmp);
return (match==NULL?NULL:*(NCD4node**)match);
}

/**************************************************/
Expand Down Expand Up @@ -1650,6 +1661,7 @@ parseForwards(NCD4parser* parser, NCD4node* root)
int ret = NC_NOERR;
size_t i,j;

NC_UNUSED(root);
/* process all vars */
for(i=0;i<nclistlength(parser->vars);i++) {
NCD4node* var = (NCD4node*)nclistget(parser->vars,i);
Expand Down
Loading