Fix some conversion warnings in ncdap4

This commit is contained in:
Peter Hill 2024-03-25 10:31:41 +00:00
parent 424e6280e9
commit dc054494ed
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE
8 changed files with 22 additions and 25 deletions

View File

@ -363,8 +363,8 @@ NCD4_get_rcproperties(NCD4INFO* state)
unsigned long interval=0;
if(sscanf(option,"%lu/%lu",&idle,&interval) != 2)
fprintf(stderr,"Illegal KEEPALIVE VALUE: %s\n",option);
state->curl->keepalive.idle = idle;
state->curl->keepalive.interval = interval;
state->curl->keepalive.idle = (long)idle;
state->curl->keepalive.interval = (long)interval;
state->curl->keepalive.active = 1;
}
}

View File

@ -309,7 +309,7 @@ fillopfixed(NCD4meta* meta, d4size_t opaquesize, NCD4offset* offset, void** dstp
SKIPCOUNTER(offset);
/* verify that it is the correct size */
actual = count;
delta = actual - opaquesize;
delta = (int)actual - (int)opaquesize;
if(delta != 0) {
#ifdef FIXEDOPAQUE
nclog(NCLOGWARN,"opaque changed from %lu to %lu",actual,opaquesize);

View File

@ -231,7 +231,6 @@ static int
delimitAtomicVar(NCD4meta* compiler, NCD4node* var, NCD4offset* offset)
{
int ret = NC_NOERR;
int typesize;
d4size_t i;
d4size_t dimproduct;
nc_type tid;
@ -249,7 +248,7 @@ delimitAtomicVar(NCD4meta* compiler, NCD4node* var, NCD4offset* offset)
truetype = basetype->basetype;
tid = truetype->subsort;
typesize = NCD4_typesize(tid);
size_t typesize = NCD4_typesize(tid);
if(tid != NC_STRING) {
INCR(offset,(typesize*dimproduct));
} else if(tid == NC_STRING) { /* walk the counts */
@ -448,13 +447,13 @@ skipAtomicInstance(NCD4meta* compiler, NCD4node* type, NCD4offset* offset)
{
int ret = NC_NOERR;
d4size_t count;
int typesize;
size_t typesize;
switch (type->subsort) {
default: /* fixed size atomic type */
typesize = NCD4_typesize(type->meta.id);
INCR(offset,typesize);
break;
INCR(offset,typesize);
break;
case NC_STRING:
/* Get string count */
count = GETCOUNTER(offset);

View File

@ -70,7 +70,7 @@ NCD4_fetchurl(CURL* curl, const char* url, NCbytes* buf, long* filetime, int* ht
if(cstat != CURLE_OK) goto done;
httpcode = NCD4_fetchhttpcode(curl);
if(httpcodep) *httpcodep = httpcode;
if(httpcodep) *httpcodep = (int)httpcode;
/* Get the last modified time */
if(filetime != NULL)

View File

@ -39,7 +39,7 @@ static int convertString(union ATOMICS* converter, NCD4node* type, const char* s
static void* copyAtomic(union ATOMICS* converter, nc_type type, size_t len, void* dst, NClist* blobs);
static int decodeEconst(NCD4meta* builder, NCD4node* enumtype, const char* nameorval, union ATOMICS* converter);
static int downConvert(union ATOMICS* converter, NCD4node* type);
static void freeStringMemory(char** mem, int count);
static void freeStringMemory(char** mem, size_t count);
static size_t getDimrefs(NCD4node* var, int* dimids);
static size_t getDimsizes(NCD4node* var, int* dimsizes);
static d4size_t getpadding(d4size_t offset, size_t alignment);
@ -535,7 +535,7 @@ buildAtomicVar(NCD4meta* builder, NCD4node* var)
#endif
rank = getDimrefs(var,dimids);
NCCHECK((nc_def_var(group->meta.id,var->name,var->basetype->meta.id,rank,dimids,&var->meta.id)));
NCCHECK((nc_def_var(group->meta.id,var->name,var->basetype->meta.id,(int)rank,dimids,&var->meta.id)));
/* Tag the var */
savevarbyid(group,var);
@ -705,11 +705,10 @@ getDimsizes(NCD4node* var, int* dimsizes)
/* Utilities */
static void
freeStringMemory(char** mem, int count)
freeStringMemory(char** mem, size_t count)
{
int i;
if(mem == NULL) return;
for(i=0;i<count;i++) {
for(size_t i=0;i<count;i++) {
char* p = mem[i];
if(p) free(p);
}

View File

@ -46,7 +46,7 @@ d4odom_new(size_t rank,
assert(odom->rank <= NC_MAX_VAR_DIMS);
for(i=0;i<odom->rank;i++) {
size_t istart,icount,istop,ideclsize;
ptrdiff_t istride;
size_t istride;
istart = (start != NULL ? start[i] : 0);
icount = (count != NULL ? count[i] : (size != NULL ? size[i] : 1));
istride = (size_t)(stride != NULL ? stride[i] : 1);

View File

@ -881,7 +881,7 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group)
{
size_t i;
int ret = NC_NOERR;
long long len;
size_t len;
NCD4node* opaquetype = NULL;
char* xattr;
@ -894,11 +894,11 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group)
/* See if this var has UCARTAGOPAQUE attribute */
xattr = ncxml_attr(varxml,UCARTAGOPAQUE);
if(xattr != NULL) {
long long tmp = 0;
long long tmp = 0;
if((ret = parseLL(xattr,&tmp)) || (tmp < 0))
FAIL(NC_EINVAL,"Illegal opaque len: %s",xattr);
len = tmp;
nullfree(xattr);
FAIL(NC_EINVAL,"Illegal opaque len: %s",xattr);
len = (size_t)tmp;
nullfree(xattr);
}
}
#ifndef FIXEDOPAQUE
@ -920,7 +920,7 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group)
if(opaquetype == NULL) {/* create it */
char name[NC_MAX_NAME+1];
/* Make name be "opaqueN" */
snprintf(name,NC_MAX_NAME,"opaque%lld_t",len);
snprintf(name,NC_MAX_NAME,"opaque%zu_t",len);
/* Opaque types are always created in the current group */
if((ret=makeNode(parser,group,NULL,NCD4_TYPE,NC_OPAQUE,&opaquetype)))
goto done;
@ -1098,14 +1098,13 @@ lookupFQNList(NCD4parser* parser, NClist* fqn, NCD4sort sort, NCD4node** result)
{
int ret = NC_NOERR;
size_t i;
int nsteps;
NCD4node* current;
char* name = NULL;
NCD4node* node = NULL;
/* Step 1: walk thru groups until can go no further */
current = parser->metadata->root;
nsteps = nclistlength(fqn);
size_t nsteps = nclistlength(fqn);
for(i=1;i<nsteps;i++) { /* start at 1 to side-step root name */
assert(ISGROUP(current->sort));
name = (char*)nclistget(fqn,i);

View File

@ -77,8 +77,8 @@ walkAtomicVar(NCD4response* resp, NCD4node* topvar, NCD4node* var, NCD4offset* o
subsort = var->basetype->basetype->subsort;
/* Only need to swap multi-byte integers and floats */
if(subsort != NC_STRING) {
int typesize = NCD4_typesize(subsort);
d4size_t totalsize = typesize*dimproduct;
size_t typesize = NCD4_typesize(subsort);
d4size_t totalsize = typesize*dimproduct;
if(typesize == 1) {
INCR(offset,totalsize);
} else { /*(typesize > 1)*/