Bug 1464063 - Remove sdp_getchoosetok. r=bwc
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 13 Jun 2018 14:29:20 -0700
changeset 422669 87163f9d6bc7670d074512cf96062ea01193ffb2
parent 422668 f7bf77f5b69a7e98273cbea1ea888617863e5198
child 422670 485b3efd9ea89580be685757a783730e2589c0d4
push id104322
push userryanvm@gmail.com
push dateFri, 15 Jun 2018 17:00:23 +0000
treeherdermozilla-inbound@87163f9d6bc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1464063
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464063 - Remove sdp_getchoosetok. r=bwc
media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
@@ -342,18 +342,16 @@ extern tinybool sdp_validate_maxprate(co
 extern char *sdp_findchar(const char *ptr, char *char_list);
 extern const char *sdp_getnextstrtok(const char *str, char *tokenstr, unsigned tokenstr_len,
                                const char *delim, sdp_result_e *result);
 extern uint32_t sdp_getnextnumtok(const char *str, const char **str_end,
                              const char *delim, sdp_result_e *result);
 extern uint32_t sdp_getnextnumtok_or_null(const char *str, const char **str_end,
                                      const char *delim, tinybool *null_ind,
                                      sdp_result_e *result);
-extern tinybool sdp_getchoosetok(const char *str, const char **str_end,
-                                 const char *delim, sdp_result_e *result);
 
 extern
 tinybool verify_sdescriptions_mki(char *buf, char *mkiVal, uint16_t *mkiLen);
 
 extern
 tinybool verify_sdescriptions_lifetime(char *buf);
 
 /* sdp_services_xxx.c */
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
@@ -1157,25 +1157,21 @@ sdp_result_e sdp_parse_media (sdp_t *sdp
             "%s No port specified in m= media line, "
             "parse failed.", sdp_p->debug_str);
         SDP_FREE(mca_p);
         sdp_p->conf_p->num_invalid_param++;
         return (SDP_INVALID_PARAMETER);
     }
     port_ptr = port;
     for (i=0; i < SDP_MAX_PORT_PARAMS; i++) {
-        if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result) == TRUE) {
-            num[i] = SDP_CHOOSE_PARAM;
-        } else {
-            num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
-                                       "/ \t", &result);
-            if (result != SDP_SUCCESS) {
-                break;
-            }
-        }
+          num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
+                                     "/ \t", &result);
+          if (result != SDP_SUCCESS) {
+              break;
+          }
         num_port_params++;
     }
 
     /* Find the transport protocol type. */
     ptr = sdp_getnextstrtok(ptr, tmp, sizeof(tmp), " \t", &result);
     if (result != SDP_SUCCESS) {
         sdp_parse_error(sdp_p,
             "%s No transport protocol type specified, "
@@ -1396,18 +1392,16 @@ sdp_result_e sdp_parse_media (sdp_t *sdp
                 sdp_parse_error(sdp_p,
                     "%s No webrtc-datachannel token in m= media line, "
                     "parse failed.", sdp_p->debug_str);
                 SDP_FREE(mca_p);
                 sdp_p->conf_p->num_invalid_param++;
                 return (SDP_INVALID_PARAMETER);
             }
             mca_p->sctp_fmt = SDP_SCTP_MEDIA_FMT_WEBRTC_DATACHANNEL;
-        } else if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result)) {
-            sctp_port = SDP_CHOOSE_PARAM;
         } else {
             sctp_port = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
                                            "/ \t", &result);
             if (result != SDP_SUCCESS) {
                 sdp_parse_error(sdp_p,
                     "%s No sctp port specified in m= media line, "
                     "parse failed.", sdp_p->debug_str);
                 SDP_FREE(mca_p);
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
@@ -427,79 +427,16 @@ uint32_t sdp_getnextnumtok (const char *
   }
 
   *result = SDP_SUCCESS;
   *str_end = token_list;
   return (uint32_t) numval;
 }
 
 
-/* See if the next token in a string is the choose character.  The delim
- * characters are passed in as a param.  The check also will not go past
- * a new line char or the end of the string.  Skip any delimiters before
- * the token.
- */
-tinybool sdp_getchoosetok (const char *str, const char **str_end,
-                           const char *delim, sdp_result_e *result)
-{
-    const char *b;
-    int   flag2moveon;
-
-    if ((str == NULL)  || (str_end == NULL)) {
-        *result = SDP_FAILURE;
-        return(FALSE);
-    }
-
-    /* Locate front of token, skipping any delimiters */
-    for ( ; ((*str != '\0') && (*str != '\n') && (*str != '\r')); str++) {
-        flag2moveon = 1;  /* Default to move on unless we find a delimiter */
-        for (b=delim; *b; b++) {
-            if (*str == *b) {
-                flag2moveon = 0;
-                break;
-            }
-        }
-        if( flag2moveon ) {
-            break;  /* We're at the beginning of the token */
-        }
-    }
-
-    /* Make sure there's really a token present. */
-    if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
-        *result = SDP_FAILURE;
-        *str_end = (char *)str;
-        return(FALSE);
-    }
-
-    /* See if the token is '$' followed by a delimiter char or end of str. */
-    if (*str == '$') {
-        str++;
-        if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
-            *result = SDP_SUCCESS;
-            /* skip the choose char in the string. */
-            *str_end = (char *)(str+1);
-            return(TRUE);
-        }
-        for (b=delim; *b; b++) {
-            if (*str == *b) {
-                *result = SDP_SUCCESS;
-                /* skip the choose char in the string. */
-                *str_end = (char *)(str+1);
-                return(TRUE);
-            }
-        }
-    }
-
-    /* If the token was not '$' followed by a delim, token is not choose */
-    *result = SDP_SUCCESS;
-    *str_end = (char *)str;
-    return(FALSE);
-
-}
-
 /*
  * SDP Crypto Utility Functions.
  *
  * First a few common definitions.
  */
 
 /*
  * Constants