Mercurial > libavformat.hg
comparison http.c @ 482:0fdc96c2f2fe libavformat
sweeping change from -EIO -> AVERROR_IO
| author | melanson |
|---|---|
| date | Sat, 19 Jun 2004 03:59:34 +0000 |
| parents | 2f56d366a787 |
| children | 056991ab9f10 |
comparison
equal
deleted
inserted
replaced
| 481:f1430abbbd8b | 482:0fdc96c2f2fe |
|---|---|
| 114 return 0; | 114 return 0; |
| 115 fail: | 115 fail: |
| 116 if (hd) | 116 if (hd) |
| 117 url_close(hd); | 117 url_close(hd); |
| 118 av_free(s); | 118 av_free(s); |
| 119 return -EIO; | 119 return AVERROR_IO; |
| 120 } | 120 } |
| 121 | 121 |
| 122 static int http_getc(HTTPContext *s) | 122 static int http_getc(HTTPContext *s) |
| 123 { | 123 { |
| 124 int len; | 124 int len; |
| 125 if (s->buf_ptr >= s->buf_end) { | 125 if (s->buf_ptr >= s->buf_end) { |
| 126 len = url_read(s->hd, s->buffer, BUFFER_SIZE); | 126 len = url_read(s->hd, s->buffer, BUFFER_SIZE); |
| 127 if (len < 0) { | 127 if (len < 0) { |
| 128 return -EIO; | 128 return AVERROR_IO; |
| 129 } else if (len == 0) { | 129 } else if (len == 0) { |
| 130 return -1; | 130 return -1; |
| 131 } else { | 131 } else { |
| 132 s->buf_ptr = s->buffer; | 132 s->buf_ptr = s->buffer; |
| 133 s->buf_end = s->buffer + len; | 133 s->buf_end = s->buffer + len; |
| 192 path, | 192 path, |
| 193 LIBAVFORMAT_IDENT, | 193 LIBAVFORMAT_IDENT, |
| 194 hoststr); | 194 hoststr); |
| 195 | 195 |
| 196 if (http_write(h, s->buffer, strlen(s->buffer)) < 0) | 196 if (http_write(h, s->buffer, strlen(s->buffer)) < 0) |
| 197 return -EIO; | 197 return AVERROR_IO; |
| 198 | 198 |
| 199 /* init input buffer */ | 199 /* init input buffer */ |
| 200 s->buf_ptr = s->buffer; | 200 s->buf_ptr = s->buffer; |
| 201 s->buf_end = s->buffer; | 201 s->buf_end = s->buffer; |
| 202 s->line_count = 0; | 202 s->line_count = 0; |
| 209 /* wait for header */ | 209 /* wait for header */ |
| 210 q = line; | 210 q = line; |
| 211 for(;;) { | 211 for(;;) { |
| 212 ch = http_getc(s); | 212 ch = http_getc(s); |
| 213 if (ch < 0) | 213 if (ch < 0) |
| 214 return -EIO; | 214 return AVERROR_IO; |
| 215 if (ch == '\n') { | 215 if (ch == '\n') { |
| 216 /* process line */ | 216 /* process line */ |
| 217 if (q > line && q[-1] == '\r') | 217 if (q > line && q[-1] == '\r') |
| 218 q--; | 218 q--; |
| 219 *q = '\0'; | 219 *q = '\0'; |
