[Mplayer-cvslog] CVS: main/libmpdemux url.c,1.20,1.21

Ross Finlayson CVS rsf at mplayerhq.hu
Sat May 3 08:16:10 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv18119

Modified Files:
	url.c 
Log Message:
Added some special-case code for checking for "sip:" URLs (because they
don't include a "//" like other URLs).


Index: url.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/url.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- url.c	18 Apr 2003 12:16:35 -0000	1.20
+++ url.c	3 May 2003 06:16:07 -0000	1.21
@@ -17,6 +17,7 @@
 	int pos1, pos2;
 	URL_t* Curl;
 	char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL;
+	int jumpSize = 3;
 
 	if( url==NULL ) return NULL;
 	
@@ -40,9 +41,15 @@
 	// extract the protocol
 	ptr1 = strstr(url, "://");
 	if( ptr1==NULL ) {
-		mp_msg(MSGT_NETWORK,MSGL_V,"Not an URL!\n");
-		url_free(Curl);
-		return NULL;
+	        // Check for a special case: "sip:" (without "//"):
+	        if (strstr(url, "sip:") == url) {
+		        ptr1 = &url[3]; // points to ':'
+			jumpSize = 1;
+		} else {
+		        mp_msg(MSGT_NETWORK,MSGL_V,"Not an URL!\n");
+		        url_free(Curl);
+			return NULL;
+		}
 	}
 	pos1 = ptr1-url;
 	Curl->protocol = (char*)malloc(pos1+1);
@@ -55,8 +62,8 @@
 	Curl->protocol[pos1] = '\0';
 
 	// jump the "://"
-	ptr1 += 3;
-	pos1 += 3;
+	ptr1 += jumpSize;
+	pos1 += jumpSize;
 
 	// check if a username:password is given
 	ptr2 = strstr(ptr1, "@");



More information about the MPlayer-cvslog mailing list