mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Silence various conversion warnings in ncdump
This commit is contained in:
parent
409ca579ab
commit
b6eb730684
@ -337,8 +337,7 @@ done:
|
||||
int
|
||||
varchunkspec_kind(int grpid, int varid)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||
if(spec->igrpid == grpid && spec->ivarid == varid)
|
||||
return spec->kind;
|
||||
@ -349,8 +348,7 @@ varchunkspec_kind(int grpid, int varid)
|
||||
bool_t
|
||||
varchunkspec_exists(int igrpid, int ivarid)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||
return true;
|
||||
@ -361,8 +359,7 @@ varchunkspec_exists(int igrpid, int ivarid)
|
||||
bool_t
|
||||
varchunkspec_omit(int igrpid, int ivarid)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||
return spec->omit;
|
||||
@ -373,8 +370,7 @@ varchunkspec_omit(int igrpid, int ivarid)
|
||||
size_t*
|
||||
varchunkspec_chunksizes(int igrpid, int ivarid)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||
return spec->chunksizes;
|
||||
@ -385,8 +381,7 @@ varchunkspec_chunksizes(int igrpid, int ivarid)
|
||||
size_t
|
||||
varchunkspec_rank(int igrpid, int ivarid)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||
return spec->rank;
|
||||
|
@ -861,7 +861,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
||||
sp = sout;
|
||||
*sp++ = '"' ;
|
||||
while(*cp) {
|
||||
switch (uc = *cp++ & 0377) {
|
||||
switch (uc = (unsigned char)*cp++ & 0377) {
|
||||
case '\b':
|
||||
*sp++ = '\\';
|
||||
*sp++ = 'b' ;
|
||||
@ -904,7 +904,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
||||
sp += 4;
|
||||
}
|
||||
else
|
||||
*sp++ = uc;
|
||||
*sp++ = (char)uc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1045,7 +1045,7 @@ chars_tostring(
|
||||
len--;
|
||||
for (iel = 0; iel < len; iel++) {
|
||||
unsigned char uc;
|
||||
switch (uc = *vals++ & 0377) {
|
||||
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
@ -1062,7 +1062,7 @@ chars_tostring(
|
||||
if (isprint(uc))
|
||||
*cp++ = *(char *)&uc; /* just copy, even if char is signed */
|
||||
else {
|
||||
size_t remaining = sout_size - (cp - sout);
|
||||
size_t remaining = sout_size - (size_t)(cp - sout);
|
||||
snprintf(cp,remaining,"\\%.3o",uc);
|
||||
cp += 4;
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ int
|
||||
listfreeall(List* l)
|
||||
{
|
||||
if(l) {
|
||||
int i;
|
||||
for(i=0;i<listlength(l);i++) {
|
||||
for(size_t i=0;i<listlength(l);i++) {
|
||||
void* elem = listget(l,i);
|
||||
if(elem != NULL) free(elem);
|
||||
}
|
||||
|
@ -312,9 +312,8 @@ printNode(NC4printer* out, NCID* node, int depth)
|
||||
CAT(">\n");
|
||||
depth++;
|
||||
for(i=0;i<count;i++) {
|
||||
long long value;
|
||||
if((ret=nc_inq_enum_member(GROUPOF(node),node->id,i,name,&numvalue))) FAIL;
|
||||
value = getNumericValue(numvalue,node->base->id);
|
||||
long long value = (long long)getNumericValue(numvalue,node->base->id);
|
||||
INDENT(depth);
|
||||
CAT("<EnumConst");
|
||||
printXMLAttributeName(out, "name", name);
|
||||
@ -442,7 +441,6 @@ static int
|
||||
printAttribute(NC4printer* out, NCID* attr, int depth)
|
||||
{
|
||||
int ret = NC_NOERR;
|
||||
int i = 0;
|
||||
void* values;
|
||||
|
||||
INDENT(depth); CAT("<Attribute");
|
||||
@ -450,7 +448,7 @@ printAttribute(NC4printer* out, NCID* attr, int depth)
|
||||
CAT(">\n");
|
||||
if((ret=readAttributeValues(attr,&values))) FAIL;
|
||||
depth++;
|
||||
for(i=0;i<attr->size;i++) {
|
||||
for(size_t i=0;i<attr->size;i++) {
|
||||
void* value = computeOffset(attr->base,values,i);
|
||||
if((ret=printValue(out,attr->base,value,depth))) FAIL;
|
||||
}
|
||||
@ -695,7 +693,7 @@ entityEscape(NCbytes* escaped, const char* s)
|
||||
const char* p;
|
||||
ncbytesclear(escaped);
|
||||
for(p=s;*p;p++) {
|
||||
int c = *p;
|
||||
char c = *p;
|
||||
switch (c) {
|
||||
case '&': ncbytescat(escaped,"&"); break;
|
||||
case '<': ncbytescat(escaped,"<"); break;
|
||||
@ -734,7 +732,7 @@ printString(NCbytes* out, const char* s, int quotes)
|
||||
if(quotes) ncbytesappend(out,'"');
|
||||
if(s == NULL) s = "";
|
||||
for(p=s;*p;p++) {
|
||||
int c = *p;
|
||||
char c = *p;
|
||||
if(c == '\\') ncbytescat(out,"\\\\");
|
||||
else if(c == '"') ncbytescat(out,"\\\"");
|
||||
else ncbytesappend(out,c);
|
||||
|
@ -288,7 +288,6 @@ parsefilterspec(const char* optarg0, List* speclist)
|
||||
char* p = NULL;
|
||||
char* remainder = NULL;
|
||||
List* vlist = NULL;
|
||||
int i;
|
||||
int isnone = 0;
|
||||
size_t nfilters = 0;
|
||||
NC_H5_Filterspec** filters = NULL;
|
||||
@ -325,7 +324,7 @@ parsefilterspec(const char* optarg0, List* speclist)
|
||||
}
|
||||
|
||||
/* Construct a spec entry for each element in vlist */
|
||||
for(i=0;i<listlength(vlist);i++) {
|
||||
for(size_t i=0;i<listlength(vlist);i++) {
|
||||
int k;
|
||||
size_t vlen;
|
||||
struct FilterOption* filtopt = NULL;
|
||||
@ -369,11 +368,10 @@ done:
|
||||
static int
|
||||
varfiltersactive(const char* ofqn)
|
||||
{
|
||||
int i;
|
||||
int hasnone = 0;
|
||||
int hasactive = 0;
|
||||
/* See which output filter options are defined for this output variable */
|
||||
for(i=0;i<listlength(filteroptions);i++) {
|
||||
for(size_t i=0;i<listlength(filteroptions);i++) {
|
||||
struct FilterOption* opt = listget(filteroptions,i);
|
||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
||||
{if(opt->nofilter) hasnone = 1;} else {hasactive = 1;}
|
||||
@ -385,10 +383,9 @@ varfiltersactive(const char* ofqn)
|
||||
static int
|
||||
varfilterssuppress(const char* ofqn)
|
||||
{
|
||||
int i;
|
||||
int hasnone = 0;
|
||||
/* See which output filter options are defined for this output variable */
|
||||
for(i=0;i<listlength(filteroptions);i++) {
|
||||
for(size_t i=0;i<listlength(filteroptions);i++) {
|
||||
struct FilterOption* opt = listget(filteroptions,i);
|
||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
||||
{if(opt->nofilter) hasnone = 1;}
|
||||
@ -400,11 +397,10 @@ varfilterssuppress(const char* ofqn)
|
||||
static List*
|
||||
filteroptsforvar(const char* ofqn)
|
||||
{
|
||||
int i;
|
||||
List* list = listnew();
|
||||
/* See which output filter options are defined for this output variable;
|
||||
both active and none. */
|
||||
for(i=0;i<listlength(filteroptions);i++) {
|
||||
for(size_t i=0;i<listlength(filteroptions);i++) {
|
||||
struct FilterOption* opt = listget(filteroptions,i);
|
||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0) {
|
||||
if(!opt->nofilter) /* Add to the list */
|
||||
@ -461,7 +457,6 @@ inq_var_chunking_params(int igrp, int ivarid, int ogrp, int ovarid,
|
||||
int stat = NC_NOERR;
|
||||
int ndims;
|
||||
size_t *ichunksizes, *ochunksizes;
|
||||
int dim;
|
||||
int icontig = NC_CONTIGUOUS, ocontig = NC_CONTIGUOUS;
|
||||
nc_type vartype;
|
||||
size_t value_size;
|
||||
@ -497,7 +492,7 @@ inq_var_chunking_params(int igrp, int ivarid, int ogrp, int ovarid,
|
||||
if(icontig != NC_CHUNKED) { /* if input contiguous|compact, treat as if chunked on
|
||||
* first dimension */
|
||||
ichunksizes[0] = 1;
|
||||
for(dim = 1; dim < ndims; dim++) {
|
||||
for(size_t dim = 1; dim < ndims; dim++) {
|
||||
ichunksizes[dim] = dim;
|
||||
}
|
||||
} else {
|
||||
@ -510,7 +505,7 @@ inq_var_chunking_params(int igrp, int ivarid, int ogrp, int ovarid,
|
||||
|
||||
nelems = 1;
|
||||
oprod = value_size;
|
||||
for(dim = 0; dim < ndims; dim++) {
|
||||
for(size_t dim = 0; dim < ndims; dim++) {
|
||||
nelems += 1 + (ichunksizes[dim] - 1) / ochunksizes[dim];
|
||||
iprod *= ichunksizes[dim];
|
||||
oprod *= ochunksizes[dim];
|
||||
@ -879,8 +874,7 @@ copy_var_filter(int igrp, int varid, int ogrp, int o_varid, int inkind, int outk
|
||||
/* Apply actual filter spec if any */
|
||||
if(!unfiltered) {
|
||||
/* add all the actual filters */
|
||||
int k;
|
||||
for(k=0;k<listlength(actualspecs);k++) {
|
||||
for(size_t k=0;k<listlength(actualspecs);k++) {
|
||||
struct FilterOption* actual = (struct FilterOption*)listget(actualspecs,k);
|
||||
if((stat=nc_def_var_filter(ovid.grpid,ovid.varid,
|
||||
actual->pfs.filterid,
|
||||
@ -956,7 +950,7 @@ copy_chunking(int igrp, int i_varid, int ogrp, int o_varid, int ndims, int inkin
|
||||
/* Figure out the chunking even if we do not decide to do so*/
|
||||
if(varchunkspec_exists(igrp,i_varid)
|
||||
&& varchunkspec_kind(igrp,i_varid) == NC_CHUNKED)
|
||||
memcpy(ochunkp,varchunkspec_chunksizes(igrp,i_varid),ndims*sizeof(size_t));
|
||||
memcpy(ochunkp,varchunkspec_chunksizes(igrp,i_varid),(size_t)ndims*sizeof(size_t));
|
||||
|
||||
/* If any kind of output filter was specified, then not contiguous */
|
||||
ovid.grpid = ogrp;
|
||||
@ -1566,12 +1560,12 @@ copy_schema(int igrp, int ogrp)
|
||||
|
||||
/* Return number of values for a variable varid in a group igrp */
|
||||
static int
|
||||
inq_nvals(int igrp, int varid, long long *nvalsp) {
|
||||
inq_nvals(int igrp, int varid, size_t *nvalsp) {
|
||||
int stat = NC_NOERR;
|
||||
int ndims;
|
||||
int *dimids;
|
||||
int dim;
|
||||
long long nvals = 1;
|
||||
size_t nvals = 1;
|
||||
|
||||
NC_CHECK(nc_inq_varndims(igrp, varid, &ndims));
|
||||
dimids = (int *) emalloc((size_t)(ndims + 1) * sizeof(int));
|
||||
@ -1594,7 +1588,7 @@ copy_var_data(int igrp, int varid, int ogrp)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
nc_type vartype;
|
||||
long long nvalues; /* number of values for this variable */
|
||||
size_t nvalues; /* number of values for this variable */
|
||||
size_t ntoget; /* number of values to access this iteration */
|
||||
size_t value_size; /* size of a single value of this variable */
|
||||
static void *buf = 0; /* buffer for the variable values */
|
||||
@ -2044,10 +2038,9 @@ copy(char* infile, char* outfile)
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
if(listlength(option_chunkspecs) > 0) {
|
||||
int i;
|
||||
/* Now that input is open, can parse option_chunkspecs into binary
|
||||
* structure. */
|
||||
for(i=0;i<listlength(option_chunkspecs);i++) {
|
||||
for(size_t i=0;i<listlength(option_chunkspecs);i++) {
|
||||
char* spec = (char*)listget(option_chunkspecs,i);
|
||||
NC_CHECK(chunkspec_parse(igrp, spec));
|
||||
}
|
||||
@ -2114,7 +2107,7 @@ copy(char* infile, char* outfile)
|
||||
}
|
||||
#endif /* USE_NETCDF4 */
|
||||
|
||||
ndims = count_dims(igrp);
|
||||
ndims = (size_t)count_dims(igrp);
|
||||
NC_CHECK(dimmap_init(ndims));
|
||||
NC_CHECK(copy_schema(igrp, ogrp));
|
||||
NC_CHECK(nc_enddef(ogrp));
|
||||
@ -2295,7 +2288,7 @@ main(int argc, char**argv)
|
||||
option_kind = NC_FORMAT_NETCDF4_CLASSIC;
|
||||
break;
|
||||
case 'd': /* non-default compression level specified */
|
||||
option_deflate_level = strtol(optarg, NULL, 10);
|
||||
option_deflate_level = (int)strtol(optarg, NULL, 10);
|
||||
if(option_deflate_level < 0 || option_deflate_level > 9) {
|
||||
error("invalid deflation level: %d", option_deflate_level);
|
||||
}
|
||||
@ -2395,9 +2388,9 @@ main(int argc, char**argv)
|
||||
case 'M': /* set min chunk size */
|
||||
#ifdef USE_NETCDF4
|
||||
if(optarg == NULL)
|
||||
option_min_chunk_bytes = 0;
|
||||
option_min_chunk_bytes = 0;
|
||||
else
|
||||
option_min_chunk_bytes = atol(optarg);
|
||||
option_min_chunk_bytes = (size_t)atol(optarg);
|
||||
break;
|
||||
#else
|
||||
error("-M requires netcdf-4");
|
||||
@ -2459,8 +2452,7 @@ main(int argc, char**argv)
|
||||
static void
|
||||
freefilteroptlist(List* specs)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<listlength(specs);i++) {
|
||||
for(size_t i=0;i<listlength(specs);i++) {
|
||||
struct FilterOption* spec = (struct FilterOption*)listget(specs,i);
|
||||
if(spec->fqn) free(spec->fqn);
|
||||
nullfree(spec->pfs.params);
|
||||
|
@ -5,6 +5,7 @@ Research/Unidata. See \ref copyright file for more info. */
|
||||
|
||||
#include "config.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
@ -429,7 +430,7 @@ pr_att_string(
|
||||
while (len != 0 && *sp-- == '\0')
|
||||
len--;
|
||||
for (iel = 0; iel < len; iel++)
|
||||
switch (uc = *cp++ & 0377) {
|
||||
switch (uc = (unsigned char)(*cp++ & 0377)) {
|
||||
case '\b':
|
||||
printf ("\\b");
|
||||
break;
|
||||
@ -500,7 +501,7 @@ pr_attx_string(
|
||||
while (len != 0 && *sp-- == '\0')
|
||||
len--;
|
||||
for (iel = 0; iel < len; iel++)
|
||||
switch (uc = *cp++ & 0377) {
|
||||
switch (uc = (unsigned char)*cp++ & 0377) {
|
||||
case '\"':
|
||||
printf (""");
|
||||
break;
|
||||
@ -908,7 +909,7 @@ pr_att(
|
||||
value = *((int64_t *)data + i);
|
||||
break;
|
||||
case NC_UINT64:
|
||||
value = *((uint64_t *)data + i);
|
||||
value = (int64_t)*((uint64_t *)data + i);
|
||||
break;
|
||||
default:
|
||||
error("enum must have an integer base type: %d", base_nc_type);
|
||||
@ -1395,7 +1396,7 @@ print_enum_type(int ncid, nc_type typeid) {
|
||||
memval = *(int64_t *)raw;
|
||||
break;
|
||||
case NC_UINT64:
|
||||
memval = *(uint64_t *)raw;
|
||||
memval = (int64_t)*(uint64_t *)raw;
|
||||
break;
|
||||
default:
|
||||
error("Bad base type for enum!");
|
||||
@ -2567,7 +2568,7 @@ searchgrouptreedim(int ncid, int dimid, int* parentidp)
|
||||
int gid;
|
||||
uintptr_t id;
|
||||
|
||||
id = ncid;
|
||||
id = (uintptr_t)ncid;
|
||||
nclistpush(queue,(void*)id); /* prime the queue */
|
||||
while(nclistlength(queue) > 0) {
|
||||
id = (uintptr_t)nclistremove(queue,0);
|
||||
@ -2589,7 +2590,7 @@ searchgrouptreedim(int ncid, int dimid, int* parentidp)
|
||||
goto done;
|
||||
/* push onto the end of the queue */
|
||||
for(i=0;i<nids;i++) {
|
||||
id = ids[i];
|
||||
id = (uintptr_t)ids[i];
|
||||
nclistpush(queue,(void*)id);
|
||||
}
|
||||
free(ids); ids = NULL;
|
||||
|
@ -15,7 +15,7 @@ main(int argc, char** argv)
|
||||
char vn[256];
|
||||
char* major, *minor, *patch;
|
||||
char* p;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
strcpy(v5,H5_VERSION);
|
||||
major = v5; minor = NULL; patch = NULL;
|
||||
|
@ -26,7 +26,7 @@ nc_blkio_init(size_t bufsize, /* size in bytes of in-memory copy buffer */
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
int i;
|
||||
long long prod;
|
||||
size_t prod;
|
||||
size_t *dims = iter->dimsizes;
|
||||
|
||||
iter->rank = rank;
|
||||
|
@ -88,7 +88,7 @@ calendar_type(int ncid, int varid) {
|
||||
nc_get_att_single_string(ncid, varid, &catt, &calstr);
|
||||
|
||||
int itype;
|
||||
int calstr_len = strlen(calstr);
|
||||
size_t calstr_len = strlen(calstr);
|
||||
for(itype = 0; itype < ncals; itype++) {
|
||||
if(strncasecmp(calstr, calmap[itype].attname, calstr_len) == 0) {
|
||||
ctype = calmap[itype].type;
|
||||
|
@ -115,7 +115,7 @@ static const char nada[4] = {0, 0, 0, 0};
|
||||
/* useful for aligning memory */
|
||||
#define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit))
|
||||
|
||||
#define ERR_ADDR (((size_t) gbp->pos - (size_t) gbp->base) + gbp->offset - gbp->size)
|
||||
#define ERR_ADDR (((size_t) gbp->pos - (size_t) gbp->base) + (size_t) gbp->offset - gbp->size)
|
||||
|
||||
#define IS_RECVAR(vp) ((vp)->shape != NULL ? (*(vp)->shape == NC_UNLIMITED) : 0 )
|
||||
|
||||
@ -425,7 +425,7 @@ hdr_len_NC_name(size_t nchars,
|
||||
long long sz = sizeof_t; /* nelems */
|
||||
|
||||
if (nchars != 0) /* namestring */
|
||||
sz += _RNDUP(nchars, X_ALIGN);
|
||||
sz += _RNDUP((long long)nchars, X_ALIGN);
|
||||
|
||||
return sz;
|
||||
}
|
||||
@ -951,7 +951,7 @@ val_fetch(int fd, bufferinfo *gbp) {
|
||||
fprintf(stderr,"Error at line %d: read %s\n",__LINE__,strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
gbp->offset += (gbp->size - slack);
|
||||
gbp->offset += (off_t)(gbp->size - (size_t)slack);
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
@ -1070,13 +1070,13 @@ hdr_get_name(int fd,
|
||||
padding = _RNDUP(nchars, X_ALIGN) - nchars;
|
||||
pos_addr = (size_t) gbp->pos;
|
||||
base_addr = (size_t) gbp->base;
|
||||
bufremain = gbp->size - (pos_addr - base_addr);
|
||||
bufremain = (long long)(gbp->size - (pos_addr - base_addr));
|
||||
cpos = *namep;
|
||||
|
||||
while (nchars > 0) {
|
||||
if (bufremain > 0) {
|
||||
strcount = MIN(bufremain, nchars);
|
||||
(void) memcpy(cpos, gbp->pos, strcount);
|
||||
(void) memcpy(cpos, gbp->pos, (size_t)strcount);
|
||||
nchars -= strcount;
|
||||
gbp->pos = (void *)((char *)gbp->pos + strcount);
|
||||
cpos += strcount;
|
||||
@ -1104,7 +1104,7 @@ hdr_get_name(int fd,
|
||||
return err;
|
||||
}
|
||||
memset(pad, 0, X_ALIGN-1);
|
||||
if (memcmp(gbp->pos, pad, padding) != 0) {
|
||||
if (memcmp(gbp->pos, pad, (size_t)padding) != 0) {
|
||||
/* This is considered not a fatal error, we continue to validate */
|
||||
if (verbose) printf("Error @ [0x%8.8zx]:\n", err_addr);
|
||||
if (verbose) printf("\t%s \"%s\": name padding is non-null byte\n", loc, *namep);
|
||||
@ -1112,7 +1112,7 @@ hdr_get_name(int fd,
|
||||
*namep = NULL; */
|
||||
DEBUG_ASSIGN_ERROR(err, NC_ENULLPAD)
|
||||
if (repair) {
|
||||
val_repair(fd, err_addr, (size_t)padding, (void*)nada);
|
||||
val_repair(fd, (off_t)err_addr, (size_t)padding, (void*)nada);
|
||||
if (verbose)
|
||||
printf("\t%s \"%s\": name padding error has been **repaired**\n",loc,*namep);
|
||||
}
|
||||
@ -1335,12 +1335,12 @@ val_get_NC_attrV(int fd,
|
||||
padding = attrp->xsz - nvalues;
|
||||
pos_addr = (size_t) gbp->pos;
|
||||
base_addr = (size_t) gbp->base;
|
||||
bufremain = gbp->size - (pos_addr - base_addr);
|
||||
bufremain = (long long)(gbp->size - (pos_addr - base_addr));
|
||||
|
||||
while (nvalues > 0) {
|
||||
if (bufremain > 0) {
|
||||
attcount = MIN(bufremain, nvalues);
|
||||
(void) memcpy(value, gbp->pos, attcount);
|
||||
(void) memcpy(value, gbp->pos, (size_t)attcount);
|
||||
nvalues -= attcount;
|
||||
gbp->pos = (void *)((char *)gbp->pos + attcount);
|
||||
value = (void *)((char *)value + attcount);
|
||||
@ -1353,19 +1353,19 @@ val_get_NC_attrV(int fd,
|
||||
if (verbose) printf("\t%s: Failed to fetch next chunk into a buffer\n", loc);
|
||||
return status;
|
||||
}
|
||||
bufremain = gbp->size;
|
||||
bufremain = (long long)gbp->size;
|
||||
}
|
||||
}
|
||||
|
||||
if (padding > 0) {
|
||||
memset(pad, 0, X_ALIGN-1);
|
||||
if (memcmp(gbp->pos, pad, padding) != 0) {
|
||||
if (memcmp(gbp->pos, pad, (size_t)padding) != 0) {
|
||||
/* This is considered not a fatal error, we continue to validate */
|
||||
if (verbose) printf("Error @ [0x%8.8zx]:\n", (size_t)ERR_ADDR);
|
||||
if (verbose) printf("\t%s: value padding is non-null byte\n", loc);
|
||||
DEBUG_ASSIGN_ERROR(status, NC_ENULLPAD)
|
||||
if (repair) {
|
||||
val_repair(fd, ERR_ADDR, (size_t)padding, (void*)nada);
|
||||
val_repair(fd, (off_t)ERR_ADDR, (size_t)padding, (void*)nada);
|
||||
if (verbose)
|
||||
printf("\t%s: value padding has been **repaired**\n",loc);
|
||||
}
|
||||
@ -1720,7 +1720,7 @@ val_get_NC_var(int fd,
|
||||
if (trace) printf("\t\tnumber of dimensions = %lld\n", ndims);
|
||||
|
||||
/* allocate variable object */
|
||||
varp = val_new_NC_var(name, ndims);
|
||||
varp = val_new_NC_var(name, (int)ndims);
|
||||
if (varp == NULL) {
|
||||
if (name != NULL) free(name);
|
||||
DEBUG_RETURN_ERROR(NC_ENOMEM)
|
||||
|
@ -127,7 +127,7 @@ static OCerror printdata_indices(OClink, OCdatanode, NCbytes*,int);
|
||||
static OCerror printdata_container(OClink, OCdatanode, NCbytes*,int);
|
||||
static OCerror printdata_leaf(OClink, OCdatanode, NCbytes*,int);
|
||||
|
||||
static off_t odom_init(size_t rank, size_t* indices, size_t* dimsizes);
|
||||
static size_t odom_init(size_t rank, size_t* indices, size_t* dimsizes);
|
||||
static int odom_more(size_t rank, size_t* indices, size_t* dimsizes);
|
||||
static void odom_next(size_t rank, size_t* indices, size_t* dimsizes);
|
||||
|
||||
@ -230,7 +230,7 @@ main(int argc, char **argv)
|
||||
} break;
|
||||
case 'X': {
|
||||
int c0;
|
||||
int so = (optarg == NULL ? 0 : strlen(optarg));
|
||||
size_t so = (optarg == NULL ? 0 : strlen(optarg));
|
||||
if(so == 0) usage("missing -X argument");
|
||||
c0 = optarg[0];
|
||||
switch (c0) {
|
||||
@ -921,7 +921,7 @@ stringescape(char* s)
|
||||
{
|
||||
size_t len;
|
||||
char* p;
|
||||
int c;
|
||||
char c;
|
||||
char* escapedstring;
|
||||
|
||||
if(s == NULL) return NULL;
|
||||
@ -948,7 +948,7 @@ static char*
|
||||
idescape(char* id, char* escapeid, size_t esize)
|
||||
{
|
||||
char* p;
|
||||
int c;
|
||||
char c;
|
||||
|
||||
if(id == NULL) return NULL;
|
||||
p = escapeid;
|
||||
@ -1068,8 +1068,7 @@ dumpdatanode(OClink link, OCdatanode datanode, size_t count, void* memory, NCbyt
|
||||
ncbytescat(buffer,tmp);
|
||||
if(entry->rank > 0) {
|
||||
if(ocopt.octest) { /* Match the octest output */
|
||||
off_t xproduct;
|
||||
xproduct = totaldimsize(entry->rank,entry->dimsizes);
|
||||
size_t xproduct = totaldimsize(entry->rank,entry->dimsizes);
|
||||
snprintf(tmp,sizeof(tmp),"[0..%lu]",(unsigned long)xproduct-1);
|
||||
ncbytescat(buffer,tmp);
|
||||
} else {
|
||||
@ -1091,12 +1090,11 @@ dumpdatanode(OClink link, OCdatanode datanode, size_t count, void* memory, NCbyt
|
||||
return OC_NOERR;
|
||||
}
|
||||
|
||||
static off_t
|
||||
static size_t
|
||||
odom_init(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
int i;
|
||||
off_t count;
|
||||
for(count=1,i=0;i<rank;i++) {
|
||||
size_t count = 1;
|
||||
for(size_t i=0;i<rank;i++) {
|
||||
indices[i] = 0;
|
||||
count *= dimsizes[i];
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ main(int argc, char **argv)
|
||||
int dimid, varid;
|
||||
nc_type typeid;
|
||||
char name_in[NC_MAX_NAME+1];
|
||||
int i;
|
||||
|
||||
int var_dims[VAR6_RANK];
|
||||
|
||||
@ -139,7 +138,7 @@ main(int argc, char **argv)
|
||||
val_in.attention_span != missing_val.attention_span ) ERR;
|
||||
|
||||
/* Read in each value and check */
|
||||
for (i = 0; i < DIM6_LEN; i++) {
|
||||
for (size_t i = 0; i < DIM6_LEN; i++) {
|
||||
size_t index[VAR6_RANK];
|
||||
index[0] = i;
|
||||
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
||||
|
@ -30,7 +30,7 @@ main(int argc, char **argv)
|
||||
int dimid, varid;
|
||||
nc_type typeid;
|
||||
char name_in[NC_MAX_NAME+1];
|
||||
int i, j, k;
|
||||
int i, j;
|
||||
|
||||
int var_dims[VAR_RANK];
|
||||
|
||||
@ -150,7 +150,7 @@ main(int argc, char **argv)
|
||||
if (val_in.mon[i] != missing_val.mon[i]) ERR;
|
||||
}
|
||||
/* Read in each value and check */
|
||||
for (k = 0; k < DIM_LEN; k++) {
|
||||
for (size_t k = 0; k < DIM_LEN; k++) {
|
||||
size_t index[VAR_RANK];
|
||||
index[0] = k;
|
||||
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
||||
|
@ -32,8 +32,6 @@ main(int argc, char **argv)
|
||||
int class_in;
|
||||
size_t size_in;
|
||||
|
||||
int i;
|
||||
|
||||
int var_dims[VAR3_RANK];
|
||||
unsigned char sensor_data[DIM3_LEN][TYPE3_SIZE] = {
|
||||
{1,2,3,4,5,6,7,8,9,10,11},
|
||||
@ -90,7 +88,7 @@ main(int argc, char **argv)
|
||||
if (nc_get_att(ncid, varid, ATT3_NAME, &val_in)) ERR;
|
||||
if (memcmp(val_in, missing_val, TYPE3_SIZE) != 0) ERR;
|
||||
|
||||
for (i = 0; i < DIM3_LEN; i++) {
|
||||
for (size_t i = 0; i < DIM3_LEN; i++) {
|
||||
size_t index[VAR3_RANK];
|
||||
index[0] = i;
|
||||
if(nc_get_var1(ncid, varid, index, val_in)) ERR;
|
||||
|
@ -96,7 +96,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
array[4][0] = missing_value; /* overwrite last row with missing for equality test */
|
||||
|
||||
for (i = 0; i < DIM5_LEN; i++) {
|
||||
for (size_t i = 0; i < DIM5_LEN; i++) {
|
||||
ragged_data[i].p = array[i];
|
||||
ragged_data[i].len = NROWS - i;
|
||||
}
|
||||
@ -137,7 +137,7 @@ main(int argc, char **argv)
|
||||
if (nc_free_vlen(&val_in)) ERR;
|
||||
|
||||
/* Read in each row, check its length and values */
|
||||
for (i = 0; i < DIM5_LEN; i++) {
|
||||
for (size_t i = 0; i < DIM5_LEN; i++) {
|
||||
size_t index[VAR5_RANK];
|
||||
float *fvals;
|
||||
index[0] = i;
|
||||
|
@ -317,7 +317,7 @@ nc_inq_dimid2(int ncid, const char *dimname, int *dimidp) {
|
||||
}
|
||||
#ifdef USE_NETCDF4
|
||||
else { /* Parse group name out and get dimid using that */
|
||||
size_t grp_namelen = sp - dimname;
|
||||
size_t grp_namelen = (size_t)(sp - dimname);
|
||||
char *grpname = emalloc(grp_namelen+1);
|
||||
|
||||
int grpid;
|
||||
|
@ -60,7 +60,7 @@ set_max_len(int len) {
|
||||
*/
|
||||
void
|
||||
lput(const char *cp) {
|
||||
size_t nn = strlen(cp);
|
||||
int nn = (int)strlen(cp);
|
||||
|
||||
if (nn+linep > max_line_len && nn > 2) {
|
||||
(void) fputs("\n", stdout);
|
||||
@ -99,9 +99,9 @@ lput2(
|
||||
* false=stay on same line */
|
||||
)
|
||||
{
|
||||
static int linep; /* current line position (number of */
|
||||
static size_t linep; /* current line position (number of */
|
||||
/* chars); saved between calls */
|
||||
int len_prefix = strlen (CDL_COMMENT_PREFIX);
|
||||
size_t len_prefix = strlen (CDL_COMMENT_PREFIX);
|
||||
bool_t make_newline;
|
||||
|
||||
size_t len1 = strlen(cp); /* length of input string */
|
||||
@ -306,11 +306,11 @@ annotate(
|
||||
/* C variable indices */
|
||||
for (id = 0; id < vrank-1; id++)
|
||||
printf("%lu,", (unsigned long) cor[id]);
|
||||
printf("%lu", (unsigned long) cor[id] + iel);
|
||||
printf("%lu", (unsigned long) cor[id] + (unsigned long) iel);
|
||||
break;
|
||||
case LANG_F:
|
||||
/* Fortran variable indices */
|
||||
printf("%lu", (unsigned long) cor[vrank-1] + iel + 1);
|
||||
printf("%lu", (unsigned long) cor[vrank-1] + (unsigned long) iel + 1);
|
||||
for (id = vrank-2; id >=0 ; id--) {
|
||||
printf(",%lu", 1 + (unsigned long) cor[id]);
|
||||
}
|
||||
@ -342,7 +342,7 @@ pr_tvals(
|
||||
len--;
|
||||
for (iel = 0; iel < len; iel++) {
|
||||
unsigned char uc;
|
||||
switch (uc = *vals++ & 0377) {
|
||||
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||
case '\b':
|
||||
printf("\\b");
|
||||
break;
|
||||
@ -441,7 +441,7 @@ print_rows(
|
||||
bool_t mark_record = (level > 0 && is_unlim_dim(ncid, vp->dims[level]));
|
||||
safebuf_t *sb = sbuf_new();
|
||||
if (rank > 0)
|
||||
d0 = vdims[level];
|
||||
d0 = (int)vdims[level];
|
||||
if(mark_record) { /* the whole point of this recursion is printing these "{}" */
|
||||
lput(LBRACE);
|
||||
marks_pending++; /* matching "}"s to emit after last "row" */
|
||||
@ -634,7 +634,7 @@ pr_tvalsx(
|
||||
len--;
|
||||
for (iel = 0; iel < len; iel++) {
|
||||
unsigned char uc;
|
||||
switch (uc = *vals++ & 0377) {
|
||||
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||
case '\b':
|
||||
printf("\\b");
|
||||
break;
|
||||
|
@ -169,8 +169,7 @@ dumpgroup(Symbol* g)
|
||||
if(debug <= 1) return;
|
||||
fdebug("group %s {\n",(g==NULL?"null":g->name));
|
||||
if(g != NULL && g->subnodes != NULL) {
|
||||
int i;
|
||||
for(i=0;i<listlength(g->subnodes);i++) {
|
||||
for(size_t i=0;i<listlength(g->subnodes);i++) {
|
||||
Symbol* sym = (Symbol*)listget(g->subnodes,i);
|
||||
char* tname;
|
||||
if(sym->objectclass == NC_PRIM
|
||||
@ -178,7 +177,7 @@ dumpgroup(Symbol* g)
|
||||
tname = nctypename(sym->subclass);
|
||||
} else
|
||||
tname = nctypename(sym->objectclass);
|
||||
fdebug(" %3d: %s\t%s\t%s\n",
|
||||
fdebug(" %3zu: %s\t%s\t%s\n",
|
||||
i,
|
||||
sym->name,
|
||||
tname,
|
||||
|
Loading…
Reference in New Issue
Block a user