[postgis-commits] svn - r2719 - trunk/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Nov 27 14:39:07 PST 2007


Author: mcayland
Date: 2007-11-27 14:39:06 -0800 (Tue, 27 Nov 2007)
New Revision: 2719

Modified:
   trunk/lwgeom/liblwgeom.h
   trunk/lwgeom/lwcurve.c
   trunk/lwgeom/lwgeom_api.c
   trunk/lwgeom/lwgeom_pg.c
   trunk/lwgeom/lwline.c
   trunk/lwgeom/lwpoint.c
   trunk/lwgeom/lwpoly.c
Log:
Rename the existing get_int32() and get_uint32() functions to lw_get_int32() and lw_get_uint32() respectively in order to avoid a collision with functions of the same name in newer versions of OS X. This should resolve the problem with PostGIS crashing on some OS X installations. Many thanks to William Kyngesburye and others for resolving this issue.

Modified: trunk/lwgeom/liblwgeom.h
===================================================================
--- trunk/lwgeom/liblwgeom.h	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/liblwgeom.h	2007-11-27 22:39:06 UTC (rev 2719)
@@ -888,8 +888,8 @@
  * utility
  ****************************************************************/
 
-extern uint32 get_uint32(const uchar *loc);
-extern int32 get_int32(const uchar *loc);
+extern uint32 lw_get_uint32(const uchar *loc);
+extern int32 lw_get_int32(const uchar *loc);
 extern void printBOX3D(BOX3D *b);
 extern void printPA(POINTARRAY *pa);
 extern void printLWPOINT(LWPOINT *point);

Modified: trunk/lwgeom/lwcurve.c
===================================================================
--- trunk/lwgeom/lwcurve.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwcurve.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -107,7 +107,7 @@
 #ifdef PGIS_DEBUG
                 lwnotice("lwcurve_deserialize: input has srid");
 #endif
-                result->SRID = get_int32(loc);               
+                result->SRID = lw_get_int32(loc);               
                 loc += 4; /* type + SRID */
          }
          else
@@ -120,7 +120,7 @@
 
          /* we've read the type (1 byte) and SRID (4 bytes, if present) */
 
-         npoints = get_uint32(loc);
+         npoints = lw_get_uint32(loc);
 #ifdef PGIS_DEBUG
          lwnotice("curve npoints = %d", npoints);
 #endif         
@@ -505,7 +505,7 @@
         }
 
         /* we've read the type (1 byte) and SRID (4 bytes, if present) */
-        npoints = get_uint32(loc);
+        npoints = lw_get_uint32(loc);
         result += sizeof(uint32); /* npoints */
 
         result += TYPE_NDIMS(type) * sizeof(double) * npoints;

Modified: trunk/lwgeom/lwgeom_api.c
===================================================================
--- trunk/lwgeom/lwgeom_api.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwgeom_api.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -906,7 +906,7 @@
 
 /* handle missaligned unsigned int32 data */
 uint32
-get_uint32(const uchar *loc)
+lw_get_uint32(const uchar *loc)
 {
 	uint32 result;
 
@@ -916,7 +916,7 @@
 
 /* handle missaligned signed int32 data */
 int32
-get_int32(const uchar *loc)
+lw_get_int32(const uchar *loc)
 {
 	int32 result;
 
@@ -974,7 +974,7 @@
 
 	if ( lwgeom_hasSRID(typefl) )
 	{
-		result->SRID = get_int32(loc);
+		result->SRID = lw_get_int32(loc);
 		loc += 4;
 	}
 
@@ -990,7 +990,7 @@
 
 	/* its a GeometryCollection or multi* geometry */
 
-	result->ngeometries = get_uint32(loc);
+	result->ngeometries = lw_get_uint32(loc);
 	loc +=4;
 
 #ifdef PGIS_DEBUG
@@ -1307,7 +1307,7 @@
 		loc += 4;
 	}
 	/* its a GeometryCollection or multi* geometry */
-	return get_uint32(loc);
+	return lw_get_uint32(loc);
 }
 
 /*
@@ -1590,7 +1590,7 @@
 	}
 
 
-	ngeoms = get_uint32(loc);
+	ngeoms = lw_get_uint32(loc);
 	loc +=4;
 	result += 4; /* numgeoms */
 
