]> git.zerfleddert.de Git - record-dvb/commitdiff
line parsing fixes
authormichael <michael>
Sun, 2 Jul 2006 11:52:15 +0000 (11:52 +0000)
committermichael <michael>
Sun, 2 Jul 2006 11:52:15 +0000 (11:52 +0000)
sap.c

diff --git a/sap.c b/sap.c
index 85ec2c321654fc88db9aca0f2fca42ebbf168a4f..6a8ef799e6a0831a6de2f5fa6be677045cfe9ca5 100644 (file)
--- a/sap.c
+++ b/sap.c
@@ -31,7 +31,7 @@ struct sdp_info {
 
 struct sdp_info *parse_sdp(char *sdp, int len)
 {
 
 struct sdp_info *parse_sdp(char *sdp, int len)
 {
-       char *pos;
+       char *pos, *line;
        static struct sdp_info sdpinfo;
 
        /* RFC 2327
        static struct sdp_info sdpinfo;
 
        /* RFC 2327
@@ -47,7 +47,7 @@ struct sdp_info *parse_sdp(char *sdp, int len)
 
        bzero(&sdpinfo, sizeof(struct sdp_info));
 
 
        bzero(&sdpinfo, sizeof(struct sdp_info));
 
-       pos = sdp;
+       pos = line = sdp;
        while(*pos != 0 && (pos-sdp) < len) {
                if (*pos == 0x0d)
                        *pos = 0;
        while(*pos != 0 && (pos-sdp) < len) {
                if (*pos == 0x0d)
                        *pos = 0;
@@ -55,55 +55,55 @@ struct sdp_info *parse_sdp(char *sdp, int len)
                if (*pos == 0x0a) {
                        *pos = 0;
 
                if (*pos == 0x0a) {
                        *pos = 0;
 
-                       if (!strncasecmp("s=", sdp, 2)) {
-                               sdpinfo.service = sdp + 2;
-                       } else if (!strncasecmp("c=", sdp, 2)) {
+                       if (!strncasecmp("s=", line, 2)) {
+                               sdpinfo.service = line + 2;
+                       } else if (!strncasecmp("c=", line, 2)) {
                                int poscnt = 0;
 
                                int poscnt = 0;
 
-                               sdp += 2;
-                               while (*sdp != 0) {
-                                       if (poscnt == 2 && *sdp == '/') {
-                                               *sdp = 0;
+                               line += 2;
+                               while (*line != 0) {
+                                       if (poscnt == 2 && *line == '/') {
+                                               *line = 0;
                                                break;
                                        }
 
                                                break;
                                        }
 
-                                       if (*sdp == ' ') {
-                                               *sdp = 0;
+                                       if (*line == ' ') {
+                                               *line = 0;
                                                poscnt++;
 
                                                /* c=<network type> <address type> <connection address> */
                                                if (poscnt == 2)
                                                poscnt++;
 
                                                /* c=<network type> <address type> <connection address> */
                                                if (poscnt == 2)
-                                                       sdpinfo.host = sdp + 1;
+                                                       sdpinfo.host = line + 1;
 
                                                if (poscnt > 2)
                                                        break;
                                        }
 
                                                if (poscnt > 2)
                                                        break;
                                        }
-                                       sdp++;
+                                       line++;
                                }
                                }
-                       } else if (!strncasecmp("m=", sdp, 2)) {
+                       } else if (!strncasecmp("m=", line, 2)) {
                                int poscnt = 0;
 
                                int poscnt = 0;
 
-                               sdp += 2;
-                               while (*sdp != 0) {
-                                       if (*sdp == ' ') {
-                                               *sdp = 0;
+                               line += 2;
+                               while (*line != 0) {
+                                       if (*line == ' ') {
+                                               *line = 0;
                                                poscnt++;
 
                                                /* m=<media> <port> <transport> <fmt list> */
                                                if (poscnt == 1)
                                                poscnt++;
 
                                                /* m=<media> <port> <transport> <fmt list> */
                                                if (poscnt == 1)
-                                                       sdpinfo.port = sdp + 1;
+                                                       sdpinfo.port = line + 1;
 
                                                if (poscnt == 2)
 
                                                if (poscnt == 2)
-                                                       sdpinfo.proto = sdp + 1;
+                                                       sdpinfo.proto = line + 1;
 
                                                if (poscnt > 2)
                                                        break;
                                        }
 
                                                if (poscnt > 2)
                                                        break;
                                        }
-                                       sdp++;
+                                       line++;
                                }
                        }
 
                                }
                        }
 
-                       sdp = ++pos;
+                       line = ++pos;
                        continue;
                }
                pos++;
                        continue;
                }
                pos++;
Impressum, Datenschutz