Commit 67583fc4 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Fix clang compiler warnings.

parent 8d6a0cde
......@@ -27,16 +27,16 @@ const char *filetypestr(int filetype)
{
switch ( filetype )
{
case CDI_FILETYPE_GRB: return ("GRIB"); break;
case CDI_FILETYPE_GRB2: return ("GRIB2"); break;
case CDI_FILETYPE_NC: return ("NetCDF"); break;
case CDI_FILETYPE_NC2: return ("NetCDF2"); break;
case CDI_FILETYPE_NC4: return ("NetCDF4"); break;
case CDI_FILETYPE_NC4C: return ("NetCDF4 classic"); break;
case CDI_FILETYPE_SRV: return ("SERVICE"); break;
case CDI_FILETYPE_EXT: return ("EXTRA"); break;
case CDI_FILETYPE_IEG: return ("IEG"); break;
default: return ("");
case CDI_FILETYPE_GRB: return ("GRIB");
case CDI_FILETYPE_GRB2: return ("GRIB2");
case CDI_FILETYPE_NC: return ("NetCDF");
case CDI_FILETYPE_NC2: return ("NetCDF2");
case CDI_FILETYPE_NC4: return ("NetCDF4");
case CDI_FILETYPE_NC4C: return ("NetCDF4 classic");
case CDI_FILETYPE_SRV: return ("SERVICE");
case CDI_FILETYPE_EXT: return ("EXTRA");
case CDI_FILETYPE_IEG: return ("IEG");
default: return ("");
}
}
......@@ -49,7 +49,7 @@ const char *datatypestr(int datatype)
snprintf(str, sizeof(str), "%d bit packed", datatype);
if ( datatype == CDI_DATATYPE_PACK ) return ("P0");
else if ( datatype > 0 && datatype <= 32 ) return (str);
else if ( datatype > 0 && datatype <= 32 ) return (str);
else if ( datatype == CDI_DATATYPE_CPX32 ) return ("C32");
else if ( datatype == CDI_DATATYPE_CPX64 ) return ("C64");
else if ( datatype == CDI_DATATYPE_FLT32 ) return ("32 bit floats");
......@@ -60,7 +60,7 @@ const char *datatypestr(int datatype)
else if ( datatype == CDI_DATATYPE_UINT8 ) return ("U8");
else if ( datatype == CDI_DATATYPE_UINT16 ) return ("U16");
else if ( datatype == CDI_DATATYPE_UINT32 ) return ("U32");
else return ("");
else return ("");
}
static
......
......@@ -2870,11 +2870,11 @@ static void read_record(int streamID, struct mapping vars[], int vlistID)
streamReadRecord(streamID, buffer, &nmiss);
for ( size_t i = 0; i < gridsize; i++ )
{
/* Wrong: (lat x basin, lev ) gridsize * levelID + i */
/* Wrong: (basin x lat, lev) gridsize * levelID + i * chardim - ( int ) floor(i / latdim) * gridsize + ( int ) floor(i/latdim)
/* Wrong: (basin x lev, lat ) gridsize/latdim * levdim * ( i - ( int ) floor(i/latdim) * latdim ) + ( int ) floor(i/latdim) + gridsize/latdim * levelID; */
/* Wrong: (lat x lev, basin ) latdim * levdim * ( int ) floor(i/latdim) + ( i - ( int ) floor(i/latdim) * latdim ) + levelID * latdim*/
/* (lev x lat, basin ) */
// Wrong: (lat x basin, lev ) gridsize * levelID + i
// Wrong: (basin x lat, lev) gridsize * levelID + i * chardim - ( int ) floor(i / latdim) * gridsize + ( int ) floor(i/latdim)
// Wrong: (basin x lev, lat ) gridsize/latdim * levdim * ( i - ( int ) floor(i/latdim) * latdim ) + ( int ) floor(i/latdim) + gridsize/latdim * levelID;
// Wrong: (lat x lev, basin ) latdim * levdim * ( int ) floor(i/latdim) + ( i - ( int ) floor(i/latdim) * latdim ) + levelID * latdim
// (lev x lat, basin )
int newIndex;
if ( levdim > 1 && type == GRID_CURVILINEAR )
newIndex = i + gridsize*levelID;
......
......@@ -169,7 +169,7 @@ void *EOF3d(void * argument)
eigenvectors[varID] = (double **) Malloc(n_eig*sizeof(double *));
eigenvalues[varID] = (double **) Malloc(nts*sizeof(double *));
for ( i = 0; i < n; i++ )
for ( int i = 0; i < n; i++ )
{
if ( i < n_eig )
{
......@@ -205,7 +205,7 @@ void *EOF3d(void * argument)
streamReadRecord(streamID1, in, &nmiss);
offset = gridsize * levelID;
for ( i = 0; i < gridsize; ++i )
for ( int i = 0; i < gridsize; ++i )
{
if ( ! DBL_IS_EQUAL(in[i], missval ) )
{
......@@ -374,7 +374,7 @@ void *EOF3d(void * argument)
} /* for ( eofID = 0; eofID < n_eig; eofID++ ) */
if ( eigv ) Free(eigv);
for ( i = 0; i < n; i++ )
for ( int i = 0; i < n; i++ )
if ( cov[i] ) Free(cov[i]);
} /* for ( varID = 0; varID < nvars; varID++ ) */
......@@ -407,7 +407,7 @@ void *EOF3d(void * argument)
for ( varID=0; varID<nvars; varID++ )
varID2[varID] = vlistDefVar(vlistID2, gridID2, zaxisID2, TSTEP_INSTANT);
ngrids = vlistNgrids(vlistID2);
for ( i = 0; i < ngrids; i++ )
for ( int i = 0; i < ngrids; i++ )
vlistChangeGridIndex(vlistID2, i, gridID2);
int streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
......@@ -449,7 +449,7 @@ void *EOF3d(void * argument)
if ( tsID < n_eig )
{
nmiss = 0;
for ( i = 0; i < gridsize; i++ )
for ( int i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(eigenvectors[varID][tsID][offset + i], missval) ) nmiss++;
streamDefRecord(streamID3, varID, levelID);
......@@ -465,7 +465,7 @@ void *EOF3d(void * argument)
for ( varID = 0; varID < nvars; varID++)
{
for ( i = 0; i < nts; i++)
for ( int i = 0; i < nts; i++)
{
Free(datafields[varID][i]);
if ( i < n_eig )
......
......@@ -39,7 +39,6 @@ void *Ninfo(void *argument)
{
enum {NYEAR, NMON, NDATE, NTIME, NPAR, NLEVEL, NGRIDPOINTS, NGRIDS};
int varID;
int nrecs;
int date0 = 0;
int day, mon0 = 0, mon, year0 = 0, year;
......@@ -73,7 +72,7 @@ void *Ninfo(void *argument)
int nyear = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
cdiDecodeDate(vdate, &year, &mon, &day);
......@@ -94,7 +93,7 @@ void *Ninfo(void *argument)
int nmon = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
cdiDecodeDate(vdate, &year, &mon, &day);
......@@ -115,7 +114,7 @@ void *Ninfo(void *argument)
int ndate = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
......@@ -134,7 +133,7 @@ void *Ninfo(void *argument)
{
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) ) tsID++;
while ( streamInqTimestep(streamID, tsID) ) tsID++;
fprintf(stdout, "%d\n", tsID);
break;
}
......
......@@ -41,7 +41,6 @@
void *Showinfo(void *argument)
{
int nrecs;
int date0 = 0;
int year, month, day;
int month0 = 0, year0 = 0;
......@@ -77,7 +76,7 @@ void *Showinfo(void *argument)
{
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
......@@ -97,7 +96,7 @@ void *Showinfo(void *argument)
{
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
......@@ -118,7 +117,7 @@ void *Showinfo(void *argument)
char vdatestr[32];
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
......@@ -139,7 +138,7 @@ void *Showinfo(void *argument)
char vtimestr[32];
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vtime = taxisInqVtime(taxisID);
......@@ -155,7 +154,7 @@ void *Showinfo(void *argument)
char vdatetimestr[64];
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
......
......@@ -218,7 +218,6 @@ void *Tinfo(void *argument)
int vdate_first = 0, vtime_first = 0;
int vdate0 = 0, vtime0 = 0;
int vdate = 0, vtime = 0;
int nrecs;
int tsID = 0, ntimeout;
int calendar;
int year0, month0, day0;
......@@ -316,7 +315,7 @@ void *Tinfo(void *argument)
fprintf(stdout, "\n");
tsID = 0;
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( streamInqTimestep(streamID, tsID) )
{
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
......
......@@ -83,6 +83,8 @@ void *cdo_task(void *task)
pthread_mutex_unlock(&(task_info->work_mtx));
pthread_exit(NULL);
return NULL;
}
#endif
......
......@@ -15,8 +15,6 @@ int fullyear = -999;
void dsets_init(dsets_t *pfi)
{
int i;
pfi->name[0] = 0;
pfi->dnam[0] = 0;
pfi->title[0] = 0;
......@@ -41,7 +39,7 @@ void dsets_init(dsets_t *pfi)
pfi->pchsub1 = NULL;
for ( i = 0; i < 5; ++i ) pfi->dnum[i] = 0;
for ( int i = 0; i < 5; ++i ) pfi->dnum[i] = 0;
}
/* Byte swap requested number of 4 byte elements */
......@@ -1219,7 +1217,7 @@ int read_gradsdes(char *filename, dsets_t *pfi)
// gaint acumstride=0;
gaint hdrb, trlb;
gaint size=0,rc,len,flag,tim1,tim2;
gaint flgs[8],e,t;
gaint e,t;
int BYTEORDER = IsBigendian();
gadouble *vals;
gadouble v1,v2,temp;
......@@ -1239,9 +1237,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
/* Copy descriptor file name into gafile structure */
getwrd (pfi->dnam,filename,MAX_NAMELEN);
/* initialize error flags */
for (i=0;i<8;i++) flgs[i] = 1;
/* Parse the data descriptor file */
while ( fgets(rec, MAX_RECLEN, descr) != NULL )
{
......@@ -1458,7 +1453,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
else
{
getstr (pfi->title,ch,MAX_NAMELEN);
flgs[7] = 0;
}
}
else if (cmpwrd("dset",rec))
......@@ -1477,7 +1471,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
{
getwrd (pfi->name,ch,MAX_NAMELEN);
}
flgs[5] = 0;
}
else if (cmpwrd("undef",rec))
{
......@@ -1498,7 +1491,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
pfi->ulow = fabs(pfi->undef/EPSILON);
pfi->uhi = pfi->undef + pfi->ulow;
pfi->ulow = pfi->undef - pfi->ulow;
flgs[4] = 0;
}
else if (cmpwrd("xdef",rec))
{
......@@ -1531,7 +1523,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
if (rc==-1) goto err8;
if (rc) goto err9;
} else goto err2;
flgs[0] = 0;
}
else if (cmpwrd("ydef",rec))
{
......@@ -1559,7 +1550,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
if (rc==-1) goto err8;
if (rc) goto err9;
}
flgs[1] = 0;
}
else if (cmpwrd("zdef",rec))
{
......@@ -1587,7 +1577,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
if (rc==-1) goto err8;
if (rc) goto err9;
} else goto err2;
flgs[2] = 0;
}
else if (cmpwrd("tdef",rec))
{
......@@ -1630,7 +1619,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
pfi->abvals[3] = vals;
pfi->linear[3] = 1;
} else goto err2;
flgs[3] = 0;
}
else if (cmpwrd("vars",rec))
{
......@@ -1853,8 +1841,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
lowcas(rec);
}
/* vars block parsed without error */
flgs[6] = 0;
}
else
{
......@@ -1863,7 +1849,6 @@ int read_gradsdes(char *filename, dsets_t *pfi)
goto err9;
}
}
(void) flgs;
/* Done scanning!
Check if scanned stuff makes sense, and then set things up correctly */
......
......@@ -368,7 +368,7 @@ size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
if(out && !out->stream) {
out->stream=fopen(out->filename, "wb");
if(!out->stream)
return -1;
return 0;
}
return fwrite(buffer, size, nmemb, out->stream);
}
......
......@@ -57,7 +57,7 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
int nsplit = NSPLIT; /* (only 2 allowed) number of segments to split
the data */
int nl[NSPLIT]; /* number of links in each sub-array */
int who_am_i,depth; /* current depth, depth of children and index
int who_am_i; /* current depth, depth of children and index
to be parent in next call to sort_par */
int add_srt[NSPLIT]; /* array for start index of sub array */
double *add1s[NSPLIT]; /* pointers to sub arrays for sort and merge step */
......@@ -78,9 +78,9 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
add1s[0] = &add1[add_srt[0]]; add1s[1] = &add1[add_srt[1]];
nl[0] = num_links/nsplit; nl[1] = num_links-nl[0];
depth = (int) (log(parent)/log(2));
#if defined(_OPENMP)
int depth = (int) (log(parent)/log(2));
/* Allow for nested parallelism */
if ( omp_in_parallel() && depth<par_depth )
{
......
......@@ -163,9 +163,8 @@ int namelist_parse_string(namelist_parser *parser, const char *buf, size_t len,
}
parser->pos = start;
return NAMELIST_ERROR_PART;
return 0;
return NAMELIST_ERROR_PART;
}
static
......@@ -184,7 +183,6 @@ int namelist_check_keyname(const char *buf, namelisttok_t *t)
break;
default:
return NAMELIST_ERROR_INTYP;
break;
}
return 0;
......
......@@ -448,12 +448,12 @@ void cdo_compute_concave_overlap_areas(unsigned N, search_t *search, struct grid
double coordinates_y[3] = {-1, -1, -1};
double coordinates_xyz[9] = {-1, -1, -1};
enum yac_edge_type edge_types[3] = {GREAT_CIRCLE, GREAT_CIRCLE, GREAT_CIRCLE};
struct grid_cell target_partial_cell =
{.coordinates_x = coordinates_x,
.coordinates_y = coordinates_y,
.coordinates_xyz = coordinates_xyz,
.edge_type = edge_types,
.num_corners = 3};
struct grid_cell target_partial_cell;
target_partial_cell.coordinates_x = coordinates_x;
target_partial_cell.coordinates_y = coordinates_y;
target_partial_cell.coordinates_xyz = coordinates_xyz;
target_partial_cell.edge_type = edge_types;
target_partial_cell.num_corners = 3;
/* Do the clipping and get the cell for the overlapping area */
......
......@@ -601,7 +601,7 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
const int nsplit = 2; /* (only 2 allowed) number of segments to split the data */
int nl[nsplit]; /* number of links in each sub-array */
int who_am_i,depth; /* current depth, depth of children and index
int who_am_i; /* current depth, depth of children and index
to be parent in next call to sort_par */
int add_srt[nsplit]/*, add_end[nsplit]*/; /* arrays for start and end index of sub array */
int *add1s[nsplit], *add2s[nsplit]; /* pointers to sub arrays for sort and merge step */
......@@ -638,9 +638,9 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
nl[0] = num_links/nsplit; nl[1] = num_links-nl[0];
//add_end[0] = nl[0]; add_end[1] = num_links;
depth = (int) (log(parent)/log(2));
#if defined(_OPENMP)
int depth = (int) (log(parent)/log(2));
/* Allow for nested parallelism */
if ( omp_in_parallel() && depth<par_depth )
{
......
......@@ -719,14 +719,14 @@ const char *filetypeext(int filetype)
switch ( filetype )
{
case CDI_FILETYPE_GRB:
case CDI_FILETYPE_GRB2: return ".grb"; break;
case CDI_FILETYPE_GRB2: return ".grb";
case CDI_FILETYPE_NC:
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C: return ".nc"; break;
case CDI_FILETYPE_SRV: return ".srv"; break;
case CDI_FILETYPE_EXT: return ".ext"; break;
case CDI_FILETYPE_IEG: return ".ieg"; break;
case CDI_FILETYPE_NC4C: return ".nc";
case CDI_FILETYPE_SRV: return ".srv";
case CDI_FILETYPE_EXT: return ".ext";
case CDI_FILETYPE_IEG: return ".ieg";
default: return "";
}
}
......
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