mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-23 16:59:54 +08:00
Merge pull request #2840 from ZedThree/silence-ncdump-warnings
Silence ncdump warnings
This commit is contained in:
commit
25fc13bd80
@ -196,7 +196,7 @@ dimchunkspec_size(int indimid) {
|
|||||||
/* Return number of dimensions for which chunking was specified in
|
/* Return number of dimensions for which chunking was specified in
|
||||||
* chunkspec string on command line, 0 if no chunkspec string was
|
* chunkspec string on command line, 0 if no chunkspec string was
|
||||||
* specified. */
|
* specified. */
|
||||||
int
|
size_t
|
||||||
dimchunkspec_ndims(void) {
|
dimchunkspec_ndims(void) {
|
||||||
return dimchunkspecs.ndims;
|
return dimchunkspecs.ndims;
|
||||||
}
|
}
|
||||||
@ -337,8 +337,7 @@ done:
|
|||||||
int
|
int
|
||||||
varchunkspec_kind(int grpid, int varid)
|
varchunkspec_kind(int grpid, int varid)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
|
||||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||||
if(spec->igrpid == grpid && spec->ivarid == varid)
|
if(spec->igrpid == grpid && spec->ivarid == varid)
|
||||||
return spec->kind;
|
return spec->kind;
|
||||||
@ -349,8 +348,7 @@ varchunkspec_kind(int grpid, int varid)
|
|||||||
bool_t
|
bool_t
|
||||||
varchunkspec_exists(int igrpid, int ivarid)
|
varchunkspec_exists(int igrpid, int ivarid)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
|
||||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||||
return true;
|
return true;
|
||||||
@ -361,8 +359,7 @@ varchunkspec_exists(int igrpid, int ivarid)
|
|||||||
bool_t
|
bool_t
|
||||||
varchunkspec_omit(int igrpid, int ivarid)
|
varchunkspec_omit(int igrpid, int ivarid)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
|
||||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||||
return spec->omit;
|
return spec->omit;
|
||||||
@ -373,8 +370,7 @@ varchunkspec_omit(int igrpid, int ivarid)
|
|||||||
size_t*
|
size_t*
|
||||||
varchunkspec_chunksizes(int igrpid, int ivarid)
|
varchunkspec_chunksizes(int igrpid, int ivarid)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
|
||||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||||
return spec->chunksizes;
|
return spec->chunksizes;
|
||||||
@ -385,8 +381,7 @@ varchunkspec_chunksizes(int igrpid, int ivarid)
|
|||||||
size_t
|
size_t
|
||||||
varchunkspec_rank(int igrpid, int ivarid)
|
varchunkspec_rank(int igrpid, int ivarid)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(varchunkspecs);i++) {
|
||||||
for(i=0;i<listlength(varchunkspecs);i++) {
|
|
||||||
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
struct VarChunkSpec* spec = listget(varchunkspecs,i);
|
||||||
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
if(spec->igrpid == igrpid && spec->ivarid == ivarid)
|
||||||
return spec->rank;
|
return spec->rank;
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#ifndef _CHUNKSPEC_H_
|
#ifndef _CHUNKSPEC_H_
|
||||||
#define _CHUNKSPEC_H_
|
#define _CHUNKSPEC_H_
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
/* Parse chunkspec string and convert into internal data structure,
|
/* Parse chunkspec string and convert into internal data structure,
|
||||||
* associating dimids from open file or group specified by ncid with
|
* associating dimids from open file or group specified by ncid with
|
||||||
* corresponding chunk sizes */
|
* corresponding chunk sizes */
|
||||||
@ -25,7 +28,7 @@ dimchunkspec_exists(int indimid);
|
|||||||
/* Return number of dimensions for which chunking was specified in
|
/* Return number of dimensions for which chunking was specified in
|
||||||
* chunkspec string on command line, 0 if no chunkspec string was
|
* chunkspec string on command line, 0 if no chunkspec string was
|
||||||
* specified. */
|
* specified. */
|
||||||
extern int
|
extern size_t
|
||||||
dimchunkspec_ndims(void);
|
dimchunkspec_ndims(void);
|
||||||
|
|
||||||
/* Return whether chunking should be omitted, due to explicit
|
/* Return whether chunking should be omitted, due to explicit
|
||||||
|
@ -861,7 +861,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
|||||||
sp = sout;
|
sp = sout;
|
||||||
*sp++ = '"' ;
|
*sp++ = '"' ;
|
||||||
while(*cp) {
|
while(*cp) {
|
||||||
switch (uc = *cp++ & 0377) {
|
switch (uc = (unsigned char)*cp++ & 0377) {
|
||||||
case '\b':
|
case '\b':
|
||||||
*sp++ = '\\';
|
*sp++ = '\\';
|
||||||
*sp++ = 'b' ;
|
*sp++ = 'b' ;
|
||||||
@ -904,7 +904,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
|
|||||||
sp += 4;
|
sp += 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*sp++ = uc;
|
*sp++ = (char)uc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1045,7 +1045,7 @@ chars_tostring(
|
|||||||
len--;
|
len--;
|
||||||
for (iel = 0; iel < len; iel++) {
|
for (iel = 0; iel < len; iel++) {
|
||||||
unsigned char uc;
|
unsigned char uc;
|
||||||
switch (uc = *vals++ & 0377) {
|
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||||
case '\b':
|
case '\b':
|
||||||
case '\f':
|
case '\f':
|
||||||
case '\n':
|
case '\n':
|
||||||
@ -1062,7 +1062,7 @@ chars_tostring(
|
|||||||
if (isprint(uc))
|
if (isprint(uc))
|
||||||
*cp++ = *(char *)&uc; /* just copy, even if char is signed */
|
*cp++ = *(char *)&uc; /* just copy, even if char is signed */
|
||||||
else {
|
else {
|
||||||
size_t remaining = sout_size - (cp - sout);
|
size_t remaining = sout_size - (size_t)(cp - sout);
|
||||||
snprintf(cp,remaining,"\\%.3o",uc);
|
snprintf(cp,remaining,"\\%.3o",uc);
|
||||||
cp += 4;
|
cp += 4;
|
||||||
}
|
}
|
||||||
@ -1806,10 +1806,8 @@ print_type_name(int locid, int typeid) {
|
|||||||
static int
|
static int
|
||||||
init_is_unlim(int ncid, int **is_unlim_p)
|
init_is_unlim(int ncid, int **is_unlim_p)
|
||||||
{
|
{
|
||||||
int num_grps; /* total number of groups */
|
size_t num_grps; /* total number of groups */
|
||||||
int num_dims = 0; /* total number of dimensions in all groups */
|
|
||||||
int max_dimid = -1; /* maximum dimid across whole dataset */
|
int max_dimid = -1; /* maximum dimid across whole dataset */
|
||||||
int num_undims = 0; /* total number of unlimited dimensions in all groups */
|
|
||||||
int *grpids = NULL; /* temporary list of all grpids */
|
int *grpids = NULL; /* temporary list of all grpids */
|
||||||
int igrp;
|
int igrp;
|
||||||
int grpid;
|
int grpid;
|
||||||
@ -1824,7 +1822,7 @@ init_is_unlim(int ncid, int **is_unlim_p)
|
|||||||
return NC_EBADGRPID;
|
return NC_EBADGRPID;
|
||||||
/* Now ncid is root group. Get total number of groups and their ids */
|
/* Now ncid is root group. Get total number of groups and their ids */
|
||||||
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, NULL) );
|
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, NULL) );
|
||||||
grpids = emalloc((size_t)(num_grps + 1) * sizeof(int));
|
grpids = emalloc((num_grps + 1) * sizeof(int));
|
||||||
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, grpids) );
|
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, grpids) );
|
||||||
#define DONT_INCLUDE_PARENTS 0
|
#define DONT_INCLUDE_PARENTS 0
|
||||||
/* Get all dimensions in groups and info about which ones are unlimited */
|
/* Get all dimensions in groups and info about which ones are unlimited */
|
||||||
@ -1836,7 +1834,6 @@ init_is_unlim(int ncid, int **is_unlim_p)
|
|||||||
int* dimids = NULL;
|
int* dimids = NULL;
|
||||||
grpid = grpids[igrp];
|
grpid = grpids[igrp];
|
||||||
NC_CHECK( nc_inq_dimids(grpid, &ndims, NULL, DONT_INCLUDE_PARENTS) );
|
NC_CHECK( nc_inq_dimids(grpid, &ndims, NULL, DONT_INCLUDE_PARENTS) );
|
||||||
num_dims += ndims;
|
|
||||||
dimids = (int*)emalloc((size_t)ndims*sizeof(int));
|
dimids = (int*)emalloc((size_t)ndims*sizeof(int));
|
||||||
NC_CHECK( nc_inq_dimids(grpid, &ndims, dimids, DONT_INCLUDE_PARENTS) );
|
NC_CHECK( nc_inq_dimids(grpid, &ndims, dimids, DONT_INCLUDE_PARENTS) );
|
||||||
for(i=0;i<ndims;i++) {if(dimids[i] > max_dimid) max_dimid = dimids[i];}
|
for(i=0;i<ndims;i++) {if(dimids[i] > max_dimid) max_dimid = dimids[i];}
|
||||||
@ -1863,7 +1860,6 @@ init_is_unlim(int ncid, int **is_unlim_p)
|
|||||||
int* isunlim = *is_unlim_p;
|
int* isunlim = *is_unlim_p;
|
||||||
int did = dimids[idim];
|
int did = dimids[idim];
|
||||||
isunlim[did] = 1;
|
isunlim[did] = 1;
|
||||||
num_undims++;
|
|
||||||
}
|
}
|
||||||
if(dimids)
|
if(dimids)
|
||||||
free(dimids);
|
free(dimids);
|
||||||
|
@ -40,8 +40,7 @@ int
|
|||||||
listfreeall(List* l)
|
listfreeall(List* l)
|
||||||
{
|
{
|
||||||
if(l) {
|
if(l) {
|
||||||
int i;
|
for(size_t i=0;i<listlength(l);i++) {
|
||||||
for(i=0;i<listlength(l);i++) {
|
|
||||||
void* elem = listget(l,i);
|
void* elem = listget(l,i);
|
||||||
if(elem != NULL) free(elem);
|
if(elem != NULL) free(elem);
|
||||||
}
|
}
|
||||||
|
@ -313,9 +313,8 @@ printNode(NC4printer* out, NCID* node, int depth)
|
|||||||
CAT(">\n");
|
CAT(">\n");
|
||||||
depth++;
|
depth++;
|
||||||
for(i=0;i<count;i++) {
|
for(i=0;i<count;i++) {
|
||||||
long long value;
|
|
||||||
if((ret=nc_inq_enum_member(GROUPOF(node),node->id,i,name,&numvalue))) FAIL;
|
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);
|
INDENT(depth);
|
||||||
CAT("<EnumConst");
|
CAT("<EnumConst");
|
||||||
printXMLAttributeName(out, "name", name);
|
printXMLAttributeName(out, "name", name);
|
||||||
@ -443,7 +442,6 @@ static int
|
|||||||
printAttribute(NC4printer* out, NCID* attr, int depth)
|
printAttribute(NC4printer* out, NCID* attr, int depth)
|
||||||
{
|
{
|
||||||
int ret = NC_NOERR;
|
int ret = NC_NOERR;
|
||||||
int i = 0;
|
|
||||||
void* values;
|
void* values;
|
||||||
|
|
||||||
INDENT(depth); CAT("<Attribute");
|
INDENT(depth); CAT("<Attribute");
|
||||||
@ -451,7 +449,7 @@ printAttribute(NC4printer* out, NCID* attr, int depth)
|
|||||||
CAT(">\n");
|
CAT(">\n");
|
||||||
if((ret=readAttributeValues(attr,&values))) FAIL;
|
if((ret=readAttributeValues(attr,&values))) FAIL;
|
||||||
depth++;
|
depth++;
|
||||||
for(i=0;i<attr->size;i++) {
|
for(size_t i=0;i<attr->size;i++) {
|
||||||
void* value = computeOffset(attr->base,values,i);
|
void* value = computeOffset(attr->base,values,i);
|
||||||
if((ret=printValue(out,attr->base,value,depth))) FAIL;
|
if((ret=printValue(out,attr->base,value,depth))) FAIL;
|
||||||
}
|
}
|
||||||
@ -696,7 +694,7 @@ entityEscape(NCbytes* escaped, const char* s)
|
|||||||
const char* p;
|
const char* p;
|
||||||
ncbytesclear(escaped);
|
ncbytesclear(escaped);
|
||||||
for(p=s;*p;p++) {
|
for(p=s;*p;p++) {
|
||||||
int c = *p;
|
char c = *p;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '&': ncbytescat(escaped,"&"); break;
|
case '&': ncbytescat(escaped,"&"); break;
|
||||||
case '<': ncbytescat(escaped,"<"); break;
|
case '<': ncbytescat(escaped,"<"); break;
|
||||||
@ -735,7 +733,7 @@ printString(NCbytes* out, const char* s, int quotes)
|
|||||||
if(quotes) ncbytesappend(out,'"');
|
if(quotes) ncbytesappend(out,'"');
|
||||||
if(s == NULL) s = "";
|
if(s == NULL) s = "";
|
||||||
for(p=s;*p;p++) {
|
for(p=s;*p;p++) {
|
||||||
int c = *p;
|
char c = *p;
|
||||||
if(c == '\\') ncbytescat(out,"\\\\");
|
if(c == '\\') ncbytescat(out,"\\\\");
|
||||||
else if(c == '"') ncbytescat(out,"\\\"");
|
else if(c == '"') ncbytescat(out,"\\\"");
|
||||||
else ncbytesappend(out,c);
|
else ncbytesappend(out,c);
|
||||||
|
@ -288,7 +288,6 @@ parsefilterspec(const char* optarg0, List* speclist)
|
|||||||
char* p = NULL;
|
char* p = NULL;
|
||||||
char* remainder = NULL;
|
char* remainder = NULL;
|
||||||
List* vlist = NULL;
|
List* vlist = NULL;
|
||||||
int i;
|
|
||||||
int isnone = 0;
|
int isnone = 0;
|
||||||
size_t nfilters = 0;
|
size_t nfilters = 0;
|
||||||
NC_H5_Filterspec** filters = NULL;
|
NC_H5_Filterspec** filters = NULL;
|
||||||
@ -325,7 +324,7 @@ parsefilterspec(const char* optarg0, List* speclist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Construct a spec entry for each element in vlist */
|
/* 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;
|
int k;
|
||||||
size_t vlen;
|
size_t vlen;
|
||||||
struct FilterOption* filtopt = NULL;
|
struct FilterOption* filtopt = NULL;
|
||||||
@ -341,9 +340,9 @@ parsefilterspec(const char* optarg0, List* speclist)
|
|||||||
filtopt->fqn[0] = '\0'; /* for strlcat */
|
filtopt->fqn[0] = '\0'; /* for strlcat */
|
||||||
if(strcmp(var,"*") != 0 && var[0] != '/') strlcat(filtopt->fqn,"/",vlen+2);
|
if(strcmp(var,"*") != 0 && var[0] != '/') strlcat(filtopt->fqn,"/",vlen+2);
|
||||||
strlcat(filtopt->fqn,var,vlen+2);
|
strlcat(filtopt->fqn,var,vlen+2);
|
||||||
if(isnone)
|
if(isnone) {
|
||||||
filtopt->nofilter = 1;
|
filtopt->nofilter = 1;
|
||||||
else {
|
} else {
|
||||||
filtopt->pfs = *nsf;
|
filtopt->pfs = *nsf;
|
||||||
if(nsf->nparams != 0) {
|
if(nsf->nparams != 0) {
|
||||||
/* Duplicate the params */
|
/* Duplicate the params */
|
||||||
@ -369,11 +368,10 @@ done:
|
|||||||
static int
|
static int
|
||||||
varfiltersactive(const char* ofqn)
|
varfiltersactive(const char* ofqn)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int hasnone = 0;
|
int hasnone = 0;
|
||||||
int hasactive = 0;
|
int hasactive = 0;
|
||||||
/* See which output filter options are defined for this output variable */
|
/* 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);
|
struct FilterOption* opt = listget(filteroptions,i);
|
||||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
||||||
{if(opt->nofilter) hasnone = 1;} else {hasactive = 1;}
|
{if(opt->nofilter) hasnone = 1;} else {hasactive = 1;}
|
||||||
@ -385,10 +383,9 @@ varfiltersactive(const char* ofqn)
|
|||||||
static int
|
static int
|
||||||
varfilterssuppress(const char* ofqn)
|
varfilterssuppress(const char* ofqn)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int hasnone = 0;
|
int hasnone = 0;
|
||||||
/* See which output filter options are defined for this output variable */
|
/* 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);
|
struct FilterOption* opt = listget(filteroptions,i);
|
||||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0)
|
||||||
{if(opt->nofilter) hasnone = 1;}
|
{if(opt->nofilter) hasnone = 1;}
|
||||||
@ -400,11 +397,10 @@ varfilterssuppress(const char* ofqn)
|
|||||||
static List*
|
static List*
|
||||||
filteroptsforvar(const char* ofqn)
|
filteroptsforvar(const char* ofqn)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
List* list = listnew();
|
List* list = listnew();
|
||||||
/* See which output filter options are defined for this output variable;
|
/* See which output filter options are defined for this output variable;
|
||||||
both active and none. */
|
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);
|
struct FilterOption* opt = listget(filteroptions,i);
|
||||||
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0) {
|
if(strcmp(opt->fqn,"*")==0 || strcmp(opt->fqn,ofqn)==0) {
|
||||||
if(!opt->nofilter) /* Add to the list */
|
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 stat = NC_NOERR;
|
||||||
int ndims;
|
int ndims;
|
||||||
size_t *ichunksizes, *ochunksizes;
|
size_t *ichunksizes, *ochunksizes;
|
||||||
int dim;
|
|
||||||
int icontig = NC_CONTIGUOUS, ocontig = NC_CONTIGUOUS;
|
int icontig = NC_CONTIGUOUS, ocontig = NC_CONTIGUOUS;
|
||||||
nc_type vartype;
|
nc_type vartype;
|
||||||
size_t value_size;
|
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
|
if(icontig != NC_CHUNKED) { /* if input contiguous|compact, treat as if chunked on
|
||||||
* first dimension */
|
* first dimension */
|
||||||
ichunksizes[0] = 1;
|
ichunksizes[0] = 1;
|
||||||
for(dim = 1; dim < ndims; dim++) {
|
for(size_t dim = 1; dim < ndims; dim++) {
|
||||||
ichunksizes[dim] = dim;
|
ichunksizes[dim] = dim;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -510,7 +505,7 @@ inq_var_chunking_params(int igrp, int ivarid, int ogrp, int ovarid,
|
|||||||
|
|
||||||
nelems = 1;
|
nelems = 1;
|
||||||
oprod = value_size;
|
oprod = value_size;
|
||||||
for(dim = 0; dim < ndims; dim++) {
|
for(size_t dim = 0; dim < ndims; dim++) {
|
||||||
nelems += 1 + (ichunksizes[dim] - 1) / ochunksizes[dim];
|
nelems += 1 + (ichunksizes[dim] - 1) / ochunksizes[dim];
|
||||||
iprod *= ichunksizes[dim];
|
iprod *= ichunksizes[dim];
|
||||||
oprod *= ochunksizes[dim];
|
oprod *= ochunksizes[dim];
|
||||||
@ -681,14 +676,14 @@ static int
|
|||||||
copy_groups(int iroot, int oroot)
|
copy_groups(int iroot, int oroot)
|
||||||
{
|
{
|
||||||
int stat = NC_NOERR;
|
int stat = NC_NOERR;
|
||||||
int numgrps;
|
size_t numgrps;
|
||||||
int *grpids;
|
int *grpids;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* get total number of groups and their ids, including all descendants */
|
/* get total number of groups and their ids, including all descendants */
|
||||||
NC_CHECK(nc_inq_grps_full(iroot, &numgrps, NULL));
|
NC_CHECK(nc_inq_grps_full(iroot, &numgrps, NULL));
|
||||||
if(numgrps > 1) { /* there's always 1 root group */
|
if(numgrps > 1) { /* there's always 1 root group */
|
||||||
grpids = emalloc((size_t)numgrps * sizeof(int));
|
grpids = emalloc(numgrps * sizeof(int));
|
||||||
NC_CHECK(nc_inq_grps_full(iroot, NULL, grpids));
|
NC_CHECK(nc_inq_grps_full(iroot, NULL, grpids));
|
||||||
/* create corresponding new groups in ogrp, except for root group */
|
/* create corresponding new groups in ogrp, except for root group */
|
||||||
for(i = 1; i < numgrps; i++) {
|
for(i = 1; i < numgrps; i++) {
|
||||||
@ -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 */
|
/* Apply actual filter spec if any */
|
||||||
if(!unfiltered) {
|
if(!unfiltered) {
|
||||||
/* add all the actual filters */
|
/* add all the actual filters */
|
||||||
int k;
|
for(size_t k=0;k<listlength(actualspecs);k++) {
|
||||||
for(k=0;k<listlength(actualspecs);k++) {
|
|
||||||
struct FilterOption* actual = (struct FilterOption*)listget(actualspecs,k);
|
struct FilterOption* actual = (struct FilterOption*)listget(actualspecs,k);
|
||||||
if((stat=nc_def_var_filter(ovid.grpid,ovid.varid,
|
if((stat=nc_def_var_filter(ovid.grpid,ovid.varid,
|
||||||
actual->pfs.filterid,
|
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*/
|
/* Figure out the chunking even if we do not decide to do so*/
|
||||||
if(varchunkspec_exists(igrp,i_varid)
|
if(varchunkspec_exists(igrp,i_varid)
|
||||||
&& varchunkspec_kind(igrp,i_varid) == NC_CHUNKED)
|
&& 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 */
|
/* If any kind of output filter was specified, then not contiguous */
|
||||||
ovid.grpid = ogrp;
|
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 */
|
/* Return number of values for a variable varid in a group igrp */
|
||||||
static int
|
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 stat = NC_NOERR;
|
||||||
int ndims;
|
int ndims;
|
||||||
int *dimids;
|
int *dimids;
|
||||||
int dim;
|
int dim;
|
||||||
long long nvals = 1;
|
size_t nvals = 1;
|
||||||
|
|
||||||
NC_CHECK(nc_inq_varndims(igrp, varid, &ndims));
|
NC_CHECK(nc_inq_varndims(igrp, varid, &ndims));
|
||||||
dimids = (int *) emalloc((size_t)(ndims + 1) * sizeof(int));
|
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;
|
int stat = NC_NOERR;
|
||||||
nc_type vartype;
|
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 ntoget; /* number of values to access this iteration */
|
||||||
size_t value_size; /* size of a single value of this variable */
|
size_t value_size; /* size of a single value of this variable */
|
||||||
static void *buf = 0; /* buffer for the variable values */
|
static void *buf = 0; /* buffer for the variable values */
|
||||||
@ -1898,7 +1892,6 @@ copy_fixed_size_data(int igrp, int ogrp, size_t nfixed_vars, int *fixed_varids)
|
|||||||
static int
|
static int
|
||||||
copy_rec_var_data(int ncid, /* input */
|
copy_rec_var_data(int ncid, /* input */
|
||||||
int ogrp, /* output */
|
int ogrp, /* output */
|
||||||
int irec, /* record number */
|
|
||||||
int varid, /* input variable id */
|
int varid, /* input variable id */
|
||||||
int ovarid, /* output variable id */
|
int ovarid, /* output variable id */
|
||||||
size_t *start, /* start indices for record data */
|
size_t *start, /* start indices for record data */
|
||||||
@ -1970,7 +1963,7 @@ copy_record_data(int ncid, int ogrp, size_t nrec_vars, int *rec_varids) {
|
|||||||
varid = rec_varids[ivar];
|
varid = rec_varids[ivar];
|
||||||
ovarid = rec_ovarids[ivar];
|
ovarid = rec_ovarids[ivar];
|
||||||
start[ivar][0] = irec;
|
start[ivar][0] = irec;
|
||||||
NC_CHECK(copy_rec_var_data(ncid, ogrp, irec, varid, ovarid,
|
NC_CHECK(copy_rec_var_data(ncid, ogrp, varid, ovarid,
|
||||||
start[ivar], count[ivar], buf[ivar]));
|
start[ivar], count[ivar], buf[ivar]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2044,10 +2037,9 @@ copy(char* infile, char* outfile)
|
|||||||
|
|
||||||
#ifdef USE_NETCDF4
|
#ifdef USE_NETCDF4
|
||||||
if(listlength(option_chunkspecs) > 0) {
|
if(listlength(option_chunkspecs) > 0) {
|
||||||
int i;
|
|
||||||
/* Now that input is open, can parse option_chunkspecs into binary
|
/* Now that input is open, can parse option_chunkspecs into binary
|
||||||
* structure. */
|
* 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);
|
char* spec = (char*)listget(option_chunkspecs,i);
|
||||||
NC_CHECK(chunkspec_parse(igrp, spec));
|
NC_CHECK(chunkspec_parse(igrp, spec));
|
||||||
}
|
}
|
||||||
@ -2114,7 +2106,7 @@ copy(char* infile, char* outfile)
|
|||||||
}
|
}
|
||||||
#endif /* USE_NETCDF4 */
|
#endif /* USE_NETCDF4 */
|
||||||
|
|
||||||
ndims = count_dims(igrp);
|
ndims = (size_t)count_dims(igrp);
|
||||||
NC_CHECK(dimmap_init(ndims));
|
NC_CHECK(dimmap_init(ndims));
|
||||||
NC_CHECK(copy_schema(igrp, ogrp));
|
NC_CHECK(copy_schema(igrp, ogrp));
|
||||||
NC_CHECK(nc_enddef(ogrp));
|
NC_CHECK(nc_enddef(ogrp));
|
||||||
@ -2295,7 +2287,7 @@ main(int argc, char**argv)
|
|||||||
option_kind = NC_FORMAT_NETCDF4_CLASSIC;
|
option_kind = NC_FORMAT_NETCDF4_CLASSIC;
|
||||||
break;
|
break;
|
||||||
case 'd': /* non-default compression level specified */
|
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) {
|
if(option_deflate_level < 0 || option_deflate_level > 9) {
|
||||||
error("invalid deflation level: %d", option_deflate_level);
|
error("invalid deflation level: %d", option_deflate_level);
|
||||||
}
|
}
|
||||||
@ -2395,9 +2387,9 @@ main(int argc, char**argv)
|
|||||||
case 'M': /* set min chunk size */
|
case 'M': /* set min chunk size */
|
||||||
#ifdef USE_NETCDF4
|
#ifdef USE_NETCDF4
|
||||||
if(optarg == NULL)
|
if(optarg == NULL)
|
||||||
option_min_chunk_bytes = 0;
|
option_min_chunk_bytes = 0;
|
||||||
else
|
else
|
||||||
option_min_chunk_bytes = atol(optarg);
|
option_min_chunk_bytes = (size_t)atol(optarg);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
error("-M requires netcdf-4");
|
error("-M requires netcdf-4");
|
||||||
@ -2459,8 +2451,7 @@ main(int argc, char**argv)
|
|||||||
static void
|
static void
|
||||||
freefilteroptlist(List* specs)
|
freefilteroptlist(List* specs)
|
||||||
{
|
{
|
||||||
int i;
|
for(size_t i=0;i<listlength(specs);i++) {
|
||||||
for(i=0;i<listlength(specs);i++) {
|
|
||||||
struct FilterOption* spec = (struct FilterOption*)listget(specs,i);
|
struct FilterOption* spec = (struct FilterOption*)listget(specs,i);
|
||||||
if(spec->fqn) free(spec->fqn);
|
if(spec->fqn) free(spec->fqn);
|
||||||
nullfree(spec->pfs.params);
|
nullfree(spec->pfs.params);
|
||||||
|
@ -5,6 +5,7 @@ Research/Unidata. See \ref copyright file for more info. */
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef HAVE_GETOPT_H
|
#ifdef HAVE_GETOPT_H
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -429,7 +430,7 @@ pr_att_string(
|
|||||||
while (len != 0 && *sp-- == '\0')
|
while (len != 0 && *sp-- == '\0')
|
||||||
len--;
|
len--;
|
||||||
for (iel = 0; iel < len; iel++)
|
for (iel = 0; iel < len; iel++)
|
||||||
switch (uc = *cp++ & 0377) {
|
switch (uc = (unsigned char)(*cp++ & 0377)) {
|
||||||
case '\b':
|
case '\b':
|
||||||
printf ("\\b");
|
printf ("\\b");
|
||||||
break;
|
break;
|
||||||
@ -500,7 +501,7 @@ pr_attx_string(
|
|||||||
while (len != 0 && *sp-- == '\0')
|
while (len != 0 && *sp-- == '\0')
|
||||||
len--;
|
len--;
|
||||||
for (iel = 0; iel < len; iel++)
|
for (iel = 0; iel < len; iel++)
|
||||||
switch (uc = *cp++ & 0377) {
|
switch (uc = (unsigned char)*cp++ & 0377) {
|
||||||
case '\"':
|
case '\"':
|
||||||
printf (""");
|
printf (""");
|
||||||
break;
|
break;
|
||||||
@ -908,7 +909,7 @@ pr_att(
|
|||||||
value = *((int64_t *)data + i);
|
value = *((int64_t *)data + i);
|
||||||
break;
|
break;
|
||||||
case NC_UINT64:
|
case NC_UINT64:
|
||||||
value = *((uint64_t *)data + i);
|
value = (int64_t)*((uint64_t *)data + i);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("enum must have an integer base type: %d", base_nc_type);
|
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;
|
memval = *(int64_t *)raw;
|
||||||
break;
|
break;
|
||||||
case NC_UINT64:
|
case NC_UINT64:
|
||||||
memval = *(uint64_t *)raw;
|
memval = (int64_t)*(uint64_t *)raw;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("Bad base type for enum!");
|
error("Bad base type for enum!");
|
||||||
@ -2567,7 +2568,7 @@ searchgrouptreedim(int ncid, int dimid, int* parentidp)
|
|||||||
int gid;
|
int gid;
|
||||||
uintptr_t id;
|
uintptr_t id;
|
||||||
|
|
||||||
id = ncid;
|
id = (uintptr_t)ncid;
|
||||||
nclistpush(queue,(void*)id); /* prime the queue */
|
nclistpush(queue,(void*)id); /* prime the queue */
|
||||||
while(nclistlength(queue) > 0) {
|
while(nclistlength(queue) > 0) {
|
||||||
id = (uintptr_t)nclistremove(queue,0);
|
id = (uintptr_t)nclistremove(queue,0);
|
||||||
@ -2589,7 +2590,7 @@ searchgrouptreedim(int ncid, int dimid, int* parentidp)
|
|||||||
goto done;
|
goto done;
|
||||||
/* push onto the end of the queue */
|
/* push onto the end of the queue */
|
||||||
for(i=0;i<nids;i++) {
|
for(i=0;i<nids;i++) {
|
||||||
id = ids[i];
|
id = (uintptr_t)ids[i];
|
||||||
nclistpush(queue,(void*)id);
|
nclistpush(queue,(void*)id);
|
||||||
}
|
}
|
||||||
free(ids); ids = NULL;
|
free(ids); ids = NULL;
|
||||||
|
@ -15,7 +15,7 @@ main(int argc, char** argv)
|
|||||||
char vn[256];
|
char vn[256];
|
||||||
char* major, *minor, *patch;
|
char* major, *minor, *patch;
|
||||||
char* p;
|
char* p;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
strcpy(v5,H5_VERSION);
|
strcpy(v5,H5_VERSION);
|
||||||
major = v5; minor = NULL; patch = NULL;
|
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 stat = NC_NOERR;
|
||||||
int i;
|
int i;
|
||||||
long long prod;
|
size_t prod;
|
||||||
size_t *dims = iter->dimsizes;
|
size_t *dims = iter->dimsizes;
|
||||||
|
|
||||||
iter->rank = rank;
|
iter->rank = rank;
|
||||||
@ -184,7 +184,6 @@ nc_get_iter(int ncid,
|
|||||||
size_t value_size = 0; /* size in bytes of each variable element */
|
size_t value_size = 0; /* size in bytes of each variable element */
|
||||||
int ndims; /* number of dimensions for variable */
|
int ndims; /* number of dimensions for variable */
|
||||||
int *dimids;
|
int *dimids;
|
||||||
long long nvalues = 1;
|
|
||||||
int dim;
|
int dim;
|
||||||
int chunked = 0;
|
int chunked = 0;
|
||||||
|
|
||||||
@ -203,7 +202,6 @@ nc_get_iter(int ncid,
|
|||||||
for(dim = 0; dim < ndims; dim++) {
|
for(dim = 0; dim < ndims; dim++) {
|
||||||
size_t len;
|
size_t len;
|
||||||
NC_CHECK(nc_inq_dimlen(ncid, dimids[dim], &len));
|
NC_CHECK(nc_inq_dimlen(ncid, dimids[dim], &len));
|
||||||
nvalues *= len;
|
|
||||||
iterp->dimsizes[dim] = len;
|
iterp->dimsizes[dim] = len;
|
||||||
}
|
}
|
||||||
NC_CHECK(nc_inq_vartype(ncid, varid, &vartype));
|
NC_CHECK(nc_inq_vartype(ncid, varid, &vartype));
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <netcdf.h>
|
#include <netcdf.h>
|
||||||
|
#include "nctime.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "nccomps.h"
|
#include "nccomps.h"
|
||||||
#include "dumplib.h" /* for sbuf_... prototypes */
|
#include "dumplib.h" /* for sbuf_... prototypes */
|
||||||
@ -55,12 +56,11 @@ bounds_add(char *bounds_name, int ncid, int varid) {
|
|||||||
* calendar type, if present. */
|
* calendar type, if present. */
|
||||||
cdCalenType
|
cdCalenType
|
||||||
calendar_type(int ncid, int varid) {
|
calendar_type(int ncid, int varid) {
|
||||||
int ctype;
|
|
||||||
int stat;
|
int stat;
|
||||||
ncatt_t catt;
|
ncatt_t catt;
|
||||||
static struct {
|
static struct {
|
||||||
char* attname;
|
char* attname;
|
||||||
int type;
|
cdCalenType type;
|
||||||
} calmap[] = {
|
} calmap[] = {
|
||||||
{"gregorian", cdMixed},
|
{"gregorian", cdMixed},
|
||||||
{"standard", cdMixed}, /* synonym */
|
{"standard", cdMixed}, /* synonym */
|
||||||
@ -77,7 +77,7 @@ calendar_type(int ncid, int varid) {
|
|||||||
};
|
};
|
||||||
#define CF_CAL_ATT_NAME "calendar"
|
#define CF_CAL_ATT_NAME "calendar"
|
||||||
int ncals = (sizeof calmap)/(sizeof calmap[0]);
|
int ncals = (sizeof calmap)/(sizeof calmap[0]);
|
||||||
ctype = cdMixed; /* default mixed Gregorian/Julian ala udunits */
|
cdCalenType ctype = cdMixed; /* default mixed Gregorian/Julian ala udunits */
|
||||||
stat = nc_inq_att(ncid, varid, CF_CAL_ATT_NAME, &catt.type, &catt.len);
|
stat = nc_inq_att(ncid, varid, CF_CAL_ATT_NAME, &catt.type, &catt.len);
|
||||||
if(stat == NC_NOERR && (catt.type == NC_CHAR || catt.type == NC_STRING) && catt.len > 0) {
|
if(stat == NC_NOERR && (catt.type == NC_CHAR || catt.type == NC_STRING) && catt.len > 0) {
|
||||||
char *calstr;
|
char *calstr;
|
||||||
@ -88,7 +88,7 @@ calendar_type(int ncid, int varid) {
|
|||||||
nc_get_att_single_string(ncid, varid, &catt, &calstr);
|
nc_get_att_single_string(ncid, varid, &catt, &calstr);
|
||||||
|
|
||||||
int itype;
|
int itype;
|
||||||
int calstr_len = strlen(calstr);
|
size_t calstr_len = strlen(calstr);
|
||||||
for(itype = 0; itype < ncals; itype++) {
|
for(itype = 0; itype < ncals; itype++) {
|
||||||
if(strncasecmp(calstr, calmap[itype].attname, calstr_len) == 0) {
|
if(strncasecmp(calstr, calmap[itype].attname, calstr_len) == 0) {
|
||||||
ctype = calmap[itype].type;
|
ctype = calmap[itype].type;
|
||||||
|
@ -115,7 +115,7 @@ static const char nada[4] = {0, 0, 0, 0};
|
|||||||
/* useful for aligning memory */
|
/* useful for aligning memory */
|
||||||
#define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit))
|
#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 )
|
#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 */
|
long long sz = sizeof_t; /* nelems */
|
||||||
|
|
||||||
if (nchars != 0) /* namestring */
|
if (nchars != 0) /* namestring */
|
||||||
sz += _RNDUP(nchars, X_ALIGN);
|
sz += _RNDUP((long long)nchars, X_ALIGN);
|
||||||
|
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
@ -951,7 +951,7 @@ val_fetch(int fd, bufferinfo *gbp) {
|
|||||||
fprintf(stderr,"Error at line %d: read %s\n",__LINE__,strerror(errno));
|
fprintf(stderr,"Error at line %d: read %s\n",__LINE__,strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gbp->offset += (gbp->size - slack);
|
gbp->offset += (off_t)(gbp->size - (size_t)slack);
|
||||||
|
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
}
|
}
|
||||||
@ -962,7 +962,7 @@ val_fetch(int fd, bufferinfo *gbp) {
|
|||||||
static int
|
static int
|
||||||
val_check_buffer(int fd,
|
val_check_buffer(int fd,
|
||||||
bufferinfo *gbp,
|
bufferinfo *gbp,
|
||||||
long long nextread)
|
size_t nextread)
|
||||||
{
|
{
|
||||||
size_t pos_addr, base_addr;
|
size_t pos_addr, base_addr;
|
||||||
|
|
||||||
@ -1014,12 +1014,12 @@ hdr_get_NON_NEG(int fd, bufferinfo *gbp, long long *sp)
|
|||||||
* NON_NEG = <non-negative INT> | // CDF-1 and CDF-2
|
* NON_NEG = <non-negative INT> | // CDF-1 and CDF-2
|
||||||
* <non-negative INT64> // CDF-5
|
* <non-negative INT64> // CDF-5
|
||||||
*/
|
*/
|
||||||
int sizeof_NON_NEG, status;
|
int status;
|
||||||
|
|
||||||
sizeof_NON_NEG = (gbp->version < 5) ? 4 : 8;
|
size_t sizeof_NON_NEG = (gbp->version < 5) ? 4 : 8;
|
||||||
status = val_check_buffer(fd, gbp, sizeof_NON_NEG);
|
status = val_check_buffer(fd, gbp, sizeof_NON_NEG);
|
||||||
if (status != NC_NOERR) {
|
if (status != NC_NOERR) {
|
||||||
if (verbose) printf("%d-byte size is expected for ", sizeof_NON_NEG);
|
if (verbose) printf("%zu-byte size is expected for ", sizeof_NON_NEG);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
if (gbp->version < 5)
|
if (gbp->version < 5)
|
||||||
@ -1070,13 +1070,13 @@ hdr_get_name(int fd,
|
|||||||
padding = _RNDUP(nchars, X_ALIGN) - nchars;
|
padding = _RNDUP(nchars, X_ALIGN) - nchars;
|
||||||
pos_addr = (size_t) gbp->pos;
|
pos_addr = (size_t) gbp->pos;
|
||||||
base_addr = (size_t) gbp->base;
|
base_addr = (size_t) gbp->base;
|
||||||
bufremain = gbp->size - (pos_addr - base_addr);
|
bufremain = (long long)(gbp->size - (pos_addr - base_addr));
|
||||||
cpos = *namep;
|
cpos = *namep;
|
||||||
|
|
||||||
while (nchars > 0) {
|
while (nchars > 0) {
|
||||||
if (bufremain > 0) {
|
if (bufremain > 0) {
|
||||||
strcount = MIN(bufremain, nchars);
|
strcount = MIN(bufremain, nchars);
|
||||||
(void) memcpy(cpos, gbp->pos, strcount);
|
(void) memcpy(cpos, gbp->pos, (size_t)strcount);
|
||||||
nchars -= strcount;
|
nchars -= strcount;
|
||||||
gbp->pos = (void *)((char *)gbp->pos + strcount);
|
gbp->pos = (void *)((char *)gbp->pos + strcount);
|
||||||
cpos += strcount;
|
cpos += strcount;
|
||||||
@ -1091,20 +1091,20 @@ hdr_get_name(int fd,
|
|||||||
*namep = NULL;
|
*namep = NULL;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
bufremain = gbp->size;
|
bufremain = (long long)gbp->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (padding > 0) {
|
if (padding > 0) {
|
||||||
err_addr = ERR_ADDR;
|
err_addr = ERR_ADDR;
|
||||||
err = val_check_buffer(fd, gbp, padding);
|
err = val_check_buffer(fd, gbp, (size_t)padding);
|
||||||
if (err != NC_NOERR) {
|
if (err != NC_NOERR) {
|
||||||
if (verbose) printf("Error @ [0x%8.8zx]:\n", err_addr);
|
if (verbose) printf("Error @ [0x%8.8zx]:\n", err_addr);
|
||||||
if (verbose) printf("\t%s - fetching name string padding\n", loc);
|
if (verbose) printf("\t%s - fetching name string padding\n", loc);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
memset(pad, 0, X_ALIGN-1);
|
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 */
|
/* This is considered not a fatal error, we continue to validate */
|
||||||
if (verbose) printf("Error @ [0x%8.8zx]:\n", err_addr);
|
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);
|
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; */
|
*namep = NULL; */
|
||||||
DEBUG_ASSIGN_ERROR(err, NC_ENULLPAD)
|
DEBUG_ASSIGN_ERROR(err, NC_ENULLPAD)
|
||||||
if (repair) {
|
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)
|
if (verbose)
|
||||||
printf("\t%s \"%s\": name padding error has been **repaired**\n",loc,*namep);
|
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;
|
padding = attrp->xsz - nvalues;
|
||||||
pos_addr = (size_t) gbp->pos;
|
pos_addr = (size_t) gbp->pos;
|
||||||
base_addr = (size_t) gbp->base;
|
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) {
|
while (nvalues > 0) {
|
||||||
if (bufremain > 0) {
|
if (bufremain > 0) {
|
||||||
attcount = MIN(bufremain, nvalues);
|
attcount = MIN(bufremain, nvalues);
|
||||||
(void) memcpy(value, gbp->pos, attcount);
|
(void) memcpy(value, gbp->pos, (size_t)attcount);
|
||||||
nvalues -= attcount;
|
nvalues -= attcount;
|
||||||
gbp->pos = (void *)((char *)gbp->pos + attcount);
|
gbp->pos = (void *)((char *)gbp->pos + attcount);
|
||||||
value = (void *)((char *)value + 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);
|
if (verbose) printf("\t%s: Failed to fetch next chunk into a buffer\n", loc);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
bufremain = gbp->size;
|
bufremain = (long long)gbp->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (padding > 0) {
|
if (padding > 0) {
|
||||||
memset(pad, 0, X_ALIGN-1);
|
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 */
|
/* 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("Error @ [0x%8.8zx]:\n", (size_t)ERR_ADDR);
|
||||||
if (verbose) printf("\t%s: value padding is non-null byte\n", loc);
|
if (verbose) printf("\t%s: value padding is non-null byte\n", loc);
|
||||||
DEBUG_ASSIGN_ERROR(status, NC_ENULLPAD)
|
DEBUG_ASSIGN_ERROR(status, NC_ENULLPAD)
|
||||||
if (repair) {
|
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)
|
if (verbose)
|
||||||
printf("\t%s: value padding has been **repaired**\n",loc);
|
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);
|
if (trace) printf("\t\tnumber of dimensions = %lld\n", ndims);
|
||||||
|
|
||||||
/* allocate variable object */
|
/* allocate variable object */
|
||||||
varp = val_new_NC_var(name, ndims);
|
varp = val_new_NC_var(name, (int)ndims);
|
||||||
if (varp == NULL) {
|
if (varp == NULL) {
|
||||||
if (name != NULL) free(name);
|
if (name != NULL) free(name);
|
||||||
DEBUG_RETURN_ERROR(NC_ENOMEM)
|
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_container(OClink, OCdatanode, NCbytes*,int);
|
||||||
static OCerror printdata_leaf(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 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);
|
static void odom_next(size_t rank, size_t* indices, size_t* dimsizes);
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ main(int argc, char **argv)
|
|||||||
} break;
|
} break;
|
||||||
case 'X': {
|
case 'X': {
|
||||||
int c0;
|
int c0;
|
||||||
int so = (optarg == NULL ? 0 : strlen(optarg));
|
size_t so = (optarg == NULL ? 0 : strlen(optarg));
|
||||||
if(so == 0) usage("missing -X argument");
|
if(so == 0) usage("missing -X argument");
|
||||||
c0 = optarg[0];
|
c0 = optarg[0];
|
||||||
switch (c0) {
|
switch (c0) {
|
||||||
@ -921,7 +921,7 @@ stringescape(char* s)
|
|||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char* p;
|
char* p;
|
||||||
int c;
|
char c;
|
||||||
char* escapedstring;
|
char* escapedstring;
|
||||||
|
|
||||||
if(s == NULL) return NULL;
|
if(s == NULL) return NULL;
|
||||||
@ -948,7 +948,7 @@ static char*
|
|||||||
idescape(char* id, char* escapeid, size_t esize)
|
idescape(char* id, char* escapeid, size_t esize)
|
||||||
{
|
{
|
||||||
char* p;
|
char* p;
|
||||||
int c;
|
char c;
|
||||||
|
|
||||||
if(id == NULL) return NULL;
|
if(id == NULL) return NULL;
|
||||||
p = escapeid;
|
p = escapeid;
|
||||||
@ -1068,8 +1068,7 @@ dumpdatanode(OClink link, OCdatanode datanode, size_t count, void* memory, NCbyt
|
|||||||
ncbytescat(buffer,tmp);
|
ncbytescat(buffer,tmp);
|
||||||
if(entry->rank > 0) {
|
if(entry->rank > 0) {
|
||||||
if(ocopt.octest) { /* Match the octest output */
|
if(ocopt.octest) { /* Match the octest output */
|
||||||
off_t xproduct;
|
size_t xproduct = totaldimsize(entry->rank,entry->dimsizes);
|
||||||
xproduct = totaldimsize(entry->rank,entry->dimsizes);
|
|
||||||
snprintf(tmp,sizeof(tmp),"[0..%lu]",(unsigned long)xproduct-1);
|
snprintf(tmp,sizeof(tmp),"[0..%lu]",(unsigned long)xproduct-1);
|
||||||
ncbytescat(buffer,tmp);
|
ncbytescat(buffer,tmp);
|
||||||
} else {
|
} else {
|
||||||
@ -1091,12 +1090,11 @@ dumpdatanode(OClink link, OCdatanode datanode, size_t count, void* memory, NCbyt
|
|||||||
return OC_NOERR;
|
return OC_NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static off_t
|
static size_t
|
||||||
odom_init(size_t rank, size_t* indices, size_t* dimsizes)
|
odom_init(size_t rank, size_t* indices, size_t* dimsizes)
|
||||||
{
|
{
|
||||||
int i;
|
size_t count = 1;
|
||||||
off_t count;
|
for(size_t i=0;i<rank;i++) {
|
||||||
for(count=1,i=0;i<rank;i++) {
|
|
||||||
indices[i] = 0;
|
indices[i] = 0;
|
||||||
count *= dimsizes[i];
|
count *= dimsizes[i];
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ main(int argc, char **argv)
|
|||||||
int dimid, varid;
|
int dimid, varid;
|
||||||
nc_type typeid;
|
nc_type typeid;
|
||||||
char name_in[NC_MAX_NAME+1];
|
char name_in[NC_MAX_NAME+1];
|
||||||
int i;
|
|
||||||
|
|
||||||
int var_dims[VAR6_RANK];
|
int var_dims[VAR6_RANK];
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ main(int argc, char **argv)
|
|||||||
val_in.attention_span != missing_val.attention_span ) ERR;
|
val_in.attention_span != missing_val.attention_span ) ERR;
|
||||||
|
|
||||||
/* Read in each value and check */
|
/* 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];
|
size_t index[VAR6_RANK];
|
||||||
index[0] = i;
|
index[0] = i;
|
||||||
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
||||||
|
@ -30,7 +30,7 @@ main(int argc, char **argv)
|
|||||||
int dimid, varid;
|
int dimid, varid;
|
||||||
nc_type typeid;
|
nc_type typeid;
|
||||||
char name_in[NC_MAX_NAME+1];
|
char name_in[NC_MAX_NAME+1];
|
||||||
int i, j, k;
|
int i, j;
|
||||||
|
|
||||||
int var_dims[VAR_RANK];
|
int var_dims[VAR_RANK];
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ main(int argc, char **argv)
|
|||||||
if (val_in.mon[i] != missing_val.mon[i]) ERR;
|
if (val_in.mon[i] != missing_val.mon[i]) ERR;
|
||||||
}
|
}
|
||||||
/* Read in each value and check */
|
/* 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];
|
size_t index[VAR_RANK];
|
||||||
index[0] = k;
|
index[0] = k;
|
||||||
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
if (nc_get_var1(ncid, varid, index, (void *) &val_in)) ERR;
|
||||||
|
@ -32,8 +32,6 @@ main(int argc, char **argv)
|
|||||||
int class_in;
|
int class_in;
|
||||||
size_t size_in;
|
size_t size_in;
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
int var_dims[VAR3_RANK];
|
int var_dims[VAR3_RANK];
|
||||||
unsigned char sensor_data[DIM3_LEN][TYPE3_SIZE] = {
|
unsigned char sensor_data[DIM3_LEN][TYPE3_SIZE] = {
|
||||||
{1,2,3,4,5,6,7,8,9,10,11},
|
{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 (nc_get_att(ncid, varid, ATT3_NAME, &val_in)) ERR;
|
||||||
if (memcmp(val_in, missing_val, TYPE3_SIZE) != 0) 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];
|
size_t index[VAR3_RANK];
|
||||||
index[0] = i;
|
index[0] = i;
|
||||||
if(nc_get_var1(ncid, varid, index, val_in)) ERR;
|
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 */
|
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].p = array[i];
|
||||||
ragged_data[i].len = NROWS - i;
|
ragged_data[i].len = NROWS - i;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ main(int argc, char **argv)
|
|||||||
if (nc_free_vlen(&val_in)) ERR;
|
if (nc_free_vlen(&val_in)) ERR;
|
||||||
|
|
||||||
/* Read in each row, check its length and values */
|
/* 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];
|
size_t index[VAR5_RANK];
|
||||||
float *fvals;
|
float *fvals;
|
||||||
index[0] = i;
|
index[0] = i;
|
||||||
|
@ -317,7 +317,7 @@ nc_inq_dimid2(int ncid, const char *dimname, int *dimidp) {
|
|||||||
}
|
}
|
||||||
#ifdef USE_NETCDF4
|
#ifdef USE_NETCDF4
|
||||||
else { /* Parse group name out and get dimid using that */
|
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);
|
char *grpname = emalloc(grp_namelen+1);
|
||||||
|
|
||||||
int grpid;
|
int grpid;
|
||||||
@ -520,7 +520,7 @@ nc_inq_grpname_count(int ncid, int igrp, char **lgrps, idnode_t *grpids) {
|
|||||||
/* Check if any group names specified with "-g grp1,...,grpn" are
|
/* Check if any group names specified with "-g grp1,...,grpn" are
|
||||||
* missing. Returns total number of matching groups if no missing
|
* missing. Returns total number of matching groups if no missing
|
||||||
* groups detected, otherwise exits. */
|
* groups detected, otherwise exits. */
|
||||||
int
|
size_t
|
||||||
grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids) {
|
grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids) {
|
||||||
int ig;
|
int ig;
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
@ -883,7 +883,7 @@ nc_free_giter(ncgiter_t *iterp)
|
|||||||
* for the group ids, then call again to get them.
|
* for the group ids, then call again to get them.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
nc_inq_grps_full(int rootid, int *numgrps, int *grpids)
|
nc_inq_grps_full(int rootid, size_t *numgrps, int *grpids)
|
||||||
{
|
{
|
||||||
int stat = NC_NOERR;
|
int stat = NC_NOERR;
|
||||||
ncgiter_t *giter; /* pointer to group iterator */
|
ncgiter_t *giter; /* pointer to group iterator */
|
||||||
|
@ -128,7 +128,7 @@ extern bool_t idmember ( const idnode_t* idlist, int id );
|
|||||||
extern bool_t group_wanted ( int grpid, int nlgrps, const idnode_t* grpids );
|
extern bool_t group_wanted ( int grpid, int nlgrps, const idnode_t* grpids );
|
||||||
|
|
||||||
/* Check group list for missing groups */
|
/* Check group list for missing groups */
|
||||||
extern int grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids);
|
extern size_t grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids);
|
||||||
|
|
||||||
/* Returns 1 if string s1 ends with string s2, 0 otherwise. */
|
/* Returns 1 if string s1 ends with string s2, 0 otherwise. */
|
||||||
extern int strendswith(const char *s1, const char *s2);
|
extern int strendswith(const char *s1, const char *s2);
|
||||||
@ -162,7 +162,7 @@ extern void freeidlist(idnode_t *idlist);
|
|||||||
* loses information about subgroup relationships, just flattening all
|
* loses information about subgroup relationships, just flattening all
|
||||||
* groups into a serial list.
|
* groups into a serial list.
|
||||||
*/
|
*/
|
||||||
extern int nc_inq_grps_full(int ncid, int *numgrps, int *ncids);
|
extern int nc_inq_grps_full(int ncid, size_t *numgrps, int *ncids);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* More complex iterator interface: get group iterator for start group
|
* More complex iterator interface: get group iterator for start group
|
||||||
|
@ -60,7 +60,7 @@ set_max_len(int len) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
lput(const char *cp) {
|
lput(const char *cp) {
|
||||||
size_t nn = strlen(cp);
|
int nn = (int)strlen(cp);
|
||||||
|
|
||||||
if (nn+linep > max_line_len && nn > 2) {
|
if (nn+linep > max_line_len && nn > 2) {
|
||||||
(void) fputs("\n", stdout);
|
(void) fputs("\n", stdout);
|
||||||
@ -99,9 +99,9 @@ lput2(
|
|||||||
* false=stay on same line */
|
* 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 */
|
/* chars); saved between calls */
|
||||||
int len_prefix = strlen (CDL_COMMENT_PREFIX);
|
size_t len_prefix = strlen (CDL_COMMENT_PREFIX);
|
||||||
bool_t make_newline;
|
bool_t make_newline;
|
||||||
|
|
||||||
size_t len1 = strlen(cp); /* length of input string */
|
size_t len1 = strlen(cp); /* length of input string */
|
||||||
@ -306,11 +306,11 @@ annotate(
|
|||||||
/* C variable indices */
|
/* C variable indices */
|
||||||
for (id = 0; id < vrank-1; id++)
|
for (id = 0; id < vrank-1; id++)
|
||||||
printf("%lu,", (unsigned long) cor[id]);
|
printf("%lu,", (unsigned long) cor[id]);
|
||||||
printf("%lu", (unsigned long) cor[id] + iel);
|
printf("%lu", (unsigned long) cor[id] + (unsigned long) iel);
|
||||||
break;
|
break;
|
||||||
case LANG_F:
|
case LANG_F:
|
||||||
/* Fortran variable indices */
|
/* 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--) {
|
for (id = vrank-2; id >=0 ; id--) {
|
||||||
printf(",%lu", 1 + (unsigned long) cor[id]);
|
printf(",%lu", 1 + (unsigned long) cor[id]);
|
||||||
}
|
}
|
||||||
@ -342,7 +342,7 @@ pr_tvals(
|
|||||||
len--;
|
len--;
|
||||||
for (iel = 0; iel < len; iel++) {
|
for (iel = 0; iel < len; iel++) {
|
||||||
unsigned char uc;
|
unsigned char uc;
|
||||||
switch (uc = *vals++ & 0377) {
|
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||||
case '\b':
|
case '\b':
|
||||||
printf("\\b");
|
printf("\\b");
|
||||||
break;
|
break;
|
||||||
@ -437,15 +437,11 @@ print_rows(
|
|||||||
int rank = vp->ndims;
|
int rank = vp->ndims;
|
||||||
size_t ncols = rank > 0 ? vdims[rank - 1] : 1; /* number of values in a row */
|
size_t ncols = rank > 0 ? vdims[rank - 1] : 1; /* number of values in a row */
|
||||||
int d0 = 0;
|
int d0 = 0;
|
||||||
size_t inc = 1;
|
|
||||||
int i;
|
int i;
|
||||||
bool_t mark_record = (level > 0 && is_unlim_dim(ncid, vp->dims[level]));
|
bool_t mark_record = (level > 0 && is_unlim_dim(ncid, vp->dims[level]));
|
||||||
safebuf_t *sb = sbuf_new();
|
safebuf_t *sb = sbuf_new();
|
||||||
if (rank > 0)
|
if (rank > 0)
|
||||||
d0 = vdims[level];
|
d0 = (int)vdims[level];
|
||||||
for(i = level + 1; i < rank; i++) {
|
|
||||||
inc *= vdims[i];
|
|
||||||
}
|
|
||||||
if(mark_record) { /* the whole point of this recursion is printing these "{}" */
|
if(mark_record) { /* the whole point of this recursion is printing these "{}" */
|
||||||
lput(LBRACE);
|
lput(LBRACE);
|
||||||
marks_pending++; /* matching "}"s to emit after last "row" */
|
marks_pending++; /* matching "}"s to emit after last "row" */
|
||||||
@ -638,7 +634,7 @@ pr_tvalsx(
|
|||||||
len--;
|
len--;
|
||||||
for (iel = 0; iel < len; iel++) {
|
for (iel = 0; iel < len; iel++) {
|
||||||
unsigned char uc;
|
unsigned char uc;
|
||||||
switch (uc = *vals++ & 0377) {
|
switch (uc = (unsigned char)(*vals++ & 0377)) {
|
||||||
case '\b':
|
case '\b':
|
||||||
printf("\\b");
|
printf("\\b");
|
||||||
break;
|
break;
|
||||||
|
@ -169,8 +169,7 @@ dumpgroup(Symbol* g)
|
|||||||
if(debug <= 1) return;
|
if(debug <= 1) return;
|
||||||
fdebug("group %s {\n",(g==NULL?"null":g->name));
|
fdebug("group %s {\n",(g==NULL?"null":g->name));
|
||||||
if(g != NULL && g->subnodes != NULL) {
|
if(g != NULL && g->subnodes != NULL) {
|
||||||
int i;
|
for(size_t i=0;i<listlength(g->subnodes);i++) {
|
||||||
for(i=0;i<listlength(g->subnodes);i++) {
|
|
||||||
Symbol* sym = (Symbol*)listget(g->subnodes,i);
|
Symbol* sym = (Symbol*)listget(g->subnodes,i);
|
||||||
char* tname;
|
char* tname;
|
||||||
if(sym->objectclass == NC_PRIM
|
if(sym->objectclass == NC_PRIM
|
||||||
@ -178,7 +177,7 @@ dumpgroup(Symbol* g)
|
|||||||
tname = nctypename(sym->subclass);
|
tname = nctypename(sym->subclass);
|
||||||
} else
|
} else
|
||||||
tname = nctypename(sym->objectclass);
|
tname = nctypename(sym->objectclass);
|
||||||
fdebug(" %3d: %s\t%s\t%s\n",
|
fdebug(" %3zu: %s\t%s\t%s\n",
|
||||||
i,
|
i,
|
||||||
sym->name,
|
sym->name,
|
||||||
tname,
|
tname,
|
||||||
|
Loading…
Reference in New Issue
Block a user