PostGIS  2.1.10dev-r@@SVN_REVISION@@
char* hexbytes_from_bytes ( uint8_t *  bytes,
size_t  size 
)

Definition at line 23 of file lwout_wkb.c.

References hexchr, lwalloc(), and lwerror().

Referenced by cu_wkb_in().

24 {
25  char *hex;
26  int i;
27  if ( ! bytes || ! size )
28  {
29  lwerror("hexbutes_from_bytes: invalid input");
30  return NULL;
31  }
32  hex = lwalloc(size * 2 + 1);
33  hex[2*size] = '\0';
34  for( i = 0; i < size; i++ )
35  {
36  /* Top four bits to 0-F */
37  hex[2*i] = hexchr[bytes[i] >> 4];
38  /* Bottom four bits to 0-F */
39  hex[2*i+1] = hexchr[bytes[i] & 0x0F];
40  }
41  return hex;
42 }
static char * hexchr
Definition: lwout_wkb.c:21
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: