From 2f63d642923204d979b95d624bb3db06442f212c Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Mon, 13 Oct 2008 13:16:14 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.osgeo.org/postgis/trunk@3095 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwgparse.c | 12 ++++++------ liblwgeom/lwgunparse.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/liblwgeom/lwgparse.c b/liblwgeom/lwgparse.c index 14612d8fa..de5873fb4 100644 --- a/liblwgeom/lwgparse.c +++ b/liblwgeom/lwgparse.c @@ -94,10 +94,10 @@ tuple* free_list=0; /* - * 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 @@ void 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 @@ parse_it(LWGEOM_PARSER_RESULT *lwg_parser_result, const char *geometry, int flag 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; diff --git a/liblwgeom/lwgunparse.c b/liblwgeom/lwgunparse.c index 9a03d281c..e6893a2bd 100644 --- a/liblwgeom/lwgunparse.c +++ b/liblwgeom/lwgunparse.c @@ -75,10 +75,10 @@ static uchar endianbyte; 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 @@ output_line_collection(uchar* geom,outfunc func,int supress) 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 @@ 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) && - (unparser_check_flags & PARSER_CHECK_CLOSURE)) + (current_unparser_check_flags & PARSER_CHECK_CLOSURE)) lwerror("geometry contains non-closed rings"); } @@ -322,11 +322,11 @@ output_curve_collection(uchar* geom,outfunc func,int supress) 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 @@ unparse_WKT(LWGEOM_UNPARSER_RESULT *lwg_unparser_result, uchar* serialized, allo 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 @@ output_wkb_line_collection(uchar* geom,outwkbfunc func) 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 @@ output_wkb_polygon_ring_collection(uchar* geom,outwkbfunc func) /* 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 @@ output_wkb_curve_collection(uchar* geom,outwkbfunc func) 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 @@ unparse_WKB(LWGEOM_UNPARSER_RESULT *lwg_unparser_result, uchar* serialized, allo 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; -- 2.50.1