PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ cu_twkb_idlist()

static void cu_twkb_idlist ( char *  wkt,
int64_t *  idlist,
int8_t  prec_xy,
int8_t  prec_z,
int8_t  prec_m,
uint8_t  variant 
)
static

Definition at line 70 of file cu_out_twkb.c.

71 {
73  LWGEOM *g_b;
74  if ( ! g ) lwnotice("input wkt is invalid: %s", wkt);
75  lwvarlena_t *twkb = lwgeom_to_twkb_with_idlist(g, idlist, variant, prec_xy, prec_z, prec_m);
76  lwgeom_free(g);
77  if ( s ) free(s);
78  if ( w ) free(w);
79  s = hexbytes_from_bytes((uint8_t *)twkb->data, LWSIZE_GET(twkb->size) - LWVARHDRSZ);
80  g_b = lwgeom_from_twkb((uint8_t *)twkb->data, LWSIZE_GET(twkb->size) - LWVARHDRSZ, LW_PARSER_CHECK_NONE);
81  w = lwgeom_to_ewkt(g_b);
82  lwgeom_free(g_b);
83  free(twkb);
84 }
static uint8_t variant
Definition: cu_in_twkb.c:26
static char * w
Definition: cu_out_twkb.c:25
static char * s
Definition: cu_out_twkb.c:24
#define LWVARHDRSZ
Definition: liblwgeom.h:311
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
char * hexbytes_from_bytes(const uint8_t *bytes, size_t size)
Definition: lwout_wkb.c:40
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2114
LWGEOM * lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition: lwin_twkb.c:654
#define LWSIZE_GET(varsize)
Macro for reading the size from the GSERIALIZED size attribute.
Definition: liblwgeom.h:324
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:565
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905
lwvarlena_t * lwgeom_to_twkb_with_idlist(const LWGEOM *geom, int64_t *idlist, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m)
Convert LWGEOM to a char* in TWKB format.
Definition: lwout_twkb.c:589
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
void free(void *)
uint32_t size
Definition: liblwgeom.h:307
char data[]
Definition: liblwgeom.h:308

References lwvarlena_t::data, free(), hexbytes_from_bytes(), LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_twkb(), lwgeom_from_wkt(), lwgeom_to_ewkt(), lwgeom_to_twkb_with_idlist(), lwnotice(), LWSIZE_GET, LWVARHDRSZ, s, lwvarlena_t::size, variant, and w.

Referenced by test_twkb_out_idlist().

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