[PATCH 1/4] Simplify mime_type_table loop

Clément Bœsch ubitux at gmail.com
Thu Nov 4 00:44:16 CET 2010


---
 stream/http.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/stream/http.c b/stream/http.c
index 60cf568..286d8ef 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -762,7 +762,6 @@ static void print_icy_metadata(HTTP_header_t *http_hdr) {
 //! 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 @@ static int http_streaming_start(stream_t *stream, int* file_format) {
 				// 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,
-- 
1.7.3.2


--61jdw2sOBCFtR2d/
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="0002-Remove-dead-define.patch"



More information about the MPlayer-dev-eng mailing list