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

replaced atoi by parameter2int

parent d125b720
......@@ -111,7 +111,7 @@ void *CDIread(void *argument)
if ( operatorArgc() > 1 ) cdoAbort("Too many arguments!");
if ( operatorArgc() == 1 ) nruns = atol(operatorArgv()[0]);
if ( operatorArgc() == 1 ) nruns = parameter2int(operatorArgv()[0]);
if ( nruns < 0 ) nruns = 0;
if ( nruns > 99 ) nruns = 99;
......
......@@ -58,7 +58,7 @@ void *CDItest(void *argument)
UNUSED(operatorID);
// operatorInputArg("Number of copies");
if ( operatorArgc() == 1 ) max_copy = atoi(operatorArgv()[0]);
if ( operatorArgc() == 1 ) max_copy = parameter2int(operatorArgv()[0]);
processStartTime(&s_utime, &s_stime);
......
......@@ -129,11 +129,11 @@ void *CDIwrite(void *argument)
if ( operatorArgc() > 5 ) cdoAbort("Too many arguments!");
gridfile = defaultgrid;
if ( operatorArgc() >= 1 ) nruns = atol(operatorArgv()[0]);
if ( operatorArgc() >= 1 ) nruns = parameter2int(operatorArgv()[0]);
if ( operatorArgc() >= 2 ) gridfile = operatorArgv()[1];
if ( operatorArgc() >= 3 ) nlevs = atol(operatorArgv()[2]);
if ( operatorArgc() >= 4 ) ntimesteps = atol(operatorArgv()[3]);
if ( operatorArgc() >= 5 ) nvars = atol(operatorArgv()[4]);
if ( operatorArgc() >= 3 ) nlevs = parameter2int(operatorArgv()[2]);
if ( operatorArgc() >= 4 ) ntimesteps = parameter2int(operatorArgv()[3]);
if ( operatorArgc() >= 5 ) nvars = parameter2int(operatorArgv()[4]);
if ( nruns < 0 ) nruns = 0;
if ( nruns > 99 ) nruns = 99;
......
......@@ -85,7 +85,7 @@ void *Change(void *argument)
{
if ( nch%2 ) cdoAbort("Odd number of input arguments!");
for ( i = 0; i < nch; i++ )
chints[i] = atoi(operatorArgv()[i]);
chints[i] = parameter2int(operatorArgv()[i]);
}
else if ( operatorID == CHPARAM || operatorID == CHNAME || operatorID == CHUNIT )
{
......@@ -103,7 +103,7 @@ void *Change(void *argument)
{
operatorCheckArgc(3);
chcode = atoi(operatorArgv()[0]);
chcode = parameter2int(operatorArgv()[0]);
chlevels[0] = parameter2double(operatorArgv()[1]);
chlevels[1] = parameter2double(operatorArgv()[2]);
}
......@@ -119,7 +119,7 @@ void *Change(void *argument)
{
if ( nch%2 ) cdoAbort("Odd number of input arguments!");
for ( i = 0; i < nch; i++ )
chltypes[i] = atoi(operatorArgv()[i]);
chltypes[i] = parameter2int(operatorArgv()[i]);
}
streamID1 = streamOpenRead(cdoStreamName(0));
......
......@@ -44,7 +44,7 @@ void *Duplicate(void *argument)
cdoInitialize(argument);
if ( operatorArgc() > 1 ) cdoAbort("Too many arguments!");
else if ( operatorArgc() == 1 ) ndup = atoi(operatorArgv()[0]);
else if ( operatorArgc() == 1 ) ndup = parameter2int(operatorArgv()[0]);
if ( cdoVerbose ) cdoPrint("ndup = %d\n", ndup);
......
......@@ -115,7 +115,7 @@ void *EOFs(void * argument)
operfunc = cdoOperatorF1(operatorID);
operatorInputArg("Number of eigen functions to write out");
n_eig = atoi(operatorArgv()[0]);
n_eig = parameter2int(operatorArgv()[0]);
envstr = getenv("CDO_SVD_MODE");
......
......@@ -352,7 +352,7 @@ void *EcaCwdi(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("eca_cwdi", 0, 31, NULL);
if ( operatorArgc() > 0 ) argN = atoi(operatorArgv()[0]);
if ( operatorArgc() > 0 ) argN = parameter2int(operatorArgv()[0]);
if ( operatorArgc() > 1 ) argT = parameter2double(operatorArgv()[1]);
longname = (char*) malloc(strlen(CWDI_LONGNAME) + 80);
......@@ -394,7 +394,7 @@ void *EcaCwfi(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("eca_cwfi", 0, 31, NULL);
if ( operatorArgc() > 0 ) argN = atoi(operatorArgv()[0]);
if ( operatorArgc() > 0 ) argN = parameter2int(operatorArgv()[0]);
longname = (char*) malloc(strlen(CWFI_LONGNAME) + 40);
sprintf(longname, CWFI_LONGNAME, argN);
......@@ -494,7 +494,7 @@ void *EcaGsl(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("eca_gsl", 0, 10, NULL);
if ( operatorArgc() > 0 ) argN = atoi(operatorArgv()[0]);
if ( operatorArgc() > 0 ) argN = parameter2int(operatorArgv()[0]);
if ( operatorArgc() > 1 ) argT = parameter2double(operatorArgv()[1]);
if ( operatorArgc() > 2 ) minLandFraction = parameter2double(operatorArgv()[2]);
......@@ -573,7 +573,7 @@ void *EcaHwdi(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("eca_hwdi", 0, 31, NULL);
if ( operatorArgc() > 0 ) argN = atoi(operatorArgv()[0]);
if ( operatorArgc() > 0 ) argN = parameter2int(operatorArgv()[0]);
if ( operatorArgc() > 1 ) argT = parameter2double(operatorArgv()[1]);
longname = (char*) malloc(strlen(HWDI_LONGNAME) + 80);
......@@ -615,7 +615,7 @@ void *EcaHwfi(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("eca_hwfi", 0, 31, NULL);
if ( operatorArgc() > 0 ) argN = atoi(operatorArgv()[0]);
if ( operatorArgc() > 0 ) argN = parameter2int(operatorArgv()[0]);
longname = (char*) malloc(strlen(HWFI_LONGNAME) + 40);
sprintf(longname, HWFI_LONGNAME, argN);
......
......@@ -86,7 +86,7 @@ void *Ensstat(void *argument)
if ( operfunc == func_pctl )
{
operatorInputArg("percentile number");
pn = atoi(operatorArgv()[0]);
pn = parameter2int(operatorArgv()[0]);
if ( pn < 1 || pn > 99 )
cdoAbort("Illegal argument: percentile number %d is not in the range 1..99!", pn);
......
......@@ -101,7 +101,7 @@ void *Ensstat3(void *argument)
if ( operfunc == func_roc ) {
operatorInputArg("Number of eigen functions to write out");
nbins = atoi(operatorArgv()[0]);
nbins = parameter2int(operatorArgv()[0]);
}
nfiles = cdoStreamCnt() - 1;
......
......@@ -111,7 +111,7 @@ void *EOF3d(void * argument)
operfunc = cdoOperatorF1(operatorID);
operatorInputArg("Number of eigen functions to write out");
n_eig = atoi(operatorArgv()[0]);
n_eig = parameter2int(operatorArgv()[0]);
envstr = getenv("CDO_SVD_MODE");
......
......@@ -120,7 +120,7 @@ void *Fldstat(void *argument)
if ( operfunc == func_pctl )
{
operatorInputArg("percentile number");
pn = atoi(operatorArgv()[0]);
pn = parameter2int(operatorArgv()[0]);
if ( pn < 1 || pn > 99 )
cdoAbort("Illegal argument: percentile number %d is not in the range 1..99!", pn);
......
......@@ -56,7 +56,7 @@ void *Fourier(void *argument)
cdoInitialize(argument);
operatorInputArg("the sign of the exponent (-1 for normal or 1 for reverse transformation)!");
sign = atoi(operatorArgv()[0]);
sign = parameter2int(operatorArgv()[0]);
streamID1 = streamOpenRead(cdoStreamName(0));
......
......@@ -1022,7 +1022,7 @@ void *Gradsdes(void *argument)
if ( operatorArgc() == 1 )
{
map_version = atoi(operatorArgv()[0]);
map_version = parameter2int(operatorArgv()[0]);
if ( map_version != 1 && map_version != 2 && map_version != 4 )
cdoAbort("map_version=%d unsupported!", map_version);
}
......
......@@ -576,8 +576,8 @@ void *Gridboxstat(void *argument)
operatorInputArg("xinc, yinc");
operatorCheckArgc(2);
xinc = atoi(operatorArgv()[0]);
yinc = atoi(operatorArgv()[1]);
xinc = parameter2int(operatorArgv()[0]);
yinc = parameter2int(operatorArgv()[1]);
cdoOperatorAdd("gridboxmin", func_min, 0, NULL);
cdoOperatorAdd("gridboxmax", func_max, 0, NULL);
......
......@@ -58,8 +58,8 @@ void *Harmonic(void *argument)
operatorCheckArgc(2);
n_out = atoi(operatorArgv()[0]);
n = atoi(operatorArgv()[1]);
n_out = parameter2int(operatorArgv()[0]);
n = parameter2int(operatorArgv()[1]);
if ( n_out > 9 ) cdoAbort("Maximum number of wave numbers is 9!");
......
......@@ -357,8 +357,8 @@ void *Intgrid(void *argument)
{
operatorInputArg("xinc, yinc");
operatorCheckArgc(2);
xinc = atoi(operatorArgv()[0]);
yinc = atoi(operatorArgv()[1]);
xinc = parameter2int(operatorArgv()[0]);
yinc = parameter2int(operatorArgv()[1]);
}
streamID1 = streamOpenRead(cdoStreamName(0));
......
......@@ -57,7 +57,7 @@ void *Intntime(void *argument)
operatorInputArg("number of timesteps between 2 timesteps");
if ( operatorArgc() < 1 ) cdoAbort("Too few arguments!");
numts = atoi(operatorArgv()[0]);
numts = parameter2int(operatorArgv()[0]);
if ( numts < 2 ) cdoAbort("parameter must be greater than 1!");
streamID1 = streamOpenRead(cdoStreamName(0));
......
......@@ -74,7 +74,7 @@ void *Merstat(void *argument)
if ( operfunc == func_pctl )
{
operatorInputArg("percentile number");
pn = atoi(operatorArgv()[0]);
pn = parameter2int(operatorArgv()[0]);
if ( pn < 1 || pn > 99 )
cdoAbort("Illegal argument: percentile number %d is not in the range 1..99!", pn);
......
......@@ -100,7 +100,7 @@ void *Output(void *argument)
if ( operatorArgc() < 1 ) cdoAbort("Too few arguments!");
format = operatorArgv()[0];
if ( operatorArgc() == 2 ) nelem = atoi(operatorArgv()[1]);
if ( operatorArgc() == 2 ) nelem = parameter2int(operatorArgv()[1]);
}
else if ( operatorID == OUTPUTTAB )
{
......
......@@ -640,7 +640,7 @@ void *Outputgmt(void *argument)
{
operatorInputArg("increment");
operatorCheckArgc(1);
ninc = atoi(operatorArgv()[0]);
ninc = parameter2int(operatorArgv()[0]);
if ( ninc < 1 ) cdoAbort("Increment must be greater than 0!");
}
......
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