Commit 277007dd authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribexDefParam: check validity of parameter number

parent 07a68777
......@@ -3,6 +3,10 @@
* Version 1.6.4 released
* using CGRIBEX library version 1.6.4
2014-03-10 Uwe Schulzweida
* cgribexDefParam: check validity of parameter number
2014-03-04 Uwe Schulzweida
* zaxisCreate: check number of levels
......
......@@ -319,7 +319,8 @@ void printShortinfo(int streamID, int vlistID, int vardis)
char pstr[4];
char paramstr[32];
printf(" File format: ");
fprintf(stdout, " File format");
fprintf(stdout, " : ");
printFiletype(streamID, vlistID);
if ( vardis )
......
......@@ -1454,6 +1454,7 @@ static
void cgribexDefParam(int *isec1, int param)
{
int pdis, pcat, pnum;
static bool lwarn_pdis = true, lwarn_pnum = true;
cdiDecodeParam(param, &pnum, &pcat, &pdis);
......@@ -1463,7 +1464,21 @@ void cgribexDefParam(int *isec1, int param)
{
char paramstr[32];
cdiParamToString(param, paramstr, sizeof(paramstr));
Warning("Can't convert GRIB2 parameter ID (%s) to GRIB1, set to %d.%d!", paramstr, pnum, pcat);
if ( lwarn_pdis )
{
Warning("Can't convert GRIB2 parameter ID (%s) to GRIB1, set to %d.%d!", paramstr, pnum, pcat);
lwarn_pdis = false;
}
}
if ( pnum > 255 )
{
if ( lwarn_pnum )
{
Warning("Parameter number %d out of bounds (1-255), set to %d!", pnum, pnum%256);
lwarn_pnum = false;
pnum = pnum%256;
}
}
ISEC1_CodeTable = pcat;
......
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