[asterisk-commits] jamesgolovich: branch jamesgolovich/chan_sip-ast_str r102060 - /team/jamesgol...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Feb 2 02:17:44 CST 2008


Author: jamesgolovich
Date: Sat Feb  2 02:17:42 2008
New Revision: 102060

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102060
Log:
Use memcpy for copy_request since a sip_request->data might have already
been parsed and contain \0 instead of \r\n

Change parse_copy to use copy_request function instead of reimplementing


Modified:
    team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c

Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c?view=diff&rev=102060&r1=102059&r2=102060
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c Sat Feb  2 02:17:42 2008
@@ -3026,11 +3026,7 @@
 /*! \brief Copy SIP request, parse it */
 static void parse_copy(struct sip_request *dst, const struct sip_request *src)
 {
-	memset(dst, 0, sizeof(*dst));
-	if (!(dst->data = ast_str_create(src->len)))
-		return;
-	dst->len = src->len;
-	ast_str_set(&dst->data, 0, "%s", src->data->str);
+	copy_request(dst, src);
 	parse_request(dst);
 }
 
@@ -8104,9 +8100,11 @@
 
 	if (!dst->data && !(dst->data = ast_str_create(src->data->used)))
 		return;
+	else if (dst->data->len < src->data->used)
+		ast_str_make_space(&dst->data, src->data->used);
 		
-	if (ast_str_set(&dst->data, 0, "%s", src->data->str) == AST_DYNSTR_BUILD_FAILED) 
-		return;
+	memcpy(dst->data->str, src->data->str, src->data->used);
+	dst->data->used = src->data->used;
 	offset = ((void *)dst->data->str) - ((void *)src->data->str);
 	/* Now fix pointer arithmetic */
 	for (x=0; x < src->headers; x++)




More information about the asterisk-commits mailing list