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

◆ lwgeom_to_wkb_write_buf()

static ptrdiff_t lwgeom_to_wkb_write_buf ( const LWGEOM geom,
uint8_t  variant,
uint8_t *  buffer 
)
static

Convert LWGEOM to a char* in WKB format.

Caller is responsible for freeing the returned array.

Parameters
variant.Unsigned bitmask value. Accepts one of: WKB_ISO, WKB_EXTENDED, WKB_SFSQL. Accepts any of: WKB_NDR, WKB_HEX. For example: Variant = ( WKB_ISO | WKB_NDR ) would return the little-endian ISO form of WKB. For Example: Variant = ( WKB_EXTENDED | WKB_HEX ) would return the big-endian extended form of WKB, as hex-encoded ASCII (the "canonical form").
size_outIf supplied, will return the size of the returned memory segment, including the null terminator in the case of ASCII.

Definition at line 797 of file lwout_wkb.c.

798{
799 /* If neither or both variants are specified, choose the native order */
800 if (!(variant & WKB_NDR || variant & WKB_XDR) || (variant & WKB_NDR && variant & WKB_XDR))
801 {
802 if (IS_BIG_ENDIAN)
804 else
806 }
807
808 /* Write the WKB into the output buffer */
809 int written_bytes = (lwgeom_to_wkb_buf(geom, buffer, variant) - buffer);
810
811 return written_bytes;
812}
static uint8_t variant
Definition cu_in_twkb.c:26
#define IS_BIG_ENDIAN
Definition liblwgeom.h:326
#define WKB_NDR
Definition liblwgeom.h:2213
#define WKB_XDR
Definition liblwgeom.h:2214
static uint8_t * lwgeom_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant)
Definition lwout_wkb.c:739
Datum buffer(PG_FUNCTION_ARGS)

References buffer(), IS_BIG_ENDIAN, lwgeom_to_wkb_buf(), variant, WKB_NDR, and WKB_XDR.

Referenced by lwgeom_to_wkb_buffer(), and lwgeom_to_wkb_varlena().

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