Commit ea02b593 authored by Martin Storsjö's avatar Martin Storsjö

HTTP: Compact the code for writing chunked post data

Originally committed as revision 23683 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 077026cc
...@@ -440,13 +440,10 @@ static int http_write(URLContext *h, const uint8_t *buf, int size) ...@@ -440,13 +440,10 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
if (size > 0) { if (size > 0) {
/* upload data using chunked encoding */ /* upload data using chunked encoding */
snprintf(temp, sizeof(temp), "%x\r\n", size); 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 ret;
} }
return size; return size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment