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

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Oct 13 06:16:14 PDT 2008


Author: mcayland
Date: 2008-10-13 06:16:14 -0700 (Mon, 13 Oct 2008)
New Revision: 3095

Modified:
   trunk/liblwgeom/lwgparse.c
   trunk/liblwgeom/lwgunparse.c
Log:
Rename parser_check_flags to current_parser_check_flags and unparser_check_flags to current_unparser_check_flags to clarify that these status variables only reflect the checks enabled for the current parse.


Modified: trunk/liblwgeom/lwgparse.c
===================================================================
--- trunk/liblwgeom/lwgparse.c	2008-10-13 13:03:23 UTC (rev 3094)
+++ trunk/liblwgeom/lwgparse.c	2008-10-13 13:16:14 UTC (rev 3095)
@@ -94,10 +94,10 @@
 
 
 /*
- * Parser global check flags - a bitmap of flags that determine which checks the parser will perform 
+ * Parser current instance check flags - a bitmap of flags that determine which checks are enabled during the current parse 
  * (see liblwgeom.h for the related PARSER_CHECK constants)
  */
-int parser_check_flags;
+int current_parser_check_flags;
 
 
 /* Parser state flags - these are set automatically by the parser */
@@ -281,21 +281,21 @@
 popc(void)
 {
 	/* If the minimum point check has been enabled, perform it */
-	if (parser_check_flags & PARSER_CHECK_MINPOINTS) {
+	if (current_parser_check_flags & PARSER_CHECK_MINPOINTS) {
 		if ( the_geom.stack->uu.nn.num < minpoints){
 			error("geometry requires more points");
 		}
 	}
 
 	/* If the odd number point check has been enabled, perform it */
-	if (parser_check_flags & PARSER_CHECK_ODD) {
+	if (current_parser_check_flags & PARSER_CHECK_ODD) {
         	if(isodd != -1 && the_geom.stack->uu.nn.num % 2 != isodd) {
                 	error("geometry must have an odd number of points");
         	}
 	}
 
 	/* If the polygon closure check has been enabled, perform it */
-	if (parser_check_flags & PARSER_CHECK_CLOSURE) {
+	if (current_parser_check_flags & PARSER_CHECK_CLOSURE) {
 		if ( checkclosed && first_point && last_point) {
 			if ( memcmp(first_point, last_point,
 				sizeof(double)*the_geom.ndims) )
@@ -1133,7 +1133,7 @@
 	ferror_occured = 0;
 
 	/* Setup the inital parser flags and empty the return struct */
-	parser_check_flags = flags;
+	current_parser_check_flags = flags;
 	lwg_parser_result->serialized_lwgeom = NULL;
 	lwg_parser_result->size = 0;
 

Modified: trunk/liblwgeom/lwgunparse.c
===================================================================
--- trunk/liblwgeom/lwgunparse.c	2008-10-13 13:03:23 UTC (rev 3094)
+++ trunk/liblwgeom/lwgunparse.c	2008-10-13 13:16:14 UTC (rev 3095)
@@ -75,10 +75,10 @@
 void (*write_wkb_bytes)(uchar* ptr,unsigned int cnt,size_t size);
 
 /*
- * Parser global check flags - a bitmap of flags that determine which checks the parser will perform
+ * Unparser current instance check flags - a bitmap of flags that determine which checks are enabled during the current unparse
  * (see liblwgeom.h for the related PARSER_CHECK constants)
  */
-int unparser_check_flags;
+int current_unparser_check_flags;
 
 /*
  * Unparser result structure
@@ -243,7 +243,7 @@
 	int cnt = read_int(&geom);
 
 	/* Ensure that LINESTRING has a minimum of 2 points */
-	if ((unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 2)
+	if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 2)
 		lwerror("geometry requires more points");
 
 	if ( cnt == 0 ){
@@ -308,7 +308,7 @@
 
         	/* Check if they are the same... */
         	if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
-			(unparser_check_flags & PARSER_CHECK_CLOSURE))
+			(current_unparser_check_flags & PARSER_CHECK_CLOSURE))
                 	lwerror("geometry contains non-closed rings");
 
 	}
@@ -322,11 +322,11 @@
 	int cnt = read_int(&geom);
 
 	/* Ensure that a CIRCULARSTRING has a minimum of 3 points */
-        if ((unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 3)
+        if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 3)
                 lwerror("geometry requires more points");
 
 	/* Ensure that a CIRCULARSTRING has an odd number of points */
-        if ((unparser_check_flags & PARSER_CHECK_ODD) && cnt % 2 != 1)
+        if ((current_unparser_check_flags & PARSER_CHECK_ODD) && cnt % 2 != 1)
                 lwerror("geometry must have an odd number of points");
 
 	if ( cnt == 0 ){
@@ -579,7 +579,7 @@
 		return 0;
 
 	/* Setup the inital parser flags and empty the return struct */
-        unparser_check_flags = flags;
+        current_unparser_check_flags = flags;
 	lwg_unparser_result->wkoutput = NULL;
         lwg_unparser_result->size = 0;
 
@@ -711,7 +711,7 @@
 	LWDEBUGF(2, "output_wkb_line_collection: %d iterations loop", cnt);
 
 	/* Ensure that LINESTRING has a minimum of 2 points */
-        if ((unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 2)
+        if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 2)
                 lwerror("geometry requires more points");
 
 	write_wkb_int(cnt);
@@ -758,7 +758,7 @@
 
 	/* Check if they are the same... */
 	if (memcmp(&first_point, &last_point, sizeof(double) * dims) &&
-		(unparser_check_flags & PARSER_CHECK_CLOSURE))
+		(current_unparser_check_flags & PARSER_CHECK_CLOSURE))
 		lwerror("geometry contains non-closed rings");
 
 	return geom;
@@ -782,11 +782,11 @@
 	LWDEBUGF(2, "output_wkb_curve_collection: %d iterations loop", cnt);
 
 	/* Ensure that a CIRCULARSTRING has a minimum of 3 points */
-        if ((unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 3)
+        if ((current_unparser_check_flags & PARSER_CHECK_MINPOINTS) && cnt < 3)
                 lwerror("geometry requires more points");
 
 	/* Ensure that a CIRCULARSTRING has an odd number of points */
-        if ((unparser_check_flags & PARSER_CHECK_ODD) && cnt % 2 != 1)
+        if ((current_unparser_check_flags & PARSER_CHECK_ODD) && cnt % 2 != 1)
                 lwerror("geometry must have an odd number of points");
 
 	write_wkb_int(cnt);
@@ -893,7 +893,7 @@
 		return 0;
 
 	/* Setup the inital parser flags and empty the return struct */
-        unparser_check_flags = flags;
+        current_unparser_check_flags = flags;
 	lwg_unparser_result->wkoutput = NULL;
 	lwg_unparser_result->size = 0;
 



More information about the postgis-commits mailing list