@@ -1745,7 +1745,7 @@
 		loc +=4;
 	}
 
-	ngeoms = get_uint32(loc);
+	ngeoms = lw_get_uint32(loc);
 	loc += 4;
 
 	/* each sub-type */
@@ -1926,7 +1926,7 @@
 		loc += sizeof(BOX2DFLOAT4);
 	}
 
-	return get_int32(loc);
+	return lw_get_int32(loc);
 }
 
 char

Modified: trunk/lwgeom/lwgeom_pg.c
===================================================================
--- trunk/lwgeom/lwgeom_pg.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwgeom_pg.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -404,7 +404,7 @@
 		loc += sizeof(BOX2DFLOAT4);
 	}
 
-	return get_int32(loc);
+	return lw_get_int32(loc);
 }
 
 

Modified: trunk/lwgeom/lwline.c
===================================================================
--- trunk/lwgeom/lwline.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwline.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -98,7 +98,7 @@
 	if ( lwgeom_hasSRID(type))
 	{
 		/*lwnotice("line has srid"); */
-		result->SRID = get_int32(loc);
+		result->SRID = lw_get_int32(loc);
 		loc +=4; /* type + SRID */
 	}
 	else
@@ -109,7 +109,7 @@
 
 	/* we've read the type (1 byte) and SRID (4 bytes, if present) */
 
-	npoints = get_uint32(loc);
+	npoints = lw_get_uint32(loc);
 	/*lwnotice("line npoints = %d", npoints); */
 	loc +=4;
 	pa = pointArray_construct(loc, TYPE_HASZ(type), TYPE_HASM(type), npoints);
@@ -303,7 +303,7 @@
 	}
 
 	/* we've read the type (1 byte) and SRID (4 bytes, if present) */
-	npoints = get_uint32(loc);
+	npoints = lw_get_uint32(loc);
 	result += sizeof(uint32); /* npoints */
 
 	result += TYPE_NDIMS(type) * sizeof(double) * npoints;

Modified: trunk/lwgeom/lwpoint.c
===================================================================
--- trunk/lwgeom/lwpoint.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwpoint.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -298,7 +298,7 @@
 #ifdef PGIS_DEBUG
 		lwnotice("lwpoint_deserialize: input has SRID");
 #endif
-		result->SRID = get_int32(loc);
+		result->SRID = lw_get_int32(loc);
 		loc += 4; /* type + SRID */
 	}
 	else

Modified: trunk/lwgeom/lwpoly.c
===================================================================
--- trunk/lwgeom/lwpoly.c	2007-11-27 22:19:30 UTC (rev 2718)
+++ trunk/lwgeom/lwpoly.c	2007-11-27 22:39:06 UTC (rev 2719)
@@ -116,7 +116,7 @@
 
 	if ( lwgeom_hasSRID(type))
 	{
-		result->SRID = get_int32(loc);
+		result->SRID = lw_get_int32(loc);
 		loc +=4; /* type + SRID */
 	}
 	else
@@ -124,7 +124,7 @@
 		result->SRID = -1;
 	}
 
-	nrings = get_uint32(loc);
+	nrings = lw_get_uint32(loc);
 	result->nrings = nrings;
 	loc +=4;
 	result->rings = (POINTARRAY**) lwalloc(nrings* sizeof(POINTARRAY*));
@@ -132,7 +132,7 @@
 	for (t =0;t<nrings;t++)
 	{
 		/* read in a single ring and make a PA */
-		npoints = get_uint32(loc);
+		npoints = lw_get_uint32(loc);
 		loc +=4;
 
 		result->rings[t] = pointArray_construct(loc, hasz, hasm, npoints);
@@ -299,7 +299,7 @@
 	}
 
 
-	nrings = get_uint32(loc);
+	nrings = lw_get_uint32(loc);
 	loc +=4;
 	result +=4;
 
@@ -309,7 +309,7 @@
 	for (t =0;t<nrings;t++)
 	{
 		/* read in a single ring and make a PA */
-		npoints = get_uint32(loc);
+		npoints = lw_get_uint32(loc);
 		loc += 4;
 		result += 4;
 



More information about the postgis-commits mailing list