예제 #1
0
파일: hex.c 프로젝트: rain10154/wiredtiger
/*将二进制数据转化成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;
}
예제 #2
0
파일: hex.c 프로젝트: ksuarz/mongo
/*
 * __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);
}
예제 #3
0
파일: hex.c 프로젝트: ksuarz/mongo
/*
 * __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);
}