Commit 661166b9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set constant variables to const.

parent 661e4fc8
......@@ -24,7 +24,6 @@
#include <cdi.h>
#include "cdo_int.h"
#include "griddes.h"
void *
......@@ -37,31 +36,28 @@ Enlarge(void *process)
operatorCheckArgc(1);
int gridID2 = cdoDefineGrid(operatorArgv()[0]);
size_t xsize2 = gridInqXsize(gridID2);
size_t ysize2 = gridInqYsize(gridID2);
const int gridID2 = cdoDefineGrid(operatorArgv()[0]);
const size_t xsize2 = gridInqXsize(gridID2);
const size_t ysize2 = gridInqYsize(gridID2);
if (Options::cdoVerbose) fprintf(stderr, "gridID2 %d, xsize2 %zu, ysize2 %zu\n", gridID2, xsize2, ysize2);
int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
const int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
int vlistID1 = cdoStreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
size_t gridsize2 = gridInqSize(gridID2);
const size_t gridsize2 = gridInqSize(gridID2);
if (gridsize2 < vlistGridsizeMax(vlistID1)) cdoAbort("Gridsize of input stream is greater than new gridsize!");
int ngrids = vlistNgrids(vlistID1);
for (int index = 0; index < ngrids; index++)
{
vlistChangeGridIndex(vlistID2, index, gridID2);
}
const int ngrids = vlistNgrids(vlistID1);
for (int index = 0; index < ngrids; index++) vlistChangeGridIndex(vlistID2, index, gridID2);
int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
const int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
cdoDefVlist(streamID2, vlistID2);
......@@ -81,16 +77,15 @@ Enlarge(void *process)
cdoInqRecord(streamID1, &varID, &levelID);
cdoReadRecord(streamID1, array1.data(), &nmiss);
double missval = vlistInqVarMissval(vlistID1, varID);
int gridID1 = vlistInqVarGrid(vlistID1, varID);
const double missval = vlistInqVarMissval(vlistID1, varID);
const int gridID1 = vlistInqVarGrid(vlistID1, varID);
const size_t gridsize1 = gridInqSize(gridID1);
size_t xsize1 = gridInqXsize(gridID1);
size_t ysize1 = gridInqYsize(gridID1);
size_t gridsize1 = gridInqSize(gridID1);
if (xsize1 == 0) xsize1 = 1;
if (ysize1 == 0) ysize1 = 1;
/* printf("%d %d %d %d\n", xsize1, ysize1, xsize2, ysize2); */
if (xsize1 == 1 && ysize1 == ysize2 && xsize1 * ysize1 == gridsize1)
{
if (linfo)
......
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