[Mplayer-cvslog] CVS: main/libmpdemux asf_mmst_streaming.c,1.8,1.9 asf_streaming.c,1.37,1.38 netstream.h,1.2,1.3 network.c,1.81,1.82 pnm.c,1.4,1.5

Alex Beregszaszi alex at mplayerhq.hu
Thu May 29 21:34:33 CEST 2003


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

Modified Files:
	asf_mmst_streaming.c asf_streaming.c netstream.h network.c 
	pnm.c 
Log Message:
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8 at yahoo.de>

Index: asf_mmst_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_mmst_streaming.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- asf_mmst_streaming.c	25 May 2003 18:28:26 -0000	1.8
+++ asf_mmst_streaming.c	29 May 2003 19:33:33 -0000	1.9
@@ -90,7 +90,7 @@
 
   memcpy (&cmd.buf[48], data, length);
 
-  if (write (s, cmd.buf, length+48) != (length+48)) {
+  if (send (s, cmd.buf, length+48, 0) != (length+48)) {
     printf ("write error\n");
   }
 }
@@ -118,7 +118,7 @@
   while (command == 0x1b) {
     int len;
 
-    len = read (s, data, BUF_SIZE) ;
+    len = recv (s, data, BUF_SIZE, 0) ;
     if (!len) {
       printf ("\nalert! eof\n");
       return;
@@ -138,7 +138,7 @@
 
   while (total < count) {
 
-    len = read (s, &buf[total], count-total);
+    len = recv (s, &buf[total], count-total, 0);
 
     if (len<0) {
       perror ("read error:");
@@ -460,7 +460,7 @@
 // send_command(s, commandno ....)
   send_command (s, 1, 0, 0x0004000b, strlen(str) * 2+8, data);
 
-  len = read (s, data, BUF_SIZE) ;
+  len = recv (s, data, BUF_SIZE, 0) ;
 
   /*This sends details of the local machine IP address to a Funnel system at the server. 
   * Also, the TCP or UDP transport selection is sent.
@@ -475,7 +475,7 @@
   memset (data, 0, 8);
   send_command (s, 2, 0, 0, 28*2+8, data);
 
-  len = read (s, data, BUF_SIZE) ;
+  len = recv (s, data, BUF_SIZE, 0) ;
 
   /* This command sends file path (at server) and file name request to the server.
   * 0x5 */

Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- asf_streaming.c	30 Mar 2003 17:10:36 -0000	1.37
+++ asf_streaming.c	29 May 2003 19:33:33 -0000	1.38
@@ -656,7 +656,7 @@
 		http_hdr = asf_http_request( stream->streaming_ctrl );
 		mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request [%s]\n", http_hdr->buffer );
 		for(i=0; i < (int)http_hdr->buffer_size ; ) {
-			int r = write( fd, http_hdr->buffer+i, http_hdr->buffer_size-i );
+			int r = send( fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0 );
 			if(r <0) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,"Socket write error : %s\n",strerror(errno));
 				return -1;
@@ -666,7 +666,7 @@
 		http_free( http_hdr );
 		http_hdr = http_new_header();
 		do {
-			i = read( fd, buffer, BUFFER_SIZE );
+			i = recv( fd, buffer, BUFFER_SIZE, 0 );
 //printf("read: %d\n", i );
 			if( i<=0 ) {
 				perror("read");

Index: netstream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/netstream.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- netstream.h	6 Apr 2003 18:15:43 -0000	1.2
+++ netstream.h	29 May 2003 19:33:33 -0000	1.3
@@ -45,7 +45,7 @@
 static int net_read(int fd, char* buf, int len) {
   int r = 0;
   while(len) {
-    r = read(fd,buf,len);
+    r = recv(fd,buf,len,0);
     if(r <= 0) {
       if(errno == EINTR) continue;
       if(r < 0)
@@ -95,7 +95,7 @@
 static int net_write(int fd, char* buf, int len) {
   int w;
   while(len) {
-    w = write(fd,buf,len);
+    w = send(fd,buf,len,0);
     if(w <= 0) {
       if(errno == EINTR) continue;
       if(w < 0)

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- network.c	28 May 2003 21:40:24 -0000	1.81
+++ network.c	29 May 2003 19:33:33 -0000	1.82
@@ -428,7 +428,7 @@
 	}
 	mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request: [%s]\n", http_hdr->buffer );
 	
-	ret = write( fd, http_hdr->buffer, http_hdr->buffer_size );
+	ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 );
 	if( ret!=(int)http_hdr->buffer_size ) {
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: didn't sent all the request\n");
 		return -1;
@@ -451,7 +451,7 @@
 	}
 
 	do {
-		i = read( fd, response, BUFFER_SIZE ); 
+		i = recv( fd, response, BUFFER_SIZE, 0 ); 
 		if( i<0 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Read failed\n");
 			http_free( http_hdr );
@@ -794,7 +794,7 @@
 
 	if( len<size ) {
 		int ret;
-		ret = read( fd, buffer+len, size-len );
+		ret = recv( fd, buffer+len, size-len, 0 );
 		if( ret<0 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno));
 		}

Index: pnm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/pnm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pnm.c	10 Jan 2003 22:41:49 -0000	1.4
+++ pnm.c	29 May 2003 19:33:33 -0000	1.5
@@ -202,7 +202,7 @@
   while (total < len){ 
     int n;
 
-    n = write (s, &buf[total], len - total);
+    n = send (s, &buf[total], len - total, 0);
 
     if (n > 0)
       total += n;
@@ -238,7 +238,7 @@
       return -1;
     }
     
-    ret=read (fd, ((uint8_t*)buf)+total, count-total);
+    ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0);
 
     if (ret<=0) {
       printf ("input_pnm: read error.\n");



More information about the MPlayer-cvslog mailing list