From 1c3714327f4cd9fe75229179ae8344d76804a2da Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Mar 2014 16:58:13 +0100 Subject: [PATCH] Do not use raw attributes to get values. --- coreapi/bellesip_sal/sal_sdp.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c index 3faa7a063..b2f106cef 100644 --- a/coreapi/bellesip_sal/sal_sdp.c +++ b/coreapi/bellesip_sal/sal_sdp.c @@ -321,8 +321,7 @@ static void sdp_parse_payload_types(belle_sdp_media_description_t *media_desc, S static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *media_desc, SalStreamDescription *stream) { belle_sip_list_t *attribute_it; - const belle_sdp_attribute_t *attribute; - const belle_sdp_raw_attribute_t *raw_attribute; + belle_sdp_attribute_t *attribute; char tmp[256], tmp2[256]; int valid_count = 0; int nb; @@ -332,10 +331,9 @@ static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *med ; valid_count < SAL_CRYPTO_ALGO_MAX && attribute_it!=NULL; attribute_it=attribute_it->next ) { attribute=BELLE_SDP_ATTRIBUTE ( attribute_it->data ); - raw_attribute=BELLE_SDP_RAW_ATTRIBUTE(attribute); - if ( keywordcmp ( "crypto",belle_sdp_attribute_get_name ( attribute ) ) ==0 && belle_sdp_raw_attribute_get_value ( raw_attribute ) !=NULL ) { - nb = sscanf ( belle_sdp_raw_attribute_get_value ( raw_attribute ), "%d %256s inline:%256s", + if ( keywordcmp ( "crypto",belle_sdp_attribute_get_name ( attribute ) ) ==0 && belle_sdp_attribute_get_value ( attribute ) !=NULL ) { + nb = sscanf ( belle_sdp_attribute_get_value ( attribute ), "%d %256s inline:%256s", &stream->crypto[valid_count].tag, tmp, tmp2 ); @@ -362,7 +360,7 @@ static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *med valid_count++; } } else { - ms_warning ( "sdp has a strange a= line (%s) nb=%i",belle_sdp_raw_attribute_get_value ( raw_attribute ),nb ); + ms_warning ( "sdp has a strange a= line (%s) nb=%i",belle_sdp_attribute_get_value ( attribute ),nb ); } } } @@ -371,17 +369,15 @@ static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *med static void sdp_parse_media_ice_parameters(belle_sdp_media_description_t *media_desc, SalStreamDescription *stream) { belle_sip_list_t *attribute_it; - const belle_sdp_attribute_t *attribute; - const belle_sdp_raw_attribute_t *raw_attribute; + belle_sdp_attribute_t *attribute; const char *att_name; const char *value; int nb_ice_candidates = 0; for (attribute_it = belle_sdp_media_description_get_attributes(media_desc); attribute_it != NULL; attribute_it=attribute_it->next) { attribute=BELLE_SDP_ATTRIBUTE(attribute_it->data); - raw_attribute=BELLE_SDP_RAW_ATTRIBUTE(attribute); att_name = belle_sdp_attribute_get_name(attribute); - value = belle_sdp_raw_attribute_get_value(raw_attribute); + value = belle_sdp_attribute_get_value(attribute); if ((keywordcmp("candidate", att_name) == 0) && (value != NULL)) { SalIceCandidate *candidate = &stream->ice_candidates[nb_ice_candidates]; @@ -473,8 +469,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md, SalStreamDescription *stream; belle_sdp_connection_t* cnx; belle_sdp_media_t* media; - const belle_sdp_attribute_t* attribute; - const belle_sdp_raw_attribute_t* raw_attribute; + belle_sdp_attribute_t* attribute; const char* value; const char *mtype,*proto; @@ -536,8 +531,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md, stream->rtcp_port = stream->rtp_port + 1; snprintf(stream->rtcp_addr, sizeof(stream->rtcp_addr), "%s", stream->rtp_addr); attribute=belle_sdp_media_description_get_attribute(media_desc,"rtcp"); - raw_attribute=BELLE_SDP_RAW_ATTRIBUTE(attribute); - if (attribute && (value=belle_sdp_raw_attribute_get_value(raw_attribute))!=NULL){ + if (attribute && (value=belle_sdp_attribute_get_value(attribute))!=NULL){ char tmp[256]; int nb = sscanf(value, "%d IN IP4 %s", &stream->rtcp_port, tmp); if (nb == 1) {