Commit 2347c51a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiGetGrid: get gridDescriptionFile with grib_get_string() instead of...

gribapiGetGrid: get gridDescriptionFile with grib_get_string() instead of grib_get_bytes() (bug fix)
parent eda1c09d
......@@ -6,6 +6,7 @@
2013-03-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* stream_gribapi: changed units for level type GRIB2_LTYPE_LANDDEPTH to m (internally mm) [Bug #3287]
* gribapiGetGrid: get gridDescriptionFile with grib_get_string() instead of grib_get_bytes() (bug fix)
2013-03-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -576,25 +576,25 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
{
char uuid[17];
char reference_link[8192];
size_t len = sizeof(reference_link);
reference_link[0] = 0;
size_t len = sizeof(reference_link);
reference_link[0] = 0;
grid->size = numberOfPoints;
if ( grib_get_long(gh, "numberOfGridUsed", &lpar) == 0 )
{
grid->number = lpar;
if ( grib_get_long(gh, "numberOfGridInReference", &lpar) == 0 ) grid->position = lpar;
if ( grib_get_bytes(gh, "gridDescriptionFile", (unsigned char *) reference_link, &len) == 0 )
{
if ( strncmp(reference_link, "file://", 7) == 0 )
grid->reference = strdupx(reference_link);
}
len = (size_t) 16;
if ( grib_get_bytes(gh, "uuidOfHGrid", (unsigned char *) uuid, &len) == 0)
{
strncpy(grid->uuid, uuid, 16);
}
}
if ( grib_get_long(gh, "numberOfGridUsed", &lpar) == 0 )
{
grid->number = lpar;
if ( grib_get_long(gh, "numberOfGridInReference", &lpar) == 0 ) grid->position = lpar;
if ( grib_get_string(gh, "gridDescriptionFile", reference_link, &len) == 0 )
{
if ( strncmp(reference_link, "file://", 7) == 0 )
grid->reference = strdupx(reference_link);
}
len = (size_t) 16;
if ( grib_get_bytes(gh, "uuidOfHGrid", (unsigned char *) uuid, &len) == 0)
{
strncpy(grid->uuid, uuid, 16);
}
}
break;
}
case GRID_GENERIC:
......
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