diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-17 13:37:11 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-17 20:37:42 +0000 |
commit | 5bfde7c6386b56db80fec85e2ca7dc1d271b461c (patch) | |
tree | 7a1e391e46bf9720719ed81ea504b193a66901a8 /wiretap/dbs-etherwatch.c | |
parent | 35a9b9813879fff308c838f8a4351abfeafa8a4a (diff) | |
download | wireshark-5bfde7c6386b56db80fec85e2ca7dc1d271b461c.tar.gz |
Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars (which
we weren't doing before).
Change-Id: I70f3d993c9a8fbf870901f12b430d733968c3fa8
Reviewed-on: https://code.wireshark.org/review/4781
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/dbs-etherwatch.c')
-rw-r--r-- | wiretap/dbs-etherwatch.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 266ffa4cfc..f3029e2c10 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -27,7 +27,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> /* This module reads the text output of the 'DBS-ETHERTRACE' command in VMS * It was initially based on vms.c. @@ -324,7 +323,7 @@ parse_dbs_etherwatch_packet(struct wtap_pkthdr *phdr, FILE_T fh, Buffer* buf, * 'HEX' character */ p = line; - while(!isxdigit((guchar)*p)) { + while(!g_ascii_isxdigit(*p)) { p++; } if(parse_hex_dump(p, &pd[eth_hdr_len], HEX_HDR_SPR, @@ -549,8 +548,8 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset) { /* Get the byte_offset directly from the record */ value = 0; for(i = 0; i < COUNT_SIZE; i++) { - if(!isspace((guchar)rec[pos])) { - if(isdigit((guchar)rec[pos])) { + if(!g_ascii_isspace(rec[pos])) { + if(g_ascii_isdigit(rec[pos])) { value *= 10; value += rec[pos] - '0'; } else { @@ -585,21 +584,21 @@ parse_hex_dump(char* dump, guint8 *buf, char seperator, char end) { count = 0; while(dump[pos] != end) { /* Check the hex value */ - if(!(isxdigit((guchar)dump[pos]) && - isxdigit((guchar)dump[pos + 1]))) { + if(!(g_ascii_isxdigit(dump[pos]) && + g_ascii_isxdigit(dump[pos + 1]))) { return 0; } /* Get the hex value value */ - if(isdigit((guchar)dump[pos])) { + if(g_ascii_isdigit(dump[pos])) { buf[count] = (dump[pos] - '0') << 4; } else { - buf[count] = (toupper(dump[pos]) - 'A' + 10) << 4; + buf[count] = (g_ascii_toupper(dump[pos]) - 'A' + 10) << 4; } pos++; - if(isdigit((guchar)dump[pos])) { + if(g_ascii_isdigit(dump[pos])) { buf[count] += dump[pos] - '0'; } else { - buf[count] += toupper(dump[pos]) - 'A' + 10; + buf[count] += g_ascii_toupper(dump[pos]) - 'A' + 10; } pos++; count++; |