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

gribapiDefParam: check range of parameter number

parent b4889299
2015-06-02 Uwe Schulzweida
* gribapiDefParam: check range of parameter number
2015-05-28 Uwe Schulzweida
* dmemory: added env. MEMORY_INFO
......
......@@ -1421,7 +1421,7 @@ void cgribexDefParam(int *isec1, int param)
static bool lwarn_pnum = true;
if ( pnum > 255 && lwarn_pnum )
{
Warning("Parameter number %d out of bounds (1-255), set to %d!", pnum, pnum%256);
Warning("Parameter number %d out of range (1-255), set to %d!", pnum, pnum%256);
lwarn_pnum = false;
pnum = pnum%256;
}
......
......@@ -1598,6 +1598,14 @@ void gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *
{
if ( pnum < 0 ) pnum = -pnum;
static bool lwarn_pnum = true;
if ( pnum > 255 && lwarn_pnum )
{
Warning("Parameter number %d out of range (1-255), set to %d!", pnum, pnum%256);
lwarn_pnum = false;
pnum = pnum%256;
}
if ( editionNumber <= 1 )
{
static bool lwarn_pdis = true;
......@@ -1609,14 +1617,6 @@ void gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *
lwarn_pdis = false;
}
static bool lwarn_pnum = true;
if ( pnum > 255 && lwarn_pnum )
{
Warning("Parameter number %d out of bounds (1-255), set to %d!", pnum, pnum%256);
lwarn_pnum = false;
pnum = pnum%256;
}
GRIB_CHECK(my_grib_set_long(gh, "table2Version", pcat), 0);
GRIB_CHECK(my_grib_set_long(gh, "indicatorOfParameter", pnum), 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