Commit fc8de8b5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed data type of gridsize from int to size_t.

parent 4df1ab27
......@@ -184,10 +184,10 @@ void usage(void)
static
void printInfo(int vdate, int vtime, char *varname, double level,
int datasize, int number, int nmiss, double missval, const double *data, int vardis)
size_t datasize, int number, size_t nmiss, double missval, const double *data, int vardis)
{
static int rec = 0;
int i, ivals = 0, imiss = 0;
size_t ivals = 0, imiss = 0;
double arrmean, arrmin, arrmax;
char vdatestr[32], vtimestr[32];
......@@ -208,9 +208,9 @@ void printInfo(int vdate, int vtime, char *varname, double level,
fprintf(stdout, "%6d :%s %s %7g ", ++rec, vdatestr, vtimestr, level);
fprintf(stdout, "%8d ", datasize);
fprintf(stdout, "%8zu ", datasize);
fprintf(stdout, "%7d :", nmiss);
fprintf(stdout, "%7zu :", nmiss);
if ( number == CDI_REAL )
{
......@@ -219,7 +219,7 @@ void printInfo(int vdate, int vtime, char *varname, double level,
arrmean = 0;
arrmin = 1.e300;
arrmax = -1.e300;
for ( i = 0; i < datasize; i++ )
for ( size_t i = 0; i < datasize; i++ )
{
if ( !DBL_IS_EQUAL(data[i], missval) )
{
......@@ -237,7 +237,7 @@ void printInfo(int vdate, int vtime, char *varname, double level,
arrmean = data[0];
arrmin = data[0];
arrmax = data[0];
for ( i = 1; i < datasize; i++ )
for ( size_t i = 1; i < datasize; i++ )
{
if ( data[i] < arrmin ) arrmin = data[i];
if ( data[i] > arrmax ) arrmax = data[i];
......@@ -251,10 +251,10 @@ void printInfo(int vdate, int vtime, char *varname, double level,
}
else
{
int nvals_r = 0, nvals_i = 0;
size_t nvals_r = 0, nvals_i = 0;
double arrsum_r = 0, arrsum_i = 0, arrmean_r = 0, arrmean_i = 0;
for ( i = 0; i < datasize; i++ )
for ( size_t i = 0; i < datasize; i++ )
{
if ( !DBL_IS_EQUAL(data[i*2], missval) )
{
......@@ -278,7 +278,7 @@ void printInfo(int vdate, int vtime, char *varname, double level,
fprintf(stdout, " : %-14s\n", varname);
if ( imiss != nmiss && nmiss > 0 )
fprintf(stdout, "Found %d of %d missing values!\n", imiss, nmiss);
fprintf(stdout, "Found %zu of %zu missing values!\n", imiss, nmiss);
}
static const char *tunit2str(int tunits)
......@@ -403,8 +403,8 @@ void printShortinfo(int streamID, int vlistID, int vardis)
fprintf(stdout, "%3d ", vlistZaxisIndex(vlistID, zaxisID) + 1);
/* grid info */
int gridsize = gridInqSize(gridID);
fprintf(stdout, "%9d ", gridsize);
size_t gridsize = gridInqSize(gridID);
fprintf(stdout, "%9zu ", gridsize);
fprintf(stdout, "%3d ", vlistGridIndex(vlistID, gridID) + 1);
/* datatype */
......@@ -832,9 +832,9 @@ int main(int argc, char *argv[])
if ( fname1 )
{
int nmiss;
size_t nmiss;
int number;
int datasize = 0;
size_t datasize = 0;
int streamID2 = CDI_UNDEFID;
int filetype;
int gridID, zaxisID;
......@@ -842,7 +842,7 @@ int main(int argc, char *argv[])
int nrecs;
int levelID, levelsize;
int nts = 0;
int gridsize = 0;
size_t gridsize = 0;
int recID;
int taxisID2 = CDI_UNDEFID;
int vlistID2 = CDI_UNDEFID;
......@@ -907,7 +907,7 @@ int main(int argc, char *argv[])
}
if ( vlistNumber(vlistID1) != CDI_REAL ) datasize *= 2;
double *data = (double *) malloc((size_t)datasize * sizeof (double));
double *data = (double *) malloc(datasize * sizeof (double));
/*
nts = cdiInqTimeSize(streamID1);
......
// This file is used in CDI and CDO !!!
#if defined (HAVE_CONFIG_H)
# include "../src/config.h"
#include "../src/config.h"
#endif
#include <stdio.h>
#ifdef CDO
#define streamInqFiletype pstreamInqFiletype
#define streamInqByteorder pstreamInqByteorder
#define streamInqTimestep pstreamInqTimestep
#endif
#define DATE_FORMAT "%5.4d-%2.2d-%2.2d"
#define TIME_FORMAT "%2.2d:%2.2d:%2.2d"
......@@ -199,9 +205,9 @@ void print_xyvals2D(int gridID, int dig)
gridInqXunits(gridID, xunits);
gridInqYunits(gridID, yunits);
int gridsize = gridInqSize(gridID);
double *xvals2D = (double*) malloc((size_t)gridsize*sizeof(double));
double *yvals2D = (double*) malloc((size_t)gridsize*sizeof(double));
size_t gridsize = gridInqSize(gridID);
double *xvals2D = (double*) malloc(gridsize*sizeof(double));
double *yvals2D = (double*) malloc(gridsize*sizeof(double));
gridInqXvals(gridID, xvals2D);
gridInqYvals(gridID, yvals2D);
......@@ -210,7 +216,7 @@ void print_xyvals2D(int gridID, int dig)
double xlast = xvals2D[0];
double yfirst = yvals2D[0];
double ylast = yvals2D[0];
for ( int i = 1; i < gridsize; i++ )
for ( size_t i = 1; i < gridsize; i++ )
{
if ( xvals2D[i] < xfirst ) xfirst = xvals2D[i];
if ( xvals2D[i] > xlast ) xlast = xvals2D[i];
......@@ -271,10 +277,10 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
fprintf(stderr, "Internal problem (%s): sub grid not equal GRID_PROJECTION!\n", __func__);
int trunc = gridInqTrunc(gridID);
int gridsize = gridInqSize(gridID);
int xsize = gridInqXsize(gridID);
int ysize = gridInqYsize(gridID);
int xysize = xsize*ysize;
size_t gridsize = gridInqSize(gridID);
size_t xsize = gridInqXsize(gridID);
size_t ysize = gridInqYsize(gridID);
size_t xysize = xsize*ysize;
// int prec = gridInqPrec(gridID);
// int dig = (prec == CDI_DATATYPE_FLT64) ? 15 : 7;
......@@ -298,6 +304,7 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
if ( gridtype == GRID_LONLAT ||
gridtype == GRID_PROJECTION ||
gridtype == GRID_GENERIC ||
gridtype == GRID_CHARXY ||
gridtype == GRID_GAUSSIAN ||
gridtype == GRID_GAUSSIAN_REDUCED )
{
......@@ -306,11 +313,11 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
#ifdef CDO
set_text_color(stdout, RESET, GREEN);
#endif
fprintf(stdout, "points=%d", gridsize);
fprintf(stdout, "points=%zu", gridsize);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
fprintf(stdout, " nlat=%d", ysize);
fprintf(stdout, " nlat=%zu", ysize);
else if ( xysize )
fprintf(stdout, " (%dx%d)", xsize, ysize);
fprintf(stdout, " (%zux%zu)", xsize, ysize);
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED )
fprintf(stdout, " np=%d", gridInqNP(gridID));
......@@ -354,7 +361,7 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
#ifdef CDO
set_text_color(stdout, RESET, GREEN);
#endif
fprintf(stdout, "points=%d nsp=%d truncation=%d", gridsize, gridsize/2, trunc);
fprintf(stdout, "points=%zu nsp=%zu truncation=%d", gridsize, gridsize/2, trunc);
if ( gridInqComplexPacking(gridID) ) fprintf(stdout, " complexPacking");
my_reset_text_color(stdout);
fprintf(stdout, "\n");
......@@ -364,7 +371,7 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
#ifdef CDO
set_text_color(stdout, RESET, GREEN);
#endif
fprintf(stdout, "points=%d nfc=%d truncation=%d\n", gridsize, gridsize/2, trunc);
fprintf(stdout, "points=%zu nfc=%zu truncation=%d\n", gridsize, gridsize/2, trunc);
my_reset_text_color(stdout);
}
else if ( gridtype == GRID_GME )
......@@ -374,7 +381,7 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
#ifdef CDO
set_text_color(stdout, RESET, GREEN);
#endif
fprintf(stdout, "points=%d nd=%d ni=%d\n", gridsize, nd, ni);
fprintf(stdout, "points=%zu nd=%d ni=%d\n", gridsize, nd, ni);
my_reset_text_color(stdout);
}
else if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED )
......@@ -383,9 +390,9 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
set_text_color(stdout, RESET, GREEN);
#endif
if ( gridtype == GRID_CURVILINEAR )
fprintf(stdout, "points=%d (%dx%d)", gridsize, xsize, ysize);
fprintf(stdout, "points=%zu (%zux%zu)", gridsize, xsize, ysize);
else
fprintf(stdout, "points=%d", gridsize);
fprintf(stdout, "points=%zu", gridsize);
if ( gridtype == GRID_UNSTRUCTURED && gridInqNvertex(gridID) > 0 )
fprintf(stdout, " nvertex=%d", gridInqNvertex(gridID));
......@@ -416,9 +423,9 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
set_text_color(stdout, RESET, GREEN);
#endif
if ( ysize == 0 )
fprintf(stdout, "points=%d\n", gridsize);
fprintf(stdout, "points=%zu\n", gridsize);
else
fprintf(stdout, "points=%d (%dx%d)\n", gridsize, xsize, ysize);
fprintf(stdout, "points=%zu (%zux%zu)\n", gridsize, xsize, ysize);
my_reset_text_color(stdout);
}
......
......@@ -198,22 +198,22 @@ cdfLazyGridDefYVals(grid_t *grid, const double *vals)
}
static double
cdfLazyGridInqXVal(grid_t *grid, int index)
cdfLazyGridInqXVal(grid_t *grid, size_t index)
{
struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *)grid;
lock_lazy_load(lazyGrid);
double rv = cdfLazyGridInqXYVal(grid, (size_t)index, &lazyGrid->xValsGet,
double rv = cdfLazyGridInqXYVal(grid, index, &lazyGrid->xValsGet,
grid->x.vals, grid->vtable->inqXValsPtr);
unlock_lazy_load(lazyGrid);
return rv;
}
static double
cdfLazyGridInqYVal(grid_t *grid, int index)
cdfLazyGridInqYVal(grid_t *grid, size_t index)
{
struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *)grid;
lock_lazy_load(lazyGrid);
double rv = cdfLazyGridInqXYVal(grid, (size_t)index, &lazyGrid->yValsGet,
double rv = cdfLazyGridInqXYVal(grid, index, &lazyGrid->yValsGet,
grid->y.vals, grid->vtable->inqYValsPtr);
unlock_lazy_load(lazyGrid);
return rv;
......
......@@ -961,13 +961,13 @@ int gridInqNvertex(int gridID);
void gridDefXbounds(int gridID, const double xbounds[]);
/* gridInqXbounds: Get the bounds of a X-axis */
int gridInqXbounds(int gridID, double xbounds[]);
size_t gridInqXbounds(int gridID, double xbounds[]);
/* gridDefYbounds: Define the bounds of a Y-axis */
void gridDefYbounds(int gridID, const double ybounds[]);
/* gridInqYbounds: Get the bounds of a Y-axis */
int gridInqYbounds(int gridID, double ybounds[]);
size_t gridInqYbounds(int gridID, double ybounds[]);
void gridDefRowlon(int gridID, int nrowlon, const int rowlon[]);
void gridInqRowlon(int gridID, int rowlon[]);
......
......@@ -527,16 +527,17 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
size_t datasize;
FAIL_ON_GRIB_ERROR(grib_get_size, gh, "values", &datasize);
long numberOfPoints;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "numberOfPoints", &numberOfPoints);
long lpar;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "numberOfPoints", &lpar);
size_t numberOfPoints = (size_t) lpar;
if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL )
{
long nlon, nlat;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Ni", &nlon);
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nj", &nlat);
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Ni", &lpar);
size_t nlon = (size_t) lpar;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nj", &lpar);
size_t nlat = (size_t) lpar;
if ( gridtype == GRID_GAUSSIAN )
{
......@@ -545,11 +546,11 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
}
if ( numberOfPoints != nlon*nlat )
Error("numberOfPoints (%ld) and gridSize (%ld) differ!", numberOfPoints, nlon*nlat);
Error("numberOfPoints (%zu) and gridSize (%zu) differ!", numberOfPoints, nlon*nlat);
grid->size = (int)numberOfPoints;
grid->x.size = (int)nlon;
grid->y.size = (int)nlat;
grid->size = numberOfPoints;
grid->x.size = nlon;
grid->y.size = nlat;
grid->x.inc = 0;
grid->y.inc = 0;
grid->x.flag = 0;
......@@ -611,7 +612,7 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nj", &lpar);
int nlat = (int)lpar;
grid->size = (int)numberOfPoints;
grid->size = numberOfPoints;
grid->nrowlon = nlat;
grid->rowlon = (int *) Malloc((size_t)nlat * sizeof (int));
......@@ -621,7 +622,7 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
for ( int i = 0; i < nlat; ++i ) grid->rowlon[i] = (int)pl[i];
Free(pl);
grid->y.size = nlat;
grid->y.size = (size_t)nlat;
grid->x.inc = 0;
grid->y.inc = 0;
grid->x.flag = 0;
......@@ -670,14 +671,14 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
else if ( projtype == CDI_PROJ_LCC )
{
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nx", &lpar);
int nlon = (int)lpar;
size_t nlon = (size_t)lpar;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Ny", &lpar);
int nlat = (int)lpar;
size_t nlat = (size_t)lpar;
if ( numberOfPoints != nlon*nlat )
Error("numberOfPoints (%d) and gridSize (%d) differ!", (int)numberOfPoints, nlon*nlat);
Error("numberOfPoints (%zu) and gridSize (%zu) differ!", numberOfPoints, nlon*nlat);
grid->size = (int)numberOfPoints;
grid->size = numberOfPoints;
grid->x.size = nlon;
grid->y.size = nlat;
......@@ -702,14 +703,14 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
grid->lcomplex = 0;
if ( strncmp(typeOfPacking, "spectral_complex", len) == 0 ) grid->lcomplex = 1;
grid->size = (int)datasize;
grid->size = datasize;
FAIL_ON_GRIB_ERROR(grib_get_long, gh, "J", &lpar);
grid->trunc = (int)lpar;
}
else if ( gridtype == GRID_GME )
{
grid->size = (int)numberOfPoints;
grid->size = numberOfPoints;
if ( grib_get_long(gh, "nd", &lpar) == 0 ) grid->gme.nd = (int)lpar;
if ( grib_get_long(gh, "Ni", &lpar) == 0 ) grid->gme.ni = (int)lpar;
if ( grib_get_long(gh, "n2", &lpar) == 0 ) grid->gme.ni2 = (int)lpar;
......@@ -723,7 +724,7 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
size_t len = sizeof(reference_link);
reference_link[0] = 0;
*/
grid->size = (int)numberOfPoints;
grid->size = numberOfPoints;
if ( grib_get_long(gh, "numberOfGridUsed", &lpar) == 0 )
{
......@@ -746,11 +747,11 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
}
else if ( gridtype == GRID_GENERIC )
{
int nlon = 0, nlat = 0;
if ( grib_get_long(gh, "Ni", &lpar) == 0 ) nlon = (int)lpar;
if ( grib_get_long(gh, "Nj", &lpar) == 0 ) nlat = (int)lpar;
size_t nlon = 0, nlat = 0;
if ( grib_get_long(gh, "Ni", &lpar) == 0 ) nlon = (size_t)lpar;
if ( grib_get_long(gh, "Nj", &lpar) == 0 ) nlat = (size_t)lpar;
grid->size = (int)numberOfPoints;
grid->size = numberOfPoints;
if ( nlon > 0 && nlat > 0 && nlon*nlat == grid->size )
{
......
......@@ -4,8 +4,6 @@
#include <assert.h>
#include <string.h>
#include <float.h> /* FLT_EPSILON */
#include <limits.h> /* INT_MAX */
#include "dmemory.h"
#include "cdi.h"
......@@ -412,7 +410,8 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
if ( fabs(yvals[0] - yfirst) > deleps || fabs(yvals[ysize-1] - ylast) > deleps )
{
double *restrict ytmp = NULL;
int nstart, lfound = 0;
int nstart;
bool lfound = false;
int ny = (int) (180./(fabs(ylast-yfirst)/(ysize-1)) + 0.5);
ny -= ny%2;
if ( ny > ysize && ny < 4096 )
......@@ -1078,7 +1077,7 @@ int gridInqType(int gridID)
@Function gridInqSize
@Title Get the size of a Grid
@Prototype int gridInqSize(int gridID)
@Prototype size_t gridInqSize(int gridID)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
......@@ -1573,7 +1572,7 @@ int gridInqXIscSerial(grid_t *gridptr)
@Function gridInqXvals
@Title Get all values of a X-axis
@Prototype int gridInqXvals(int gridID, double *xvals)
@Prototype size_t gridInqXvals(int gridID, double *xvals)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item xvals Pointer to the location into which the X-values are read.
......@@ -2191,7 +2190,7 @@ bool compareXYvals2(grid_t *gridRef, grid_t *gridTest)
bool differ = ((gridTest->x.vals == NULL) ^ (gridRef->x.vals == NULL))
|| ((gridTest->y.vals == NULL) ^ (gridRef->y.vals == NULL));
typedef double (*inqVal)(grid_t *grid, int index);
typedef double (*inqVal)(grid_t *grid, size_t index);
inqVal inqXValRef = gridRef->vtable->inqXVal,
inqYValRef = gridRef->vtable->inqYVal,
inqXValTest = gridTest->vtable->inqXVal,
......@@ -3100,7 +3099,7 @@ gridInqXBoundsSerial(grid_t *gridptr, double *xbounds)
@Function gridInqXbounds
@Title Get the bounds of a X-axis
@Prototype int gridInqXbounds(int gridID, double *xbounds)
@Prototype size_t gridInqXbounds(int gridID, double *xbounds)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item xbounds Pointer to the location into which the X-bounds are read.
......@@ -3116,7 +3115,7 @@ Otherwise, 0 is returned and @func{xbounds} is empty.
@EndFunction
*/
int gridInqXbounds(int gridID, double *xbounds)
size_t gridInqXbounds(int gridID, double *xbounds)
{
grid_t *gridptr = grid_to_pointer(gridID);
return gridptr->vtable->inqXBounds(gridptr, xbounds);
......@@ -3188,7 +3187,7 @@ gridInqYBoundsSerial(grid_t *gridptr, double *ybounds)
@Function gridInqYbounds
@Title Get the bounds of a Y-axis
@Prototype int gridInqYbounds(int gridID, double *ybounds)
@Prototype size_t gridInqYbounds(int gridID, double *ybounds)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item ybounds Pointer to the location into which the Y-bounds are read.
......@@ -3204,7 +3203,7 @@ Otherwise, 0 is returned and @func{ybounds} is empty.
@EndFunction
*/
int gridInqYbounds(int gridID, double *ybounds)
size_t gridInqYbounds(int gridID, double *ybounds)
{
grid_t *gridptr = grid_to_pointer(gridID);
return gridptr->vtable->inqYBounds(gridptr, ybounds);
......@@ -3522,7 +3521,7 @@ void gridPrintKernel(int gridID, int opt, FILE *fp)
fprintf(fp, "x%ss = %.*s\n", attstr, xstrlen, xcvals[0]);
else
fprintf(fp, "xstrings = %.*s\n", xstrlen, xcvals[0]);
for ( int i = 1; i < xsize; i++ )
for ( size_t i = 1; i < xsize; i++ )
fprintf(fp, " = %.*s\n", xstrlen, xcvals[i]);
}
......@@ -3568,7 +3567,7 @@ void gridPrintKernel(int gridID, int opt, FILE *fp)
fprintf(fp, "x%ss = %.*s\n", attstr, ystrlen, ycvals[0]);
else
fprintf(fp, "ystrings = %.*s\n", ystrlen, ycvals[0]);
for ( int i = 1; i < ysize; i++ )
for ( size_t i = 1; i < ysize; i++ )
fprintf(fp, " = %.*s\n", ystrlen, ycvals[i]);
}
......@@ -3690,7 +3689,7 @@ void gridPrintP(void *voidptr, FILE *fp)
if ( gridInqMaskGME(gridID, NULL) )
{
int gridsize = gridptr->size;
size_t gridsize = gridptr->size;
int *mask = (gridsize>0) ? (int*) Malloc(gridsize*sizeof(int)) : NULL;
gridInqMaskGME(gridID, mask);
static const char prefix[] = "mask_gme = ";
......@@ -4468,7 +4467,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->y.inc = doubleBuffer[GRID_PACK_DBL_IDX_Y_INC];
}
int irregular = gridP->type == GRID_UNSTRUCTURED
bool irregular = gridP->type == GRID_UNSTRUCTURED
|| gridP->type == GRID_CURVILINEAR;
if (memberMask & gridHasXValsFlag)
{
......
......@@ -27,8 +27,8 @@ struct gridVirtTable
void (*defXBounds)(grid_t *gridptr, const double *xbounds);
void (*defYBounds)(grid_t *gridptr, const double *ybounds);
void (*defArea)(grid_t *gridptr, const double *area);
double (*inqXVal)(grid_t *gridptr, int index);
double (*inqYVal)(grid_t *gridptr, int index);
double (*inqXVal)(grid_t *gridptr, size_t index);
double (*inqYVal)(grid_t *gridptr, size_t index);
size_t (*inqXVals)(grid_t *gridptr, double *xvals);
size_t (*inqXCvals)(grid_t *gridptr, char **xcvals);
int (*inqXIsc)(grid_t *gridptr);
......@@ -47,10 +47,10 @@ struct gridVirtTable
void (*inqArea)(grid_t *gridptr, double *area);
const double *(*inqAreaPtr)(grid_t *gridptr);
int (*hasArea)(grid_t *gridptr);
int (*inqMask)(grid_t *gridptr, int *mask);
size_t (*inqMask)(grid_t *gridptr, int *mask);
int (*inqMaskGME)(grid_t *gridptr, int *mask_gme);
int (*inqXBounds)(grid_t *gridptr, double *xbounds);
int (*inqYBounds)(grid_t *gridptr, double *ybounds);
size_t (*inqXBounds)(grid_t *gridptr, double *xbounds);
size_t (*inqYBounds)(grid_t *gridptr, double *ybounds);
const double *(*inqXBoundsPtr)(grid_t *gridptr);
const double *(*inqYBoundsPtr)(grid_t *gridptr);
};
......
......@@ -89,7 +89,7 @@ typedef struct {
int ndims;
int dimids[8];
int dimtype[8];
int chunks[8];
size_t chunks[8];
int chunked;
int chunktype;
int natts;
......@@ -1097,11 +1097,11 @@ void cdf_scan_var_attr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimi
if ( storage_in == NC_CHUNKED )
{
ncvars[ncvarid].chunked = 1;
for ( int i = 0; i < nvdims; ++i ) ncvars[ncvarid].chunks[i] = (int)chunks[i];
for ( int i = 0; i < nvdims; ++i ) ncvars[ncvarid].chunks[i] = chunks[i];
if ( CDI_Debug )
{
fprintf(stderr, "%s: chunking %d %d %d chunks ", name, storage_in, NC_CONTIGUOUS, NC_CHUNKED);
for ( int i = 0; i < nvdims; ++i ) fprintf(stderr, "%ld ", chunks[i]);
for ( int i = 0; i < nvdims; ++i ) fprintf(stderr, "%zu ", chunks[i]);
fprintf(stderr, "\n");
}
{
......@@ -1112,8 +1112,7 @@ void cdf_scan_var_attr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimi
pos += sizeof (prefix) - 1;
for ( int i = nvdims-1; i >= 0; --i )
{
pos += (size_t)(sprintf(buf + pos, "%zu%s", chunks[i],
i > 0 ? "x" : ""));
pos += (size_t)(sprintf(buf + pos, "%zu%s", chunks[i], i > 0 ? "x" : ""));
}
buf[pos] = ' '; buf[pos + 1] = 0;
}
......@@ -2119,7 +2118,7 @@ void cdf_check_gridtype(int *gridtype, bool islon, bool islat, size_t xsize, siz
if ( islat && (islon || xsize == 0) )
{
double yinc = 0;
if ( islon && (int) ysize > 1 )
if ( islon && ysize > 1 )
{
yinc = fabs(grid->y.vals[0] - grid->y.vals[1]);
for ( size_t i = 2; i < ysize; i++ )
......@@ -2247,8 +2246,8 @@ bool cdf_read_ycoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
}
else if ( (ndims - ntdims) == 1 )
{
if ( (int) *ysize == 0 ) size = xsize;
else size = *ysize;
if ( *ysize == 0 ) size = xsize;
else size = *ysize;
int dimid = axisvar->dimids[ndims-1];
size_t dimsize = ncdims[dimid].len;
......@@ -2367,8 +2366,8 @@ bool cdf_read_coordinates(struct cdfLazyGrid *restrict lazyGrid, ncvar_t *ncvar,
xsize, &ysize, ntdims, start, count, &islat) )
return true;
if ( (int) ysize == 0 ) size = xsize;
else if ( (int) xsize == 0 ) size = ysize;
if ( ysize == 0 ) size = xsize;
else if ( xsize == 0 ) size = ysize;
else if ( ncvar->gridtype == GRID_UNSTRUCTURED ) size = xsize;
else size = xsize*ysize;
......@@ -2398,9 +2397,9 @@ bool cdf_read_coordinates(struct cdfLazyGrid *restrict lazyGrid, ncvar_t *ncvar,
case GRID_CURVILINEAR:
case GRID_PROJECTION:
{
grid->size = (int)size;
grid->x.size = (int)xsize;
grid->y.size = (int)ysize;
grid->size = size;
grid->x.size = xsize;
grid->y.size = ysize;
if ( xvarid != CDI_UNDEFID )
{
grid->x.flag = 1;
......@@ -2442,14 +2441,14 @@ bool cdf_read_coordinates(struct cdfLazyGrid *restrict lazyGrid, ncvar_t *ncvar,
}
case GRID_SPECTRAL:
{
grid->size = (int)size;
grid->size = size;
grid->lcomplex = 1;
grid->trunc = ncvar->truncation;
break;
}
case GRID_FOURIER: