diff tcp.c @ 385:2f56d366a787 libavformat

no read loop tcp/http and http CRLF fix by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
author michael
date Sun, 14 Mar 2004 02:59:33 +0000
parents 5f27f90ed496
children 9af30d452a0a
line wrap: on
line diff
--- a/tcp.c	Sat Mar 13 23:04:37 2004 +0000
+++ b/tcp.c	Sun Mar 14 02:59:33 2004 +0000
@@ -141,12 +141,11 @@
 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 @@
 #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)