PostGIS  2.5.7dev-r@@SVN_REVISION@@
lwin_wkb.c File Reference
#include "../postgis_config.h"
#include "liblwgeom_internal.h"
#include "lwgeom_log.h"
#include <math.h>
#include <limits.h>
Include dependency graph for lwin_wkb.c:

Go to the source code of this file.

Data Structures

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

Macros

#define LW_PARSER_MAX_DEPTH   200
 Max depth in a geometry. More...
 

Functions

LWGEOMlwgeom_from_wkb_state (wkb_parse_state *s)
 Internal function declarations. More...
 
uint8_tbytes_from_hexbytes (const char *hexbuf, size_t hexsize)
 
static void wkb_parse_state_check (wkb_parse_state *s, size_t next)
 Check that we are not about to read off the end of the WKB array. More...
 
static void lwtype_from_wkb_state (wkb_parse_state *s, uint32_t wkb_type)
 Take in an unknown kind of wkb type number and ensure it comes out as an extended WKB type number (with Z/M/SRID flags masked onto the high bits). More...
 
static char byte_from_wkb_state (wkb_parse_state *s)
 Byte Read a byte and advance the parse state forward. More...
 
static uint32_t integer_from_wkb_state (wkb_parse_state *s)
 Int32 Read 4-byte integer and advance the parse state forward. More...
 
static double double_from_wkb_state (wkb_parse_state *s)
 Double Read an 8-byte double and advance the parse state forward. More...
 
static POINTARRAYptarray_from_wkb_state (wkb_parse_state *s)
 POINTARRAY Read a dynamically sized point array and advance the parse state forward. More...
 
static LWPOINTlwpoint_from_wkb_state (wkb_parse_state *s)
 POINT Read a WKB point, starting just after the endian byte, type number and optional srid number. More...
 
static LWLINElwline_from_wkb_state (wkb_parse_state *s)
 LINESTRING Read a WKB linestring, starting just after the endian byte, type number and optional srid number. More...
 
static LWCIRCSTRINGlwcircstring_from_wkb_state (wkb_parse_state *s)
 CIRCULARSTRING Read a WKB circularstring, starting just after the endian byte, type number and optional srid number. More...
 
static LWPOLYlwpoly_from_wkb_state (wkb_parse_state *s)
 POLYGON Read a WKB polygon, starting just after the endian byte, type number and optional srid number. More...
 
static LWTRIANGLElwtriangle_from_wkb_state (wkb_parse_state *s)
 TRIANGLE Read a WKB triangle, starting just after the endian byte, type number and optional srid number. More...
 
static LWCURVEPOLYlwcurvepoly_from_wkb_state (wkb_parse_state *s)
 CURVEPOLYTYPE. More...
 
static LWCOLLECTIONlwcollection_from_wkb_state (wkb_parse_state *s)
 POLYHEDRALSURFACETYPE. More...
 
LWGEOMlwgeom_from_wkb (const uint8_t *wkb, const size_t wkb_size, const 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...
 
LWGEOMlwgeom_from_hexwkb (const char *hexwkb, const char check)
 

Variables

static uint8_t hex2char [256]