|
From: Arlindo da S. <da...@al...> - 2008-02-03 05:09:22
|
On Feb 2, 2008 7:21 PM, Jennifer Adams <jm...@co...> wrote:
>
>
> Arlindo --
> There is a bug in seekgb.c of the g2clib that causes it to fail to detect
> the end of a grib2 record if sizeof(g2int) != 4 (i.e. on 64-bit systems).
> I guess we should put the patch in the subblib src files we are
> redistributing (on your site and COLA's). This bug causes gribmap to fail to
> find any records -- pretty bad.
>
> # diff ./seekgb.c ~/Desktop/seekgb.c
> 39a40
> > int hdr;
> 68,69c69,70
> < k4=fread(&end,sizeof(g2int),1,lugb);
> < if (k4 == 1 && end == 926365495) { //GRIB message found
> ---
> > k4=fread(&hdr,4,1,lugb);
> > if (k4 == 1 && hdr == 926365495) { //GRIB message found
>
>
If it is OK with you I'll replace int with g2int for consistency with rest
of grib2c. They do assume that g2int = int are 32 bits, but keeping
everything in terms of g2int will make it easier to update the code if we
ran into ints that are > 32 bits.
g2int hdr;
...
k4=fread(&hdr,sizeof(hdr),1,lugb); if (k4 == 1 && hdr
== 926365495) { //GRIB message found
--
Arlindo da Silva
da...@al...
|