[sr-dev] git:luismartingil/msrp_crash: msrp: improved parser

Luis Martin Gil martingil.luis at gmail.com
Thu Apr 17 14:30:42 CEST 2014


Module: sip-router
Branch: luismartingil/msrp_crash
Commit: 164435ab191964bc9f0054874536c022dcf11063
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=164435ab191964bc9f0054874536c022dcf11063

Author: Luis Martin Gil <martingil.luis at gmail.com>
Committer: Luis Martin Gil <martingil.luis at gmail.com>
Date:   Thu Apr 17 12:29:47 2014 +0000

        msrp: improved parser

        - changed indentation as required by Daniel
	  http://sip-router.org/tracker/index.php?do=details&task_id=419#comment1390

---

 modules/msrp/msrp_parser.c |   35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/modules/msrp/msrp_parser.c b/modules/msrp/msrp_parser.c
index 8df1a92..b23c5a1 100644
--- a/modules/msrp/msrp_parser.c
+++ b/modules/msrp/msrp_parser.c
@@ -220,7 +220,6 @@ int msrp_parse_headers(msrp_frame_t *mf)
 	char *s; /* start for search */
 	msrp_hdr_t *hdr;
 	msrp_hdr_t *last;
-
 	int fpath = 0; /* From path set */
 	int tpath = 0; /* To path set */
 	int any = 0; /* Any header set */
@@ -296,23 +295,23 @@ int msrp_parse_headers(msrp_frame_t *mf)
 		msrp_hdr_set_type(hdr);
 	
 		if (hdr->htype == MSRP_HDR_TO_PATH) {
-		  tpath = 1;
-		  if (fpath || any) {
-		    LM_ERR("broken msrp frame message, To-Path must be the first header.\n");
-		    return -1;		    
-		  }
+			tpath = 1;
+			if (fpath || any) {
+				LM_ERR("broken msrp frame message, To-Path must be the first header.\n");
+				return -1;		    
+			}
 		} else if (hdr->htype == MSRP_HDR_FROM_PATH) {
-		  fpath = 1;
-		  if (!tpath || any) {
-		    LM_ERR("broken msrp frame message, From-Path must be the second header.\n");
-		    return -1;
-		  }
+			fpath = 1;
+			if (!tpath || any) {
+				LM_ERR("broken msrp frame message, From-Path must be the second header.\n");
+				return -1;
+			}
 		} else {
-		  any = 1;
-		  if (!tpath || !fpath) {
-		    LM_ERR("broken msrp frame message, To-Path and From-Path must be defined before any header.\n");
-		    return -1;
-		  }
+			any = 1;
+			if (!tpath || !fpath) {
+				LM_ERR("broken msrp frame message, To-Path and From-Path must be defined before any header.\n");
+				return -1;
+			}
 		}
 		
 		LM_DBG("MSRP Header: (%p) [%.*s] [%d] [%.*s]\n",
@@ -322,8 +321,8 @@ int msrp_parse_headers(msrp_frame_t *mf)
 	}
 
 	if (!tpath || !fpath) {
-	  LM_ERR("broken msrp frame message, To-Path and From-Path must be defined.\n");
-	  return -1;
+		LM_ERR("broken msrp frame message, To-Path and From-Path must be defined.\n");
+		return -1;
 	}
 
 ateoh:




More information about the sr-dev mailing list