[postgis-commits] svn - r3826 - trunk/liblwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Mar 10 08:12:12 PDT 2009


Author: pramsey
Date: 2009-03-10 08:12:11 -0700 (Tue, 10 Mar 2009)
New Revision: 3826

Modified:
   trunk/liblwgeom/lwgunparse.c
Log:
Fix for GBT #130, remove bdpoly regression failure.


Modified: trunk/liblwgeom/lwgunparse.c
===================================================================
--- trunk/liblwgeom/lwgunparse.c	2009-03-10 15:06:42 UTC (rev 3825)
+++ trunk/liblwgeom/lwgunparse.c	2009-03-10 15:12:11 UTC (rev 3826)
@@ -346,10 +346,14 @@
        	 	}
 
         	/* Check if they are the same... */
-        	if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
-			(current_unparser_check_flags & PARSER_CHECK_CLOSURE))
+        	if (
+             (first_point[0] != last_point[0] || first_point[1] != last_point[1] ) &&
+			 (current_unparser_check_flags & PARSER_CHECK_CLOSURE))
+			{
                 	LWGEOM_WKT_UNPARSER_ERROR(UNPARSER_ERROR_UNCLOSED);	
+			}
 
+
 		/* Ensure that POLYGON has a minimum of 4 points */
         	if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && orig_cnt < 4)
                 	LWGEOM_WKT_UNPARSER_ERROR(UNPARSER_ERROR_MOREPOINTS);
@@ -835,15 +839,22 @@
 		dimcount++;
 	}
 
-	/* Check if they are the same... */
-	if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
+	/* Check if they are the same... */	
+	if (((first_point[0] != last_point[0]) ||
+		(first_point[1] != last_point[1])) &&
+		(current_unparser_check_flags & PARSER_CHECK_CLOSURE)) 
+	{
+		LWGEOM_WKB_UNPARSER_ERROR(UNPARSER_ERROR_UNCLOSED);
+	}
+
+/*	if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
 		(current_unparser_check_flags & PARSER_CHECK_CLOSURE)) {
 		LWGEOM_WKB_UNPARSER_ERROR(UNPARSER_ERROR_UNCLOSED);
 	}
-
+*/
 	/* Ensure that POLYGON has a minimum of 4 points */
 	if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && orig_cnt < 4)
-		LWGEOM_WKT_UNPARSER_ERROR(UNPARSER_ERROR_MOREPOINTS);
+		LWGEOM_WKB_UNPARSER_ERROR(UNPARSER_ERROR_MOREPOINTS);
 
 	return geom;
 }



More information about the postgis-commits mailing list