diff options
author | cboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-11-25 10:01:03 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-16 04:29:20 +0200 |
commit | a9b5a9348d51465167c0907a2913f6f14ad28d00 (patch) | |
tree | 27b6c297dc8c9449619b52b83b1a308adf8d4236 /stream | |
parent | 9bf59a1fcb6de3fed117accaec60b6b0eaece17d (diff) | |
download | mpv-a9b5a9348d51465167c0907a2913f6f14ad28d00.tar.bz2 mpv-a9b5a9348d51465167c0907a2913f6f14ad28d00.tar.xz |
stream/network.c, stream/http.c: cleanup
Simplify mime_type_table loop
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32644 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove dead define
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32645 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove GCC warning hack not needed anymore
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32646 b3059339-0415-0410-9bf9-f77b7e298cf2
Use calloc instead of malloc+memset.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32647 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/http.c | 7 | ||||
-rw-r--r-- | stream/network.c | 10 |
2 files changed, 4 insertions, 13 deletions
diff --git a/stream/http.c b/stream/http.c index 91b05c6d1c..9d00f00f87 100644 --- a/stream/http.c +++ b/stream/http.c @@ -764,7 +764,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; @@ -853,16 +852,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, diff --git a/stream/network.c b/stream/network.c index 1da6f24ca9..c8667686ec 100644 --- a/stream/network.c +++ b/stream/network.c @@ -20,8 +20,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -//#define DUMP2FILE - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -114,13 +112,11 @@ const mime_struct_t mime_type_table[] = { streaming_ctrl_t * streaming_ctrl_new(void) { - streaming_ctrl_t *streaming_ctrl; - streaming_ctrl = malloc(sizeof(streaming_ctrl_t)); + streaming_ctrl_t *streaming_ctrl = calloc(1, sizeof(*streaming_ctrl)); if( streaming_ctrl==NULL ) { mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n"); return NULL; } - memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) ); return streaming_ctrl; } @@ -475,10 +471,6 @@ nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctr 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; } |