]> granicus.if.org Git - postgis/commitdiff
Fix for GBT #130, remove bdpoly regression failure.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 10 Mar 2009 15:12:11 +0000 (15:12 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 10 Mar 2009 15:12:11 +0000 (15:12 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3826 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgunparse.c

index 580daae70cbcfd0f3d2a55c6bc46fb3d5cc29fd8..949136fb5428e0720732c05594d7e0dcca59d734 100644 (file)
@@ -346,9 +346,13 @@ output_polygon_ring_collection(uchar* geom,outfunc func,int supress)
                        }
 
                /* 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)
@@ -835,15 +839,22 @@ output_wkb_polygon_ring_collection(uchar* geom,outwkbfunc func)
                dimcount++;
        }
 
-       /* Check if they are the same... */
-       if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
-               (current_unparser_check_flags & PARSER_CHECK_CLOSURE)) {
+       /* 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;
 }