Commit 7628316b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

fix some Clang Static Analyzer warning (scan-build make)

parent 5a925308
......@@ -208,8 +208,6 @@ void *Adisit(void *argument)
for ( varID = 0; varID < nvars; varID++ )
{
gridID = vlistInqVarGrid(vlistID1, varID);
code = vlistInqVarCode(vlistID1, varID);
if ( code <= 0 )
......
......@@ -164,10 +164,7 @@ void *Cloudlayer(void *argument)
int nvars = vlistNvars(vlistID1);
for ( varID = 0; varID < nvars; ++varID )
{
gridID = vlistInqVarGrid(vlistID1, varID);
zaxisID = vlistInqVarZaxis(vlistID1, varID);
nlevel = zaxisInqSize(zaxisID);
code = vlistInqVarCode(vlistID1, varID);
if ( code <= 0 )
......
......@@ -409,7 +409,6 @@ void *Collgrid(void *argument)
gridsize = vlistGridsizeMax(ef[fileID].vlistID);
if ( gridsize > gridsizemax ) gridsizemax = gridsize;
}
gridsize = gridsizemax;
for ( fileID = 0; fileID < nfiles; fileID++ )
ef[fileID].array = (double*) malloc(gridsizemax*sizeof(double));
......
......@@ -106,7 +106,7 @@ void *Diff(void *argument)
missval1 = vlistInqVarMissval(vlistID1, varID1);
missval2 = vlistInqVarMissval(vlistID2, varID2);
checkrel = gridInqType(gridID) != GRID_SPECTRAL;
//checkrel = gridInqType(gridID) != GRID_SPECTRAL;
checkrel = FALSE;
cdiParamToString(param, paramstr, sizeof(paramstr));
......
......@@ -228,7 +228,6 @@ void *Distgrid(void *argument)
sgrid_t *grids = (sgrid_t*) malloc(ngrids*sizeof(sgrid_t));
for ( i = 0; i < ngrids; i++ )
{
gridID1 = vlistGrid(vlistID1, i);
grids[i].gridID = vlistGrid(vlistID1, i);
grids[i].gridIDs = (int*) malloc(nsplit*sizeof(int));
grids[i].gridsize = (int*) malloc(nsplit*sizeof(int));
......
......@@ -221,7 +221,7 @@ void *EOFs(void * argument)
int gridID1 = vlistInqVarGrid(vlistID1, 0);
int gridsize = vlistGridsizeMax(vlistID1);
int nvars = vlistNvars(vlistID1);
int nrecs = vlistNrecs(vlistID1);
int nrecs;
int ngrids = vlistNgrids(vlistID1);
for ( int index = 1; index < ngrids; index++ )
......@@ -329,7 +329,6 @@ void *EOFs(void * argument)
for ( varID = 0; varID < nvars; ++varID )
{
gridID1 = vlistInqVarGrid(vlistID1, varID);
gridsize = vlistGridsizeMax(vlistID1);
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
missval = vlistInqVarMissval(vlistID1, varID);
......
......@@ -41,10 +41,10 @@
void *Ensstat(void *argument)
{
int i;
int varID, recID;
int varID = 0, recID;
int gridID;
int nrecs, nrecs0;
int levelID;
int levelID = 0;
int streamID = 0;
int nmiss;
int fileID;
......
......@@ -91,11 +91,10 @@ void *EOF3d(void * argument)
int streamID1 = streamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int taxisID1 = vlistInqTaxis(vlistID1);
int gridID1 = vlistInqVarGrid(vlistID1, 0);
long gridsize = vlistGridsizeMax(vlistID1);
int nvars = vlistNvars(vlistID1);
int nrecs = vlistNrecs(vlistID1);
int nrecs;
double *weight = (double *) malloc(gridsize*sizeof(double));
for ( i = 0; i < gridsize; ++i ) weight[i] = 1.;
......@@ -136,7 +135,7 @@ void *EOF3d(void * argument)
streamID1 = streamOpenRead(cdoStreamName(0));
vlistID1 = streamInqVlist(streamID1);
taxisID1 = vlistInqTaxis(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
/* reset the requested number of eigen-function to the maximum if neccessary */
if ( n_eig > nts )
......@@ -160,7 +159,6 @@ void *EOF3d(void * argument)
for ( varID = 0; varID < nvars; ++varID )
{
gridID1 = vlistInqVarGrid(vlistID1, varID);
gridsize = vlistGridsizeMax(vlistID1);
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
temp_size = gridsize * nlevs;
......
......@@ -81,7 +81,6 @@ void *Eofcoeff(void * argument)
cdoAbort("Too many grids in input");
nvars = vlistNvars(vlistID1)==vlistNvars(vlistID2) ? vlistNvars(vlistID1) : -1;
nrecs = vlistNrecs(vlistID1);
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, 0));
//w = (double*) malloc(gridsize*sizeof(double));
//gridWeights(gridID2, w);
......@@ -160,7 +159,6 @@ void *Eofcoeff(void * argument)
// open streams for eofcoeff output
streamIDs = (int*) malloc(neof*sizeof(int));
eofID = 0;
for ( eofID = 0; eofID < neof; eofID++)
{
oname[nchars] = '\0';
......
......@@ -82,7 +82,6 @@ void *Eofcoeff3d(void * argument)
cdoAbort("Too many grids in input");
nvars = vlistNvars(vlistID1)==vlistNvars(vlistID2) ? vlistNvars(vlistID1) : -1;
nrecs = vlistNrecs(vlistID1);
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, 0));
//w = (double*) malloc(gridsize*sizeof(double));
//gridWeights(gridID2, w);
......@@ -162,7 +161,6 @@ void *Eofcoeff3d(void * argument)
// open streams for eofcoeff output
streamIDs = (int*) malloc(neof*sizeof(int));
eofID = 0;
for ( eofID = 0; eofID < neof; eofID++)
{
oname[nchars] = '\0';
......
......@@ -227,7 +227,6 @@ void *Expr(void *argument)
if ( parse_arg.var_needed[varID] )
{
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
offset = gridsize*levelID;
single1 = parse_arg.vardata1[varID] + offset;
streamReadRecord(streamID1, single1, &nmiss);
......
......@@ -189,8 +189,6 @@ void *FC(void *argument)
}
gridID2 = gridIDfc;
nfc = gridInqSize(gridID2);
sptrans = sptrans_new(nlon, nlat, ntr, 0);
}
}
......
......@@ -105,7 +105,7 @@ void *Fldstat2(void *argument)
int needWeights = TRUE;
int nmiss1, nmiss2, nmiss3;
double missval1, missval2;
double sglval;
double sglval = 0;
char varname[CDI_MAX_NAME];
cdoInitialize(argument);
......
......@@ -34,7 +34,6 @@ void *Gengrid(void *argument)
int gridID1, gridID2, gridID3;
int zaxisID3;
int datatype;
int nrecs;
int tsID, varID, levelID;
int gridsize, i;
int xsize, ysize;
......@@ -66,10 +65,6 @@ void *Gengrid(void *argument)
array2 = (double*) malloc(gridsize*sizeof(double));
array3 = (double*) malloc(gridsize*sizeof(double));
tsID = 0;
nrecs = streamInqTimestep(streamID1, tsID);
nrecs = streamInqTimestep(streamID2, tsID);
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array1, &nmiss1);
streamInqRecord(streamID2, &varID, &levelID);
......
......@@ -145,7 +145,6 @@ void *Harmonic(void *argument)
{
streamInqRecord(streamID1, &varID, &levelID);
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
offset = gridsize*levelID;
streamReadRecord(streamID1, array, &nmiss);
......
......@@ -97,7 +97,7 @@ void *Hi(void *argument)
int varID1, varID2, varID3, varID4;
int levelID1, levelID2, levelID3;
int vlistID1, vlistID2, vlistID3, vlistID4;
int taxisID1, taxisID2, taxisID3, taxisID4;
int taxisID1, /*taxisID2, taxisID3,*/ taxisID4;
field_t field1, field2, field3;
cdoInitialize(argument);
......@@ -112,8 +112,8 @@ void *Hi(void *argument)
vlistID3 = streamInqVlist(streamID3);
taxisID1 = vlistInqTaxis(vlistID1);
taxisID2 = vlistInqTaxis(vlistID2);
taxisID3 = vlistInqTaxis(vlistID3);
//taxisID2 = vlistInqTaxis(vlistID2);
//taxisID3 = vlistInqTaxis(vlistID3);
vlistCompare(vlistID1, vlistID2, CMP_DIM);
vlistCompare(vlistID1, vlistID3, CMP_DIM);
......
......@@ -259,7 +259,8 @@ void *Info(void *argument)
char vdatestr[32], vtimestr[32];
double missval;
double level;
double arrmin = 0, arrmax = 0, arrmean = 0, arrvar = 0;
double arrmin = 0, arrmax = 0, arrmean = 0;
// double arrvar = 0;
cdoInitialize(argument);
......@@ -362,7 +363,7 @@ void *Info(void *argument)
{
ivals = 0;
arrmean = 0;
arrvar = 0;
//arrvar = 0;
arrmin = 1.e300;
arrmax = -1.e300;
for ( i = 0; i < gridsize; ++i )
......@@ -372,7 +373,7 @@ void *Info(void *argument)
if ( array[i] < arrmin ) arrmin = array[i];
if ( array[i] > arrmax ) arrmax = array[i];
arrmean += array[i];
arrvar += array[i]*array[i];
//arrvar += array[i]*array[i];
ivals++;
}
}
......@@ -382,7 +383,7 @@ void *Info(void *argument)
else
{
arrmean = array[0];
arrvar = array[0];
//arrvar = array[0];
arrmin = array[0];
arrmax = array[0];
// #pragma omp parallel for default(none) shared(arrmin, arrmax, array, gridsize) reduction(+:arrmean, arrvar)
......
......@@ -349,7 +349,6 @@ void *Intlevel(void *argument)
{
streamInqRecord(streamID1, &varID, &levelID);
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
offset = gridsize*levelID;
single1 = vardata1[varID] + offset;
......
......@@ -237,8 +237,8 @@ void *Intntime(void *argument)
vardata2[varID] = vardatap;
}
vdate1 = vdate2;
vtime1 = vtime2;
//vdate1 = vdate2;
//vtime1 = vtime2;
juldate1 = juldate2;
}
......
......@@ -162,9 +162,7 @@ void *Invertlev(void *argument)
if ( vardata[varID] )
{
gridID = vlistInqVarGrid(vlistID1, varID);
zaxisID = vlistInqVarZaxis(vlistID1, varID);
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
offset = gridsize*levelID;
streamReadRecord(streamID1, vardata[varID]+offset, &nmiss);
......
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