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

Fix clang compiler warnings.

parent 972e9f17
......@@ -341,18 +341,18 @@ Output(void *process)
cdoInqRecord(streamID, &varID, &levelID);
vlistInqVarName(vlistID, varID, name);
int param = vlistInqVarParam(vlistID, varID);
int code = vlistInqVarCode(vlistID, varID);
int gridID = vlistInqVarGrid(vlistID, varID);
int zaxisID = vlistInqVarZaxis(vlistID, varID);
int datatype = vlistInqVarDatatype(vlistID, varID);
int dig = (datatype == CDI_DATATYPE_FLT64) ? Options::CDO_dbl_digits : Options::CDO_flt_digits;
size_t nwpv = (vlistInqVarNumber(vlistID, varID) == CDI_COMP) ? 2 : 1;
size_t gridsize = nwpv * gridInqSize(gridID);
const int param = vlistInqVarParam(vlistID, varID);
const int code = vlistInqVarCode(vlistID, varID);
const int gridID = vlistInqVarGrid(vlistID, varID);
const int zaxisID = vlistInqVarZaxis(vlistID, varID);
const int datatype = vlistInqVarDatatype(vlistID, varID);
const int dig = (datatype == CDI_DATATYPE_FLT64) ? Options::CDO_dbl_digits : Options::CDO_flt_digits;
const size_t nwpv = (vlistInqVarNumber(vlistID, varID) == CDI_COMP) ? 2 : 1;
const size_t gridsize = nwpv * gridInqSize(gridID);
size_t nlon = gridInqXsize(gridID);
size_t nlat = gridInqYsize(gridID);
double level = cdoZaxisInqLevel(zaxisID, levelID);
double missval = vlistInqVarMissval(vlistID, varID);
const double level = cdoZaxisInqLevel(zaxisID, levelID);
const double missval = vlistInqVarMissval(vlistID, varID);
cdiParamToString(param, paramstr, sizeof(paramstr));
......@@ -365,7 +365,7 @@ Output(void *process)
cdoReadRecord(streamID, array.data(), &nmiss);
if (operatorID == OUTPUTSRV)
fprintf(stdout, "%4d %8g %8ld %4d %8zu %8zu %d %d\n", code, level, vdate, vtime, nlon, nlat, 0, 0);
fprintf(stdout, "%4d %8g %8ld %4d %8zu %8zu %d %d\n", code, level, (long)vdate, vtime, nlon, nlat, 0, 0);
if (operatorID == OUTPUTEXT) fprintf(stdout, "%8lld %4d %8g %8zu\n", vdate, code, level, gridsize);
......@@ -421,10 +421,9 @@ Output(void *process)
}
else if (operatorID == OUTPUTTAB)
{
bool l2d = false;
int xsize = gridInqXsize(gridID);
const bool l2d = (gridtype == GRID_CURVILINEAR);
const int xsize = gridInqXsize(gridID);
// int ysize = gridInqYsize(gridID);
if (gridtype == GRID_CURVILINEAR) l2d = true;
for (size_t i = 0; i < gridsize; i++)
{
......@@ -435,8 +434,8 @@ Output(void *process)
yind /= xsize;
xind -= yind * xsize;
}
double lon = grid_center_lon[i];
double lat = grid_center_lat[i];
const double lon = grid_center_lon[i];
const double lat = grid_center_lat[i];
for (k = 0; k < nkeys; ++k)
{
......
......@@ -87,8 +87,6 @@ Selyearidx(void *process)
}
}
const int calendar = taxisInqCalendar(taxisID2);
int tsID = 0;
int tsID2 = 0;
int tsID3 = 0;
......
......@@ -141,7 +141,7 @@ printBounds(int taxisID, int calendar)
getTimeInc(jdelta, vdate0, vdate1, &incperiod, &incunit);
/* fprintf(stdout, " %g %g %g %d", jdelta, jdelta/3600, fmod(jdelta,3600), incperiod%3600);*/
int len = fprintf(stdout, " %3ld %s%s", incperiod, tunits[incunit], labs(incperiod) != 1 ? "s" : "");
int len = fprintf(stdout, " %3ld %s%s", (long)incperiod, tunits[incunit], labs(incperiod) != 1 ? "s" : "");
for (int i = 0; i < 11 - len; ++i) fprintf(stdout, " ");
}
......@@ -345,7 +345,7 @@ Tinfo(void *process)
getTimeInc(jdelta, vdate0, vdate, &incperiod, &incunit);
/* fprintf(stdout, " %g %g %g %d", jdelta, jdelta/3600, fmod(jdelta,3600), incperiod%3600);*/
len = fprintf(stdout, " %3ld %s%s", incperiod, tunits[incunit], labs(incperiod) != 1 ? "s" : "");
len = fprintf(stdout, " %3ld %s%s", (long)incperiod, tunits[incunit], labs(incperiod) != 1 ? "s" : "");
for (i = 0; i < 11 - len; ++i) fprintf(stdout, " ");
}
else
......@@ -440,7 +440,7 @@ Tinfo(void *process)
time2str(vtime, vtimestr, sizeof(vtimestr));
fprintf(stdout, " End date : %s %s\n", vdatestr, vtimestr);
fprintf(stdout, " Increment : %3ld %s%s\n", incperiod0, tunits[incunit0], incperiod0 != 1 ? "s" : "");
fprintf(stdout, " Increment : %3ld %s%s\n", (long)incperiod0, tunits[incunit0], incperiod0 != 1 ? "s" : "");
fprintf(stdout, " Number of timesteps : %d\n", tsID);
fprintf(stdout, " Gaps identified : %d\n", ngaps);
......
......@@ -20,10 +20,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* =============================================== */
/* These include files should be standard on all */
/* UNIX systems. */
/* =============================================== */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -32,13 +29,6 @@
#include "error.h"
#include "dmemory.h"
#ifndef true
#define true 1
#endif
#ifndef false
#define false 0
#endif
#define MaxLevel 1024
#define MaxCodes 277
......
......@@ -60,7 +60,7 @@
/* sxxxYYYYMMDDhhmm0 */
#define DATE_LEN 31 /* YYYYMMDDhhmmss allocate DTLEN+1 !!!! */
#define SET_DATE(dtstr, date, time) (sprintf(dtstr, "%*ld%*d", DATE_LEN - 6, date, 6, time))
#define SET_DATE(dtstr, date, time) (sprintf(dtstr, "%*ld%*d", DATE_LEN - 6, (long)date, 6, time))
#define DATE_IS_NEQ(dtstr1, dtstr2, len) (memcmp(dtstr1, dtstr2, len) != 0)
enum T_WEIGHT_MODE
......
......@@ -27,8 +27,6 @@ int CDO_Color = 1;
void
set_text_color(FILE *fp, TextMode attr, TextColor fg)
{
int bg = -1;
if (fp == stdout && !COLOR_STDOUT) return;
if (fp == stderr && !COLOR_STDERR) return;
......
......@@ -183,7 +183,7 @@ cdo_compute_concave_overlap_areas(size_t N, search_t &search, const grid_cell &t
double coordinates_x[3] = { -1, -1, -1 };
double coordinates_y[3] = { -1, -1, -1 };
double coordinates_xyz[3][3] = { -1, -1, -1 };
double coordinates_xyz[3][3] = { {-1, -1, -1}, {-1, -1, -1}, {-1, -1, -1} };
enum yac_edge_type edge_types[3] = { GREAT_CIRCLE, GREAT_CIRCLE, GREAT_CIRCLE };
grid_cell target_partial_cell;
......@@ -205,8 +205,8 @@ cdo_compute_concave_overlap_areas(size_t N, search_t &search, const grid_cell &t
for (unsigned num_corners = 0; num_corners < target_cell.num_corners; ++num_corners)
{
unsigned corner_a = num_corners;
unsigned corner_b = (num_corners + 1) % target_cell.num_corners;
const unsigned corner_a = num_corners;
const unsigned corner_b = (num_corners + 1) % target_cell.num_corners;
// skip clipping and area calculation for degenerated triangles
//
......@@ -221,8 +221,7 @@ cdo_compute_concave_overlap_areas(size_t N, search_t &search, const grid_cell &t
//
// and use temp_target_cell for triangulation.
//
// Compared to the if statement below the alternative seems
// to be quite costly.
// Compared to the if statement below the alternative seems to be quite costly.
if (((std::fabs(target_cell.coordinates_xyz[corner_a][0] - target_cell.coordinates_xyz[corner_b][0]) < tol)
&& (std::fabs(target_cell.coordinates_xyz[corner_a][1] - target_cell.coordinates_xyz[corner_b][1]) < tol)
......
Markdown is supported
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