Commit 1ada5601 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Simplify statement.

parent c9322f75
......@@ -76,7 +76,7 @@ Change_e5slm(void *process)
streamClose(streamIDslm);
for (size_t i = 0; i < gridsize; ++i) lsea[i] = !(cland[i] > 0);
for (size_t i = 0; i < gridsize; ++i) lsea[i] = cland[i] <= 0;
int nvars = vlistNvars(vlistID1);
std::vector<short> codes(nvars);
......
......@@ -225,7 +225,7 @@ levelDirDown(int nlev, double *lev)
{
bool ldown = (nlev > 1 && lev[1] < lev[0]);
for (int i = 1; i < nlev - 1; ++i)
if (ldown && !(lev[i + 1] < lev[i])) return false;
if (ldown && lev[i + 1] >= lev[i]) return false;
return ldown;
}
......
......@@ -277,7 +277,7 @@ Mrotuvb(void *process)
int gridID2 = vlistGrid(vlistID2, 0);
size_t gridsize = gridInqSize(gridID1);
if (gpint && gridID1 == gridID2) cdoAbort("Input grids are the same, use parameter >noint< to disable interpolation!");
if (gpint == false && gridID1 != gridID2) cdoAbort("Input grids are not the same!");
if (!gpint && gridID1 != gridID2) cdoAbort("Input grids are not the same!");
if (gridsize != gridInqSize(gridID2)) cdoAbort("Grids have different size!");
if (gridInqType(gridID1) != GRID_LONLAT && gridInqType(gridID1) != GRID_GAUSSIAN && gridInqType(gridID1) != GRID_CURVILINEAR)
......
......@@ -482,8 +482,8 @@ Remapeta(void *process)
double *fis1 = (double *) Malloc(gridsize * sizeof(double));
double *ps1 = (double *) Malloc(gridsize * sizeof(double));
if (lfis2 == false) fis2 = (double *) Malloc(gridsize * sizeof(double));
if (lfis2 == true && gridsize != nfis2gp) cdoAbort("Orographies have different grid size!");
if (!lfis2) fis2 = (double *) Malloc(gridsize * sizeof(double));
if (lfis2 && gridsize != nfis2gp) cdoAbort("Orographies have different grid size!");
double *ps2 = (double *) Malloc(gridsize * sizeof(double));
......@@ -601,7 +601,7 @@ Remapeta(void *process)
if (minval < MIN_FIS || maxval > MAX_FIS) cdoWarning("Orography out of range (min=%g max=%g)!", minval, maxval);
}
if (lfis2 == false)
if (!lfis2)
for (size_t i = 0; i < gridsize; i++) fis2[i] = fis1[i];
if (ltq)
......
......@@ -31,7 +31,7 @@
#include "grid.h"
static void
sampleData(double *array1, int gridID1, double *array2, int gridID2, int resampleFactor)
sampleData(const double *array1, int gridID1, double *array2, int gridID2, int resampleFactor)
{
const size_t nlon1 = gridInqXsize(gridID1);
const size_t nlat1 = gridInqYsize(gridID1);
......
......@@ -478,7 +478,7 @@ Select(void *process)
if (ptimestep < 0)
{
if (nfiles != 1) cdoAbort("Negative timesteps only supported with one input stream!");
if (ntsteps < 0 && processSelf().inputStreams[0]->ispipe == false)
if (ntsteps < 0 && !processSelf().inputStreams[0]->ispipe)
{
int tsID = 0;
while (cdoStreamInqTimestep(streamID1, tsID)) tsID++;
......@@ -527,7 +527,7 @@ Select(void *process)
timestep++;
bool copytimestep = true;
if (ltimsel == true)
if (ltimsel)
{
copytimestep = false;
......
......@@ -439,7 +439,7 @@ Seltime(void *process)
}
bool copy_nts2 = false;
if (operatorID == SELSMON && copytimestep == false)
if (operatorID == SELSMON && !copytimestep)
{
copy_nts2 = false;
......
......@@ -74,7 +74,7 @@ Setgatt(void *process)
int attlen = 0;
FILE *fp = fopen(attfile, "r");
if (fp == 0) cdoAbort("Open failed on %s", attfile);
if (fp == nullptr) cdoAbort("Open failed on %s", attfile);
while (readline(fp, line, 1024))
{
......
......@@ -133,7 +133,7 @@ applyParameterList(pt_mode_t ptmode, PMList &pmlist, int nvars, int vlistID2, st
const int levtype = zaxisInqLtype(vlistInqVarZaxis(vlistID2, varID));
const KeyValues *kv = kvlist->search("ltype");
const int ltype = (kv && kv->nvalues == 1) ? parameter2int(kv->values[0].c_str()) : levtype;
if (!(levtype == ltype)) kvlist = nullptr;
if (levtype != ltype) kvlist = nullptr;
}
}
else if (ptmode == VARIABLE_NAME)
......
......@@ -32,7 +32,7 @@
#define NALLOC_INC 1024
static void
spectrum(int nrec, double *data, double *spectrum, double *real, double *imag, double *window, double wssum, int detrend, int seg_n,
spectrum(int nrec, double *data, double *spectrum, double *real, double *imag, const double *window, double wssum, int detrend, int seg_n,
int seg_l)
{
int k;
......
......@@ -145,7 +145,7 @@ dv2uv(const double *d, const double *o, double *u, double *v, double *f, double
}
/*
void scaluv(double *fu, double rclat[], long nlat, long lot)
void scaluv(double *fu, const double *rclat, long nlat, long lot)
{
long l, lat;
double *ful;
......@@ -165,7 +165,7 @@ void scaluv(double *fu, double rclat[], long nlat, long lot)
*/
void
scaluv(double *fu, double *rclat, long nlat, long lot)
scaluv(double *fu, const double *rclat, long nlat, long lot)
{
for (long l = 0; l < lot; l++)
for (long lat = 0; lat < nlat; lat++)
......
......@@ -88,7 +88,7 @@ scan_time(int verbose, char *namelist, int *hours, int max_hours)
int time = (int) strtol(cp, &icp, 10);
while ((char *) icp != (char *) cp && nrqh < max_hours)
while (icp != (char *) cp && nrqh < max_hours)
{
hours[nrqh++] = time;
cp = icp;
......
......@@ -182,7 +182,7 @@ void fc2sp(double *fa, double *sa, const double *poli, long klev, long nlat, lon
/* Physc */
void dv2ps(const double * div, double * pot, long nlev, long ntr);
void dv2uv(const double *d, const double *o, double *u, double *v, double *f, double *g, long nt, long nsp, long nlev);
void scaluv(double *fu, double rclat[], long nlat, long lot);
void scaluv(double *fu, const double *rclat, long nlat, long lot);
void uv2dv(double *fu, double *fv, double *sd, double *sv, double *pol2, double *pol3, long klev, long nlat, long nt);
void geninx(long ntr, double *f, double *g);
......
......@@ -20,7 +20,7 @@
#include "grid.h"
void geninx(long ntr, double *f, double *g);
void scaluv(double *fu, double *rclat, int nlat, int lot);
void scaluv(double *fu, const double *rclat, int nlat, int lot);
void uv2dv(double *fu, double *fv, double *sd, double *sv, double *pol2, double *pol3, long klev, long nlat, long nt);
void dv2uv(const double *d, const double *o, double *u, double *v, double *f, double *g, long nt, long nsp, long nlev);
......
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