mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
Fix return type of listlength
This commit is contained in:
parent
320c29c723
commit
c74b78efc6
@ -34,20 +34,15 @@ genbin_netcdf(void)
|
||||
{
|
||||
int stat, ncid;
|
||||
size_t idim, ivar, iatt;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
const char* filename = rootgroup->file.filename;
|
||||
|
||||
size_t ndims = listlength(dimdefs);
|
||||
size_t nvars = listlength(vardefs);
|
||||
size_t natts = listlength(attdefs);
|
||||
size_t ngatts = listlength(gattdefs);
|
||||
#ifdef USE_NETCDF4
|
||||
int ntyps, ngrps;
|
||||
#endif
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
#ifdef USE_NETCDF4
|
||||
ntyps = listlength(typdefs);
|
||||
ngrps = listlength(grpdefs);
|
||||
size_t ntyps = listlength(typdefs);
|
||||
size_t ngrps = listlength(grpdefs);
|
||||
#endif /*USE_NETCDF4*/
|
||||
|
||||
/* Turn on logging */
|
||||
|
14
ncgen/genc.c
14
ncgen/genc.c
@ -40,22 +40,20 @@ genc_netcdf(void)
|
||||
{
|
||||
size_t idim, ivar, iatt;
|
||||
int maxdims;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
char* cmode_string;
|
||||
const char *filename = rootgroup->file.filename;
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
size_t igrp, ityp;
|
||||
int ngrps, ntyps;
|
||||
#endif
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
size_t ndims = listlength(dimdefs);
|
||||
size_t nvars = listlength(vardefs);
|
||||
size_t natts = listlength(attdefs);
|
||||
size_t ngatts = listlength(gattdefs);
|
||||
#ifdef USE_NETCDF4
|
||||
ngrps = listlength(grpdefs);
|
||||
ntyps = listlength(typdefs);
|
||||
size_t ngrps = listlength(grpdefs);
|
||||
size_t ntyps = listlength(typdefs);
|
||||
#endif /*USE_NETCDF4*/
|
||||
|
||||
/* wrap in main program */
|
||||
|
@ -117,7 +117,7 @@ generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist*
|
||||
|
||||
case NC_COMPOUND: {
|
||||
size_t i, dllen;
|
||||
int uid, nfields;
|
||||
int uid;
|
||||
if(con == NULL || isfillconst(con)) {
|
||||
Datalist* fill = (filler==NULL?getfiller(tsym):filler);
|
||||
ASSERT(fill->length == 1);
|
||||
@ -140,7 +140,7 @@ generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist*
|
||||
}
|
||||
|
||||
data = con->value.compoundv;
|
||||
nfields = listlength(tsym->subnodes);
|
||||
size_t nfields = listlength(tsym->subnodes);
|
||||
dllen = datalistlen(data);
|
||||
if(dllen > nfields) {
|
||||
semerror(con->lineno,"Datalist longer than the number of compound fields");
|
||||
|
@ -48,14 +48,13 @@ void
|
||||
genf77_netcdf(void)
|
||||
{
|
||||
size_t idim, ivar, iatt;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
char* cmode_string;
|
||||
const char *filename = rootgroup->file.filename;
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
size_t ndims = listlength(dimdefs);
|
||||
size_t nvars = listlength(vardefs);
|
||||
size_t natts = listlength(attdefs);
|
||||
size_t ngatts = listlength(gattdefs);
|
||||
|
||||
/* Construct the main program */
|
||||
|
||||
@ -708,7 +707,7 @@ genf77_writevar(Generator* generator, Symbol* vsym, Bytebuffer* code,
|
||||
f77skip();
|
||||
} else { /* rank > 0 && typecode != NC_CHAR*/
|
||||
char* dimstring;
|
||||
int index = listlength(f77procs);
|
||||
size_t index = listlength(f77procs);
|
||||
Bytebuffer* proctext;
|
||||
Bytebuffer* save;
|
||||
List* calllist;
|
||||
|
@ -42,13 +42,12 @@ genjava_netcdf(void)
|
||||
{
|
||||
size_t idim, ivar, iatt;
|
||||
int maxdims;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
const char *filename = rootgroup->file.filename;
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
size_t ndims = listlength(dimdefs);
|
||||
size_t nvars = listlength(vardefs);
|
||||
size_t natts = listlength(attdefs);
|
||||
size_t ngatts = listlength(gattdefs);
|
||||
|
||||
/* Construct the main class */
|
||||
codeline("import java.util.*;");
|
||||
|
@ -74,7 +74,7 @@ fill(Symbol* tsym, Datalist* filler)
|
||||
consisting itself of N constants, where N is the number of fields.
|
||||
Non-array fields will be direct, array fields will be sublists.
|
||||
*/
|
||||
Datalist* cmpdlist = builddatalist(listlength(tsym->subnodes)); /* list of field constants */
|
||||
Datalist* cmpdlist = builddatalist((int)listlength(tsym->subnodes)); /* list of field constants */
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
NCConstant* fieldinstance = NULL;
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
@ -123,7 +123,7 @@ filllist(Symbol* tsym, Datalist* dl)
|
||||
dlappend(dl,con);
|
||||
break;
|
||||
case NC_COMPOUND:
|
||||
sublist = builddatalist(listlength(tsym->subnodes));
|
||||
sublist = builddatalist((int)listlength(tsym->subnodes));
|
||||
for(size_t i=0;i<listlength(tsym->subnodes);i++) {
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
filllist(field->typ.basetype,sublist);
|
||||
|
@ -57,6 +57,6 @@ EXTERNC List* listclone(List*);
|
||||
#define listclear(l) listsetlength((l),0)
|
||||
#define listextend(l,len) listsetalloc((l),(len)+(l->alloc))
|
||||
#define listcontents(l) ((l)==NULL?NULL:(l)->content)
|
||||
#define listlength(l) ((l)==NULL?0:(int)(l)->length)
|
||||
#define listlength(l) ((l)==NULL?0:(l)->length)
|
||||
|
||||
#endif /*LIST_H*/
|
||||
|
@ -373,11 +373,10 @@ char*
|
||||
prefixtostring(List* prefix, char* separator)
|
||||
{
|
||||
size_t slen=0;
|
||||
int plen;
|
||||
size_t i;
|
||||
char* result;
|
||||
if(prefix == NULL) return pooldup("");
|
||||
plen = prefixlen(prefix);
|
||||
size_t plen = prefixlen(prefix);
|
||||
if(plen == 0) { /* root prefix*/
|
||||
slen=0;
|
||||
/* slen += strlen(separator);*/
|
||||
@ -425,7 +424,7 @@ prefixeq(List* x1, List* x2)
|
||||
{
|
||||
Symbol** l1;
|
||||
Symbol** l2;
|
||||
int len,i;
|
||||
size_t len,i;
|
||||
if((len=listlength(x1)) != listlength(x2)) return 0;
|
||||
l1=(Symbol**)listcontents(x1);
|
||||
l2=(Symbol**)listcontents(x2);
|
||||
|
Loading…
Reference in New Issue
Block a user