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

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:50:29 PST 2009


Author: mikej
Date: Wed Feb 11 10:50:29 2009
New Revision: 11802

Log:
Thu Jan  8 14:56:49 CST 2009  Pekka Pessi <first.last at nokia.com>
  * msg: using <sofia-sip/su_string.h> functions



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 10:50:29 2009
@@ -1 +1 @@
-Wed Feb 11 10:49:44 CST 2009
+Wed Feb 11 10:50:12 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c	Wed Feb 11 10:50:29 2009
@@ -42,6 +42,7 @@
 #include <string.h>
 #include <assert.h>
 
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/msg_date.h>
 #include <sofia-sip/bnf.h>
 
@@ -238,7 +239,7 @@
     if (time_d(&s, &hour, &min, &sec) < 0) return -1;
     if (*s) {
       tz = s; skip_token(&s); skip_lws(&s);
-      if (strncasecmp(tz, "GMT", 3) && strncasecmp(tz, "UCT", 3))
+      if (!su_casenmatch(tz, "GMT", 3) && !su_casenmatch(tz, "UCT", 3))
 	return -1;
     }
   }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c	Wed Feb 11 10:50:29 2009
@@ -47,6 +47,7 @@
 
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg_parser.h"
@@ -351,7 +352,7 @@
 
     /* long form */
     for (hr = NULL; (hc = mc->mc_hash[i].hr_class); i = (i + 1) % N) {
-      if (m == hc->hc_len && strncasecmp(s, hc->hc_name, m) == 0) {
+      if (m == hc->hc_len && su_casenmatch(s, hc->hc_name, m)) {
 	hr = &mc->mc_hash[i];
 	break;
       }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c	Wed Feb 11 10:50:29 2009
@@ -38,14 +38,8 @@
 
 #define _GNU_SOURCE 1
 
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <assert.h>
-
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg.h"
@@ -54,16 +48,18 @@
 #include <sofia-sip/su_uniqueid.h>
 #include <sofia-sip/su_errno.h>
 
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <errno.h>
+#include <assert.h>
+
 #if !HAVE_MEMMEM
 void *memmem(const void *haystack, size_t haystacklen,
 	     const void *needle, size_t needlelen);
 #endif
 
-size_t memspn(const void *mem, size_t memlen,
-	      const void *accept, size_t acceptlen);
-size_t memcspn(const void *mem, size_t memlen,
-	       const void *reject, size_t rejectlen);
-
 /** Protocol version of MIME */
 char const msg_mime_version_1_0[] = "MIME/1.0";
 
@@ -154,7 +150,7 @@
  * argument to msg_multipart_parse() function:
  * @code
  *    if (sip->sip_content_type &&
- *        strncasecmp(sip->sip_content_type, "multipart/", 10) == 0) {
+ *        su_casenmatch(sip->sip_content_type, "multipart/", 10)) {
  *      msg_multipart_t *mp;
  *
  *      if (sip->sip_multipart)
@@ -316,7 +312,7 @@
   /* Boundary looks like LF -- string SP* [CR] LF */
   if (memcmp("--", p, 2) == 0) {
     /* We can be at boundary beginning, there is no CR LF */
-    m = 2 + memspn(p + 2, len - 2, bchars, bchars_len);
+    m = 2 + su_memspn(p + 2, len - 2, bchars, bchars_len);
     if (m + 2 >= len)
       return NULL;
     crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -336,7 +332,7 @@
   /* Look for LF -- */
   for (;(p = memmem(p, end - p, LF "--", 3)); p += 3) {
     len = end - p;
-    m = 3 + memspn(p + 3, len - 3, bchars, bchars_len);
+    m = 3 + su_memspn(p + 3, len - 3, bchars, bchars_len);
     if (m + 2 >= len)
       return NULL;
     crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -1146,7 +1142,7 @@
   if (name == NULL) {
     ac->ac_q = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     /* XXX - check for invalid value? */
     ac->ac_q = value;
   }
@@ -1233,7 +1229,7 @@
   if (name == NULL) {
     aa->aa_q = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     aa->aa_q = value;
   }
 
@@ -1523,10 +1519,10 @@
     cd->cd_handling = NULL, cd->cd_required = 0, cd->cd_optional = 0;
   }
   else if (namelen == strlen("handling") &&
-	   strncasecmp(name, "handling", namelen) == 0) {
+	   su_casenmatch(name, "handling", namelen)) {
     cd->cd_handling = value;
-    cd->cd_required = strcasecmp(value, "required") == 0;
-    cd->cd_optional = strcasecmp(value, "optional") == 0;
+    cd->cd_required = su_casematch(value, "required");
+    cd->cd_optional = su_casematch(value, "optional");
   }
 
   return 0;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c	Wed Feb 11 10:50:29 2009
@@ -47,6 +47,7 @@
 
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include "msg_internal.h"
 #include "sofia-sip/msg_parser.h"
@@ -871,7 +872,7 @@
 	}
       }
       else {
-	if (strncasecmp(maybe, param, plen) == 0 &&
+	if (su_casenmatch(maybe, param, plen) &&
 	    (maybe[plen] == '=' || maybe[plen] == 0))
 	  break;
       }
@@ -1212,7 +1213,7 @@
 
     for (i = 0; params[i]; i++) {
       msg_param_t param = params[i];
-      if (strncasecmp(param, token, n) == 0) {
+      if (su_casenmatch(param, token, n)) {
 	if (param[n] == '=')
 	  return param + n + 1;
         else if (param[n] == 0)
@@ -1246,7 +1247,7 @@
 
     for (i = 0; params[i]; i++) {
       msg_param_t param = params[i];
-      if (strncasecmp(param, token, n) == 0) {
+      if (su_casenmatch(param, token, n)) {
 	if (param[n] == '=')
 	  return params + i;
         else if (param[n] == 0 || token[n - 1] == '=')
@@ -1295,7 +1296,7 @@
     for (i = 0; params[i]; i++) {
       msg_param_t maybe = params[i];
 
-      if (!(strncasecmp(maybe, param, n))) {
+      if (su_casenmatch(maybe, param, n)) {
 	if (maybe[n] == '=' || maybe[n] == 0) {
 	  params[i] = param;
 	  return 1;
@@ -1327,7 +1328,7 @@
   for (i = 0; params[i]; i++) {
     msg_param_t maybe = params[i];
 
-    if (strncasecmp(maybe, param, n) == 0) {
+    if (su_casenmatch(maybe, param, n)) {
       if (maybe[n] == '=' || maybe[n] == 0) {
 	/* Remove */
 	do {
@@ -1415,10 +1416,10 @@
 
   for (i = 0; d[i]; i++) {
     if ((prune == 1 &&
-	 strncasecmp(p, d[i], nlen) == 0
+	 su_casenmatch(p, d[i], nlen)
 	 && (d[i][nlen] == '=' || d[i][nlen] == '\0'))
 	||
-	(prune == 2 && strcasecmp(p, d[i]) == 0)
+	(prune == 2 && su_casematch(p, d[i]))
 	||
 	(prune == 3 && strcmp(p, d[i]) == 0))
       return 1;
@@ -1649,7 +1650,7 @@
     if (*a == NULL || *b == NULL)
       return (*a != NULL) - (*b != NULL);
     nlen = strcspn(*a, "=");
-    if ((c = strncasecmp(*a, *b, nlen)))
+    if ((c = su_strncasecmp(*a, *b, nlen)))
       return c;
     if ((c = strcmp(*a + nlen, *b + nlen)))
       return c;



More information about the Freeswitch-svn mailing list