aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2011-05-05 20:48:21 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2011-05-05 20:48:21 +0000
commit453d0a85686e332798ba43164c60947abfbefbd0 (patch)
tree584ed98bf2f60e687b9c4d09ebc01dd05457d455 /epan/to_str.c
parent1792f8e3a6e8baba0e95e3719e0c862cb38ac106 (diff)
Introduce ip6_to_str_buf_len (little cleaner version of inet_ntop6 from wsutil/inet_ntop.c)
and use it instead of inet_ntop(AF_INET6, ...) - Add MAX_IP6_STR_LEN define. - use MAX_IP6_STR_LEN as a buffer size when ip6_to_str_buf() is used. svn path=/trunk/; revision=37000
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/to_str.c b/epan/to_str.c
index 8afa03eec4..ca7152f9c1 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -67,6 +67,22 @@ word_to_hex(char *out, guint16 word) {
}
char *
+word_to_hex_npad(char *out, guint16 word) {
+ static const gchar hex_digits[16] =
+ { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ if (word >= 0x1000)
+ *out++ = hex_digits[(word >> 12) & 0xF];
+ if (word >= 0x0100)
+ *out++ = hex_digits[(word >> 8) & 0xF];
+ if (word >= 0x0010)
+ *out++ = hex_digits[(word >> 4) & 0xF];
+ *out++ = hex_digits[word & 0xF];
+ return out;
+}
+
+char *
dword_to_hex(char *out, guint32 dword) {
out = byte_to_hex(out, dword >> 24);
out = byte_to_hex(out, dword >> 16);