[postgis] Fixed - odd insert problem

Dave Blasby dblasby at refractions.net
Tue Jun 19 17:09:07 PDT 2001



Frank Warmerdam wrote:
> The error seems to be in the assumptions about 4 vs. 8 byte alignment.  It
> seems that under linux stuff only needs to be four byte aligned.

This is exactly what was wrong.  Sparc aligns doubles on 8 bytes and
i386 aligns on 4 bytes.  This causes problems when the GEOMETRY
structure was originally created on a 4-byte boundary, then later
re-allocated on a 8-byte boundary (or vis-versa).  This would never
happen on a sparc.

The solution is easy, replace everything that looks like:

>             if ((int32) pts != (((int32)pts>>3)<<3) )
>                 pts = (POINT3D *) ((char *) pts + 4);

with 
	     pts = (POINT3D *) MAXALIGN(pts);

I was going to do this in a later release anyways since its more
readable.
{ On a sparc, the MAXALIGN macro will align to 8 byte boundaries, and on
i386 to 4 byte boundaries}

 
Release 0.2 will have this fix in it.

dave

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list