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

◆ integer_from_wkb_state()

static uint32_t integer_from_wkb_state ( wkb_parse_state s)
static

Int32 Read 4-byte integer and advance the parse state forward.

Definition at line 278 of file lwin_wkb.c.

279{
280 uint32_t i = 0;
281
283 if (s->error)
284 return 0;
285
286 memcpy(&i, s->pos, WKB_INT_SIZE);
287
288 /* Swap? Copy into a stack-allocated integer. */
289 if( s->swap_bytes )
290 {
291 int j = 0;
292 uint8_t tmp;
293
294 for( j = 0; j < WKB_INT_SIZE/2; j++ )
295 {
296 tmp = ((uint8_t*)(&i))[j];
297 ((uint8_t*)(&i))[j] = ((uint8_t*)(&i))[WKB_INT_SIZE - j - 1];
298 ((uint8_t*)(&i))[WKB_INT_SIZE - j - 1] = tmp;
299 }
300 }
301
302 s->pos += WKB_INT_SIZE;
303 return i;
304}
char * s
Definition cu_in_wkt.c:23
#define WKB_INT_SIZE
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.
Definition lwin_wkb.c:131

References s, WKB_INT_SIZE, and wkb_parse_state_check().

Referenced by lwcollection_from_wkb_state(), lwcurvepoly_from_wkb_state(), lwgeom_from_wkb_state(), lwpoly_from_wkb_state(), lwtriangle_from_wkb_state(), and ptarray_from_wkb_state().

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