[Shapelib] possible bug when reading the boundaries ?

Stephane Routelous route at CAE.COM
Wed May 19 12:09:16 EDT 2004


I'm investigating using ShapeLib instead of our own library because of
performace issues.

I think I found a bug in the code for reading the bounds of a shape file in
at line 448, you have :
    fread( pabyBuf, 100, 1, psSHP->fpSHX );
meaning that you are reading informations from the shx file.

But after, you are reading the bounds with :
    if( bBigEndian ) SwapWord( 8, pabyBuf+36 ); //line 480
    memcpy( &dValue, pabyBuf+36, 8 );
    psSHP->adBoundsMin[0] = dValue;

it means that the bounds are read from the SHX file, but according to the
specifications, the bounds are in the SHP file.
So, I think you should move the reading of the boundaries before the line

Can you confirm ?

Thanks in advance,

Stephane Routelous

More information about the Shapelib mailing list