HTTP: Compact the code for writing chunked post data
authorMartin Storsjö <martin@martin.st>
Mon, 21 Jun 2010 19:02:05 +0000 (19:02 +0000)
committerMartin Storsjö <martin@martin.st>
Mon, 21 Jun 2010 19:02:05 +0000 (19:02 +0000)
Originally committed as revision 23683 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/http.c

index 7156e0c..d4300a6 100644 (file)
@@ -440,13 +440,10 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
     if (size > 0) {
         /* upload data using chunked encoding */
             snprintf(temp, sizeof(temp), "%x\r\n", size);
-            if ((ret = url_write(s->hd, temp, strlen(temp))) < 0)
-                return ret;
 
-        if ((ret = url_write(s->hd, buf, size)) < 0)
-            return ret;
-
-        if ((ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
+        if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
+            (ret = url_write(s->hd, buf, size)) < 0 ||
+            (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
             return ret;
     }
     return size;