Commit 3b6c3f9a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Fix some clang-tidy warnings.

parent 7d5ecd98
Pipeline #3317 passed with stages
in 14 minutes and 36 seconds
......@@ -331,7 +331,7 @@ CMOR_lite(void *process)
bool convert_data = false;
if (operatorArgc() == 2)
{
if (cdoOperatorArgv(1).compare("convert") == 0)
if (cdoOperatorArgv(1) == "convert")
convert_data = true;
else
cdoAbort("Unknown parameter: >%s<", cdoOperatorArgv(1).c_str());
......
......@@ -396,7 +396,7 @@ Collgrid(void *process)
{
for (int isel = 0; isel < nsel; isel++)
{
if (cdoOperatorArgv(noff + isel).compare(varList1[varID].name) == 0)
if (cdoOperatorArgv(noff + isel) == varList1[varID].name)
{
selfound[isel] = true;
vars1[varID] = true;
......
......@@ -331,9 +331,9 @@ static int addWithFrequency(std::vector<std::string> &params, const char *operat
auto kv = kvlist.search("freq");
if (kv && kv->nvalues > 0 )
{
if ( kv->values[0].compare("month") == 0 )
if (kv->values[0] == "month")
opID = cdoOperatorAdd(operatorName, 0, 8, nullptr);
else if ( kv->values[0].compare("year") == 0 )
else if (kv->values[0] == "year")
opID = cdoOperatorAdd(operatorName, 0, 10, nullptr);
else
cdoAbort("Frequency '%s' unknown.", kv->values[0]);
......@@ -1358,9 +1358,9 @@ void *EcaPd(void *process)
auto kv = kvlist.search("freq");
if (kv && kv->nvalues > 0 )
{
if ( kv->values[0].compare("month") == 0 )
if (kv->values[0] == "month")
datelenOp = 8;
else if ( kv->values[0].compare("year") == 0 )
else if (kv->values[0] == "year")
datelenOp = 10;
}
}
......
......@@ -180,7 +180,7 @@ Ensstat(void *process)
bool withCountData = false;
if (argc == 1)
{
if (cdoOperatorArgv(nargc - 1).compare("count") == 0)
if (cdoOperatorArgv(nargc - 1) == "count")
withCountData = true;
else
cdoAbort("Unknown parameter: >%s<", cdoOperatorArgv(nargc - 1).c_str());
......
......@@ -260,7 +260,7 @@ Mrotuvb(void *process)
cdoInitialize(process);
if (operatorArgc() == 1)
if (cdoOperatorArgv(0).compare("noint") == 0) gpint = false;
if (cdoOperatorArgv(0) == "noint") gpint = false;
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
......
......@@ -102,7 +102,7 @@ datelist(const std::vector<std::string> &arguments)
{
double fval = 0;
// if "-" set start date to maximum start (i == 0) or end (i == 1)
if (arguments[i].compare("-") == 0)
if (arguments[i] == "-")
{
fval = (i == 0) ? -99999999999. : 99999999999.;
}
......
......@@ -182,7 +182,7 @@ Setpartab(void *process)
bool convert_data = false;
if (operatorArgc() == 2)
{
if (cdoOperatorArgv(1).compare("convert") == 0)
if (cdoOperatorArgv(1) == "convert")
convert_data = true;
else
cdoAbort("Unknown parameter: >%s<", cdoOperatorArgv(1).c_str());
......
......@@ -175,9 +175,9 @@ Shiftxy(void *process)
auto pargv = cdoGetOperArgv();
for (int ic = 1; ic < pargc; ++ic)
{
if (pargv[ic].compare("cyclic") == 0)
if (pargv[ic] == "cyclic")
lcyclic = true;
else if (pargv[ic].compare("coord") == 0)
else if (pargv[ic] == "coord")
lcoord = true;
}
}
......
......@@ -88,7 +88,7 @@ smooth(int gridID, double missval, const double *restrict array1, double *restri
std::vector<knnWeightsType> knnWeights;
for (int i = 0; i < Threading::ompNumThreads; ++i) knnWeights.push_back(knnWeightsType(numNeighbors));
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
auto start = Options::cdoVerbose ? cdo_get_wtime() : 0.0;
bool xIsCyclic = false;
size_t dims[2] = { gridsize, 0 };
......
......@@ -79,7 +79,7 @@ Split(void *process)
for (int i = 0; i < operatorArgc(); ++i)
{
if (cdoOperatorArgv(i).compare("swap") == 0)
if (cdoOperatorArgv(i) == "swap")
swap_obase = true;
else if (cdoOperatorArgv(i).find("uuid=") == 0)
uuid_attribute = &cdoOperatorArgv(i)[0] + 5;
......
......@@ -145,7 +145,7 @@ Vertintap(void *process)
operatorInputArg(cdoOperatorEnter(operatorID));
Varray<double> plev;
if (operatorArgc() == 1 && cdoOperatorArgv(0).compare("default") == 0)
if (operatorArgc() == 1 && cdoOperatorArgv(0) == "default")
{
if (useHightLevel)
plev = { 10, 50, 100, 500, 1000, 5000, 10000, 15000, 20000, 25000, 30000 };
......@@ -248,7 +248,7 @@ Vertintap(void *process)
std::vector<std::vector<size_t>> varnmiss(nvars);
Field3DVector vardata1(nvars), vardata2(nvars);
const int maxlev = nhlevh > nplev ? nhlevh : nplev;
const auto maxlev = nhlevh > nplev ? nhlevh : nplev;
std::vector<size_t> pnmiss;
if (!extrapolate) pnmiss.resize(nplev);
......
......@@ -138,7 +138,7 @@ Vertintml(void *process)
if (operatorID == ML2PL || operatorID == ML2HL || operatorID == ML2PL_LP || operatorID == ML2HL_LP)
{
const auto envstr = getenv("EXTRAPOLATE");
if (envstr && isdigit((int) envstr[0]))
if (envstr != nullptr && isdigit(static_cast<int>(envstr[0])))
{
if (atoi(envstr) == 1) extrapolate = true;
if (extrapolate) cdoPrint("Extrapolation of missing values enabled!");
......@@ -152,7 +152,7 @@ Vertintml(void *process)
operatorInputArg(cdoOperatorEnter(operatorID));
Varray<double> plev;
if (operatorArgc() == 1 && cdoOperatorArgv(0).compare("default") == 0)
if (operatorArgc() == 1 && cdoOperatorArgv(0) == "default")
{
if (useHightLevel)
plev = { 10, 50, 100, 500, 1000, 5000, 10000, 15000, 20000, 25000, 30000 };
......@@ -200,7 +200,7 @@ Vertintml(void *process)
if (i == nvct) linvertvct = true;
}
if (Options::cdoVerbose) cdoPrint("linvertvct = %d", (int) linvertvct);
if (Options::cdoVerbose) cdoPrint("linvertvct = %d", static_cast<int>(linvertvct));
if (linvertvct) invert_vct(vct);
......@@ -216,7 +216,7 @@ Vertintml(void *process)
std::vector<std::vector<size_t>> varnmiss(nvars);
Field3DVector vardata1(nvars), vardata2(nvars);
const int maxlev = nhlevh > nplev ? nhlevh : nplev;
const auto maxlev = nhlevh > nplev ? nhlevh : nplev;
std::vector<size_t> pnmiss;
if (!extrapolate) pnmiss.resize(nplev);
......@@ -267,7 +267,7 @@ Vertintml(void *process)
bool useTable = false;
for (varID = 0; varID < nvars; varID++)
{
const int tableNum = tableInqNum(vlistInqVarTable(vlistID1, varID));
const auto tableNum = tableInqNum(vlistInqVarTable(vlistID1, varID));
if (tableNum > 0 && tableNum != 255)
{
useTable = true;
......@@ -422,7 +422,7 @@ Vertintml(void *process)
if (zaxisIDh != -1 && gheightID != -1 && tempID == -1)
cdoAbort("Temperature not found, needed for vertical interpolation of geopotheight!");
int presID = lnpsID;
auto presID = lnpsID;
if (psvarID != -1) presID = psvarID;
if (zaxisIDh != -1 && presID == -1)
......
......@@ -2,7 +2,7 @@
#define GRID_READ_PINGO_H
#include <cstdio>
#include <array.h>
#include "array.h"
size_t input_darray(FILE *gfp, size_t n_values, Varray<double> &array);
int grid_read_pingo(FILE *gfp);
......
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