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

cast result of malloc

parent bc590a12
......@@ -102,11 +102,11 @@ void *Copy(void *argument)
streamDefVlist(streamID2, vlistID2);
gridsize = vlistGridsizeMax(vlistID1);
array = malloc(gridsize*sizeof(double));
array = (double*) malloc(gridsize*sizeof(double));
if ( cdoParIO )
{
fprintf(stderr, "Parallel reading enabled!\n");
parIO.array = malloc(gridsize*sizeof(double));
parIO.array = (double*) malloc(gridsize*sizeof(double));
parIO.array_size = gridsize;
}
}
......
......@@ -100,7 +100,7 @@ void *Deltime(void *argument)
if ( ! lcopy )
{
gridsize = vlistGridsizeMax(vlistID1);
array = malloc(gridsize*sizeof(double));
array = (double*) malloc(gridsize*sizeof(double));
}
nfound = 0;
......
......@@ -152,7 +152,7 @@ void *Detrend(void *argument)
streamInqRecord(streamID1, &varID, &levelID);
gridID = vlistInqVarGrid(vlistID1, varID);
gridsize = gridInqSize(gridID);
vars[tsID][varID][levelID].ptr = malloc(gridsize*sizeof(double));
vars[tsID][varID][levelID].ptr = (double*) malloc(gridsize*sizeof(double));
streamReadRecord(streamID1, vars[tsID][varID][levelID].ptr, &nmiss);
vars[tsID][varID][levelID].nmiss = nmiss;
}
......@@ -162,11 +162,11 @@ void *Detrend(void *argument)
nts = tsID;
mem = malloc(ompNumThreads*sizeof(memory_t));
mem = (memory_t*) malloc(ompNumThreads*sizeof(memory_t));
for ( i = 0; i < ompNumThreads; i++ )
{
mem[i].array1 = malloc(nts*sizeof(double));
mem[i].array2 = malloc(nts*sizeof(double));
mem[i].array1 = (double*) malloc(nts*sizeof(double));
mem[i].array2 = (double*) malloc(nts*sizeof(double));
}
for ( varID = 0; varID < nvars; varID++ )
......
......@@ -80,8 +80,8 @@ void *Diff(void *argument)
gridsize = vlistGridsizeMax(vlistID1);
array1 = malloc(gridsize*sizeof(double));
array2 = malloc(gridsize*sizeof(double));
array1 = (double*) malloc(gridsize*sizeof(double));
array2 = (double*) malloc(gridsize*sizeof(double));
indg = 0;
tsID = 0;
......
......@@ -101,7 +101,7 @@ void *Duplicate(void *argument)
streamInqRecord(streamID1, &varID, &levelID);
gridID = vlistInqVarGrid(vlistID1, varID);
gridsize = gridInqSize(gridID);
vars[tsID][varID][levelID].ptr = malloc(gridsize*sizeof(double));
vars[tsID][varID][levelID].ptr = (double*) malloc(gridsize*sizeof(double));
streamReadRecord(streamID1, vars[tsID][varID][levelID].ptr, &nmiss);
vars[tsID][varID][levelID].nmiss = nmiss;
}
......
......@@ -144,7 +144,7 @@ void *EOFs(void * argument)
nvars = vlistNvars(vlistID1);
nrecs = vlistNrecs(vlistID1);
weight = malloc(gridsize*sizeof(double));
weight = (double*) malloc(gridsize*sizeof(double));
if ( WEIGHTS )
gridWeights(gridID1, &weight[0]);
else
......@@ -237,11 +237,11 @@ void *EOFs(void * argument)
if ( cdoTimer ) timer_start(timer_alloc);
/* allocation of temporary fields and output structures */
in = malloc(gridsize*sizeof(double));
datafields = malloc(nvars*sizeof(double ***));
datacounts = malloc(nvars*sizeof(int **));
eigenvectors = malloc(nvars*sizeof(double ***));
eigenvalues = malloc(nvars*sizeof(double ***));
in = (double*) malloc(gridsize*sizeof(double));
datafields = (double ****) malloc(nvars*sizeof(double ***));
datacounts = (int ***) malloc(nvars*sizeof(int **));
eigenvectors = (double ****) malloc(nvars*sizeof(double ***));
eigenvalues = (double ****) malloc(nvars*sizeof(double ***));
for ( varID = 0; varID < nvars; ++varID )
{
......@@ -250,22 +250,22 @@ void *EOFs(void * argument)
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
missval = vlistInqVarMissval(vlistID1, varID);
datafields[varID] = malloc(nlevs*sizeof(double **));
datacounts[varID] = malloc(nlevs*sizeof(int* ));
eigenvectors[varID] = malloc(nlevs*sizeof(double **));
eigenvalues[varID] = malloc(nlevs*sizeof(double **));
datafields[varID] = (double ***) malloc(nlevs*sizeof(double **));
datacounts[varID] = (int* *) malloc(nlevs*sizeof(int* ));
eigenvectors[varID] = (double ***) malloc(nlevs*sizeof(double **));
eigenvalues[varID] = (double ***) malloc(nlevs*sizeof(double **));
for ( levelID = 0; levelID < nlevs; ++levelID )
{
if ( grid_space )
{
datafields[varID][levelID] = malloc(1*sizeof(double *));
datafields[varID][levelID] = (double **) malloc(1*sizeof(double *));
//datafields[varID][levelID][0].grid = gridID1;
//datafields[varID][levelID][0].nmiss = 0;
//datafields[varID][levelID][0].missval = missval;
datafields[varID][levelID][0] = malloc(gridsize*gridsize*sizeof(double));
datafields[varID][levelID][0] = (double*) malloc(gridsize*gridsize*sizeof(double));
datacounts[varID][levelID] = malloc(gridsize*gridsize*sizeof(int));
datacounts[varID][levelID] = (int*) malloc(gridsize*gridsize*sizeof(int));
for ( i = 0; i<gridsize*gridsize; i++ )
{
datacounts[varID][levelID][i] = 0;
......@@ -274,34 +274,34 @@ void *EOFs(void * argument)
}
else if ( time_space )
{
datafields[varID][levelID] = malloc(nts*sizeof(double *));
datafields[varID][levelID] = (double **) malloc(nts*sizeof(double *));
for ( tsID = 0; tsID < nts; tsID++ )
{
//datafields[varID][levelID][tsID].grid = gridID1;
//datafields[varID][levelID][tsID].nmiss = 0;
//datafields[varID][levelID][tsID].missval = missval;
datafields[varID][levelID][tsID] = malloc(gridsize*sizeof(double));
datafields[varID][levelID][tsID] = (double*) malloc(gridsize*sizeof(double));
for ( i = 0; i < gridsize; ++i )
datafields[varID][levelID][tsID][i] = 0;
}
datacounts[varID][levelID] = malloc(gridsize*sizeof(int));
datacounts[varID][levelID] = (int*) malloc(gridsize*sizeof(int));
for(i=0;i<gridsize;i++)
datacounts[varID][levelID][i] = 0;
}
eigenvectors[varID][levelID] = malloc(n_eig*sizeof(double *));
eigenvalues[varID][levelID] = malloc(n*sizeof(double *));
eigenvectors[varID][levelID] = (double **) malloc(n_eig*sizeof(double *));
eigenvalues[varID][levelID] = (double **) malloc(n*sizeof(double *));
for ( i = 0; i < n; i++ )
{
if ( i < n_eig )
{
eigenvectors[varID][levelID][i] = malloc(gridsize*sizeof(double));
eigenvectors[varID][levelID][i] = (double*) malloc(gridsize*sizeof(double));
for ( ii = 0; ii < gridsize; ++ii )
eigenvectors[varID][levelID][i][ii] = missval;
}
eigenvalues[varID][levelID][i] = malloc(1*sizeof(double));
eigenvalues[varID][levelID][i] = (double*) malloc(1*sizeof(double));
eigenvalues[varID][levelID][i][0] = missval;
}
}
......@@ -400,8 +400,8 @@ void *EOFs(void * argument)
}
/*
pack = malloc(gridsize*sizeof(int)); //TODO
miss = malloc(gridsize*sizeof(int));
pack = (int*) malloc(gridsize*sizeof(int)); //TODO
miss = (int*) malloc(gridsize*sizeof(int));
*/
if ( cdoTimer ) timer_stop(timer_read);
......@@ -436,8 +436,8 @@ void *EOFs(void * argument)
if ( grid_space )
{
pack = malloc(gridsize*sizeof(int));
miss = malloc(gridsize*sizeof(int));
pack = (int*) malloc(gridsize*sizeof(int));
miss = (int*) malloc(gridsize*sizeof(int));
for ( i1 = 0; i1 < gridsize; i1++ )
{
......@@ -453,10 +453,10 @@ void *EOFs(void * argument)
n = npack;
if ( npack )
{
cov = malloc(npack*sizeof(double *));
cov = (double **) malloc(npack*sizeof(double *));
for (i1 = 0; i1 < npack; i1++ )
cov[i1] = malloc(npack*sizeof(double));
eigv = malloc(npack*sizeof(double));
cov[i1] = (double*) malloc(npack*sizeof(double));
eigv = (double*) malloc(npack*sizeof(double));
}
for (i1 = 0; i1 < npack; i1++)
......@@ -489,7 +489,7 @@ void *EOFs(void * argument)
cov = malloc (nts*sizeof(double*));
for ( j1 = 0; j1 < nts; j1++)
cov[j1] = malloc(nts*sizeof(double));
cov[j1] = (double*) malloc(nts*sizeof(double));
eigv = malloc (nts*sizeof(double));
#if defined(_OPENMP)
......
......@@ -89,7 +89,7 @@ void inivar(VAR *var, int gridtype, int zaxistype, int code, const char *name,
static
void inivars_ml(VAR **vars)
{
*vars = malloc((nvars_ml+1)*sizeof(VAR));
*vars = (VAR*) malloc((nvars_ml+1)*sizeof(VAR));
inivar(&(*vars)[0], GRID_GAUSSIAN, ZAXIS_HYBRID, 133, "Q", "specific humidity", "kg/kg");
inivar(&(*vars)[1], GRID_SPECTRAL, ZAXIS_HYBRID, 138, "SVO", "vorticity", "1/s");
......@@ -170,15 +170,15 @@ int import_e5ml(const char *filename, VAR **vars)
zaxisIDsfc = zaxisCreate(ZAXIS_SURFACE, 1);
zaxisIDml = zaxisCreate(ZAXIS_HYBRID, nlev);
levs = malloc(nlev*sizeof(double));
levs = (double*) malloc(nlev*sizeof(double));
for ( i = 0; i < nlev; i++ ) levs[i] = i+1;
zaxisDefLevels(zaxisIDml, levs);
free(levs);
/* read variables */
xvals = malloc(nlon*sizeof(double));
yvals = malloc(nlat*sizeof(double));
xvals = (double*) malloc(nlon*sizeof(double));
yvals = (double*) malloc(nlat*sizeof(double));
nce(nc_inq_varid(nc_file_id, "lon", &nc_var_id));
nce(nc_get_var_double(nc_file_id, nc_var_id, xvals));
......@@ -192,7 +192,7 @@ int import_e5ml(const char *filename, VAR **vars)
free(xvals);
free(yvals);
vct = malloc(nvct*sizeof(double));
vct = (double*) malloc(nvct*sizeof(double));
nce(nc_inq_varid(nc_file_id, "vct_a", &nc_var_id));
nce(nc_get_var_double(nc_file_id, nc_var_id, vct));
......@@ -225,7 +225,7 @@ int import_e5ml(const char *filename, VAR **vars)
(*vars)[iv].gridsize = nvals;
(*vars)[iv].nlev = nlev;
(*vars)[iv].ptr = malloc(nlev*nvals*sizeof(double));
(*vars)[iv].ptr = (double*) malloc(nlev*nvals*sizeof(double));
for ( i = 0; i < nlev; i++ )
{
......@@ -255,7 +255,7 @@ int import_e5ml(const char *filename, VAR **vars)
start[0] = 0; start[1] = 0; start[2] = nlev;
count[0] = nsp; count[1] = 2; count[2] = 1;
(*vars)[nvars_ml].ptr = malloc(nsp*2*sizeof(double));
(*vars)[nvars_ml].ptr = (double*) malloc(nsp*2*sizeof(double));
nce(nc_inq_varid(nc_file_id, "STP", &nc_var_id));
nce(nc_get_vara_double(nc_file_id, nc_var_id, start, count, (*vars)[nvars_ml].ptr));
......@@ -449,8 +449,8 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
/* define gaussian grid */
xvals = malloc(nlon*sizeof(double));
yvals = malloc(nlat*sizeof(double));
xvals = (double*) malloc(nlon*sizeof(double));
yvals = (double*) malloc(nlat*sizeof(double));
gridInqXvals(gridIDgp, xvals);
gridInqYvals(gridIDgp, yvals);
......@@ -484,7 +484,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
nvct = nvclev*2;
/* vct = malloc(nvct*sizeof(double)); */
/* vct = (double*) malloc(nvct*sizeof(double)); */
vct = zaxisInqVctPtr(zaxisIDml);
......@@ -631,7 +631,7 @@ void read_gg3d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxis
var->gridsize = gridsize;
var->nlev = nlev;
var->ptr = malloc(nlev*gridsize*sizeof(double));
var->ptr = (double*) malloc(nlev*gridsize*sizeof(double));
for ( i = 0; i < nlev; i++ )
{
......@@ -668,7 +668,7 @@ void read_fc4d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxis
var->gridsize = nfc;
var->nlev = nlev;
var->ptr = malloc(nlev*nfc*sizeof(double));
var->ptr = (double*) malloc(nlev*nfc*sizeof(double));
for ( i = 0; i < nlev; i++ )
{
......@@ -794,8 +794,8 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
gridDefXsize(gridIDgp, nlon);
gridDefYsize(gridIDgp, nlat);
xvals = malloc(nlon*sizeof(double));
yvals = malloc(nlat*sizeof(double));
xvals = (double*) malloc(nlon*sizeof(double));
yvals = (double*) malloc(nlat*sizeof(double));
nce(nc_inq_varid(nc_file_id, "lon", &nc_var_id));
nce(nc_get_var_double(nc_file_id, nc_var_id, xvals));
......@@ -829,7 +829,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
nlev = belowsurface;
zaxisIDbsfc = zaxisCreate(ZAXIS_DEPTH_BELOW_LAND, nlev);
levs = malloc(nlev*sizeof(double));
levs = (double*) malloc(nlev*sizeof(double));
for ( i = 0; i < nlev; i++ ) levs[i] = 0;
zaxisDefLevels(zaxisIDbsfc, levs);
free(levs);
......@@ -840,7 +840,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
nlev = n2;
zaxisIDn2 = zaxisCreate(ZAXIS_GENERIC, nlev);
levs = malloc(nlev*sizeof(double));
levs = (double*) malloc(nlev*sizeof(double));
for ( i = 0; i < nlev; i++ ) levs[i] = 0;
zaxisDefLevels(zaxisIDn2, levs);
free(levs);
......@@ -850,7 +850,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
nlev = lev;
nvct = nvclev*2;
vct = malloc(nvct*sizeof(double));
vct = (double*) malloc(nvct*sizeof(double));
nce(nc_inq_varid(nc_file_id, "vct_a", &nc_var_id));
nce(nc_get_var_double(nc_file_id, nc_var_id, vct));
......@@ -862,7 +862,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
zaxisIDml = zaxisCreate(ZAXIS_HYBRID, nlev);
levs = malloc(nlev*sizeof(double));
levs = (double*) malloc(nlev*sizeof(double));
for ( i = 0; i < nlev; i++ ) levs[i] = i+1;
zaxisDefLevels(zaxisIDml, levs);
free(levs);
......@@ -873,7 +873,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
zaxisIDmlh = zaxisCreate(ZAXIS_HYBRID_HALF, nlevp1);
levs = malloc(nlevp1*sizeof(double));
levs = (double*) malloc(nlevp1*sizeof(double));
for ( i = 0; i < nlevp1; i++ ) levs[i] = i;
zaxisDefLevels(zaxisIDmlh, levs);
free(levs);
......@@ -930,7 +930,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
}
}
*vars = malloc(max_vars*sizeof(VAR));
*vars = (VAR*) malloc(max_vars*sizeof(VAR));
varid = 0;
for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
......@@ -1002,7 +1002,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
(*vars)[varid].gridsize = nvals;
(*vars)[varid].nlev = 1;
(*vars)[varid].ptr = malloc(nvals*sizeof(double));
(*vars)[varid].ptr = (double*) malloc(nvals*sizeof(double));
nce(nc_inq_varid(nc_file_id, name, &nc_var_id));
nce(nc_get_var_double(nc_file_id, nc_var_id, (*vars)[varid].ptr));
......@@ -1020,7 +1020,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
(*vars)[varid].gridsize = nvals;
(*vars)[varid].nlev = nlev;
(*vars)[varid].ptr = malloc(nvals*nlev*sizeof(double));
(*vars)[varid].ptr = (double*) malloc(nvals*nlev*sizeof(double));
for ( i = 0; i < nlev; i++ )
{
......@@ -1369,8 +1369,8 @@ void export_e5res(const char *filename, VAR *vars, int nvars)
nlon = lon;
nlat = lat;
xvals = malloc(nlon*sizeof(double));
yvals = malloc(nlat*sizeof(double));
xvals = (double*) malloc(nlon*sizeof(double));
yvals = (double*) malloc(nlat*sizeof(double));
gridInqXvals(gridIDgp, xvals);
gridInqYvals(gridIDgp, yvals);
......@@ -1394,7 +1394,7 @@ void export_e5res(const char *filename, VAR *vars, int nvars)
nlev = lev;
nvct = nvclev*2;
/* vct = malloc(nvct*sizeof(double)); */
/* vct = (double*) malloc(nvct*sizeof(double)); */
vct = zaxisInqVctPtr(zaxisIDml);
......@@ -1530,7 +1530,7 @@ void *Echam5ini(void *argument)
nvars = vlistNvars(vlistID1);
vars = malloc(nvars*sizeof(VAR));
vars = (VAR*) malloc(nvars*sizeof(VAR));
for ( varID = 0; varID < nvars; ++varID )
{
......@@ -1581,7 +1581,7 @@ void *Echam5ini(void *argument)
vars[varID].gridsize = gridsize;
vars[varID].nlev = nlev;
vars[varID].ptr = malloc(nlev*gridsize*sizeof(double));
vars[varID].ptr = (double*) malloc(nlev*gridsize*sizeof(double));
}
nrecs = streamInqTimestep(streamID1, 0);
......
......@@ -77,8 +77,8 @@ void *Enlarge(void *argument)
streamDefVlist(streamID2, vlistID2);
array1 = malloc(gridsize2*sizeof(double));
array2 = malloc(gridsize2*sizeof(double));
array1 = (double*) malloc(gridsize2*sizeof(double));
array2 = (double*) malloc(gridsize2*sizeof(double));
tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
......
......@@ -69,13 +69,13 @@ void gen_index(int gridID1, int gridID2, int *index)
if ( ! (gridInqXvals(gridID2, NULL) && gridInqYvals(gridID2, NULL)) )
cdoAbort("Grid 2 has no values!");
xvals1 = malloc(nlon1*sizeof(double));
yvals1 = malloc(nlat1*sizeof(double));
xvals2 = malloc(nlon2*sizeof(double));
yvals2 = malloc(nlat2*sizeof(double));
xvals1 = (double*) malloc(nlon1*sizeof(double));
yvals1 = (double*) malloc(nlat1*sizeof(double));
xvals2 = (double*) malloc(nlon2*sizeof(double));
yvals2 = (double*) malloc(nlat2*sizeof(double));
xindex = malloc(nlon2*sizeof(int));
yindex = malloc(nlat2*sizeof(int));
xindex = (int*) malloc(nlon2*sizeof(int));
yindex = (int*) malloc(nlat2*sizeof(int));
gridInqXvals(gridID1, xvals1);
gridInqYvals(gridID1, yvals1);
......@@ -209,9 +209,9 @@ void *Enlargegrid(void *argument)
gridsize1 = gridInqSize(gridID1);
gridsize2 = gridInqSize(gridID2);
array1 = malloc(gridsize1*sizeof(double));
array2 = malloc(gridsize2*sizeof(double));
gindex = malloc(gridsize1*sizeof(int));
array1 = (double*) malloc(gridsize1*sizeof(double));
array2 = (double*) malloc(gridsize2*sizeof(double));
gindex = (int*) malloc(gridsize1*sizeof(int));
gen_index(gridID2, gridID1, gindex);
......
......@@ -108,15 +108,15 @@ void *Ensstat(void *argument)
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
ef = malloc(nfiles*sizeof(ens_file_t));
ef = (ens_file_t*) malloc(nfiles*sizeof(ens_file_t));
field = malloc(ompNumThreads*sizeof(field_t));
field = (field_t*) malloc(ompNumThreads*sizeof(field_t));
for ( i = 0; i < ompNumThreads; i++ )
{
field_init(&field[i]);
field[i].size = nfiles;
field[i].ptr = malloc(nfiles*sizeof(double));
field[i].weight = malloc(nfiles*sizeof(double));
field[i].ptr = (double*) malloc(nfiles*sizeof(double));
field[i].weight = (double*) malloc(nfiles*sizeof(double));
for ( fileID = 0; fileID < nfiles; fileID++ )
field[i].weight[fileID] = 1;
}
......@@ -148,9 +148,9 @@ void *Ensstat(void *argument)
gridsize = vlistGridsizeMax(vlistID1);
for ( fileID = 0; fileID < nfiles; fileID++ )
ef[fileID].array = malloc(gridsize*sizeof(double));
ef[fileID].array = (double*) malloc(gridsize*sizeof(double));
array2 = malloc(gridsize*sizeof(double));
array2 = (double*) malloc(gridsize*sizeof(double));
tsID = 0;
do
......
......@@ -121,7 +121,7 @@ void *Ensstat3(void *argument)
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
ef = malloc(nfiles*sizeof(ens_file_t));
ef = (ens_file_t*) malloc(nfiles*sizeof(ens_file_t));
/* *************************************************** */
/* should each thread be allocating memory locally???? */
......@@ -129,17 +129,17 @@ void *Ensstat3(void *argument)
/* --> #pragma omp parallel for ... */
/* *************************************************** */
#if defined(_OPENMP)
field = malloc(omp_get_max_threads()*sizeof(field_t));
field = (field_t*) malloc(omp_get_max_threads()*sizeof(field_t));
for ( i = 0; i < omp_get_max_threads(); i++ )
#else
field = malloc(1*sizeof(field_t));
field = (field_t*) malloc(1*sizeof(field_t));
for ( i = 0; i < 1; i++ )
#endif
{
field_init(&field[i]);
field[i].size = nfiles;
field[i].ptr = malloc(nfiles*sizeof(double));
field[i].weight = malloc(nfiles*sizeof(double));
field[i].ptr = (double*) malloc(nfiles*sizeof(double));
field[i].weight = (double*) malloc(nfiles*sizeof(double));
for ( fileID = 0; fileID < nfiles; fileID++ )
field[i].weight[fileID] = 1;
}
......@@ -161,7 +161,7 @@ void *Ensstat3(void *argument)
vlistID1 = ef[0].vlistID;
vlistID2 = vlistCreate();
nvars = vlistNvars(vlistID1);
varID2 = malloc(nvars*sizeof(int));
varID2 = (int*) malloc(nvars*sizeof(int));
levs = calloc (nfiles, sizeof(double) );
zaxisID2 = zaxisCreate(ZAXIS_GENERIC, nfiles);
......@@ -217,11 +217,11 @@ void *Ensstat3(void *argument)
gridsize = vlistGridsizeMax(vlistID1);
for ( fileID = 0; fileID < nfiles; fileID++ )
ef[fileID].array = malloc(gridsize*sizeof(double));
ef[fileID].array = (double*) malloc(gridsize*sizeof(double));
if ( operfunc == func_rank && datafunc == SPACE )
{ /*need to memorize data for entire grid before writing */
array2 = malloc((nfiles+1)*sizeof(int*));
array2 = (int**) malloc((nfiles+1)*sizeof(int*));
for ( binID=0; binID<nfiles; binID++ )
array2[binID] = calloc ( gridsize, sizeof(int) );
}
......@@ -451,7 +451,7 @@ void *Ensstat3(void *argument)
int osize = gridsize;
if ( datafunc == TIME ) osize = 1;
tmpdoub = malloc(osize*sizeof(double));
tmpdoub = (double*) malloc(osize*sizeof(double));
for ( binID = 0; binID < nfiles; binID++ )
{
......
......@@ -142,7 +142,7 @@ void *Ensval(void *argument)
if ( cdoVerbose )
cdoPrint("Ensemble over %d files (Ensstat5).", nfiles-1);
ef = malloc(nfiles*sizeof(ens_file_t));
ef = (ens_file_t*) malloc(nfiles*sizeof(ens_file_t));
for ( fileID = 0; fileID < nfiles; fileID++ )
{
......@@ -274,7 +274,7 @@ void *Ensval(void *argument)
}
if (ef[fileID].array ) free(ef[fileID].array);
ef[fileID].array = malloc(gridsize*sizeof(double));
ef[fileID].array = (double*) malloc(gridsize*sizeof(double));
streamID = ef[fileID].streamID;
streamReadRecord(streamID, ef[fileID].array, &nmiss);
......
......@@ -144,7 +144,7 @@ void *EOF3d(void * argument)
nvars = vlistNvars(vlistID1);
nrecs = vlistNrecs(vlistID1);
taxisID1 = vlistInqTaxis(vlistID1);
weight = malloc(gridsize*sizeof(double));
weight = (double*) malloc(gridsize*sizeof(double));
if ( WEIGHTS )
gridWeights(gridID1, &weight[0]);
else
......@@ -160,9 +160,9 @@ void *EOF3d(void * argument)
gridID2 = gridCreate(GRID_LONLAT, 1);
gridDefXsize(gridID2, 1);
gridDefYsize(gridID2, 1);
xvals = malloc(1*sizeof(double));
yvals = malloc(1*sizeof(double));
zvals = malloc(1*sizeof(double));
xvals = (double*) malloc(1*sizeof(double));
yvals = (double*) malloc(1*sizeof(double));
zvals = (double*) malloc(1*sizeof(double));
xvals[0] = 0;