diff options
author | Michael Mann <mmann78@netscape.net> | 2018-10-20 17:46:34 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-10-21 07:55:40 +0000 |
commit | 7a4e9325718e13e5d977677032f211c93e91aba9 (patch) | |
tree | 202cbefec4c9a64ff6de997bf6554d36d5e35ec6 /epan/dissectors/asn1/s1ap/s1ap.cnf | |
parent | 7ce9081fdcf48085611d2de6db0964dffd9ae700 (diff) |
Add tvb_ascii_isprint API
This allows dissectors to check if a portion of the tvb is an ascii string while hiding the use of tvb_get_ptr.
Change-Id: Iaec7559dcfdefb8a5ae23e099ced45e90e611f8f
Reviewed-on: https://code.wireshark.org/review/30291
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1/s1ap/s1ap.cnf')
-rw-r--r-- | epan/dissectors/asn1/s1ap/s1ap.cnf | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/epan/dissectors/asn1/s1ap/s1ap.cnf b/epan/dissectors/asn1/s1ap/s1ap.cnf index c22f71ba79..f0585435ad 100644 --- a/epan/dissectors/asn1/s1ap/s1ap.cnf +++ b/epan/dissectors/asn1/s1ap/s1ap.cnf @@ -243,7 +243,6 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound") #.FN_BODY ENBname VAL_PTR = parameter_tvb tvbuff_t *parameter_tvb=NULL; int length; - int p_offset; gboolean is_ascii; %(DEFAULT_BODY)s @@ -253,20 +252,13 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound") length = tvb_reported_length(parameter_tvb); - is_ascii = TRUE; - for (p_offset=0; p_offset < length; p_offset++){ - if(!g_ascii_isprint(tvb_get_guint8(parameter_tvb, p_offset ))){ - is_ascii = FALSE; - break; - } - } + is_ascii = tvb_ascii_isprint(parameter_tvb, 0, length); if (is_ascii) proto_item_append_text(actx->created_item," (%%s)",tvb_format_text(parameter_tvb, 0, length)); #.FN_BODY MMEname VAL_PTR = parameter_tvb tvbuff_t *parameter_tvb=NULL; int length; - int p_offset; gboolean is_ascii; %(DEFAULT_BODY)s @@ -276,13 +268,7 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound") length = tvb_reported_length(parameter_tvb); - is_ascii = TRUE; - for (p_offset=0; p_offset < length; p_offset++){ - if(!g_ascii_isprint(tvb_get_guint8(parameter_tvb, p_offset ))){ - is_ascii = FALSE; - break; - } - } + is_ascii = tvb_ascii_isprint(parameter_tvb, 0, length); if (is_ascii) proto_item_append_text(actx->created_item," (%%s)",tvb_format_text(parameter_tvb, 0, length)); |