[Freeswitch-svn] [commit] r8617 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/soa

Freeswitch SVN mikej at freeswitch.org
Sun May 25 11:05:09 EDT 2008


Author: mikej
Date: Sun May 25 11:05:09 2008
New Revision: 8617

Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c

Log:
Tue May 20 09:35:37 EDT 2008  Pekka.Pessi at nokia.com
  * soa.c: fixed klocwork issues



Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Sun May 25 11:05:09 2008
@@ -1 +1 @@
-Sun May 25 11:03:45 EDT 2008
+Sun May 25 11:05:03 EDT 2008

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	Sun May 25 11:05:09 2008
@@ -881,37 +881,41 @@
 
 /** Set capabilities */
 int 
-soa_base_set_capability_sdp(soa_session_t *ss, 
-			    sdp_session_t *sdp, char const *str0, isize_t len0)
+soa_base_set_capability_sdp(soa_session_t *ss,
+			    sdp_session_t *_sdp,
+			    char const *str0, isize_t len0)
 {
+  sdp_session_t sdp[1];
   sdp_origin_t o[1] = {{ sizeof(o) }};
   sdp_connection_t *c, c0[1] = {{ sizeof(c0) }};
   char c_address[64];
   sdp_time_t t[1] = {{ sizeof(t) }};
   sdp_media_t *m;
 
+  *sdp = *_sdp;
+
   if (sdp->sdp_origin)
     *o = *sdp->sdp_origin;
   else
     o->o_address = c0;
 
-  sdp->sdp_origin = o;
-
   if (soa_init_sdp_origin(ss, o, c_address) < 0)
     return -1;
 
+  sdp->sdp_origin = o;
+
   if (!sdp->sdp_subject)
-    sdp->sdp_subject = "-";
+    sdp->sdp_subject = "-";	/* s=- */
 
-  sdp->sdp_time = t;
+  sdp->sdp_time = t;		/* t=0 0 */
 
   /* Set port to zero - or should we check that port is already zero? */
   for (m = sdp->sdp_media; m; m = m->m_next)
     m->m_port = 0;
 
-  c = sdp->sdp_origin->o_address;
-
   if (sdp->sdp_connection == NULL) {
+    c = sdp->sdp_origin->o_address;
+
     for (m = sdp->sdp_media; m; m = m->m_next)
       if (m->m_connections == NULL)
 	break;
@@ -1977,6 +1981,9 @@
   sdp_parser_t *parser = NULL;
   sdp_session_t sdp[1];
 
+  if (ss == NULL)
+    return -1;
+
   switch (what) {
   case soa_capability_sdp_kind:
     ssd = ss->ss_caps;
@@ -1994,15 +2001,16 @@
     return -1;
   }
 
-  if (sdp_str && str_len == -1)
-    str_len = strlen(sdp_str);
-
-  if (sdp0)
+  if (sdp0) {
     new_version = sdp_session_cmp(sdp0, ssd->ssd_sdp) != 0;
-  else if (sdp_str)
+    sdp_str = NULL, str_len = -1;
+  }
+  else if (sdp_str) {
+    if (str_len == -1)
+      str_len = strlen(sdp_str);
     new_version = !ssd->ssd_unparsed ||
-      str0ncmp(sdp_str, ssd->ssd_unparsed, str_len) != 0 ||
-      ssd->ssd_unparsed[str_len] != '\0';
+      str0ncmp(sdp_str, ssd->ssd_unparsed, str_len + 1) != 0;
+  }
   else
     return (void)su_seterrno(EINVAL), -1;
 



More information about the Freeswitch-svn mailing list