// printf("%s\n", str);
lwfree(str);
- // See http://trac.osgeo.org/postgis/ticket/2412
+ // See http://trac.osgeo.org/postgis/ticket/2425
+ // and http://trac.osgeo.org/postgis/ticket/2420
+ in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10,0 0)");
+ out = lwgeom_desegmentize(in);
+ str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
+ CU_ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10,0 0)");
+ lwgeom_free(in);
+ lwgeom_free(out);
+ lwfree(str);
+
+ // See http://trac.osgeo.org/postgis/ticket/2412
in = lwgeom_from_text("LINESTRING(0 0, 1 1)");
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
+
}
static void test_ptarray_contains_point()
#include "liblwgeom_internal.h"
-//#define POSTGIS_DEBUG_LEVEL 4
+/* #define POSTGIS_DEBUG_LEVEL 4 */
#include "lwgeom_log.h"
/* Allocate our result array of vertices that are part of arcs */
num_edges = points->npoints - 1;
- edges_in_arcs = lwalloc(num_edges);
- memset(edges_in_arcs, 0, num_edges);
+ edges_in_arcs = lwalloc(num_edges + 1);
+ memset(edges_in_arcs, 0, num_edges + 1);
/* We make a candidate arc of the first two edges, */
/* And then see if the next edge follows it */