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

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Sun Jan 4 12:39:11 PST 2009


Author: mcayland
Date: 2009-01-04 12:39:11 -0800 (Sun, 04 Jan 2009)
New Revision: 3491

Modified:
   trunk/liblwgeom/lwgeom.c
Log:
Fix comment in lwgeom_from_ewkt() and also add a quick error check to lwgeom_from_ewkt() and lwgeom_from_ewkb() - otherwise upon parse failure we could pass a half-baked geometry back to the caller which would not be good :(


Modified: trunk/liblwgeom/lwgeom.c
===================================================================
--- trunk/liblwgeom/lwgeom.c	2009-01-04 20:11:03 UTC (rev 3490)
+++ trunk/liblwgeom/lwgeom.c	2009-01-04 20:39:11 UTC (rev 3491)
@@ -535,6 +535,8 @@
 
 	/* Rely on grammar parser to construct a LWGEOM */
 	result = serialized_lwgeom_from_ewkt(&lwg_parser_result, hexewkb, flags);
+	if (result)
+		lwerror("%s", (char *)lwg_parser_result.message);
 
 	/* Free intermediate HEXified representation */
 	lwfree(hexewkb);
@@ -546,11 +548,7 @@
 }
 
 /*
- * Make an LWGEOM object from a EWKB binary representation.
- * Currently highly unoptimized as it:
- * 	- convert EWKB to HEXEWKB 
- *	- construct PG_LWGEOM
- *	- deserialize it
+ * Make an LWGEOM object from a EWKT representation.
  */
 LWGEOM *
 lwgeom_from_ewkt(char *ewkt, int flags)
@@ -561,6 +559,8 @@
 
 	/* Rely on grammar parser to construct a LWGEOM */
 	result = serialized_lwgeom_from_ewkt(&lwg_parser_result, ewkt, flags);
+	if (result)
+		lwerror("%s", (char *)lwg_parser_result.message);
 
 	/* Deserialize */
 	ret = lwgeom_deserialize(lwg_parser_result.serialized_lwgeom);



More information about the postgis-commits mailing list