diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2014-01-08 00:28:13 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2014-01-08 00:28:13 +0000 |
commit | d28084d1839bb581229f72acc37608b00c2caba7 (patch) | |
tree | fb6ba22256d5334b83e0279879544f28efcb8601 /epan/strutil.c | |
parent | e8dd800cc16765afadc8543ed9292ea5caf73df1 (diff) | |
download | wireshark-d28084d1839bb581229f72acc37608b00c2caba7.tar.gz wireshark-d28084d1839bb581229f72acc37608b00c2caba7.tar.bz2 wireshark-d28084d1839bb581229f72acc37608b00c2caba7.zip |
Move UAT xton() to wsutil library
Use ws_xton() in few more places.
svn path=/trunk/; revision=54642
Diffstat (limited to 'epan/strutil.c')
-rw-r--r-- | epan/strutil.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/epan/strutil.c b/epan/strutil.c index e0c3a7610a..0df9b515c9 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -31,6 +31,7 @@ #include "strutil.h" #include "emem.h" +#include <wsutil/str_util.h> #ifdef _WIN32 #include <windows.h> @@ -899,22 +900,12 @@ convert_string_to_hex(const char *string, size_t *nbytes) if (c==':' || c=='.' || c=='-') continue; /* skip any ':', '.', or '-' between bytes */ /* From the loop above, we know this is a hex digit */ - if (isdigit(c)) - byte_val = c - '0'; - else if (c >= 'a') - byte_val = (c - 'a') + 10; - else - byte_val = (c - 'A') + 10; + byte_val = ws_xton(c); byte_val <<= 4; /* We also know this is a hex digit */ c = *p++; - if (isdigit(c)) - byte_val |= c - '0'; - else if (c >= 'a') - byte_val |= (c - 'a') + 10; - else if (c >= 'A') - byte_val |= (c - 'A') + 10; + byte_val |= ws_xton(c); *q++ = byte_val; } |