diff --git a/libhdf5/hdf5attr.c b/libhdf5/hdf5attr.c index 795bce81f9..0f58f80b0a 100644 --- a/libhdf5/hdf5attr.c +++ b/libhdf5/hdf5attr.c @@ -496,7 +496,7 @@ nc4_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type, /* For an existing att, if we're not in define mode, the len must not be greater than the existing len for classic model. */ if (!(h5->flags & NC_INDEF) && - len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid)) + len * nc4typelen(file_type) > att->len * nc4typelen(att->nc_typeid)) { if (h5->cmode & NC_CLASSIC_MODEL) return NC_ENOTINDEFINE; diff --git a/libnczarr/zarr.c b/libnczarr/zarr.c index 832b0d7c40..13d702a1d0 100644 --- a/libnczarr/zarr.c +++ b/libnczarr/zarr.c @@ -3,6 +3,7 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ +#include "ncconfigure.h" #include "zincludes.h" #include @@ -232,7 +233,7 @@ int NCZ_get_superblock(NC_FILE_INFO_T* file, int* superblockp) { NCZ_FILE_INFO_T* zinfo = file->format_file_info; - if(superblockp) *superblockp = zinfo->zarr.nczarr_version.major; + if(superblockp) *superblockp = (int)zinfo->zarr.nczarr_version.major; return NC_NOERR; } @@ -337,7 +338,7 @@ applycontrols(NCZ_FILE_INFO_T* zinfo) } /* Apply negative controls by turning off negative flags */ /* This is necessary to avoid order dependence of mode flags when both positive and negative flags are defined */ - zinfo->controls.flags &= (~noflags); + zinfo->controls.flags &= (size64_t)(~noflags); /* Process other controls */ if((value = controllookup(zinfo->controllist,"log")) != NULL) { diff --git a/libnczarr/zarr.h b/libnczarr/zarr.h index 22dd2d1cfc..d97a1b0317 100644 --- a/libnczarr/zarr.h +++ b/libnczarr/zarr.h @@ -12,6 +12,12 @@ #ifndef ZARR_H #define ZARR_H +#include "nc4internal.h" +#include "ncbytes.h" +#include "ncjson.h" +#include "netcdf.h" +#include "zinternal.h" + struct ChunkKey; struct S3credentials; @@ -78,7 +84,7 @@ EXTERNL int NCZ_subobjects(NCZMAP* map, const char* prefix, const char* tag, cha EXTERNL int NCZ_grpname_full(int gid, char** pathp); EXTERNL int ncz_get_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var); EXTERNL int NCZ_comma_parse(const char* s, NClist* list); -EXTERNL int NCZ_swapatomicdata(size_t datalen, void* data, int typesize); +EXTERNL int NCZ_swapatomicdata(size_t datalen, void* data, size_t typesize); EXTERNL char** NCZ_clonestringvec(size_t len, const char** vec); EXTERNL void NCZ_freestringvec(size_t len, char** vec); EXTERNL int NCZ_ischunkname(const char* name,char dimsep); diff --git a/libnczarr/zattr.c b/libnczarr/zattr.c index 23fbb04281..e917dbcfb8 100644 --- a/libnczarr/zattr.c +++ b/libnczarr/zattr.c @@ -51,7 +51,7 @@ ncz_getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp, NCindex **at { NC_VAR_INFO_T *var; - if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid))) + if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, (size_t)varid))) return NC_ENOTVAR; assert(var->hdr.id == varid); @@ -120,14 +120,13 @@ ncz_get_att_special(NC_FILE_INFO_T* h5, NC_VAR_INFO_T* var, const char* name, /* The global reserved attributes */ if(strcmp(name,NCPROPS)==0) { - int len; if(h5->provenance.ncproperties == NULL) {stat = NC_ENOTATT; goto done;} if(mem_type == NC_NAT) mem_type = NC_CHAR; if(mem_type != NC_CHAR) {stat = NC_ECHAR; goto done;} if(filetypep) *filetypep = NC_CHAR; - len = strlen(h5->provenance.ncproperties); + size_t len = strlen(h5->provenance.ncproperties); if(lenp) *lenp = len; if(data) strncpy((char*)data,h5->provenance.ncproperties,len+1); } else if(strcmp(name,ISNETCDF4ATT)==0 @@ -138,7 +137,7 @@ ncz_get_att_special(NC_FILE_INFO_T* h5, NC_VAR_INFO_T* var, const char* name, if(strcmp(name,SUPERBLOCKATT)==0) iv = (unsigned long long)h5->provenance.superblockversion; else /* strcmp(name,ISNETCDF4ATT)==0 */ - iv = NCZ_isnetcdf4(h5); + iv = (unsigned long long)NCZ_isnetcdf4(h5); if(mem_type == NC_NAT) mem_type = NC_INT; if(data) switch (mem_type) { @@ -279,8 +278,7 @@ NCZ_del_att(int ncid, int varid, const char *name) NC_FILE_INFO_T *h5; NC_ATT_INFO_T *att; NCindex* attlist = NULL; - int i; - size_t deletedid; + int deletedid; int retval; /* Name must be provided. */ @@ -354,7 +352,7 @@ NCZ_del_att(int ncid, int varid, const char *name) return retval; /* Renumber all attributes with higher indices. */ - for (i = 0; i < ncindexsize(attlist); i++) + for (size_t i = 0; i < ncindexsize(attlist); i++) { NC_ATT_INFO_T *a; if (!(a = (NC_ATT_INFO_T *)ncindexith(attlist, i))) @@ -379,7 +377,7 @@ NCZ_del_att(int ncid, int varid, const char *name) * @return Type size in bytes, or -1 if type not found. * @author Dennis Heimbigner, Ed Hartnett */ -static int +static size_t nc4typelen(nc_type type) { switch(type){ @@ -399,7 +397,7 @@ nc4typelen(nc_type type) case NC_UINT64: return 8; } - return -1; + return 0; } /** @@ -516,7 +514,7 @@ ncz_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type, /* For an existing att, if we're not in define mode, the len must not be greater than the existing len for classic model. */ if (!(h5->flags & NC_INDEF) && - len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid)) + len * nc4typelen(file_type) > att->len * nc4typelen(att->nc_typeid)) { if (h5->cmode & NC_CLASSIC_MODEL) return NC_ENOTINDEFINE; @@ -980,7 +978,6 @@ int ncz_create_fillvalue(NC_VAR_INFO_T* var) { int stat = NC_NOERR; - int i; NC_ATT_INFO_T* fv = NULL; /* Have the var's attributes been read? */ @@ -989,7 +986,7 @@ ncz_create_fillvalue(NC_VAR_INFO_T* var) /* Is FillValue warranted? */ if(!var->no_fill && var->fill_value != NULL) { /* Make sure _FillValue does not exist */ - for(i=0;iatt);i++) { + for(size_t i=0;iatt);i++) { fv = (NC_ATT_INFO_T*)ncindexith(var->att,i); if(strcmp(fv->hdr.name,_FillValue)==0) break; fv = NULL; diff --git a/libnczarr/zchunking.c b/libnczarr/zchunking.c index d2defd230a..b6fd8dd0d6 100644 --- a/libnczarr/zchunking.c +++ b/libnczarr/zchunking.c @@ -34,10 +34,8 @@ NCZ_compute_chunk_ranges( NCZChunkRange* ncr) { int stat = NC_NOERR; - int i; - int rank = common->rank; - for(i=0;irank;i++) { if((stat = compute_intersection(&slices[i],common->chunklens[i],common->isunlimited[i],&ncr[i]))) goto done; } @@ -84,7 +82,7 @@ This is somewhat complex because: */ int -NCZ_compute_projections(struct Common* common, int r, size64_t chunkindex, const NCZSlice* slice, size_t n, NCZProjection* projections) +NCZ_compute_projections(struct Common* common, size_t r, size64_t chunkindex, const NCZSlice* slice, size_t n, NCZProjection* projections) { int stat = NC_NOERR; NCZProjection* projection = NULL; @@ -215,7 +213,7 @@ Create a vector of projections wrt a slice and a sequence of chunks. int NCZ_compute_per_slice_projections( struct Common* common, - int r, /* which dimension are we projecting? */ + size_t r, /* which dimension are we projecting? */ const NCZSlice* slice, /* the slice for which projections are computed */ const NCZChunkRange* range, /* range */ NCZSliceProjections* slp) @@ -290,7 +288,7 @@ verifyslice(const NCZSlice* slice) } void -NCZ_clearsliceprojections(int count, NCZSliceProjections* slpv) +NCZ_clearsliceprojections(size_t count, NCZSliceProjections* slpv) { if(slpv != NULL) { int i; diff --git a/libnczarr/zchunking.h b/libnczarr/zchunking.h index f3a14703eb..956e9f947d 100644 --- a/libnczarr/zchunking.h +++ b/libnczarr/zchunking.h @@ -48,7 +48,7 @@ typedef struct NCProjection { /* Set of Projections for a slice */ typedef struct NCZSliceProjections { - int r; /* 0<=r read, 0 => write */ - int rank; + size_t rank; int scalar; /* 1 => scalar variable */ size64_t dimlens[NC_MAX_VAR_DIMS]; unsigned char isunlimited[NC_MAX_VAR_DIMS]; @@ -81,8 +81,8 @@ struct Common { /**************************************************/ /* From zchunking.c */ EXTERNL int NCZ_compute_chunk_ranges(struct Common*, const NCZSlice*, NCZChunkRange* ncr); -EXTERNL int NCZ_compute_projections(struct Common*, int r, size64_t chunkindex, const NCZSlice* slice, size_t n, NCZProjection* projections); -EXTERNL int NCZ_compute_per_slice_projections(struct Common*, int rank, const NCZSlice*, const NCZChunkRange*, NCZSliceProjections* slp); +EXTERNL int NCZ_compute_projections(struct Common*, size_t r, size64_t chunkindex, const NCZSlice* slice, size_t n, NCZProjection* projections); +EXTERNL int NCZ_compute_per_slice_projections(struct Common*, size_t rank, const NCZSlice*, const NCZChunkRange*, NCZSliceProjections* slp); EXTERNL int NCZ_compute_all_slice_projections(struct Common*, const NCZSlice* slices, const NCZChunkRange*, NCZSliceProjections*); /* From zwalk.c */ @@ -98,8 +98,8 @@ EXTERNL size64_t NCZ_computelinearoffset(size_t, const size64_t*, const size64_t struct Common; struct NCZOdometer; EXTERNL int NCZ_projectslices(struct Common*, NCZSlice* slices, struct NCZOdometer**); -EXTERNL int NCZ_chunkindexodom(int rank, const NCZChunkRange* ranges, size64_t*, struct NCZOdometer** odom); -EXTERNL void NCZ_clearsliceprojections(int count, NCZSliceProjections* slpv); +EXTERNL int NCZ_chunkindexodom(size_t rank, const NCZChunkRange* ranges, size64_t*, struct NCZOdometer** odom); +EXTERNL void NCZ_clearsliceprojections(size_t count, NCZSliceProjections* slpv); EXTERNL void NCZ_clearcommon(struct Common* common); #define floordiv(x,y) ((x) / (y)) diff --git a/libnczarr/zclose.c b/libnczarr/zclose.c index 7515bfcce7..0c8d32a5aa 100644 --- a/libnczarr/zclose.c +++ b/libnczarr/zclose.c @@ -72,14 +72,13 @@ zclose_group(NC_GRP_INFO_T *grp) { int stat = NC_NOERR; NCZ_GRP_INFO_T* zgrp; - int i; assert(grp && grp->format_grp_info != NULL); LOG((3, "%s: grp->name %s", __func__, grp->hdr.name)); /* Recursively call this function for each child, if any, stopping * if there is an error. */ - for(i=0; ichildren); i++) { + for(size_t i=0; ichildren); i++) { if ((stat = zclose_group((NC_GRP_INFO_T*)ncindexith(grp->children,i)))) goto done; } @@ -123,8 +122,7 @@ zclose_gatts(NC_GRP_INFO_T* grp) { int stat = NC_NOERR; NC_ATT_INFO_T *att; - int a; - for(a = 0; a < ncindexsize(grp->att); a++) { + for(size_t a = 0; a < ncindexsize(grp->att); a++) { NCZ_ATT_INFO_T* zatt = NULL; att = (NC_ATT_INFO_T* )ncindexith(grp->att, a); assert(att && att->format_att_info != NULL); @@ -149,11 +147,10 @@ NCZ_zclose_var1(NC_VAR_INFO_T* var) int stat = NC_NOERR; NCZ_VAR_INFO_T* zvar; NC_ATT_INFO_T* att; - int a; assert(var && var->format_var_info); zvar = var->format_var_info;; - for(a = 0; a < ncindexsize(var->att); a++) { + for(size_t a = 0; a < ncindexsize(var->att); a++) { NCZ_ATT_INFO_T* zatt; att = (NC_ATT_INFO_T*)ncindexith(var->att, a); assert(att && att->format_att_info); @@ -191,9 +188,8 @@ zclose_vars(NC_GRP_INFO_T* grp) { int stat = NC_NOERR; NC_VAR_INFO_T* var; - int i; - for(i = 0; i < ncindexsize(grp->vars); i++) { + for(size_t i = 0; i < ncindexsize(grp->vars); i++) { var = (NC_VAR_INFO_T*)ncindexith(grp->vars, i); assert(var && var->format_var_info); if((stat = NCZ_zclose_var1(var))) goto done; @@ -215,9 +211,8 @@ zclose_dims(NC_GRP_INFO_T* grp) { int stat = NC_NOERR; NC_DIM_INFO_T* dim; - int i; - for(i = 0; i < ncindexsize(grp->dim); i++) { + for(size_t i = 0; i < ncindexsize(grp->dim); i++) { NCZ_DIM_INFO_T* zdim; dim = (NC_DIM_INFO_T*)ncindexith(grp->dim, i); assert(dim && dim->format_dim_info); @@ -265,10 +260,9 @@ static int zclose_types(NC_GRP_INFO_T* grp) { int stat = NC_NOERR; - int i; NC_TYPE_INFO_T* type; - for(i = 0; i < ncindexsize(grp->type); i++) + for(size_t i = 0; i < ncindexsize(grp->type); i++) { type = (NC_TYPE_INFO_T*)ncindexith(grp->type, i); if((stat = zclose_type(type))) goto done; @@ -289,7 +283,7 @@ static int zwrite_vars(NC_GRP_INFO_T *grp) { int stat = NC_NOERR; - int i; + size_t i; assert(grp && grp->format_grp_info != NULL); LOG((3, "%s: grp->name %s", __func__, grp->hdr.name)); diff --git a/libnczarr/zcvt.c b/libnczarr/zcvt.c index 26dc936b07..72a1815a5c 100644 --- a/libnczarr/zcvt.c +++ b/libnczarr/zcvt.c @@ -15,7 +15,7 @@ Code taken directly from libdap4/d4cvt.c */ -static const int ncz_type_size[NC_MAX_ATOMIC_TYPE+1] = { +static const size_t ncz_type_size[NC_MAX_ATOMIC_TYPE+1] = { 0, /*NC_NAT*/ sizeof(char), /*NC_BYTE*/ sizeof(char), /*NC_CHAR*/ diff --git a/libnczarr/zdebug.c b/libnczarr/zdebug.c index 3b1e0e9217..ddf6983d91 100644 --- a/libnczarr/zdebug.c +++ b/libnczarr/zdebug.c @@ -2,6 +2,7 @@ * Copyright 2018, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ +#include "ncconfigure.h" #include "zincludes.h" /* Mnemonic */ @@ -108,13 +109,13 @@ nczprint_slicex(const NCZSlice slice, int raw) } char* -nczprint_slices(int rank, const NCZSlice* slices) +nczprint_slices(size_t rank, const NCZSlice* slices) { return nczprint_slicesx(rank, slices, !RAW); } char* -nczprint_slicesx(int rank, const NCZSlice* slices, int raw) +nczprint_slicesx(size_t rank, const NCZSlice* slices, int raw) { int i; char* result = NULL; @@ -135,7 +136,7 @@ nczprint_slicesx(int rank, const NCZSlice* slices, int raw) } char* -nczprint_slab(int rank, const NCZSlice* slices) +nczprint_slab(size_t rank, const NCZSlice* slices) { return nczprint_slicesx(rank,slices,RAW); } @@ -148,7 +149,7 @@ nczprint_odom(const NCZOdometer* odom) char value[128]; char* txt = NULL; - snprintf(value,sizeof(value),"Odometer{rank=%d ",odom->rank); + snprintf(value,sizeof(value),"Odometer{rank=%zu ",odom->rank); ncbytescat(buf,value); ncbytescat(buf," start="); @@ -223,7 +224,7 @@ nczprint_projectionx(const NCZProjection proj, int raw) } char* -nczprint_allsliceprojections(int r, const NCZSliceProjections* slp) +nczprint_allsliceprojections(size_t r, const NCZSliceProjections* slp) { int i; char* s; @@ -251,7 +252,7 @@ nczprint_sliceprojectionsx(const NCZSliceProjections slp, int raw) char tmp[4096]; int i; - snprintf(tmp,sizeof(tmp),"SliceProjection{r=%d range=%s count=%ld", + snprintf(tmp,sizeof(tmp),"SliceProjection{r=%zu range=%s count=%ld", slp.r,nczprint_chunkrange(slp.range),(long)slp.count); ncbytescat(buf,tmp); ncbytescat(buf,",projections=[\n"); @@ -294,7 +295,7 @@ nczprint_idvector(size_t len, const int* ids) { size64_t v[4096]; size_t i; - for(i=0;ivar->hdr.name); fprintf(stderr,"\treading=%d\n",c->reading); #endif - fprintf(stderr,"\trank=%d",c->rank); + fprintf(stderr,"\trank=%zu",c->rank); fprintf(stderr," dimlens=%s",nczprint_vector(c->rank,c->dimlens)); fprintf(stderr," chunklens=%s",nczprint_vector(c->rank,c->chunklens)); #if 0 diff --git a/libnczarr/zdebug.h b/libnczarr/zdebug.h index 83f45cdef3..28f96dc4d1 100644 --- a/libnczarr/zdebug.h +++ b/libnczarr/zdebug.h @@ -14,6 +14,8 @@ #include "ncexternl.h" #include "nclog.h" +#include + #define ZLOG(tag,...) nclog(tag,__VA_ARGS__) #ifdef ZCATCH @@ -46,15 +48,15 @@ EXTERNL int zreport(int err, const char* msg, const char* fname, const char* fcn /* printers */ EXTERNL void nczprint_reclaim(void); EXTERNL char* nczprint_slice(NCZSlice); -EXTERNL char* nczprint_slices(int rank, const NCZSlice*); -EXTERNL char* nczprint_slab(int rank, const NCZSlice*); +EXTERNL char* nczprint_slices(size_t rank, const NCZSlice*); +EXTERNL char* nczprint_slab(size_t rank, const NCZSlice*); EXTERNL char* nczprint_odom(const NCZOdometer*); EXTERNL char* nczprint_chunkrange(const NCZChunkRange); EXTERNL char* nczprint_projection(const NCZProjection); EXTERNL char* nczprint_sliceprojections(const NCZSliceProjections); -EXTERNL char* nczprint_allsliceprojections(int r, const NCZSliceProjections* slp); +EXTERNL char* nczprint_allsliceprojections(size_t r, const NCZSliceProjections* slp); EXTERNL char* nczprint_slicex(const NCZSlice slice, int raw); -EXTERNL char* nczprint_slicesx(int rank, const NCZSlice* slices, int raw); +EXTERNL char* nczprint_slicesx(size_t rank, const NCZSlice* slices, int raw); EXTERNL char* nczprint_projectionx(const NCZProjection proj, int raw); EXTERNL char* nczprint_sliceprojectionsx(const NCZSliceProjections slp, int raw); EXTERNL char* nczprint_vector(size_t,const size64_t*); diff --git a/libnczarr/zfile.c b/libnczarr/zfile.c index 2346b4944d..c44b85ce3c 100644 --- a/libnczarr/zfile.c +++ b/libnczarr/zfile.c @@ -294,7 +294,6 @@ NCZ_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) NC_FILE_INFO_T* file; NC_GRP_INFO_T *grp; int stat = NC_NOERR; - int i; LOG((2, "%s: ncid 0x%x", __func__, ncid)); @@ -333,7 +332,7 @@ NCZ_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) with netcdf-3, then only the last unlimited one will be reported back in xtendimp. */ /* Note that this code is inconsistent with nc_inq_unlimid() */ - for(i=0;idim);i++) { + for(size_t i=0;idim);i++) { NC_DIM_INFO_T* d = (NC_DIM_INFO_T*)ncindexith(grp->dim,i); if(d == NULL) continue; if(d->unlimited) { diff --git a/libnczarr/zfilter.c b/libnczarr/zfilter.c index bf1eb8542c..4f96280e28 100644 --- a/libnczarr/zfilter.c +++ b/libnczarr/zfilter.c @@ -772,7 +772,7 @@ int NCZ_filter_finalize(void) { int stat = NC_NOERR; - int i; + size_t i; ZTRACE(6,""); if(!NCZ_filter_initialized) goto done; #ifdef NETCDF_ENABLE_NCZARR_FILTERS @@ -780,7 +780,7 @@ NCZ_filter_finalize(void) #ifdef DEBUGL fprintf(stderr,">>> DEBUGL: finalize reclaim:\n"); #endif - for(i=0;i<=loaded_plugins_max;i++) { + for(i=0; i < (loaded_plugins_max + 1); i++) { if(loaded_plugins[i]) { NCZ_unload_plugin(loaded_plugins[i]); loaded_plugins[i] = NULL; @@ -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) { @@ -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) { diff --git a/libnczarr/zinternal.c b/libnczarr/zinternal.c index 81c6fe0ee4..4e7ad1b185 100644 --- a/libnczarr/zinternal.c +++ b/libnczarr/zinternal.c @@ -113,7 +113,7 @@ find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid, *maxlen = 0; /* Find this var. */ - var = (NC_VAR_INFO_T*)ncindexith(grp->vars,varid); + var = (NC_VAR_INFO_T*)ncindexith(grp->vars,(size_t)varid); if (!var) return NC_ENOTVAR; assert(var->hdr.id == varid); @@ -230,7 +230,7 @@ ncz_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len) { NC_VAR_INFO_T *var; int retval; - int i; + size_t i; assert(grp && len); LOG((3, "%s: grp->name %s dimid %d", __func__, grp->hdr.name, dimid)); @@ -608,7 +608,7 @@ ncz_find_grp_var_att(int ncid, int varid, const char *name, int attnum, if (att) { my_att = use_name ? (NC_ATT_INFO_T *)ncindexlookup(attlist, my_norm_name) : - (NC_ATT_INFO_T *)ncindexith(attlist, attnum); + (NC_ATT_INFO_T *)ncindexith(attlist, (size_t)attnum); if (!my_att) return NC_ENOTATT; } diff --git a/libnczarr/zinternal.h b/libnczarr/zinternal.h index 14c8079f0f..56471e683f 100644 --- a/libnczarr/zinternal.h +++ b/libnczarr/zinternal.h @@ -12,6 +12,9 @@ #ifndef ZINTERNAL_H #define ZINTERNAL_H +#include "nc4internal.h" +#include "zmap.h" + #define ZARRVERSION "2" /* NCZARRVERSION is independent of Zarr version, @@ -190,7 +193,7 @@ typedef struct NCZ_VAR_INFO { size64_t chunkproduct; /* product of chunksizes */ size64_t chunksize; /* chunkproduct * typesize */ int order; /* 1=>column major, 0=>row major (default); not currently enforced */ - size_t scalar; + int scalar; struct NCZChunkCache* cache; struct NClist* xarray; /* names from _ARRAY_DIMENSIONS */ char dimension_separator; /* '.' | '/' */ diff --git a/libnczarr/zmap.c b/libnczarr/zmap.c index 47285cc891..0ff349432f 100644 --- a/libnczarr/zmap.c +++ b/libnczarr/zmap.c @@ -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 0) { if(sscanf(env,"%d",&perms) == 1) NC_DEFAULT_CREATE_PERMS = perms; @@ -299,7 +299,7 @@ zfileopen(const char *path, int mode, size64_t flags, void* parameters, NCZMAP** abspath = NULL; /* Verify root dir exists */ - if((stat = platformopendir(zfmap->map.mode,zfmap->root))) + if((stat = platformopendir(zfmap->root))) goto done; /* Dataset superblock will be read by higher layer */ @@ -527,11 +527,10 @@ 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(); @@ -539,7 +538,8 @@ zfcreategroup(ZFMAP* zfmap, const char* key, int nskip) 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;imap.url,canonpath); @@ -745,11 +745,11 @@ platformcreatefile(mode_t mode, const char* canonpath, FD* fd) /* Open a file; fail if it does not exist */ static int -platformopenfile(mode_t mode, const char* canonpath, FD* fd) +platformopenfile(int mode, const char* canonpath, FD* fd) { int stat = NC_NOERR; int ioflags = 0; - int permissions = 0; + mode_t permissions = 0; ZTRACE(6,"map=%s canonpath=%s",zfmap->map.url,canonpath); @@ -781,7 +781,7 @@ platformopenfile(mode_t mode, const char* canonpath, FD* fd) /* Create a dir */ static int -platformcreatedir(mode_t mode, const char* canonpath) +platformcreatedir(int mode, const char* canonpath) { int ret = NC_NOERR; @@ -811,7 +811,7 @@ platformcreatedir(mode_t mode, const char* canonpath) /* Open a dir; fail if it does not exist */ static int -platformopendir(mode_t mode, const char* canonpath) +platformopendir(const char* canonpath) { int ret = NC_NOERR; @@ -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); @@ -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: @@ -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: diff --git a/libnczarr/zodom.c b/libnczarr/zodom.c index 21e9204125..7aa9416a2c 100644 --- a/libnczarr/zodom.c +++ b/libnczarr/zodom.c @@ -5,7 +5,7 @@ #include "zincludes.h" /*Forward*/ -static int buildodom(int rank, NCZOdometer** odomp); +static int buildodom(size_t rank, NCZOdometer** odomp); void nczodom_reset(NCZOdometer* odom) @@ -16,7 +16,7 @@ nczodom_reset(NCZOdometer* odom) } NCZOdometer* -nczodom_new(int rank, const size64_t* start, const size64_t* stop, const size64_t* stride, const size64_t* len) +nczodom_new(size_t rank, const size64_t* start, const size64_t* stop, const size64_t* stride, const size64_t* len) { int i; NCZOdometer* odom = NULL; @@ -38,7 +38,7 @@ nczodom_new(int rank, const size64_t* start, const size64_t* stop, const size64_ } NCZOdometer* -nczodom_fromslices(int rank, const NCZSlice* slices) +nczodom_fromslices(size_t rank, const NCZSlice* slices) { size_t i; NCZOdometer* odom = NULL; @@ -108,7 +108,7 @@ nczodom_offset(const NCZOdometer* odom) { int i; size64_t offset; - int rank = odom->rank; + size_t rank = odom->rank; offset = 0; for(i=0;irank,nczodom_offset(odom),nczodom_avail(odom)); + fprintf(stderr,"odom{rank=%zu offset=%llu avail=%llu",odom->rank,nczodom_offset(odom),nczodom_avail(odom)); fprintf(stderr," start=("); for(i=0;irank;i++) {fprintf(stderr,"%s%llu",(i==0?"":" "),(unsigned long long)odom->start[i]);} fprintf(stderr,")"); diff --git a/libnczarr/zodom.h b/libnczarr/zodom.h index 36c52c0158..d5792fc85e 100644 --- a/libnczarr/zodom.h +++ b/libnczarr/zodom.h @@ -9,7 +9,7 @@ struct NCZSlice; typedef struct NCZOdometer { - int rank; /*rank */ + size_t rank; /*rank */ size64_t* start; size64_t* stride; size64_t* stop; /* start + (count*stride) */ @@ -24,8 +24,8 @@ typedef struct NCZOdometer { /**************************************************/ /* From zodom.c */ -extern NCZOdometer* nczodom_new(int rank, const size64_t*, const size64_t*, const size64_t*, const size64_t*); -extern NCZOdometer* nczodom_fromslices(int rank, const struct NCZSlice* slices); +extern NCZOdometer* nczodom_new(size_t rank, const size64_t*, const size64_t*, const size64_t*, const size64_t*); +extern NCZOdometer* nczodom_fromslices(size_t rank, const struct NCZSlice* slices); extern int nczodom_more(const NCZOdometer*); extern void nczodom_next(NCZOdometer*); extern size64_t* nczodom_indices(const NCZOdometer*); diff --git a/libnczarr/zprov.c b/libnczarr/zprov.c index a56d32368b..f788a0a967 100644 --- a/libnczarr/zprov.c +++ b/libnczarr/zprov.c @@ -274,7 +274,7 @@ NCZ_write_ncproperties(NC_FILE_INFO_T* h5) #ifdef SUPPRESSNCPROPERTY return NC_NOERR; #else /*!SUPPRESSNCPROPERTY*/ - int i,stat = NC_NOERR; + int stat = NC_NOERR; NC4_Provenance* prov = &h5->provenance; NC_ATT_INFO_T* ncprops = NULL; NCindex* attlist = NULL; @@ -291,7 +291,7 @@ NCZ_write_ncproperties(NC_FILE_INFO_T* h5) goto done; /* Look for _NCProperties */ - for(i=0; ihdr.name)==0) { ncprops = att; diff --git a/libnczarr/zsync.c b/libnczarr/zsync.c index 59f1502b7a..66d5767a73 100644 --- a/libnczarr/zsync.c +++ b/libnczarr/zsync.c @@ -3,6 +3,7 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ +#include "ncconfigure.h" #include "zincludes.h" #include "zfilter.h" #include @@ -22,7 +23,7 @@ static int ncz_collect_dims(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NCjson** j static int ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose); static int load_jatts(NCZMAP* map, NC_OBJ* container, int nczarrv1, NCjson** jattrsp, NClist** atypes); -static int zconvert(NCjson* src, nc_type typeid, size_t typelen, int* countp, NCbytes* dst); +static int zconvert(NCjson* src, nc_type typeid, size_t typelen, size_t* countp, NCbytes* dst); static int computeattrinfo(const char* name, NClist* atypes, nc_type typehint, int purezarr, NCjson* values, nc_type* typeidp, size_t* typelenp, size_t* lenp, void** datap); static int parse_group_content(NCjson* jcontent, NClist* dimdefs, NClist* varnames, NClist* subgrps); @@ -93,7 +94,7 @@ ncz_sync_file(NC_FILE_INFO_T* file, int isclose) static int ncz_collect_dims(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NCjson** jdimsp) { - int i, stat=NC_NOERR; + int stat=NC_NOERR; NCjson* jdims = NULL; NCjson* jdimsize = NULL; NCjson* jdimargs = NULL; @@ -102,7 +103,7 @@ ncz_collect_dims(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NCjson** jdimsp) ZTRACE(3,"file=%s grp=%s",file->controller->path,grp->hdr.name); NCJnew(NCJ_DICT,&jdims); - for(i=0; idim); i++) { + for(size_t i=0; idim); i++) { NC_DIM_INFO_T* dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,i); char slen[128]; @@ -144,7 +145,8 @@ ncz_collect_dims(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NCjson** jdimsp) int ncz_sync_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, int isclose) { - int i,stat = NC_NOERR; + int stat = NC_NOERR; + size_t i; NCZ_FILE_INFO_T* zinfo = NULL; char version[1024]; int purezarr = 0; @@ -709,7 +711,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc if((stat = NCJnew(NCJ_DICT,&jtypes))) goto done; /* Walk all the attributes convert to json and collect the dtype */ - for(i=0;inc_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 */ @@ -730,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} */ @@ -969,11 +971,11 @@ zcharify(NCjson* src, NCbytes* buf) /* Convert a json value to actual data values of an attribute. */ static int -zconvert(NCjson* src, nc_type typeid, size_t typelen, int* countp, NCbytes* dst) +zconvert(NCjson* src, nc_type typeid, size_t typelen, size_t* countp, NCbytes* dst) { int stat = NC_NOERR; int i; - int count = 0; + size_t count = 0; ZTRACE(3,"src=%s typeid=%d typelen=%u",NCJtotext(src),typeid,typelen); @@ -994,7 +996,7 @@ zconvert(NCjson* src, nc_type typeid, size_t typelen, int* countp, NCbytes* dst) if((stat = zcharify(src,dst))) goto done; count = ncbyteslength(dst); } else { - count = NCJlength(src); + count = (size_t)NCJlength(src); for(i=0;i attribute value is neither scalar nor array of scalars */ - int count = 0; /* no. of attribute values */ + size_t count = 0; /* no. of attribute values */ ZTRACE(3,"typehint=%d typeid=%d values=|%s|",typehint,*typeidp,NCJtotext(values)); @@ -1917,7 +1919,7 @@ ncz_read_superblock(NC_FILE_INFO_T* file, char** nczarrvp, char** zarrfp) if((stat = ncz_validate(file))) goto done; /* ok, assume pure zarr with no groups */ zinfo->controls.flags |= FLAG_PUREZARR; - zinfo->controls.flags &= ~(FLAG_NCZARR_V1); + zinfo->controls.flags &= ~((size64_t)FLAG_NCZARR_V1); if(zarr_format == NULL) zarr_format = strdup("2"); } else if(jnczgroup != NULL) { zinfo->controls.flags |= FLAG_NCZARR_V1; diff --git a/libnczarr/zutil.c b/libnczarr/zutil.c index 1d49738542..111b570326 100644 --- a/libnczarr/zutil.c +++ b/libnczarr/zutil.c @@ -860,17 +860,16 @@ NCZ_comma_parse(const char* s, NClist* list) } int -NCZ_swapatomicdata(size_t datalen, void* data, int typesize) +NCZ_swapatomicdata(size_t datalen, void* data, size_t typesize) { int stat = NC_NOERR; - int i; assert(datalen % typesize == 0); if(typesize == 1) goto done; /*(typesize > 1)*/ - for(i=0;i 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; diff --git a/libnczarr/zvar.c b/libnczarr/zvar.c index b10df70c02..ed3ad26040 100644 --- a/libnczarr/zvar.c +++ b/libnczarr/zvar.c @@ -105,7 +105,8 @@ ncz_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) { int d; size_t type_size; - float num_values = 1, num_unlim = 0; + float num_values = 1; + size_t num_unlim = 0; int retval; size_t suggested_size; #ifdef LOGGING @@ -152,7 +153,7 @@ ncz_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) "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)); + 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; @@ -166,8 +167,8 @@ ncz_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)(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; @@ -548,7 +549,7 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, {retval = NC_EPERM; goto done;} /* Find the var. */ - if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid))) + if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, (size_t)varid))) {retval = NC_ENOTVAR; goto done;} assert(var && var->hdr.id == varid); @@ -963,7 +964,7 @@ ncz_def_var_chunking_ints(int ncid, int varid, int contiguous, int *chunksizesp) /* Copy to size_t array. */ for (i = 0; i < var->ndims; i++) - cs[i] = chunksizesp[i]; + cs[i] = (size_t)chunksizesp[i]; retval = ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, &contiguous, cs, NULL, NULL, NULL, NULL, NULL); @@ -1254,7 +1255,7 @@ NCZ_rename_var(int ncid, int varid, const char *name) return THROW(retval); /* Get the variable wrt varid */ - if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid))) + if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, (size_t)varid))) return NC_ENOTVAR; /* Check if new name is in use; note that renaming to same name is @@ -1553,13 +1554,10 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, int need_to_convert = 0; int zero_count = 0; /* true if a count is zero */ size_t len = 1; - size64_t fmaxdims[NC_MAX_VAR_DIMS]; NCZ_VAR_INFO_T* zvar; - NC_UNUSED(fmaxdims); - #ifndef LOOK - NC_UNUSED(fmaxdims); + NC_UNUSED(ones); #endif /* Find info for this file, group, and var. */ @@ -1602,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. */ @@ -1855,13 +1853,17 @@ 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; size_t len = 1; NCZ_VAR_INFO_T* zvar = NULL; +#ifndef LOOK + NC_UNUSED(ones); +#endif + /* Find info for this file, group, and var. */ if ((retval = nc4_find_grp_h5_var(ncid, varid, &h5, &grp, &var))) return THROW(retval); @@ -1895,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. */ diff --git a/libnczarr/zwalk.c b/libnczarr/zwalk.c index 21f9ed9436..9baa0fb07a 100644 --- a/libnczarr/zwalk.c +++ b/libnczarr/zwalk.c @@ -56,7 +56,7 @@ ncz_chunking_init(void) optimize = 0; #endif val = getenv("NCZ_WDEBUG"); - wdebug = (val == NULL ? 0 : atoi(val)); + wdebug = (val == NULL ? 0 : (unsigned int)atoi(val)); #ifdef WDEBUG if(wdebug > 0) fprintf(stderr,"wdebug=%u\n",wdebug); #endif @@ -156,7 +156,7 @@ NCZ_transferslice(NC_VAR_INFO_T* var, int reading, } if(wdebug >= 1) { - fprintf(stderr,"\trank=%d",common.rank); + fprintf(stderr,"\trank=%zu",common.rank); if(!common.scalar) { fprintf(stderr," dimlens=%s",nczprint_vector(common.rank,dimlens)); fprintf(stderr," chunklens=%s",nczprint_vector(common.rank,chunklens)); @@ -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", @@ -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, @@ -684,7 +684,7 @@ NCZ_offset2indices(size_t R, size64_t offset, const size64_t* dimlens, size64_t* /* Unit test entry points */ int -NCZ_chunkindexodom(int rank, const NCZChunkRange* ranges, size64_t* chunkcounts, NCZOdometer** odomp) +NCZ_chunkindexodom(size_t rank, const NCZChunkRange* ranges, size64_t* chunkcounts, NCZOdometer** odomp) { int stat = NC_NOERR; int r; diff --git a/libnczarr/zxcache.c b/libnczarr/zxcache.c index 957ed15250..66941c9654 100644 --- a/libnczarr/zxcache.c +++ b/libnczarr/zxcache.c @@ -78,7 +78,7 @@ NCZ_set_var_chunk_cache(int ncid, int varid, size_t cachesize, size_t nelems, fl assert(grp && h5); /* Find the var. */ - if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid))) + if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, (size_t)varid))) {retval = NC_ENOTVAR; goto done;} assert(var && var->hdr.id == varid); @@ -176,7 +176,7 @@ NCZ_create_chunk_cache(NC_VAR_INFO_T* var, size64_t chunksize, char dimsep, NCZC if((cache = calloc(1,sizeof(NCZChunkCache))) == NULL) {stat = NC_ENOMEM; goto done;} cache->var = var; - cache->ndims = var->ndims + zvar->scalar; + cache->ndims = var->ndims + (size_t)zvar->scalar; cache->fillchunk = NULL; cache->chunksize = chunksize; cache->dimension_separator = dimsep; @@ -273,7 +273,7 @@ int NCZ_read_cache_chunk(NCZChunkCache* cache, const size64_t* indices, void** datap) { int stat = NC_NOERR; - int rank = cache->ndims; + size_t rank = cache->ndims; NCZCacheEntry* entry = NULL; ncexhashkey_t hkey = 0; int created = 0; @@ -496,7 +496,8 @@ NCZ_flush_chunk_cache(NCZChunkCache* cache) int NCZ_ensure_fill_chunk(NCZChunkCache* cache) { - int i, stat = NC_NOERR; + int stat = NC_NOERR; + size_t i; NC_VAR_INFO_T* var = cache->var; nc_type typeid = var->type_info->hdr.id; size_t typesize = var->type_info->size; @@ -670,7 +671,7 @@ put_chunk(NCZChunkCache* cache, NCZCacheEntry* entry) if((stat = NC_reclaim_data_all(file->controller,tid,entry->data,cache->chunkcount))) goto done; entry->data = NULL; entry->data = strchunk; strchunk = NULL; - entry->size = cache->chunkcount * maxstrlen; + entry->size = cache->chunkcount * (size64_t)maxstrlen; entry->isfixedstring = 1; }