[Mplayer-cvslog] CVS: main/libmpdemux asf_mmst_streaming.c,1.5,1.6 asf_streaming.c,1.33,1.34 cdd.h,1.1,1.2 cddb.c,1.7,1.8 http.h,1.5,1.6 network.c,1.63,1.64 network.h,1.14,1.15

Bertrand Baudet bertrand at mplayerhq.hu
Tue Oct 29 10:18:56 CET 2002


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

Modified Files:
	asf_mmst_streaming.c asf_streaming.c cdd.h cddb.c http.h 
	network.c network.h 
Log Message:
GCC warning fixes


Index: asf_mmst_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_mmst_streaming.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- asf_mmst_streaming.c	23 Oct 2002 20:39:49 -0000	1.5
+++ asf_mmst_streaming.c	29 Oct 2002 09:18:53 -0000	1.6
@@ -133,8 +133,8 @@
 
 static int get_data (int s, char *buf, size_t count) 
 {
-  ssize_t  len, total;
-  total = 0;
+  ssize_t  len;
+  size_t total = 0;
 
   while (total < count) {
 
@@ -161,7 +161,7 @@
 static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) 
 {
   unsigned char  pre_header[8];
-  int            header_len,i ;
+  int            header_len;
 
   header_len = 0;
 
@@ -200,16 +200,16 @@
 
     } else {
 
-      int packet_len;
+      int32_t packet_len;
       int command;
       char data[BUF_SIZE];
 
-      if (!get_data (s, &packet_len, 4)) {
+      if (!get_data (s, (char*)&packet_len, 4)) {
 	printf ("packet_len read failed\n");
 	return 0;
       }
       
-      packet_len = get_32 (&packet_len, 0) + 4;
+      packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
       
 //      printf ("command packet detected, len=%d\n", packet_len);
       
@@ -304,7 +304,6 @@
 
 static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl) {
   unsigned char  pre_header[8];
-  int            i;
   char           data[BUF_SIZE];
 
   if (!get_data (s, pre_header, 8)) {
@@ -333,14 +332,15 @@
 
   } else {
 
-    int packet_len, command;
+    int32_t packet_len;
+    int command;
 
-    if (!get_data (s, &packet_len, 4)) {
+    if (!get_data (s, (char*)&packet_len, 4)) {
       printf ("packet_len read failed\n");
       return 0;
     }
 
-    packet_len = get_32 (&packet_len, 0) + 4;
+    packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
 
     if (!get_data (s, data, packet_len)) {
       printf ("command data read failed\n");
@@ -415,6 +415,10 @@
 asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) 
 {
 	return -1;
+	// Shut up gcc warning
+	fd++;
+	pos++;
+	streaming_ctrl=NULL;
 }
 
 int asf_mmst_streaming_start(stream_t *stream)
@@ -426,7 +430,7 @@
   int                  len, i, packet_length;
   char                *path;
   URL_t *url1 = stream->streaming_ctrl->url;
-  int s;
+  int s = stream->fd;
 
   if( s>0 ) {
 	  close( stream->fd );

Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- asf_streaming.c	22 Sep 2002 02:33:25 -0000	1.33
+++ asf_streaming.c	29 Oct 2002 09:18:53 -0000	1.34
@@ -23,6 +23,11 @@
 
 extern int verbose;
 
+
+int asf_http_streaming_start( stream_t *stream );
+int asf_mmst_streaming_start( stream_t *stream );
+
+
 // ASF streaming support several network protocol.
 // One use UDP, not known, yet!
 // Another is HTTP, this one is known.
@@ -143,7 +148,7 @@
 	// is big, the ASF header will be split in 2 network chunk.
 	// So we need to retrieve all the chunk before starting to parse the header.
   do {
-	  for( r=0; r < sizeof(ASF_stream_chunck_t) ; ) {
+	  for( r=0; r < (int)sizeof(ASF_stream_chunck_t) ; ) {
 		i = nop_streaming_read(fd,((char*)&chunk)+r,sizeof(ASF_stream_chunck_t) - r,streaming_ctrl);
 		if(i <= 0) return -1;
 		r += i;
@@ -270,7 +275,7 @@
 	if( streaming_ctrl->bandwidth!=0 ) {
 		int stream_count, stream_id, max_bitrate;
 		char *ptr = buffer+pos;
-		int total_bitrate=0, p_id, p_br;
+		unsigned int total_bitrate=0, p_id=0, p_br=0;
 		int i;
 		ptr += sizeof(objh);
 		stream_count = le2me_16(*(uint16_t*)ptr);
@@ -387,6 +392,10 @@
 int
 asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) {
 	return -1;
+	// to shut up gcc warning
+	fd++;
+	pos++;
+	streaming_ctrl=NULL;
 }
 
 int
@@ -550,10 +559,10 @@
 }
 
 int
-asf_http_parse_response( HTTP_header_t *http_hdr ) {
+asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTTP_header_t *http_hdr ) {
 	char *content_type, *pragma;
 	char features[64] = "\0";
-	int len;
+	size_t len;
 	if( http_response_parse(http_hdr)<0 ) {
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response\n");
 		return -1;
@@ -583,7 +592,7 @@
 				pragma += 9;
 				end = strstr( pragma, "," );
 				if( end==NULL ) {
-				  int s = strlen(pragma);
+				  size_t s = strlen(pragma);
 				  if(s > sizeof(features)) {
 				    mp_msg(MSGT_NETWORK,MSGL_WARN,"ASF HTTP PARSE WARNING : Pragma %s cuted from %d bytes to %d\n",pragma,s,sizeof(features));
 				    len = sizeof(features);
@@ -591,7 +600,7 @@
 				    len = s;
 				  }
 				} else { 
-				  len = MIN(end-pragma,sizeof(features));
+				  len = MIN((unsigned int)(end-pragma),sizeof(features));
 				}
 				strncpy( features, pragma, len );
 				features[len]='\0';
@@ -605,8 +614,8 @@
 		} while( comma_ptr!=NULL );
 		pragma = http_get_next_field( http_hdr );
 	}
-
-	return asf_http_streaming_type( content_type, features, http_hdr );
+	asf_http_ctrl->streaming_type = asf_http_streaming_type( content_type, features, http_hdr );
+	return 0;
 }
 
 int
@@ -614,7 +623,6 @@
 	HTTP_header_t *http_hdr=NULL;
 	URL_t *url = stream->streaming_ctrl->url;
 	asf_http_streaming_ctrl_t *asf_http_ctrl;
-	ASF_StreamType_e streaming_type;
 	char buffer[BUFFER_SIZE];
 	int i, ret;
 	int fd = stream->fd;
@@ -646,7 +654,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 <  http_hdr->buffer_size ; ) {
+		for(i=0; i < (int)http_hdr->buffer_size ; ) {
 			int r = write( fd, http_hdr->buffer+i, http_hdr->buffer_size-i );
 			if(r <0) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,"Socket write error : %s\n",strerror(errno));
@@ -670,14 +678,13 @@
 			http_hdr->buffer[http_hdr->buffer_size]='\0';
 			mp_msg(MSGT_NETWORK,MSGL_DBG2,"Response [%s]\n", http_hdr->buffer );
 		}
-		streaming_type = asf_http_parse_response(http_hdr);
-		if( streaming_type<0 ) {
+		ret = asf_http_parse_response(asf_http_ctrl, http_hdr);
+		if( ret<0 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse header\n");
 			http_free( http_hdr );
 			return -1;
 		}
-		asf_http_ctrl->streaming_type = streaming_type;
-		switch( streaming_type ) {
+		switch( asf_http_ctrl->streaming_type ) {
 			case ASF_Live_e:
 			case ASF_Prerecorded_e:
 			case ASF_PlainText_e:
@@ -688,7 +695,7 @@
 					}
 				}
 				if( asf_http_ctrl->request==1 ) {
-					if( streaming_type!=ASF_PlainText_e ) {
+					if( asf_http_ctrl->streaming_type!=ASF_PlainText_e ) {
 						// First request, we only got the ASF header.
 						ret = asf_streaming_parse_header(fd,stream->streaming_ctrl);
 						if(ret < 0) return -1;
@@ -729,7 +736,7 @@
 	} while(!done);
 
 	stream->fd = fd;
-	if( streaming_type==ASF_PlainText_e || streaming_type==ASF_Redirector_e ) {
+	if( asf_http_ctrl->streaming_type==ASF_PlainText_e || asf_http_ctrl->streaming_type==ASF_Redirector_e ) {
 		stream->streaming_ctrl->streaming_read = nop_streaming_read;
 		stream->streaming_ctrl->streaming_seek = nop_streaming_seek;
 	} else {

Index: cdd.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cdd.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cdd.h	10 Jul 2002 08:46:51 -0000	1.1
+++ cdd.h	29 Oct 2002 09:18:53 -0000	1.2
@@ -61,5 +61,6 @@
 cd_track_t*	cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length);
 cd_track_t*	cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb);
 
+void 		cd_info_debug(cd_info_t *cd_info);
 
 #endif // __CDD_H__

Index: cddb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cddb.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cddb.c	16 Oct 2002 08:14:42 -0000	1.7
+++ cddb.c	29 Oct 2002 09:18:53 -0000	1.8
@@ -371,7 +371,7 @@
 			}
 			// Ok found the end
 			// do a sanity check
-			if( http_hdr->body_size<(ptr2-ptr) ) {
+			if( http_hdr->body_size<(unsigned int)(ptr2-ptr) ) {
 				printf("Unexpected fix me\n");
 				return -1;
 			}
@@ -746,7 +746,7 @@
 			// Search for the genre
 			else if( xmcd_parse_dgenre(cd_info, ptr) );
 			// Search for a track title
-			else if( xmcd_parse_ttitle(cd_info, ptr) );
+			else if( xmcd_parse_ttitle(cd_info, ptr) ) audiolen++;	// <-- audiolen++ to shut up gcc warning
 		}
 		if( ptr2[1]=='\n' ) ptr2++;
 		pos = (ptr2+1)-ptr;

Index: http.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/http.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- http.h	23 Jun 2002 09:16:08 -0000	1.5
+++ http.h	29 Oct 2002 09:18:53 -0000	1.6
@@ -16,21 +16,21 @@
 	char *protocol;
 	char *method;
 	char *uri;
-	int status_code;
+	unsigned int status_code;
 	char *reason_phrase;
-	int http_minor_version;
+	unsigned int http_minor_version;
 	// Field variables
 	HTTP_field_t *first_field;
 	HTTP_field_t *last_field;
-	int field_nb;
+	unsigned int field_nb;
 	char *field_search;
 	HTTP_field_t *field_search_pos;
 	// Body variables
 	char *body;
-	int body_size;
+	size_t body_size;
 	char *buffer;
-	int buffer_size;
-	int is_parsed;
+	size_t buffer_size;
+	unsigned int is_parsed;
 } HTTP_header_t;
 
 HTTP_header_t*	http_new_header();

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- network.c	23 Oct 2002 22:07:29 -0000	1.63
+++ network.c	29 Oct 2002 09:18:53 -0000	1.64
@@ -35,6 +35,9 @@
 
 extern int mp_input_check_interrupt(int time);
 
+int asf_streaming_start( stream_t *stream );
+int rtsp_streaming_start( stream_t *stream );
+
 /* Variables for the command line option -user, -passwd & -bandwidth */
 char *network_username=NULL;
 char *network_password=NULL;
@@ -150,7 +153,7 @@
 	fd_set set;
 	struct timeval tv;
 	struct sockaddr_in server_address;
-	struct hostent *hp;
+	struct hostent *hp=NULL;
 
 	socket_server_fd = socket(AF_INET, SOCK_STREAM, 0);
 	if( socket_server_fd==-1 ) {
@@ -173,7 +176,7 @@
 	server_address.sin_port=htons(port);
 	
 	// Turn the socket as non blocking so we can timeout on the connection
-	if( isalpha(host[0]) ) {
+	if( isalpha(host[0]) && hp!=NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%d.%d.%d.%d]:%d ...\n", host, (hp->h_addr_list[0][0])&0xff, (hp->h_addr_list[0][1])&0xff, (hp->h_addr_list[0][2])&0xff, (hp->h_addr_list[0][3])&0xff, port );
 	} else {
 		mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s:%d ...\n", host, port );
@@ -312,7 +315,7 @@
 	mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request: [%s]\n", http_hdr->buffer );
 	
 	ret = write( fd, http_hdr->buffer, http_hdr->buffer_size );
-	if( ret!=http_hdr->buffer_size ) {
+	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;
 	}
@@ -354,7 +357,7 @@
 int
 http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
 	char *aut;
-	int ret;
+
 	if( *auth_retry==1 ) {
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Authentication failed\n");
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Please use the option -user and -passwd to provide your username/password for a list of URLs,\n");
@@ -643,6 +646,10 @@
 int
 nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl ) {
 	return -1;
+	// To shut up gcc warning
+	fd++;
+	pos++;
+	stream_ctrl=NULL;
 }
 
 int
@@ -805,7 +812,7 @@
 
 int
 streaming_start(stream_t *stream, int *demuxer_type, URL_t *url) {
-	int ret, val;
+	int ret;
 	if( stream==NULL ) return -1;
 
 	stream->streaming_ctrl = streaming_ctrl_new();
@@ -884,7 +891,6 @@
 		streaming_ctrl_free( stream->streaming_ctrl );
 		stream->streaming_ctrl = NULL;
 	} else if( stream->streaming_ctrl->buffering ) {
-		int cache_size = stream_cache_size; 
 		if(stream_cache_size<0) {
 			// cache option not set, will use our computed value.
 			// buffer in KBytes, *5 because the prefill is 20% of the buffer.

Index: network.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- network.h	29 Aug 2002 07:07:12 -0000	1.14
+++ network.h	29 Oct 2002 09:18:53 -0000	1.15
@@ -52,6 +52,8 @@
 int http_send_request(URL_t *url);
 HTTP_header_t *http_read_response(int fd);
 
+int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
+
 /* 
  * Joey Parrish <joey at yunamusic.com>:
  *




More information about the MPlayer-cvslog mailing list