PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ hexbytes_from_bytes()

char* hexbytes_from_bytes ( const uint8_t *  bytes,
size_t  size 
)

Definition at line 40 of file lwout_wkb.c.

41 {
42  char *hex;
43  uint32_t i;
44  if ( ! bytes || ! size )
45  {
46  lwerror("hexbutes_from_bytes: invalid input");
47  return NULL;
48  }
49  hex = lwalloc(size * 2 + 1);
50  hex[2*size] = '\0';
51  for( i = 0; i < size; i++ )
52  {
53  /* Top four bits to 0-F */
54  hex[2*i] = hexchr[bytes[i] >> 4];
55  /* Bottom four bits to 0-F */
56  hex[2*i+1] = hexchr[bytes[i] & 0x0F];
57  }
58  return hex;
59 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static char * hexchr
Definition: lwout_wkb.c:38

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

Referenced by cu_twkb(), cu_twkb_idlist(), cu_twkb_in(), cu_wkb_in(), do_test_s32_varint(), do_test_s64_varint(), do_test_u32_varint(), and do_test_u64_varint().

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