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

cast result of malloc

parent 2356e461
......@@ -487,10 +487,10 @@ void *EOFs(void * argument)
if ( cdoVerbose )
cdoPrint("allocating cov with %i x %i elements | npack=%i",nts,nts,npack);
cov = malloc (nts*sizeof(double*));
cov = (double**) malloc(nts*sizeof(double*));
for ( j1 = 0; j1 < nts; j1++)
cov[j1] = (double*) malloc(nts*sizeof(double));
eigv = malloc (nts*sizeof(double));
eigv = (double*) malloc(nts*sizeof(double));
#if defined(_OPENMP)
#pragma omp parallel for private(j1,j2,i,sum, df1p, df2p) default(shared) schedule(dynamic)
......
......@@ -163,7 +163,7 @@ void *Ensstat3(void *argument)
nvars = vlistNvars(vlistID1);
varID2 = (int*) malloc(nvars*sizeof(int));
levs = calloc (nfiles, sizeof(double) );
levs = calloc(nfiles, sizeof(double) );
zaxisID2 = zaxisCreate(ZAXIS_GENERIC, nfiles);
for ( i=0; i<nfiles; i++ )
levs[i] = i;
......@@ -223,14 +223,14 @@ void *Ensstat3(void *argument)
{ /*need to memorize data for entire grid before writing */
array2 = (int**) malloc((nfiles+1)*sizeof(int*));
for ( binID=0; binID<nfiles; binID++ )
array2[binID] = calloc ( gridsize, sizeof(int) );
array2[binID] = calloc( gridsize, sizeof(int) );
}
else if ( operfunc == func_rank )
{ /* can process data separately for each timestep and only need */
/* to cumulate values over the grid */
array2 = malloc ( (nfiles+1)*sizeof(int *));
array2 = (int **) malloc( (nfiles+1)*sizeof(int *));
for ( binID=0; binID<nfiles; binID++ )
array2[binID] = calloc ( 1, sizeof(int) );
array2[binID] = calloc( 1, sizeof(int) );
}
if ( operfunc == func_roc ) {
......@@ -241,13 +241,13 @@ void *Ensstat3(void *argument)
roc = malloc ((nbins+1)*sizeof(double*) );
for ( i=0; i<nbins; i++ ) {
ctg_tab[i] = calloc ( 4,sizeof(int) );
ctg_tab[i] = calloc( 4,sizeof(int) );
roc[i] = calloc( 2,sizeof(double));
uThresh[i] = ((double)i+1)/nbins;
lThresh[i] = (double)i/nbins;
}
ctg_tab[nbins] = calloc (4,sizeof(int));
roc[nbins] = calloc (2,sizeof(double));
ctg_tab[nbins] = calloc(4,sizeof(int));
roc[nbins] = calloc(2,sizeof(double));
}
......
......@@ -127,17 +127,17 @@ void *Ensval(void *argument)
taxisID2 = malloc ( nostreams*sizeof(int) );
zaxisID2 = malloc ( nostreams*sizeof(int) );
val = calloc ( nfiles,sizeof(double) );
val = calloc( nfiles,sizeof(double) );
if ( operfunc == CRPS ) {
alpha=calloc ( nens+1,sizeof(double) );
beta =calloc ( nens+1,sizeof(double) );
alpha_weights=calloc ( nens+1,sizeof(double) );
beta_weights =calloc ( nens+1,sizeof(double) );
alpha=calloc( nens+1,sizeof(double) );
beta =calloc( nens+1,sizeof(double) );
alpha_weights=calloc( nens+1,sizeof(double) );
beta_weights =calloc( nens+1,sizeof(double) );
}
else if ( operfunc == BRS ) {
brs_g = calloc ( nens+1,sizeof(double) );
brs_o = calloc ( nens+1,sizeof(double) );
brs_g = calloc( nens+1,sizeof(double) );
brs_o = calloc( nens+1,sizeof(double) );
}
if ( cdoVerbose )
cdoPrint("Ensemble over %d files (Ensstat5).", nfiles-1);
......
......@@ -179,7 +179,7 @@ void *EOF3d(void * argument)
taxisDefRtime(taxisID2, 0);
vlistDefTaxis(vlistID2, taxisID2);
varID2 = malloc (nvars*sizeof(int));
varID2 = (int*) malloc(nvars*sizeof(int));
for ( varID=0; varID<nvars; varID++ )
varID2[varID] = vlistDefVar(vlistID2, gridID2, zaxisID2, TSTEP_INSTANT);
ngrids = vlistNgrids(vlistID2);
......@@ -396,7 +396,7 @@ void *EOF3d(void * argument)
}
cov = malloc (nts*sizeof(double*));
cov = (double**) malloc(nts*sizeof(double*));
for ( j1 = 0; j1 < nts; j1++)
cov[j1] = (double*) malloc(nts*sizeof(double));
eigv = (double*) malloc(n*sizeof(double));
......
......@@ -120,7 +120,7 @@ void *Eofcoeff(void * argument)
streamInqRecord(streamID1, &varID, &levelID);
missval1 = vlistInqVarMissval(vlistID1, varID);
if ( eofID == 0 )
eof[varID][levelID] = malloc (1*sizeof(field_t));
eof[varID][levelID] = (field_t*) malloc(1*sizeof(field_t));
else
eof[varID][levelID] = realloc (eof[varID][levelID], (eofID+1)*sizeof(field_t));
eof[varID][levelID][eofID].grid = gridID1;
......@@ -164,7 +164,7 @@ void *Eofcoeff(void * argument)
vlistDefVarTsteptype(vlistID3, varID, TSTEP_INSTANT);
// open streams for eofcoeff output
streamIDs = malloc (neof*sizeof(int));
streamIDs = (int*) malloc(neof*sizeof(int));
eofID = 0;
for ( eofID = 0; eofID < neof; eofID++)
{
......@@ -191,7 +191,7 @@ void *Eofcoeff(void * argument)
in.grid = gridID1;
out.missval = missval1;
out.nmiss = 0;
out.ptr = malloc (1*sizeof(double));
out.ptr = (double*) malloc(1*sizeof(double));
//
reached_eof=0;
......
......@@ -118,7 +118,7 @@ void *Eofcoeff3d(void * argument)
streamInqRecord(streamID1, &varID, &levelID);
missval1 = vlistInqVarMissval(vlistID1, varID);
if ( eofID == 0 )
eof[varID][levelID] = malloc (1*sizeof(field_t));
eof[varID][levelID] = (field_t*) malloc(1*sizeof(field_t));
else
eof[varID][levelID] = realloc (eof[varID][levelID], (eofID+1)*sizeof(field_t));
eof[varID][levelID][eofID].grid = gridID1;
......@@ -165,7 +165,7 @@ void *Eofcoeff3d(void * argument)
varID3[varID] = vlistDefVar(vlistID3, gridID3, zaxisID3, TSTEP_INSTANT);
// open streams for eofcoeff output
streamIDs = malloc (neof*sizeof(int));
streamIDs = (int*) malloc(neof*sizeof(int));
eofID = 0;
for ( eofID = 0; eofID < neof; eofID++)
{
......@@ -189,13 +189,13 @@ void *Eofcoeff3d(void * argument)
// ALLOCATE temporary fields for data read and write
in.ptr = (double*) malloc(gridsize*sizeof(double));
in.grid = gridID1;
out = malloc (nvars*sizeof(field_t*));
out = (field_t**) malloc(nvars*sizeof(field_t*));
for ( varID = 0; varID < nvars; varID++ ) {
out[varID] = malloc ( neof * sizeof(field_t) );
for ( eofID=0; eofID<neof; eofID++ ) {
out[varID][eofID].missval = missval1;
out[varID][eofID].nmiss = 0;
out[varID][eofID].ptr = malloc (1*sizeof(double));
out[varID][eofID].ptr = (double*) malloc(1*sizeof(double));
}
}
......
......@@ -758,7 +758,7 @@ void glo_coor(double *pxn, double *prlon, double *prlat,
* icosahedral triangles into mni equal parts.
*/
if ((mcosv = malloc (knd*sizeof(int))) == NULL )
if ((mcosv = (int)*) malloc(knd*sizeof(int))) == NULL )
{
perror("malloc mcosv");
exit (-1);
......
......@@ -1376,7 +1376,7 @@ int jacobi_1side(double **M, double *A, long n)
if ( n > 0 )
{
annihilations_buff = malloc (n*n*2*sizeof(int));
annihilations_buff = (int*) malloc(n*n*2*sizeof(int));
annihilations = (int**) malloc((n*n)*sizeof(int*));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment