diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-19 23:14:50 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-20 06:15:19 +0000 |
commit | 80e6f6251e96dd7b8a9ab0fdbf63b03a73ef6692 (patch) | |
tree | 92d519b9b19cccba0d083a6ad20152352daa5924 /epan/dissectors/packet-aprs.c | |
parent | 0b9eb9f4b71b6632cfb4b87bcdefdfa75eaf2dd0 (diff) |
Get rid of calls to ctype.h functions.
They don't handle values outside the range -1 to 127, and their behavior
is locale-dependent. Use g_ascii_isXXX() and g_ascii_toXXX() instead of
isXXX() and toXXX().
If you're checking for printable ASCII, don't use isascii() and don't
use iscntrl(), use g_ascii_isprint(). If you're checking for graphical
ASCII, i.e. printable ASCII except for a space, use g_ascii_isgraph().
Use ws_xton() to convert a hex digit character to the corresponding
numeric value.
Change-Id: Id3039bc586fbf66d8736c2df248c790c0d7a2330
Reviewed-on: https://code.wireshark.org/review/4851
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-aprs.c')
-rw-r--r-- | epan/dissectors/packet-aprs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/epan/dissectors/packet-aprs.c b/epan/dissectors/packet-aprs.c index 60ce834462..eaee53a813 100644 --- a/epan/dissectors/packet-aprs.c +++ b/epan/dissectors/packet-aprs.c @@ -40,7 +40,6 @@ #include "config.h" #include <string.h> -#include <ctype.h> #include <math.h> #include <glib.h> @@ -515,7 +514,7 @@ dissect_aprs_msg( tvbuff_t *tvb, ch = tvb_get_guint8( tvb, offset ); - if ( isdigit( ch ) ) + if ( g_ascii_isdigit( ch ) ) { if ( wind ) proto_tree_add_item( msg_tree, *msg_items->hf_msg_dir, tvb, offset, 3, ENC_ASCII|ENC_NA ); @@ -900,7 +899,7 @@ dissect_aprs_weather( tvbuff_t *tvb, weather_tree = proto_item_add_subtree( tc, ett_aprs_weather_idx ); ch = tvb_get_guint8( tvb, offset ); - if ( isdigit( ch ) ) + if ( g_ascii_isdigit( ch ) ) { proto_tree_add_item( weather_tree, *weather_items->hf_weather_dir, tvb, offset, 3, ENC_ASCII|ENC_NA ); offset += 3; @@ -1019,7 +1018,7 @@ aprs_timestamp( proto_tree *aprs_tree, tvbuff_t *tvb, int offset ) tzone = "zulu"; ch= tvb_get_guint8( tvb, offset + 6 ); - if ( isdigit( ch ) ) + if ( g_ascii_isdigit( ch ) ) { /* MDHM */ proto_tree_add_item( aprs_tree, hf_aprs_mdhm, tvb, offset, data_len, ENC_ASCII|ENC_NA ); proto_tree_add_string( aprs_tree, hf_aprs_tz, tvb, offset, data_len, tzone ); @@ -1209,7 +1208,7 @@ aprs_position( proto_tree *aprs_tree, tvbuff_t *tvb, int offset, gboolean with_m gboolean probably_a_msg = FALSE; gboolean probably_not_a_msg = FALSE; - if ( isdigit( tvb_get_guint8( tvb, offset ) ) ) + if ( g_ascii_isdigit( tvb_get_guint8( tvb, offset ) ) ) { offset = aprs_default_string( aprs_tree, tvb, offset, 8, hf_aprs_lat ); symbol_table_id = tvb_get_guint8( tvb, offset ); |