/*将二进制数据转化成16进制字符串,并将结果存入to中*/ int __wt_raw_to_hex(WT_SESSION_IMPL *session, const uint8_t *from, size_t size, WT_ITEM *to) { size_t len; len = size * 2 + 1; WT_RET(__wt_buf_init(session, to, len)); __fill_hex(from, size, to->mem, len, &to->size); return 0; }
/* * __wt_raw_to_hex -- * Convert a chunk of data to a nul-terminated printable hex string. */ int __wt_raw_to_hex( WT_SESSION_IMPL *session, const uint8_t *from, size_t size, WT_ITEM *to) { size_t len; /* * Every byte takes up 2 spaces, plus a trailing nul byte. */ len = size * 2 + 1; WT_RET(__wt_buf_init(session, to, len)); __fill_hex(from, size, to->mem, len, &to->size); return (0); }
/* * __wt_fill_hex -- * In-memory conversion of raw bytes to a hexadecimal representation. */ void __wt_fill_hex(const uint8_t *src, size_t src_max, uint8_t *dest, size_t dest_max, size_t *lenp) { __fill_hex(src, src_max, dest, dest_max, lenp); }