Fix conversion warnings in libdispatch

This commit is contained in:
Peter Hill 2024-02-02 10:59:55 +00:00
parent 9639ba445d
commit c72511404e
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE
19 changed files with 85 additions and 95 deletions

View File

@ -281,7 +281,7 @@ setauthfield(NCauth* auth, const char* flag, const char* value)
}
if(strcmp(flag,"HTTP.SSL.VERIFYPEER")==0) {
int v;
if((v = atol(value))) {
if((v = atoi(value))) {
auth->ssl.verifypeer = v;
#ifdef DEBUG
nclog(NCLOGNOTE,"HTTP.SSL.VERIFYPEER: %d", v);
@ -290,7 +290,7 @@ setauthfield(NCauth* auth, const char* flag, const char* value)
}
if(strcmp(flag,"HTTP.SSL.VERIFYHOST")==0) {
int v;
if((v = atol(value))) {
if((v = atoi(value))) {
auth->ssl.verifyhost = v;
#ifdef DEBUG
nclog(NCLOGNOTE,"HTTP.SSL.VERIFYHOST: %d", v);

View File

@ -311,11 +311,9 @@ done:
#define LBRACK '['
#define RBRACK ']'
static int gettype(int q0, int q1, int* unsignedp);
/* Look at q0 and q1) to determine type */
static int
gettype(const int q0, const int q1, int* isunsignedp)
gettype(const char q0, const char q1, int* isunsignedp)
{
int type = 0;
int isunsigned = 0;

View File

@ -774,7 +774,7 @@ void dump(const char *text, FILE *stream, unsigned char *ptr, size_t size)
/* show data on the right */
for(c = 0; (c < width) && (i+c < size); c++) {
char x = (ptr[i+c] >= 0x20 && ptr[i+c] < 0x80) ? ptr[i+c] : '.';
const int x = (ptr[i+c] >= 0x20 && ptr[i+c] < 0x80) ? ptr[i+c] : '.';
fputc(x, stream);
}

View File

@ -213,7 +213,7 @@ static int parseonchar(const char* s, int ch, NClist* segments);
static int mergelist(NClist** valuesp);
static int openmagic(struct MagicFile* file);
static int readmagic(struct MagicFile* file, long pos, char* magic);
static int readmagic(struct MagicFile* file, size_t pos, char* magic);
static int closemagic(struct MagicFile* file);
static int NC_interpret_magic_number(char* magic, NCmodel* model);
#ifdef DEBUG
@ -1288,7 +1288,7 @@ check_file_type(const char *path, int omode, int use_parallel,
search forward at starting at 512
and doubling to see if we have HDF5 magic number */
{
long pos = 512L;
size_t pos = 512L;
for(;;) {
if((pos+MAGIC_NUMBER_LEN) > magicinfo.filelen)
{status = NC_ENOTNC; goto done;}
@ -1395,7 +1395,7 @@ done:
}
static int
readmagic(struct MagicFile* file, long pos, char* magic)
readmagic(struct MagicFile* file, size_t pos, char* magic)
{
int status = NC_NOERR;
NCbytes* buf = ncbytesnew();
@ -1413,8 +1413,8 @@ readmagic(struct MagicFile* file, long pos, char* magic)
#endif
} else if(file->uri != NULL) {
#ifdef NETCDF_ENABLE_BYTERANGE
fileoffset_t start = (size_t)pos;
fileoffset_t count = MAGIC_NUMBER_LEN;
size64_t start = (size64_t)pos;
size64_t count = MAGIC_NUMBER_LEN;
status = nc_http_read(file->state, start, count, buf);
if (status == NC_NOERR) {
if (ncbyteslength(buf) != count)
@ -1436,7 +1436,7 @@ readmagic(struct MagicFile* file, long pos, char* magic)
#endif /* USE_PARALLEL */
{ /* Ordinary read */
long i;
i = fseek(file->fp, pos, SEEK_SET);
i = fseek(file->fp, (long)pos, SEEK_SET);
if (i < 0) { status = errno; goto done; }
ncbytessetlength(buf, 0);
if ((status = NC_readfileF(file->fp, buf, MAGIC_NUMBER_LEN))) goto done;

View File

@ -12,6 +12,8 @@ Currently two operations are defined:
*/
#include "config.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@ -411,7 +413,7 @@ dump_datar(int ncid, nc_type xtype, Position* offset, NCbytes* buf)
break;
}
if(xtype <= NC_MAX_ATOMIC_TYPE)
offset->offset += xsize;
offset->offset += (ptrdiff_t)xsize;
done:
return stat;
@ -440,12 +442,12 @@ dump_vlen(int ncid, nc_type xtype, nc_type basetype, Position* offset, NCbytes*
voffset.offset = 0;
for(i=0;i<vl->len;i++) {
if(i > 0) ncbytescat(buf," ");
voffset.offset = NC_read_align(voffset.offset,alignment);
voffset.offset = (ptrdiff_t)NC_read_align((uintptr_t)voffset.offset, alignment);
if((stat = dump_datar(ncid,basetype,&voffset,buf))) goto done;
}
}
ncbytescat(buf,")}");
offset->offset += sizeof(nc_vlen_t);
offset->offset += (ptrdiff_t)sizeof(nc_vlen_t);
done:
return stat;
@ -469,12 +471,12 @@ dump_opaque(int ncid, nc_type xtype, size_t size, Position* offset, NCbytes* buf
/* basically a fixed size sequence of bytes */
ncbytescat(buf,"|");
for(i=0;i<size;i++) {
unsigned char x = *(offset->memory+offset->offset+i);
unsigned char x = (unsigned char)*(offset->memory+offset->offset+i);
snprintf(sx,sizeof(sx),"%2x",x);
ncbytescat(buf,sx);
}
ncbytescat(buf,"|");
offset->offset += size;
offset->offset += (ptrdiff_t)size;
return NC_NOERR;
}
@ -482,7 +484,7 @@ static int
dump_compound(int ncid, nc_type xtype, size_t size, size_t nfields, Position* offset, NCbytes* buf)
{
int stat = NC_NOERR;
size_t fid, i, arraycount;
size_t i;
ptrdiff_t saveoffset;
int ndims;
int dimsizes[NC_MAX_VAR_DIMS];
@ -492,7 +494,7 @@ dump_compound(int ncid, nc_type xtype, size_t size, size_t nfields, Position* of
ncbytescat(buf,"<");
/* Get info about each field in turn and dump it */
for(fid=0;fid<nfields;fid++) {
for(int fid=0;fid<nfields;fid++) {
size_t fieldalignment;
nc_type fieldtype;
char name[NC_MAX_NAME];
@ -513,9 +515,9 @@ dump_compound(int ncid, nc_type xtype, size_t size, size_t nfields, Position* of
ncbytescat(buf,")");
if(ndims == 0) {ndims=1; dimsizes[0]=1;} /* fake the scalar case */
/* Align to this field */
offset->offset = saveoffset + fieldalignment;
offset->offset = saveoffset + (ptrdiff_t)fieldalignment;
/* compute the total number of elements in the field array */
arraycount = 1;
int arraycount = 1;
for(i=0;i<ndims;i++) arraycount *= dimsizes[i];
for(i=0;i<arraycount;i++) {
if(i > 0) ncbytescat(buf," ");
@ -525,7 +527,7 @@ dump_compound(int ncid, nc_type xtype, size_t size, size_t nfields, Position* of
ncbytescat(buf,">");
/* Return to beginning of the compound and move |compound| */
offset->offset = saveoffset;
offset->offset += size;
offset->offset += (ptrdiff_t)size;
done:
return stat;

View File

@ -133,7 +133,7 @@ reclaim_datar(NC_FILE_INFO_T* file, NC_TYPE_INFO_T* utype, Position instance)
NC_TYPE_INFO_T* basetype = NULL;
size_t nfields;
nc_vlen_t* vlen;
size_t fid, arraycount;
size_t fid;
int ndims;
int dimsizes[NC_MAX_VAR_DIMS];
size_t alignment = 0;
@ -184,7 +184,7 @@ out:
/* Get field's dimension sizes */
field = (NC_FIELD_INFO_T*)nclistget(utype->u.c.field,fid);
ndims = field->ndims;
arraycount = 1;
int arraycount = 1;
for(i=0;i<ndims;i++) {dimsizes[i] = field->dim_size[i]; arraycount *= dimsizes[i];}
if(field->ndims == 0) {ndims=1; dimsizes[0]=1;} /* fake the scalar case */
@ -423,7 +423,7 @@ copy_datar(NC_FILE_INFO_T* file, NC_TYPE_INFO_T* utype, Position src, Position d
field = (NC_FIELD_INFO_T*)nclistget(utype->u.c.field,fid);
ndims = field->ndims;
arraycount = 1;
for(i=0;i<ndims;i++) {dimsizes[i] = field->dim_size[i]; arraycount *= dimsizes[i];}
for(i=0;i<ndims;i++) {dimsizes[i] = field->dim_size[i]; arraycount *= (size_t)dimsizes[i];}
if(field->ndims == 0) {ndims=1; dimsizes[0]=1;} /* fake the scalar case */
/* "move" to this field */

View File

@ -85,7 +85,7 @@ static const char* cygwinspecial[] =
static const struct Path {
int kind;
int drive;
char drive;
char* path;
} empty = {NCPD_UNKNOWN,0,NULL};
@ -896,7 +896,7 @@ unparsepath(struct Path* xp, char** pathp, int target)
char sdrive[4] = "\0\0\0\0";
char* p = NULL;
int cygspecial = 0;
int drive = 0;
char drive = 0;
/* Short circuit a relative path */
if(xp->kind == NCPD_REL) {

View File

@ -282,11 +282,10 @@ done:
static int
endswith(const char* s, const char* suffix)
{
ssize_t ls, lsf, delta;
if(s == NULL || suffix == NULL) return 0;
ls = strlen(s);
lsf = strlen(suffix);
delta = (ls - lsf);
size_t ls = strlen(s);
size_t lsf = strlen(suffix);
ssize_t delta = (ssize_t)(ls - lsf);
if(delta < 0) return 0;
if(memcmp(s+delta,suffix,lsf)!=0) return 0;
return 1;
@ -404,11 +403,10 @@ static void
freeprofile(struct AWSprofile* profile)
{
if(profile) {
int i;
#ifdef AWSDEBUG
fprintf(stderr,">>> freeprofile: %s\n",profile->name);
#endif
for(i=0;i<nclistlength(profile->entries);i++) {
for(size_t i=0;i<nclistlength(profile->entries);i++) {
struct AWSentry* e = (struct AWSentry*)nclistget(profile->entries,i);
freeentry(e);
}
@ -422,8 +420,7 @@ void
NC_s3freeprofilelist(NClist* profiles)
{
if(profiles) {
int i;
for(i=0;i<nclistlength(profiles);i++) {
for(size_t i=0;i<nclistlength(profiles);i++) {
struct AWSprofile* p = (struct AWSprofile*)nclistget(profiles,i);
freeprofile(p);
}
@ -549,10 +546,9 @@ int
NC_authgets3profile(const char* profilename, struct AWSprofile** profilep)
{
int stat = NC_NOERR;
int i = -1;
NCglobalstate* gstate = NC_getglobalstate();
for(i=0;i<nclistlength(gstate->rcinfo->s3profiles);i++) {
for(size_t i=0;i<nclistlength(gstate->rcinfo->s3profiles);i++) {
struct AWSprofile* profile = (struct AWSprofile*)nclistget(gstate->rcinfo->s3profiles,i);
if(strcmp(profilename,profile->name)==0)
{if(profilep) {*profilep = profile; goto done;}}
@ -572,13 +568,13 @@ done:
int
NC_s3profilelookup(const char* profile, const char* key, const char** valuep)
{
int i,stat = NC_NOERR;
int stat = NC_NOERR;
struct AWSprofile* awsprof = NULL;
const char* value = NULL;
if(profile == NULL) return NC_ES3;
if((stat=NC_authgets3profile(profile,&awsprof))==NC_NOERR && awsprof != NULL) {
for(i=0;i<nclistlength(awsprof->entries);i++) {
for(size_t i=0;i<nclistlength(awsprof->entries);i++) {
struct AWSentry* entry = (struct AWSentry*)nclistget(awsprof->entries,i);
if(strcasecmp(entry->key,key)==0) {
value = entry->value;
@ -735,7 +731,6 @@ typedef struct AWSparser {
static int
awslex(AWSparser* parser)
{
int c;
int token = 0;
char* start;
size_t count;
@ -751,7 +746,7 @@ awslex(AWSparser* parser)
}
while(token == 0) { /* avoid need to goto when retrying */
c = *parser->pos;
char c = *parser->pos;
if(c == '\0') {
token = AWS_EOF;
} else if(c == '\n') {
@ -785,7 +780,7 @@ awslex(AWSparser* parser)
}
/* Pushback last char */
parser->pos--;
count = ((parser->pos) - start);
count = (size_t)(parser->pos - start);
ncbytesappendn(parser->yytext,start,count);
ncbytesnull(parser->yytext);
token = AWS_WORD;
@ -811,7 +806,7 @@ done:
static int
awsparse(const char* text, NClist* profiles)
{
int i,stat = NC_NOERR;
int stat = NC_NOERR;
size_t len;
AWSparser* parser = NULL;
struct AWSprofile* profile = NULL;
@ -891,7 +886,7 @@ fprintf(stderr,">>> parse: entry=(%s,%s)\n",entry->key,entry->value);
}
/* If this profile already exists, then replace old one */
for(i=0;i<nclistlength(profiles);i++) {
for(size_t i=0;i<nclistlength(profiles);i++) {
struct AWSprofile* p = (struct AWSprofile*)nclistget(profiles,i);
if(strcasecmp(p->name,profile->name)==0) {
nclistset(profiles,i,profile);

View File

@ -153,7 +153,7 @@ int nc_utf8_to_utf16(const unsigned char* s8, unsigned short** utf16p, size_t* l
goto done;
} else { /* move to next char */
/* Complain if top 16 bits not zero */
if((codepoint & 0xFFFF0000) != 0) {
if((codepoint & (nc_utf8proc_int32_t)0xFFFF0000) != 0) {
ncstat = NC_EBADNAME;
goto done;
}

View File

@ -282,7 +282,7 @@ NC_readfileF(FILE* stream, NCbytes* content, long long amount)
{
#define READ_BLOCK_SIZE 4194304
int ret = NC_NOERR;
long long red = 0;
size_t red = 0;
char *part = (char*) malloc(READ_BLOCK_SIZE);
while(amount < 0 || red < amount) {
@ -294,7 +294,7 @@ NC_readfileF(FILE* stream, NCbytes* content, long long amount)
}
/* Keep only amount */
if(amount >= 0) {
if(red > amount) ncbytessetlength(content,amount); /* read too much */
if(red > amount) ncbytessetlength(content, (unsigned long)amount); /* read too much */
if(red < amount) ret = NC_ETRUNC; /* |file| < amount */
}
ncbytesnull(content);
@ -405,7 +405,6 @@ NC_addmodetag(NCURI* uri, const char* tag)
{
int stat = NC_NOERR;
int found = 0;
int i;
const char* modestr = NULL;
char* modevalue = NULL;
NClist* modelist = NULL;
@ -417,7 +416,7 @@ NC_addmodetag(NCURI* uri, const char* tag)
} else
modelist = nclistnew();
/* Search for tag */
for(i=0;i<nclistlength(modelist);i++) {
for(size_t i=0;i<nclistlength(modelist);i++) {
const char* mode = (const char*)nclistget(modelist,i);
if(strcasecmp(mode,tag)==0) {found = 1; break;}
}

View File

@ -1411,7 +1411,7 @@ ncattput(
const void* value
)
{
const int status = nc_put_att(ncid, varid, name, datatype, len, value);
const int status = nc_put_att(ncid, varid, name, datatype, (size_t)len, value);
if(status != NC_NOERR)
{
nc_advise("ncattput", status, "ncid %d", ncid);

View File

@ -867,9 +867,7 @@ nc_def_var_szip(int ncid, int varid, int options_mask, int pixels_per_block)
/* This will cause H5Pset_szip to be called when the var is
* created. */
unsigned int params[2];
params[0] = options_mask;
params[1] = pixels_per_block;
unsigned int params[2] = {(unsigned int)options_mask, (unsigned int)pixels_per_block};
if ((ret = nc_def_var_filter(ncid, varid, HDF5_FILTER_SZIP, 2, params)))
return ret;

View File

@ -203,7 +203,7 @@ ncbytesremove(NCbytes* bb, unsigned long pos)
if(bb == NULL) return ncbytesfail();
if(bb->length <= pos) return ncbytesfail();
if(pos < (bb->length - 1)) {
int copylen = (bb->length - pos) - 1;
size_t copylen = (bb->length - pos) - 1;
memmove(bb->content+pos,bb->content+pos+1,copylen);
}
bb->length--;

View File

@ -736,7 +736,7 @@ ncexhashiterate(NCexhashmap* map, ncexhashkey_t* keyp, uintptr_t* datap)
void
ncexhashprint(NCexhashmap* hm)
{
int dirindex,index;
int index;
if(hm == NULL) {fprintf(stderr,"NULL"); fflush(stderr); return;}
fprintf(stderr,"{depth=%u leaflen=%u",hm->depth,hm->leaflen);
@ -745,9 +745,9 @@ ncexhashprint(NCexhashmap* hm)
hm->iterator.leaf,hm->iterator.index);
}
fprintf(stderr,"\n");
for(dirindex=0;dirindex<(1<<hm->depth);dirindex++) {
for(size_t dirindex=0;dirindex<(1<<hm->depth);dirindex++) {
NCexleaf* leaf = hm->directory[dirindex];
fprintf(stderr,"\tdirectory[%03d|%sb]=(%04x)[(%u)^%d|%d|",
fprintf(stderr,"\tdirectory[%03zu|%sb]=(%04x)[(%u)^%d|%d|",
dirindex,ncexbinstr(dirindex,hm->depth),
leaf->active,
(unsigned)(0xffff & (uintptr_t)leaf),
@ -776,10 +776,9 @@ ncexhashprint(NCexhashmap* hm)
void
ncexhashprintdir(NCexhashmap* map, NCexleaf** dir)
{
int dirindex;
for(dirindex=0;dirindex<(1<<map->depth);dirindex++) {
for(unsigned long long dirindex=0;dirindex<(1<<map->depth);dirindex++) {
NCexleaf* leaf = dir[dirindex];
fprintf(stderr,"\tdirectory[%03d|%sb]=%d/%p\n",
fprintf(stderr,"\tdirectory[%03llu|%sb]=%d/%p\n",
dirindex,ncexbinstr(dirindex,map->depth),leaf->uid,leaf);
}
fflush(stderr);
@ -831,14 +830,14 @@ ncexbinstr(ncexhashkey_t hkey, int depth)
void
ncexhashprintstats(NCexhashmap* map)
{
int nactive, nleaves;
int nactive;
NCexleaf* leaf = NULL;
double leafavg = 0.0;
double leafload = 0.0;
unsigned long long dirsize, leafsize, total;
nactive = 0;
nleaves = 0;
unsigned long long nleaves = 0;
for(leaf=map->leaves;leaf;leaf=leaf->next) {
nleaves++;
nactive += leaf->active;
@ -850,7 +849,7 @@ ncexhashprintstats(NCexhashmap* map)
if(nactive != map->nactive) {
fprintf(stderr,"nactive mismatch: map->active=%d actual=%d\n",map->nactive,nactive);
}
fprintf(stderr,"|directory|=%llu nleaves=%d nactive=%d",
fprintf(stderr,"|directory|=%llu nleaves=%llu nactive=%d",
(unsigned long long)(1<<(map->depth)),nleaves,nactive);
fprintf(stderr," |leaf|=%d nactive/nleaves=%g", map->leaflen, leafavg);
fprintf(stderr," load=%g",leafload);

View File

@ -71,7 +71,7 @@ extern nchashkey_t hash_fast(const char*, size_t length);
/* Forward */
static const unsigned int NC_nprimes;
static const unsigned int NC_primes[16386];
static unsigned int findPrimeGreaterThan(size_t val);
static size_t findPrimeGreaterThan(size_t val);
extern void printhashmapstats(NC_hashmap* hm);
extern void printhashmap(NC_hashmap* hm);
@ -160,7 +160,7 @@ locate(NC_hashmap* hash, nchashkey_t hashkey, const char* key, size_t keysize, s
nchashkey_t
NC_hashmapkey(const char* key, size_t size)
{
return NC_crc64(0,(void*)key,(unsigned int)size);
return (nchashkey_t)NC_crc64(0,(void*)key,(unsigned int)size);
}
NC_hashmap*
@ -399,7 +399,7 @@ static int isPrime(size_t n)
}
/* Function to return the smallest prime number greater than N */
static int nextPrime(size_t val)
static size_t nextPrime(size_t val)
{
if (val <= 1)
return 2;
@ -424,18 +424,18 @@ Binary search prime table for first prime just greater than or
equal to val
*/
static unsigned int
static size_t
findPrimeGreaterThan(size_t val)
{
int n = NC_nprimes;
int L = 1; /* skip leading flag number */
int R = (n - 2); /* skip trailing flag */
unsigned int v = 0;
int m;
size_t n = NC_nprimes;
size_t L = 1; /* skip leading flag number */
size_t R = (n - 2); /* skip trailing flag */
size_t v = 0;
size_t m;
if(val >= 0xFFFFFFFF)
return 0; /* Too big */
v = (unsigned int)val;
v = val;
if (v > NC_primes[n - 2]) {
/*

View File

@ -71,7 +71,7 @@ typedef struct NCJparser {
} NCJparser;
typedef struct NCJbuf {
int len; /* |text|; does not include nul terminator */
size_t len; /* |text|; does not include nul terminator */
char* text; /* NULL || nul terminated */
} NCJbuf;
@ -109,7 +109,7 @@ static int NCJyytext(NCJparser*, char* start, size_t pdlen);
static void NCJreclaimArray(struct NCjlist*);
static void NCJreclaimDict(struct NCjlist*);
static int NCJunescape(NCJparser* parser);
static int unescape1(int c);
static char unescape1(char c);
static int listappend(struct NCjlist* list, NCjson* element);
static int NCJcloneArray(const NCjson* array, NCjson** clonep);
@ -368,13 +368,12 @@ done:
static int
NCJlex(NCJparser* parser)
{
int c;
int token = NCJ_UNDEF;
char* start;
size_t count;
while(token == 0) { /* avoid need to goto when retrying */
c = *parser->pos;
char c = *parser->pos;
if(c == '\0') {
token = NCJ_EOF;
} else if(c <= ' ' || c == '\177') {/* ignore whitespace */
@ -393,7 +392,7 @@ NCJlex(NCJparser* parser)
}
/* Pushback c */
parser->pos--;
count = ((parser->pos) - start);
count = (size_t)((parser->pos) - start);
if(NCJyytext(parser,start,count)) goto done;
/* Discriminate the word string to get the proper sort */
if(testbool(parser->yytext) == NCJ_OK)
@ -420,7 +419,7 @@ NCJlex(NCJparser* parser)
token = NCJ_UNDEF;
goto done;
}
count = ((parser->pos) - start) - 1; /* -1 for trailing quote */
count = (size_t)((parser->pos) - start) - 1; /* -1 for trailing quote */
if(NCJyytext(parser,start,count)==NCJ_ERR) goto done;
if(NCJunescape(parser)==NCJ_ERR) goto done;
token = NCJ_STRING;
@ -641,7 +640,7 @@ NCJunescape(NCJparser* parser)
{
char* p = parser->yytext;
char* q = p;
int c;
char c;
for(;(c=*p++);) {
if(c == NCJ_ESCAPE) {
c = *p++;
@ -651,9 +650,9 @@ NCJunescape(NCJparser* parser)
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case NCJ_QUOTE: c = c; break;
case NCJ_ESCAPE: c = c; break;
default: c = c; break;/* technically not Json conformant */
case NCJ_QUOTE: break;
case NCJ_ESCAPE: break;
default: break;/* technically not Json conformant */
}
}
*q++ = c;
@ -663,8 +662,8 @@ NCJunescape(NCJparser* parser)
}
/* Unescape a single character */
static int
unescape1(int c)
static char
unescape1(char c)
{
switch (c) {
case 'b': c = '\b'; break;
@ -672,7 +671,7 @@ unescape1(int c)
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
default: c = c; break;/* technically not Json conformant */
default: break;/* technically not Json conformant */
}
return c;
}
@ -1007,7 +1006,7 @@ static int
escape(const char* text, NCJbuf* buf)
{
const char* p = text;
int c;
char c;
for(;(c=*p++);) {
char replace = 0;
switch (c) {

View File

@ -143,7 +143,7 @@ ncuriparse(const char* uri0, NCURI** durip)
NClist* params = nclistnew();
NClist* querylist = nclistnew();
size_t len0;
int pathchar;
char pathchar;
if(uri0 == NULL)
{THROW(NC_EURL);}
@ -899,7 +899,7 @@ ncrshift1(char* p)
static const char* hexchars = "0123456789abcdefABCDEF";
static void
toHex(unsigned int b, char hex[2])
toHex(char b, char hex[2])
{
hex[0] = hexchars[(b >> 4) & 0xf];
hex[1] = hexchars[(b) & 0xf];
@ -943,7 +943,7 @@ ncuriencodeonly(const char* s, const char* allowable)
encoded = (char*)malloc((3*slen) + 1); /* max possible size */
for(inptr=s,outptr=encoded;*inptr;) {
int c = *inptr++;
char c = *inptr++;
{
/* search allowable */
char* p = strchr(allowable,c);

View File

@ -230,7 +230,7 @@ ncxcachenew(size_t leaflen, NCxcache** cachep)
cache = calloc(1,sizeof(NCxcache));
if(cache == NULL)
{stat = NC_ENOMEM; goto done;}
cache->map = ncexhashnew(leaflen);
cache->map = ncexhashnew((int)leaflen);
if(cache->map == NULL)
{stat = NC_ENOMEM; goto done;}
cache->lru.next = &cache->lru;

View File

@ -1763,8 +1763,8 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
LOG((4, "%s: name %s dim %d DEFAULT_CHUNK_SIZE %d num_values %f type_size %d "
"chunksize %ld", __func__, var->hdr.name, d, DEFAULT_CHUNK_SIZE, num_values, type_size, var->chunksizes[0]));
}
if (var->ndims > 1 && var->ndims == num_unlim) { /* all dims unlimited */
suggested_size = pow((double)DEFAULT_CHUNK_SIZE/type_size, 1.0/(double)(var->ndims));
if (var->ndims > 1 && (float)var->ndims == num_unlim) { /* all dims unlimited */
suggested_size = (size_t)pow((double)DEFAULT_CHUNK_SIZE/(double)type_size, 1.0/(double)(var->ndims));
for (d = 0; d < var->ndims; d++)
{
var->chunksizes[d] = suggested_size ? suggested_size : 1;
@ -1778,8 +1778,8 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
for (d = 0; d < var->ndims; d++)
if (!var->chunksizes[d])
{
suggested_size = (pow((double)DEFAULT_CHUNK_SIZE/(num_values * type_size),
1.0/(double)(var->ndims - num_unlim)) * var->dim[d]->len - .5);
suggested_size = (size_t)(pow((double)DEFAULT_CHUNK_SIZE/(num_values * (double)type_size),
1.0/(double)((double)var->ndims - num_unlim)) * (double)var->dim[d]->len - .5);
if (suggested_size > var->dim[d]->len)
suggested_size = var->dim[d]->len;
var->chunksizes[d] = suggested_size ? suggested_size : 1;