[asterisk-commits] mmichelson: branch mmichelson/issue14220 r169196 - /team/mmichelson/issue1422...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 17 16:31:50 CST 2009


Author: mmichelson
Date: Sat Jan 17 16:31:50 2009
New Revision: 169196

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=169196
Log:
%s/REQ_OFFSET/REQ_OFFSET_TO_STR/g

Modified:
    team/mmichelson/issue14220/channels/chan_sip.c

Modified: team/mmichelson/issue14220/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/issue14220/channels/chan_sip.c?view=diff&rev=169196&r1=169195&r2=169196
==============================================================================
--- team/mmichelson/issue14220/channels/chan_sip.c (original)
+++ team/mmichelson/issue14220/channels/chan_sip.c Sat Jan 17 16:31:50 2009
@@ -1215,7 +1215,7 @@
  * To avoid adding a bunch of redundant pointer arithmetic to the code, this macro is
  * provided to retrieve the string at a particular offset within the request's buffer
  */
-#define REQ_OFFSET(req,offset) ((req)->data->str + (req)->offset)
+#define REQ_OFFSET_TO_STR(req,offset) ((req)->data->str + (req)->offset)
 
 /*! \brief structure used in transfers */
 struct sip_dual {
@@ -2756,7 +2756,7 @@
 		}
 
 		/* Read in headers one line at a time */
-		while (req.len < 4 || strncmp(REQ_OFFSET(&req, len - 4), "\r\n\r\n", 4)) {
+		while (req.len < 4 || strncmp(REQ_OFFSET_TO_STR(&req, len - 4), "\r\n\r\n", 4)) {
 			ast_mutex_lock(&tcptls_session->lock);
 			if (!fgets(buf, sizeof(buf), tcptls_session->f)) {
 				ast_mutex_unlock(&tcptls_session->lock);
@@ -3791,7 +3791,7 @@
 		struct sip_request tmp = { .rlPart1 = 0, };
 		parse_copy(&tmp, req);
 		append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s - %s", tmp.data->str, get_header(&tmp, "CSeq"), 
-			(tmp.method == SIP_RESPONSE || tmp.method == SIP_UNKNOWN) ? REQ_OFFSET(&tmp, rlPart2) : sip_methods[tmp.method].text);
+			(tmp.method == SIP_RESPONSE || tmp.method == SIP_UNKNOWN) ? REQ_OFFSET_TO_STR(&tmp, rlPart2) : sip_methods[tmp.method].text);
 		ast_free(tmp.data);
 	}
 	res = (reliable) ?
@@ -6252,7 +6252,7 @@
 	int len = strlen(name);
 
 	while (*start < req->sdp_end) {
-		const char *r = get_body_by_line(REQ_OFFSET(req, line[(*start)++]), name, len, '=');
+		const char *r = get_body_by_line(REQ_OFFSET_TO_STR(req, line[(*start)++]), name, len, '=');
 		if (r[0] != '\0')
 			return r;
 	}
@@ -6276,7 +6276,7 @@
 	char *r;
 
 	for (x = 0; x < req->lines; x++) {
-		r = get_body_by_line(REQ_OFFSET(req, line[x]), name, len, delimiter);
+		r = get_body_by_line(REQ_OFFSET_TO_STR(req, line[x]), name, len, delimiter);
 		if (r[0] != '\0')
 			return r;
 	}
