PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwcurvepoly_from_wkb_state()

static LWCURVEPOLY * lwcurvepoly_from_wkb_state ( wkb_parse_state s)
static

CURVEPOLYTYPE.

Definition at line 648 of file lwin_wkb.c.

649{
650 uint32_t ngeoms = integer_from_wkb_state(s);
651 if (s->error)
652 return NULL;
653 LWCURVEPOLY *cp = lwcurvepoly_construct_empty(s->srid, s->has_z, s->has_m);
654 LWGEOM *geom = NULL;
655 uint32_t i;
656
657 /* Empty collection? */
658 if ( ngeoms == 0 )
659 return cp;
660
661 s->depth++;
662 if (s->depth >= LW_PARSER_MAX_DEPTH)
663 {
664 lwgeom_free((LWGEOM *)cp);
665 lwerror("Geometry has too many chained curves");
666 return NULL;
667 }
668 for ( i = 0; i < ngeoms; i++ )
669 {
670 geom = lwgeom_from_wkb_state(s);
671 if ( lwcurvepoly_add_ring(cp, geom) == LW_FAILURE )
672 {
673 lwgeom_free(geom);
674 lwgeom_free((LWGEOM *)cp);
675 lwerror("Unable to add geometry (%p) to curvepoly (%p)", (void *) geom, (void *) cp);
676 return NULL;
677 }
678 }
679 s->depth--;
680
681 return cp;
682}
char * s
Definition cu_in_wkt.c:23
#define LW_FAILURE
Definition liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
LWCURVEPOLY * lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition lwcurvepoly.c:35
int lwcurvepoly_add_ring(LWCURVEPOLY *poly, LWGEOM *ring)
Add a ring, allocating extra space if necessary.
Definition lwcurvepoly.c:71
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint32_t integer_from_wkb_state(wkb_parse_state *s)
Int32 Read 4-byte integer and advance the parse state forward.
Definition lwin_wkb.c:285
#define LW_PARSER_MAX_DEPTH
Max depth in a geometry.
Definition lwin_wkb.c:34
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition lwin_wkb.c:743

References integer_from_wkb_state(), LW_FAILURE, LW_PARSER_MAX_DEPTH, lwcurvepoly_add_ring(), lwcurvepoly_construct_empty(), lwerror(), lwgeom_free(), lwgeom_from_wkb_state(), and s.

Referenced by lwgeom_from_wkb_state().

Here is the call graph for this function:
Here is the caller graph for this function: