Commit 55d9d2f8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

fixed-a-wrong-assumption-about-sensible-sign-extensi.patch

parent 590ddeed
......@@ -405,6 +405,7 @@ int cdiGribIterator_levelType(CdiIterator *super, int levelSelector, char **outN
static double logicalLevelValue2(long gribType, long storedValue, long power)
{
double factor = 1;
assert(power >= 0);
while(power--) factor *= 10; //this is precise up to factor == 22.
switch(gribType)
{
......@@ -450,7 +451,7 @@ static int readLevel2(grib_handle *gribHandle, const char *levelTypeKey, const c
default:
{
long power = gribGetLongDefault(gribHandle, powerKey, 0); //1 byte
long power = 255 & gribGetLongDefault(gribHandle, powerKey, 0); //1 byte
if(power == 255) power = 0;
long value = gribGetLongDefault(gribHandle, valueKey, 0); //4 bytes
*outValue1 = logicalLevelValue2(levelType, value, power);
......
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