@@ -6339,7 +6339,7 @@
 	for (pass = 0; name && pass < 2;pass++) {
 		int x, len = strlen(name);
 		for (x = *start; x < req->headers; x++) {
-			char *header = REQ_OFFSET(req, header[x]);
+			char *header = REQ_OFFSET_TO_STR(req, header[x]);
 			if (!strncasecmp(header, name, len)) {
 				char *r = header + len;	/* skip name */
 				if (sip_cfg.pedanticsipchecking)
@@ -7250,7 +7250,7 @@
 	   sdp part and the end boundry if it exists */
 
 	for (x = 0; x < (req->lines); x++) {
-		char *line = REQ_OFFSET(req, line[x]);
+		char *line = REQ_OFFSET_TO_STR(req, line[x]);
 		if (!strncasecmp(line, boundary, strlen(boundary))){
 			if (found_application_sdp && found_end_of_headers) {
 				req->sdp_end = x-1;
@@ -8448,14 +8448,14 @@
 	}
 	
 	if (sipmethod == SIP_CANCEL)
-		c = REQ_OFFSET(&p->initreq, rlPart2);	/* Use original URI */
+		c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);	/* Use original URI */
 	else if (sipmethod == SIP_ACK) {
 		/* Use URI from Contact: in 200 OK (if INVITE) 
 		(we only have the contacturi on INVITEs) */
 		if (!ast_strlen_zero(p->okcontacturi))
 			c = is_strict ? p->route->hop : p->okcontacturi;
  		else
- 			c = REQ_OFFSET(&p->initreq, rlPart2);
+ 			c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
 	} else if (!ast_strlen_zero(p->okcontacturi)) 
 		c = is_strict ? p->route->hop : p->okcontacturi; /* Use for BYE or REINVITE */
 	else if (!ast_strlen_zero(p->uri)) 
@@ -12077,7 +12077,7 @@
 
 	/* Find the request URI */
 	if (req->rlPart2)
-		ast_copy_string(tmp, REQ_OFFSET(req, rlPart2), sizeof(tmp));
+		ast_copy_string(tmp, REQ_OFFSET_TO_STR(req, rlPart2), sizeof(tmp));
 	
 	if (sip_cfg.pedanticsipchecking)
 		ast_uri_decode(tmp);
@@ -13019,7 +13019,7 @@
 	if (y < 0)
 		y = 0;
 	for (x = 0; x < req->lines; x++) {
-		char *line = REQ_OFFSET(req, line[x]);
+		char *line = REQ_OFFSET_TO_STR(req, line[x]);
 		strncat(buf, line, y); /* safe */
 		y -= strlen(line) + 1;
 		if (y < 0)
@@ -18476,8 +18476,8 @@
 		/* If pedantic is on, we need to check the tags. If they're different, this is
 	   	in fact a forked call through a SIP proxy somewhere. */
 		int different;
-		char *initial_rlPart2 = REQ_OFFSET(&p->initreq, rlPart2);
-		char *this_rlPart2 = REQ_OFFSET(req, rlPart2);
+		char *initial_rlPart2 = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
+		char *this_rlPart2 = REQ_OFFSET_TO_STR(req, rlPart2);
 		if (sip_cfg.pedanticsipchecking)
 			different = sip_uri_cmp(initial_rlPart2, this_rlPart2);
 		else
@@ -20291,8 +20291,8 @@
 	}
 	/* Get the command XXX */
 
-	cmd = REQ_OFFSET(req, rlPart1);
-	e = REQ_OFFSET(req, rlPart2);
+	cmd = REQ_OFFSET_TO_STR(req, rlPart1);
+	e = REQ_OFFSET_TO_STR(req, rlPart2);
 
 	/* Save useragent of the client */
 	useragent = get_header(req, "User-Agent");
@@ -20639,7 +20639,7 @@
 		ast_str_reset(req->data); /* nulling this out is NOT a good idea here. */
 		return 1;
 	}
-	req->method = find_sip_method(REQ_OFFSET(req, rlPart1));
+	req->method = find_sip_method(REQ_OFFSET_TO_STR(req, rlPart1));
 
 	if (req->debug)
 		ast_verbose("--- (%d headers %d lines)%s ---\n", req->headers, req->lines, (req->headers + req->lines == 0) ? " Nat keepalive" : "");
@@ -20679,7 +20679,7 @@
 	p->recv = *sin;
 
 	if (p->do_history) /* This is a request or response, note what it was for */
-		append_history(p, "Rx", "%s / %s / %s", req->data->str, get_header(req, "CSeq"), REQ_OFFSET(req, rlPart2));
+		append_history(p, "Rx", "%s / %s / %s", req->data->str, get_header(req, "CSeq"), REQ_OFFSET_TO_STR(req, rlPart2));
 
 	if (!lockretry) {
 		if (!queue_request(p, req)) {




More information about the asterisk-commits mailing list