Use g_ascii_isalpha(), not is_rfc2234_alpha().
authorGuy Harris <guy@alum.mit.edu>
Wed, 24 Jul 2019 20:12:16 +0000 (13:12 -0700)
committerGuy Harris <guy@alum.mit.edu>
Wed, 24 Jul 2019 20:37:55 +0000 (20:37 +0000)
Use GLib's locale-independent "is this alphabetic?" routine, rather than
rolling our own.

Change-Id: I841de09d534867ec7510bd680fd97387719b2850
Reviewed-on: https://code.wireshark.org/review/34075
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/dissectors/packet-mgcp.c

index 96b62606e96c2beef5982e4bbf63fd3a993e853c..77b1f76901f4758037c9f4a9c74a3bd88c36930d 100644 (file)
@@ -407,7 +407,6 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
  */
 static gint tvb_find_null_line(tvbuff_t* tvb, gint offset, gint len, gint* next_offset);
 static gint tvb_find_dot_line(tvbuff_t* tvb, gint offset, gint len, gint* next_offset);
-static gboolean is_rfc2234_alpha(guint8 c);
 
 static dissector_handle_t sdp_handle;
 static dissector_handle_t mgcp_handle;
@@ -697,8 +696,8 @@ static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const g
                    ((g_ascii_strncasecmp(word, "AUCX", 4) == 0) && (*verb_name = "AuditConnection")) ||
                    ((g_ascii_strncasecmp(word, "RSIP", 4) == 0) && (*verb_name = "RestartInProgress")) ||
                    ((g_ascii_strncasecmp(word, "MESG", 4) == 0) && (*verb_name = "Message")) ||
-                   (word[0] == 'X' && is_rfc2234_alpha(word[1]) && is_rfc2234_alpha(word[2]) &&
-                                      is_rfc2234_alpha(word[3]) && (*verb_name = "*Experimental*")))
+                   (word[0] == 'X' && g_ascii_isalpha(word[1]) && g_ascii_isalpha(word[2]) &&
+                                      g_ascii_isalpha(word[3]) && (*verb_name = "*Experimental*")))
                {
                        returnvalue = TRUE;
                }
@@ -763,24 +762,6 @@ static gboolean is_mgcp_rspcode(tvbuff_t *tvb, gint offset, gint maxlength)
        return returnvalue;
 }
 
-/*
- * is_rfc2234_alpha - Indicates whether the character c is an alphabetical
- *                    character.  This function is used instead of
- *                    isalpha because isalpha may deviate from the rfc2234
- *                    definition of ALPHA in some locales.
- *
- * Parameter:
- * c - The character being checked for being an alphabetical character.
- *
- * Return: TRUE if c is an upper or lower case alphabetical character,
- *         FALSE otherwise.
- */
-static gboolean is_rfc2234_alpha(guint8 c)
-{
-       return ((c <= 'Z' && c >= 'A' ) || (c <= 'z' && c >= 'a'));
-}
-
-
 /*
  * tvb_parse_param - Parse the MGCP param into a type and a value.
  *
@@ -902,7 +883,7 @@ static gint tvb_parse_param(tvbuff_t* tvb, gint offset, gint len, int** hf, mgcp
                                        /* Keep going, through possible vendor param name */
                                        for (counter = 1;
                                            ((len > (counter + tvb_current_offset-offset)) &&
-                                           (is_rfc2234_alpha(tempchar = tvb_get_guint8(tvb, tvb_current_offset+counter)) ||
+                                           (g_ascii_isalpha(tempchar = tvb_get_guint8(tvb, tvb_current_offset+counter)) ||
                                             g_ascii_isdigit(tempchar))) ;
                                             counter++);