PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcurvepoly_from_wkb_state()

static LWCURVEPOLY* lwcurvepoly_from_wkb_state ( wkb_parse_state s)
static

CURVEPOLYTYPE.

Definition at line 639 of file lwin_wkb.c.

640 {
641  uint32_t ngeoms = integer_from_wkb_state(s);
642  if (s->error)
643  return NULL;
644  LWCURVEPOLY *cp = lwcurvepoly_construct_empty(s->srid, s->has_z, s->has_m);
645  LWGEOM *geom = NULL;
646  uint32_t i;
647 
648  /* Empty collection? */
649  if ( ngeoms == 0 )
650  return cp;
651 
652  for ( i = 0; i < ngeoms; i++ )
653  {
654  geom = lwgeom_from_wkb_state(s);
655  if ( lwcurvepoly_add_ring(cp, geom) == LW_FAILURE )
656  {
657  lwgeom_free(geom);
658  lwgeom_free((LWGEOM *)cp);
659  lwerror("Unable to add geometry (%p) to curvepoly (%p)", geom, cp);
660  return NULL;
661  }
662  }
663 
664  return cp;
665 }
char * s
Definition: cu_in_wkt.c:23
#define LW_FAILURE
Definition: liblwgeom.h:110
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
int lwcurvepoly_add_ring(LWCURVEPOLY *poly, LWGEOM *ring)
Add a ring, allocating extra space if necessary.
Definition: lwcurvepoly.c:71
LWCURVEPOLY * lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwcurvepoly.c:35
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
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:278
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:726

References integer_from_wkb_state(), LW_FAILURE, 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: