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

Set type of initialized variables to auto.

parent ce76e84a
......@@ -48,9 +48,9 @@ Cond2(void *process)
cdoOperatorAdd("ifthenelse", 0, 0, nullptr);
CdoStreamID streamID1 = cdoOpenRead(0);
CdoStreamID streamID2 = cdoOpenRead(1);
CdoStreamID streamID3 = cdoOpenRead(2);
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
int vlistID1 = cdoStreamInqVlist(streamID1);
int vlistID2 = cdoStreamInqVlist(streamID2);
......@@ -80,7 +80,7 @@ Cond2(void *process)
nospec(vlistID2);
nospec(vlistID3);
CdoStreamID streamID4 = cdoOpenWrite(3);
const auto streamID4 = cdoOpenWrite(3);
cdoDefVlist(streamID4, vlistID4);
size_t gridsize = vlistGridsizeMax(vlistID1);
......
......@@ -63,8 +63,8 @@ Merstat(void *process)
cdoOperatorAdd("merpctl", func_pctl, 0, nullptr);
// clang-format on
const int operatorID = cdoOperatorID();
const int operfunc = cdoOperatorF1(operatorID);
const auto operatorID = cdoOperatorID();
const auto operfunc = cdoOperatorF1(operatorID);
const bool needWeights = cdoOperatorF2(operatorID) != 0;
double pn = 0;
......@@ -75,16 +75,16 @@ Merstat(void *process)
percentile_check_number(pn);
}
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const int ngrids = vlistNgrids(vlistID1);
const auto ngrids = vlistNgrids(vlistID1);
int ndiffgrids = 0;
for (index = 1; index < ngrids; index++)
if (vlistGrid(vlistID1, 0) != vlistGrid(vlistID1, index)) ndiffgrids++;
......
......@@ -45,8 +45,8 @@ Monarith(void *process)
const int operatorID = cdoOperatorID();
const int operfunc = cdoOperatorF1(operatorID);
CdoStreamID streamID1 = cdoOpenRead(0);
CdoStreamID streamID2 = cdoOpenRead(1);
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
......@@ -68,7 +68,7 @@ Monarith(void *process)
const int taxisID3 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID3, taxisID3);
CdoStreamID streamID3 = cdoOpenWrite(2);
const auto streamID3 = cdoOpenWrite(2);
cdoDefVlist(streamID3, vlistID3);
FieldVector2D vars2;
......
......@@ -261,8 +261,8 @@ Mrotuvb(void *process)
if (operatorArgc() == 1)
if (strcmp(operatorArgv()[0], "noint") == 0) gpint = false;
CdoStreamID streamID1 = cdoOpenRead(0);
CdoStreamID streamID2 = cdoOpenRead(1);
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
......@@ -362,7 +362,7 @@ Mrotuvb(void *process)
if (Options::cdoVerbose) vlistPrint(vlistID3);
CdoStreamID streamID3 = cdoOpenWrite(2);
const auto streamID3 = cdoOpenWrite(2);
cdoDefVlist(streamID3, vlistID3);
double missval1 = vlistInqVarMissval(vlistID1, 0);
......
......@@ -184,7 +184,7 @@ NCL_wind(void *process)
set_parameter();
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
int vlistID1 = cdoStreamInqVlist(streamID1);
int vlistID2 = CDI_UNDEFID;
......@@ -253,7 +253,7 @@ NCL_wind(void *process)
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
......
......@@ -60,7 +60,7 @@ Pressure(void *process)
int operatorID = cdoOperatorID();
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
int vlistID1 = cdoStreamInqVlist(streamID1);
......@@ -225,7 +225,7 @@ Pressure(void *process)
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
int tsID = 0;
......
......@@ -28,10 +28,10 @@ Recttocomplex(void *process)
cdoInitialize(process);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
CdoStreamID streamID2 = cdoOpenRead(1);
const auto streamID2 = cdoOpenRead(1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
const int vlistID3 = vlistDuplicate(vlistID1);
......@@ -48,7 +48,7 @@ Recttocomplex(void *process)
vlistDefVarDatatype(vlistID3, varID, datatype);
}
CdoStreamID streamID3 = cdoOpenWrite(2);
const auto streamID3 = cdoOpenWrite(2);
cdoDefVlist(streamID3, vlistID3);
const size_t gridsizemax = vlistGridsizeMax(vlistID1);
......
......@@ -435,9 +435,9 @@ set_remapgrids(int filetype, int vlistID, int ngrids, std::vector<bool> &remapgr
{
remapgrids[index] = true;
const int gridID = vlistGrid(vlistID, index);
const int gridtype = gridInqType(gridID);
const int projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID) : -1;
const auto gridID = vlistGrid(vlistID, index);
const auto gridtype = gridInqType(gridID);
const auto projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID) : -1;
const bool lprojparams = (gridtype == GRID_PROJECTION) && grid_has_proj_params(gridID);
if (gridtype != GRID_LONLAT && !lprojparams && projtype != CDI_PROJ_RLL && projtype != CDI_PROJ_LAEA
......@@ -485,15 +485,15 @@ set_max_remaps(int vlistID)
{
int max_remaps = 0;
const int nzaxis = vlistNzaxis(vlistID);
const auto nzaxis = vlistNzaxis(vlistID);
for (int index = 0; index < nzaxis; index++)
{
const int zaxisID = vlistZaxis(vlistID, index);
const int zaxisSize = zaxisInqSize(zaxisID);
const auto zaxisID = vlistZaxis(vlistID, index);
const auto zaxisSize = zaxisInqSize(zaxisID);
if (zaxisSize > max_remaps) max_remaps = zaxisSize;
}
const int nvars = vlistNvars(vlistID);
const auto nvars = vlistNvars(vlistID);
if (nvars > max_remaps) max_remaps = nvars;
max_remaps++;
......@@ -809,8 +809,8 @@ Remap(void *argument)
addOperators();
const int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
const auto operatorID = cdoOperatorID();
auto operfunc = cdoOperatorF1(operatorID);
const bool writeRemapWeightsOnly = cdoOperatorF2(operatorID);
const bool lremap = operfunc == REMAP;
......@@ -847,21 +847,21 @@ Remap(void *argument)
if (gridInqType(gridID2) == GRID_GENERIC) cdoAbort("Unsupported target grid type (generic)!");
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int filetype = cdoInqFiletype(streamID1);
const auto filetype = cdoInqFiletype(streamID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const int ngrids = vlistNgrids(vlistID1);
const auto ngrids = vlistNgrids(vlistID1);
std::vector<bool> remapgrids(ngrids);
const int index = set_remapgrids(filetype, vlistID1, ngrids, remapgrids);
const int gridID1 = vlistGrid(vlistID1, index);
const auto index = set_remapgrids(filetype, vlistID1, ngrids, remapgrids);
const auto gridID1 = vlistGrid(vlistID1, index);
for (int index = 0; index < ngrids; index++)
if (remapgrids[index]) vlistChangeGridIndex(vlistID2, index, gridID2);
......@@ -883,7 +883,7 @@ Remap(void *argument)
if (remaps[0].vars.links_per_value == 0) remapLinksPerValue(remaps[0].vars);
nremaps = 1;
size_t gridsize = remaps[0].src_grid.size;
auto gridsize = remaps[0].src_grid.size;
remaps[0].gridID = gridID1;
remaps[0].gridsize = gridInqSize(gridID1);
......@@ -899,7 +899,7 @@ Remap(void *argument)
for (size_t i = 0; i < gridsize; i++)
if (remaps[0].src_grid.mask[i] == false) remaps[0].nmiss++;
size_t gridsize2 = gridInqSize(gridID2);
auto gridsize2 = gridInqSize(gridID2);
if (gridInqType(gridID2) == GRID_GME)
{
remaps[0].tgt_grid.nvgp = gridInqSize(gridID2);
......@@ -953,7 +953,7 @@ Remap(void *argument)
std::vector<double> array1(grid1sizemax);
std::vector<int> imask(grid1sizemax);
size_t gridsize = gridInqSize(gridID2);
auto gridsize = gridInqSize(gridID2);
std::vector<double> array2(gridsize);
if (!writeRemapWeightsOnly)
......@@ -975,8 +975,8 @@ Remap(void *argument)
cdoReadRecord(streamID1, &array1[0], &nmiss1);
if (!useMask) nmiss1 = 0;
const int gridID1 = vlistInqVarGrid(vlistID1, varID);
const double missval = vlistInqVarMissval(vlistID1, varID);
const auto gridID1 = vlistInqVarGrid(vlistID1, varID);
const auto missval = vlistInqVarMissval(vlistID1, varID);
size_t gridsize = gridInqSize(gridID1);
bool skipVar = false;
......@@ -1110,7 +1110,7 @@ Remap(void *argument)
if (remaps[r].src_grid.vgpm[i]) array1[j++] = array1[i];
}
size_t gridsize2 = gridInqSize(gridID2);
auto gridsize2 = gridInqSize(gridID2);
if (remap_genweights)
{
......@@ -1168,7 +1168,7 @@ Remap(void *argument)
int nd, ni, ni2, ni3;
gridInqParamGME(gridID2, &nd, &ni, &ni2, &ni3);
size_t j = remaps[r].tgt_grid.size;
auto j = remaps[r].tgt_grid.size;
for (size_t i = gridsize2; i > 0; i--)
if (remaps[r].tgt_grid.vgpm[i - 1]) array2[i - 1] = array2[--j];
......
......@@ -274,7 +274,7 @@ Remapeta(void *process)
if (Options::cdoVerbose)
for (i = 0; i < nhlevf2 + 1; ++i) cdoPrint("vct2: %5d %25.17f %25.17f", i, vct2[i], vct2[nvct2 / 2 + i]);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
if (operatorArgc() == 2)
{
......@@ -360,7 +360,7 @@ Remapeta(void *process)
if (Options::cdoVerbose)
for (i = 0; i < nvct1 / 2; ++i) cdoPrint("vct1: %5d %25.17f %25.17f", i, vct1[i], vct1[nvct1 / 2 + i]);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
if (zaxisIDh == -1) cdoWarning("No 3D variable with hybrid sigma pressure coordinate found!");
......
......@@ -46,13 +46,13 @@ Replace(void *process)
cdoInitialize(process);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID3 = taxisDuplicate(taxisID1);
CdoStreamID streamID2 = cdoOpenRead(1);
const auto streamID2 = cdoOpenRead(1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
......@@ -146,7 +146,7 @@ Replace(void *process)
const int vlistID3 = vlistDuplicate(vlistID1);
CdoStreamID streamID3 = cdoOpenWrite(2);
const auto streamID3 = cdoOpenWrite(2);
vlistDefTaxis(vlistID3, taxisID3);
cdoDefVlist(streamID3, vlistID3);
......
......@@ -78,7 +78,7 @@ Replacevalues(void *process)
newval2 = parameter2double(operatorArgv()[3]);
}
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -87,7 +87,7 @@ Replacevalues(void *process)
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
......
......@@ -167,7 +167,7 @@ Rhopot(void *process)
if (operatorArgc() == 1) pin = parameter2double(operatorArgv()[0]);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int nvars = vlistNvars(vlistID1);
......@@ -268,7 +268,7 @@ Rhopot(void *process)
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
int tsID = 0;
......
......@@ -47,7 +47,7 @@ Runpctl(void *process)
percentile_check_number(pn);
const int ndates = parameter2int(operatorArgv()[1]);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -57,7 +57,7 @@ Runpctl(void *process)
taxisWithBounds(taxisID2);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
const int nvars = vlistNvars(vlistID1);
......
......@@ -87,7 +87,7 @@ Runstat(void *process)
operatorCheckArgc(1);
int ndates = parameter2int(operatorArgv()[0]);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -105,7 +105,7 @@ Runstat(void *process)
if (nsteps > 0) vlistDefNtsteps(vlistID2, nsteps);
}
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
const int maxrecs = vlistNrecs(vlistID1);
......
......@@ -114,7 +114,7 @@ Samplegrid(void *process)
else
cdoAbort("Unknown operator ...");
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -171,7 +171,7 @@ Samplegrid(void *process)
if (operatorID == SUBGRID) Debug("Sub-grid has been created.");
});
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
size_t gridsize = vlistGridsizeMax(vlistID1);
......
......@@ -527,7 +527,7 @@ Samplegridicon(void *process)
const int gridID2 = read_grid(operatorArgv()[nsamplegrids - 1]);
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
long gridsize = vlistGridsizeMax(vlistID1);
......@@ -559,10 +559,10 @@ Samplegridicon(void *process)
vlistChangeGridIndex(vlistID3, index, gridID2);
}
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
CdoStreamID streamID3 = cdoOpenWrite(2);
const auto streamID3 = cdoOpenWrite(2);
cdoDefVlist(streamID3, vlistID3);
long gridsize2 = gridInqSize(gridID2);
......
......@@ -42,7 +42,7 @@ Seascount(void *process)
const int season_start = get_season_start();
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -51,7 +51,7 @@ Seascount(void *process)
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
const int maxrecs = vlistNrecs(vlistID1);
......
......@@ -53,9 +53,9 @@ Seaspctl(void *process)
season_start = get_season_start();
CdoStreamID streamID1 = cdoOpenRead(0);
CdoStreamID streamID2 = cdoOpenRead(1);
CdoStreamID streamID3 = cdoOpenRead(2);
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
......@@ -74,7 +74,7 @@ Seaspctl(void *process)
taxisWithBounds(taxisID4);
vlistDefTaxis(vlistID4, taxisID4);
CdoStreamID streamID4 = cdoOpenWrite(3);
const auto streamID4 = cdoOpenWrite(3);
cdoDefVlist(streamID4, vlistID4);
const int nvars = vlistNvars(vlistID1);
......
......@@ -861,7 +861,7 @@ Selbox(void *process)
operatorInputArg(cdoOperatorEnter(operatorID));
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -939,7 +939,7 @@ Selbox(void *process)
if (varID >= nvars) cdoWarning("No variables selected!");
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
size_t gridsizemax = vlistGridsizeMax(vlistID1);
......
......@@ -172,7 +172,7 @@ Selgridcell(void *process)
if (indmin < 0) cdoAbort("Index < 1 not allowed!");
CdoStreamID streamID1 = cdoOpenRead(0);
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
......@@ -245,7 +245,7 @@ Selgridcell(void *process)
if (varID >= nvars) cdoAbort("No variables selected!");
CdoStreamID streamID2 = cdoOpenWrite(1);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
size_t gridsize = vlistGridsizeMax(vlistID1);
......
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