[PATCH 1/5] introduce http_get_line
Peter Holik
peter
Mon Jun 1 19:09:36 CEST 2009
Signed-off-by: Peter Holik <peter at holik.at>
---
libavformat/http.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index d904e7a..ffc34e1 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -151,6 +151,30 @@ static int http_getc(HTTPContext *s)
return *s->buf_ptr++;
}
+static int http_get_line(HTTPContext *s, char *line, int line_size)
+{
+ int ch;
+ char *q;
+
+ q = line;
+ for(;;) {
+ ch = http_getc(s);
+ if (ch < 0)
+ return AVERROR(EIO);
+ if (ch == '\n') {
+ /* process line */
+ if (q > line && q[-1] == '\r')
+ q--;
+ *q = '\0';
+
+ return 0;
+ } else {
+ if ((q - line) < line_size - 1)
+ *q++ = ch;
+ }
+ }
+}
+
static int process_line(URLContext *h, char *line, int line_count,
int *new_location)
{
--
1.6.3.1
------=_20090601194625_76390
Content-Type: text/x-patch;
name="0002-http_connect-changed-to-use-http_get_line.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
filename="0002-http_connect-changed-to-use-http_get_line.patch"
More information about the ffmpeg-devel
mailing list