aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-06-28 22:52:24 +0000
committerGuy Harris <guy@alum.mit.edu>2013-06-28 22:52:24 +0000
commit67f849fcbc0c86211c4e1ad3a83e10b5211b44b9 (patch)
tree549d6fd511b5d53b9e52dd1486b51ab7e2e5367f /epan/to_str.c
parent882db1c5fbd8746c795b537fd2ea8162368b49f0 (diff)
Rename octet_to_hex() to low_nibble_of_octet_to_hex() to indicate what
it actually does (it takes the low-order nibble of an octet and returns a single character). Cast away some warnings. svn path=/trunk/; revision=50225
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/epan/to_str.c b/epan/to_str.c
index 36bf7b5b32..6368b5a534 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -43,7 +43,7 @@
#define BUF_TOO_SMALL_ERR "[Buffer too small]"
static inline char
-octet_to_hex(guint8 oct)
+low_nibble_of_octet_to_hex(guint8 oct)
{
/* At least one version of Apple's C compiler/linker is buggy, causing
a complaint from the linker about the "literal C string section"
@@ -60,8 +60,8 @@ octet_to_hex(guint8 oct)
static inline char *
byte_to_hex(char *out, guint32 dword) {
- *out++ = octet_to_hex(dword >> 4);
- *out++ = octet_to_hex(dword);
+ *out++ = low_nibble_of_octet_to_hex(dword >> 4);
+ *out++ = low_nibble_of_octet_to_hex(dword);
return out;
}
@@ -75,12 +75,12 @@ word_to_hex(char *out, guint16 word) {
char *
word_to_hex_npad(char *out, guint16 word) {
if (word >= 0x1000)
- *out++ = octet_to_hex(word >> 12);
+ *out++ = low_nibble_of_octet_to_hex((guint8)(word >> 12));
if (word >= 0x0100)
- *out++ = octet_to_hex(word >> 8);
+ *out++ = low_nibble_of_octet_to_hex((guint8)(word >> 8));
if (word >= 0x0010)
- *out++ = octet_to_hex(word >> 4);
- *out++ = octet_to_hex(word);
+ *out++ = low_nibble_of_octet_to_hex((guint8)(word >> 4));
+ *out++ = low_nibble_of_octet_to_hex((guint8)(word >> 0));
return out;
}
@@ -1135,7 +1135,7 @@ char *
hex_to_str_back(char *ptr, int pad, guint32 value)
{
do {
- *(--ptr) = octet_to_hex(value);
+ *(--ptr) = low_nibble_of_octet_to_hex(value);
value >>= 4;
pad--;
} while (value);