Skip to content

Commit

Permalink
Silence remaining nczarr conversion warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Mar 25, 2024
1 parent dac5355 commit e7c1c78
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions libnczarr/zfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,9 @@ NCZ_load_all_plugins(void)
struct CodecAPI* dfalt = (struct CodecAPI*)nclistget(codec_defaults,j);
if(dfalt->codec != NULL) {
const NCZ_codec_t* codec = dfalt->codec;
int hdf5id = codec->hdf5id;
unsigned int hdf5id = codec->hdf5id;
NCZ_Plugin* p = NULL;
if(hdf5id < 0 || hdf5id > loaded_plugins_max) {ret = NC_EFILTER; goto done;}
if(hdf5id > loaded_plugins_max) {ret = NC_EFILTER; goto done;}
p = loaded_plugins[hdf5id]; /* get candidate */
if(p != NULL && p->hdf5.filter != NULL
&& p->codec.codec == NULL) {
Expand Down Expand Up @@ -1519,8 +1519,8 @@ fprintf(stderr,">>> \n");
h5id = h5class->id;
if((stat = NCZ_plugin_loaded(h5class->id,&plugin))) goto done;
} else if(codec != NULL) {
h5id = codec->hdf5id;
if((stat = NCZ_plugin_loaded(codec->hdf5id,&plugin))) goto done;
h5id = (int)codec->hdf5id;
if((stat = NCZ_plugin_loaded((int)codec->hdf5id,&plugin))) goto done;
}

if(plugin == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion libnczarr/zmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ nczm_divide_at(const char* key, int nsegs, char** prefixp, char** suffixp)
if(nsegs >= 0)
{presegs = abssegs;}
else
{presegs = (len - abssegs);}
{presegs = ((int)len - abssegs);}

/* skip past the first presegs segments */
for(p=key,i=0;i<presegs;i++) {
Expand Down
16 changes: 8 additions & 8 deletions libnczarr/zmap_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ typedef struct ZFMAP {
/* Forward */
static NCZMAP_API zapi;
static int zfileclose(NCZMAP* map, int delete);
static int zfcreategroup(ZFMAP*, const char* key, int nskip);
static int zfcreategroup(ZFMAP*, const char* key, size_t nskip);
static int zflookupobj(ZFMAP*, const char* key, FD* fd);
static int zfparseurl(const char* path0, NCURI** urip);
static int zffullpath(ZFMAP* zfmap, const char* key, char**);
Expand Down Expand Up @@ -527,19 +527,19 @@ zfunlink(const char* canonpath)
/* Lookup a group by parsed path (segments)*/
/* Return NC_EEMPTY if not found, NC_EINVAL if not a directory; create if create flag is set */
static int
zfcreategroup(ZFMAP* zfmap, const char* key, int nskip)
zfcreategroup(ZFMAP* zfmap, const char* key, size_t nskip)
{
int stat = NC_NOERR;
size_t i;
int len;
char* fullpath = NULL;
NCbytes* path = ncbytesnew();
NClist* segments = nclistnew();

ZTRACE(5,"map=%s key=%s nskip=%d",zfmap->map.url,key,nskip);
if((stat=nczm_split(key,segments)))
goto done;
len = nclistlength(segments);
size_t len = nclistlength(segments);
if (nskip >= len) goto done;
len -= nskip; /* leave off last nskip segments */
ncbytescat(path,zfmap->root); /* We need path to be absolute */
for(i=0;i<len;i++) {
Expand Down Expand Up @@ -1066,9 +1066,9 @@ platformseek(FD* fd, int pos, size64_t* sizep)
ret = NCfstat(fd->fd, &statbuf);
if(ret < 0)
{ret = platformerr(errno); goto done;}
if(sizep) size = *sizep; else size = 0;
if(sizep) size = (off_t)*sizep; else size = 0;
newsize = lseek(fd->fd,size,pos);
if(sizep) *sizep = newsize;
if(sizep) *sizep = (size64_t)newsize;
done:
errno = 0;
return ZUNTRACEX(ret,"sizep=%llu",*sizep);
Expand All @@ -1089,7 +1089,7 @@ platformread(FD* fd, size64_t count, void* content)
ssize_t red;
if((red = read(fd->fd,readpoint,need)) <= 0)
{stat = errno; goto done;}
need -= red;
need -= (size_t)red;
readpoint += red;
}
done:
Expand All @@ -1112,7 +1112,7 @@ platformwrite(FD* fd, size64_t count, const void* content)
ssize_t red = 0;
if((red = write(fd->fd,(void*)writepoint,need)) <= 0)
{ret = NC_EACCESS; goto done;}
need -= red;
need -= (size_t)red;
writepoint += red;
}
done:
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc
if(a->nc_typeid > NC_MAX_ATOMIC_TYPE)
{stat = (THROW(NC_ENCZARR)); goto done;}
if(a->nc_typeid == NC_STRING)
typesize = NCZ_get_maxstrlen(container);
typesize = (size_t)NCZ_get_maxstrlen(container);
else
{if((stat = NC4_inq_atomic_type(a->nc_typeid,NULL,&typesize))) goto done;}
/* Convert to storable json */
Expand All @@ -732,7 +732,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc

/* Collect the corresponding dtype */
{
if((stat = ncz_nctype2dtype(a->nc_typeid,endianness,purezarr,typesize,&tname))) goto done;
if((stat = ncz_nctype2dtype(a->nc_typeid,endianness,purezarr,(int)typesize,&tname))) goto done;
if((stat = NCJnewstring(NCJ_STRING,tname,&jtype))) goto done;
nullfree(tname); tname = NULL;
if((stat = NCJinsert(jtypes,a->hdr.name,jtype))) goto done; /* add {name: type} */
Expand Down Expand Up @@ -996,7 +996,7 @@ zconvert(NCjson* src, nc_type typeid, size_t typelen, size_t* countp, NCbytes* d
if((stat = zcharify(src,dst))) goto done;
count = ncbyteslength(dst);
} else {
count = NCJlength(src);
count = (size_t)NCJlength(src);
for(i=0;i<count;i++) {
NCjson* value = NCJith(src,i);
if((stat = NCZ_convert1(value, typeid, dst))) goto done;
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,15 +1030,15 @@ NCZ_char2fixed(const char** charp, void* fixed, size_t count, int maxstrlen)
{
size_t i;
unsigned char* p = fixed;
memset(fixed,0,maxstrlen*count); /* clear target */
memset(fixed,0,(size_t)maxstrlen*count); /* clear target */
for(i=0;i<count;i++,p+=maxstrlen) {
size_t len;
if(charp[i] != NULL) {
len = strlen(charp[i]);
if(len > maxstrlen) len = maxstrlen;
if(len > maxstrlen) len = (size_t)maxstrlen;
memcpy(p,charp[i],len);
} else {
memset(p,'\0',maxstrlen);
memset(p,'\0',(size_t)maxstrlen);
}
}
return NC_NOERR;
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
fdims[i] = var->dim[i]->len;
start[i] = startp[i];
count[i] = countp ? countp[i] : fdims[i];
stride[i] = stridep ? stridep[i] : 1;
stride[i] = stridep ? (size64_t)stridep[i] : 1;
ones[i] = 1;

/* Check to see if any counts are zero. */
Expand Down Expand Up @@ -1853,7 +1853,7 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
size64_t stride[NC_MAX_VAR_DIMS];
size64_t ones[NC_MAX_VAR_DIMS];
int no_read = 0, provide_fill = 0;
int fill_value_size[NC_MAX_VAR_DIMS];
size64_t fill_value_size[NC_MAX_VAR_DIMS];
int retval, range_error = 0, i, d2;
void *bufr = NULL;
int need_to_convert = 0;
Expand Down Expand Up @@ -1897,7 +1897,7 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
return NC_ESTRIDE;
start[i] = startp[i];
count[i] = countp[i];
stride[i] = stridep ? stridep[i] : 1;
stride[i] = stridep ? (size64_t)stridep[i] : 1;

ones[i] = 1;
/* if any of the count values are zero don't actually read. */
Expand Down
6 changes: 3 additions & 3 deletions libnczarr/zwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ wdebug2(const struct Common* common, unsigned char* slpptr, unsigned char* mempt
unsigned char* membase = common->memory;
unsigned slpoff = (unsigned)(slpptr - slpbase);
unsigned memoff = (unsigned)(memptr - membase);
unsigned slpidx = slpoff / common->typesize;
unsigned memidx = memoff / common->typesize;
unsigned slpidx = slpoff / (unsigned)common->typesize;
unsigned memidx = memoff / (unsigned)common->typesize;
unsigned value;

fprintf(stderr,"wdebug2: %s: [%u/%d] %u->%u",
Expand Down Expand Up @@ -644,7 +644,7 @@ NCZ_projectslices(struct Common* common,
static int
rangecount(NCZChunkRange range)
{
return (range.stop - range.start);
return (int)(range.stop - range.start);
}

/* Goal: Given a set of per-dimension indices,
Expand Down

0 comments on commit e7c1c78

Please sign in to comment.