PostGIS  2.4.9dev-r@@SVN_REVISION@@
lwin_twkb.c File Reference
#include <math.h>
#include "liblwgeom_internal.h"
#include "lwgeom_log.h"
#include "varint.h"
Include dependency graph for lwin_twkb.c:

Go to the source code of this file.

Data Structures

struct  twkb_parse_state
 Used for passing the parse state between the parsing functions. More...
 

Macros

#define TWKB_IN_MAXCOORDS   4
 

Functions

LWGEOMlwgeom_from_twkb_state (twkb_parse_state *s)
 Internal function declarations. More...
 
static void twkb_parse_state_advance (twkb_parse_state *s, size_t next)
 Check that we are not about to read off the end of the WKB array. More...
 
static int64_t twkb_parse_state_varint (twkb_parse_state *s)
 
static uint64_t twkb_parse_state_uvarint (twkb_parse_state *s)
 
static double twkb_parse_state_double (twkb_parse_state *s, double factor)
 
static void twkb_parse_state_varint_skip (twkb_parse_state *s)
 
static uint32_t lwtype_from_twkb_type (uint8_t twkb_type)
 
static uint8_t byte_from_twkb_state (twkb_parse_state *s)
 Byte Read a byte and advance the parse state forward. More...
 
static POINTARRAYptarray_from_twkb_state (twkb_parse_state *s, uint32_t npoints)
 POINTARRAY Read a dynamically sized point array and advance the parse state forward. More...
 
static LWPOINTlwpoint_from_twkb_state (twkb_parse_state *s)
 POINT. More...
 
static LWLINElwline_from_twkb_state (twkb_parse_state *s)
 LINESTRING. More...
 
static LWPOLYlwpoly_from_twkb_state (twkb_parse_state *s)
 POLYGON. More...
 
static LWCOLLECTIONlwmultipoint_from_twkb_state (twkb_parse_state *s)
 MULTIPOINT. More...
 
static LWCOLLECTIONlwmultiline_from_twkb_state (twkb_parse_state *s)
 MULTILINESTRING. More...
 
static LWCOLLECTIONlwmultipoly_from_twkb_state (twkb_parse_state *s)
 MULTIPOLYGON. More...
 
static LWCOLLECTIONlwcollection_from_twkb_state (twkb_parse_state *s)
 COLLECTION, MULTIPOINTTYPE, MULTILINETYPE, MULTIPOLYGONTYPE. More...
 
static void header_from_twkb_state (twkb_parse_state *s)
 
LWGEOMlwgeom_from_twkb (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 segment (this stops a malevolent user from declaring a one-ring polygon to have 10 rings, causing the WKB reader to walk off the end of the memory). More...