Mercurial > libavformat.hg
comparison http.c @ 2274:b21c2af60bc9 libavformat
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
author | takis |
---|---|
date | Thu, 19 Jul 2007 15:23:32 +0000 |
parents | 5ce5fad0dfac |
children | 477419a721a3 |
comparison
equal
deleted
inserted
replaced
2273:7eb456c4ed8a | 2274:b21c2af60bc9 |
---|---|
99 goto fail; | 99 goto fail; |
100 if ((s->http_code == 302 || s->http_code == 303) && location_changed == 1) { | 100 if ((s->http_code == 302 || s->http_code == 303) && location_changed == 1) { |
101 /* url moved, get next */ | 101 /* url moved, get next */ |
102 url_close(hd); | 102 url_close(hd); |
103 if (redirects++ >= MAX_REDIRECTS) | 103 if (redirects++ >= MAX_REDIRECTS) |
104 return AVERROR_IO; | 104 return AVERROR(EIO); |
105 location_changed = 0; | 105 location_changed = 0; |
106 goto redo; | 106 goto redo; |
107 } | 107 } |
108 return 0; | 108 return 0; |
109 fail: | 109 fail: |
110 if (hd) | 110 if (hd) |
111 url_close(hd); | 111 url_close(hd); |
112 return AVERROR_IO; | 112 return AVERROR(EIO); |
113 } | 113 } |
114 | 114 |
115 static int http_open(URLContext *h, const char *uri, int flags) | 115 static int http_open(URLContext *h, const char *uri, int flags) |
116 { | 116 { |
117 HTTPContext *s; | 117 HTTPContext *s; |
137 { | 137 { |
138 int len; | 138 int len; |
139 if (s->buf_ptr >= s->buf_end) { | 139 if (s->buf_ptr >= s->buf_end) { |
140 len = url_read(s->hd, s->buffer, BUFFER_SIZE); | 140 len = url_read(s->hd, s->buffer, BUFFER_SIZE); |
141 if (len < 0) { | 141 if (len < 0) { |
142 return AVERROR_IO; | 142 return AVERROR(EIO); |
143 } else if (len == 0) { | 143 } else if (len == 0) { |
144 return -1; | 144 return -1; |
145 } else { | 145 } else { |
146 s->buf_ptr = s->buffer; | 146 s->buf_ptr = s->buffer; |
147 s->buf_end = s->buffer + len; | 147 s->buf_end = s->buffer + len; |
235 hoststr, | 235 hoststr, |
236 auth_b64); | 236 auth_b64); |
237 | 237 |
238 av_freep(&auth_b64); | 238 av_freep(&auth_b64); |
239 if (http_write(h, s->buffer, strlen(s->buffer)) < 0) | 239 if (http_write(h, s->buffer, strlen(s->buffer)) < 0) |
240 return AVERROR_IO; | 240 return AVERROR(EIO); |
241 | 241 |
242 /* init input buffer */ | 242 /* init input buffer */ |
243 s->buf_ptr = s->buffer; | 243 s->buf_ptr = s->buffer; |
244 s->buf_end = s->buffer; | 244 s->buf_end = s->buffer; |
245 s->line_count = 0; | 245 s->line_count = 0; |
253 /* wait for header */ | 253 /* wait for header */ |
254 q = line; | 254 q = line; |
255 for(;;) { | 255 for(;;) { |
256 ch = http_getc(s); | 256 ch = http_getc(s); |
257 if (ch < 0) | 257 if (ch < 0) |
258 return AVERROR_IO; | 258 return AVERROR(EIO); |
259 if (ch == '\n') { | 259 if (ch == '\n') { |
260 /* process line */ | 260 /* process line */ |
261 if (q > line && q[-1] == '\r') | 261 if (q > line && q[-1] == '\r') |
262 q--; | 262 q--; |
263 *q = '\0'; | 263 *q = '\0'; |