changeset 32557:683199947822

Simplify mime_type_table loop
author cboesch
date Thu, 25 Nov 2010 10:01:03 +0000
parents 34215c3e6e10
children 35eb07c24cda
files stream/http.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Tue Nov 23 14:44:26 2010 +0000
+++ b/stream/http.c	Thu Nov 25 10:01:03 2010 +0000
@@ -762,7 +762,6 @@
 //! If this function succeeds you must closesocket stream->fd
 static int http_streaming_start(stream_t *stream, int* file_format) {
 	HTTP_header_t *http_hdr = NULL;
-	unsigned int i;
 	int fd = stream->fd;
 	int res = STREAM_UNSUPPORTED;
 	int redirect = 0;
@@ -851,16 +850,16 @@
 				// Look if we can use the Content-Type
 				content_type = http_get_field( http_hdr, "Content-Type" );
 				if( content_type!=NULL ) {
+					unsigned int i;
+
 					mp_msg(MSGT_NETWORK,MSGL_V,"Content-Type: [%s]\n", content_type );
 					// Check in the mime type table for a demuxer type
-					i = 0;
-					while(mime_type_table[i].mime_type != NULL) {
+					for (i = 0; mime_type_table[i].mime_type != NULL; i++) {
 						if( !strcasecmp( content_type, mime_type_table[i].mime_type ) ) {
 							*file_format = mime_type_table[i].demuxer_type;
 							res = seekable;
 							goto out;
 						}
-						i++;
 					}
 				}
 				// Not found in the mime type table, don't fail,