diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-03-12 02:33:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-12 02:34:02 +0100 |
commit | 03fd80dcb1f8885385bcd04aa59a2931db5316d3 (patch) | |
tree | 877ebeb520afd0563601e496cc904e2c7e7292a2 /libavformat/http.c | |
parent | 3a05d7a9e583b8f5fee361d97d6793cf01974af2 (diff) | |
parent | 55a215ba63d9fa79cd7ee265ee2e777ee86b200c (diff) |
Merge commit '55a215ba63d9fa79cd7ee265ee2e777ee86b200c'
* commit '55a215ba63d9fa79cd7ee265ee2e777ee86b200c':
http: Return meaningful error codes
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r-- | libavformat/http.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/http.c b/libavformat/http.c index f693c4d0c6..1f1297c0f0 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -287,7 +287,7 @@ static int http_getc(HTTPContext *s) if (len < 0) { return len; } else if (len == 0) { - return -1; + return AVERROR_EOF; } else { s->buf_ptr = s->buffer; s->buf_end = s->buffer + len; @@ -350,7 +350,7 @@ static int process_line(URLContext *h, char *line, int line_count, end += strspn(end, SPACE_CHARS); av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", s->http_code, end); - return -1; + return AVERROR(EIO); } } else { while (*p != '\0' && *p != ':') @@ -969,7 +969,7 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence) URLContext *old_hd = s->hd; int64_t old_off = s->off; uint8_t old_buf[BUFFER_SIZE]; - int old_buf_size; + int old_buf_size, ret; AVDictionary *options = NULL; if (whence == AVSEEK_SIZE) @@ -977,7 +977,7 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence) else if ((whence == SEEK_CUR && off == 0) || (whence == SEEK_SET && off == s->off)) return s->off; else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed) - return -1; + return AVERROR(ENOSYS); if (whence == SEEK_CUR) off += s->off; @@ -996,14 +996,14 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence) /* if it fails, continue on old connection */ av_dict_copy(&options, s->chained_options, 0); - if (http_open_cnx(h, &options) < 0) { + if ((ret = http_open_cnx(h, &options)) < 0) { av_dict_free(&options); memcpy(s->buffer, old_buf, old_buf_size); s->buf_ptr = s->buffer; s->buf_end = s->buffer + old_buf_size; s->hd = old_hd; s->off = old_off; - return -1; + return ret; } av_dict_free(&options); ffurl_close(old_hd); |