diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-03-14 02:59:33 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-03-14 02:59:33 +0000 |
commit | 9eef2b77b29189606148e1fdf5d6c8d7b52b08b0 (patch) | |
tree | 8bab32620ce05bcb106c0ef9c7d56257d4911c2b /libavformat/tcp.c | |
parent | c3775e542f8fda9eeda31cce1d588d70c2fcd56b (diff) | |
download | ffmpeg-9eef2b77b29189606148e1fdf5d6c8d7b52b08b0.tar.gz |
no read loop tcp/http and http CRLF fix by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
Originally committed as revision 2885 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r-- | libavformat/tcp.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 7638b95d92..b49e78ff24 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -141,12 +141,11 @@ static int tcp_open(URLContext *h, const char *uri, int flags) static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int size1, len, fd_max; + int len, fd_max; fd_set rfds; struct timeval tv; - size1 = size; - while (size > 0) { + for (;;) { if (url_interrupt_cb()) return -EINTR; fd_max = s->fd; @@ -167,15 +166,9 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) #else return -errno; #endif - else - continue; - } else if (len == 0) { - break; - } - size -= len; - buf += len; + } else break; } - return size1 - size; + return len; } static int tcp_write(URLContext *h, uint8_t *buf, int size) |