Commit 6f3e0b21 authored by Panagiotis Issaris's avatar Panagiotis Issaris

Replace all occurrences of AVERROR_IO with AVERROR(EIO).

Originally committed as revision 9760 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 769e10f0
......@@ -133,7 +133,7 @@ void print_error(const char *filename, int err)
case AVERROR_NOFMT:
fprintf(stderr, "%s: Unknown format\n", filename);
break;
case AVERROR_IO:
case AVERROR(EIO):
fprintf(stderr, "%s: I/O error occured\n"
"Usually that means that input file is truncated and/or corrupted.\n",
filename);
......
......@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s,
if (!header)
return AVERROR(ENOMEM);
if (get_buffer(pb, header, header_size) != header_size)
return AVERROR_IO;
return AVERROR(EIO);
/* take the lazy approach and search for any and all vtrk and strk chunks */
for (i = 0; i < header_size - 8; i++) {
......@@ -235,7 +235,7 @@ static int fourxm_read_packet(AVFormatContext *s,
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
if (url_feof(pb))
return AVERROR_IO;
return AVERROR(EIO);
switch (fourcc_tag) {
case LIST_TAG:
......@@ -253,7 +253,7 @@ static int fourxm_read_packet(AVFormatContext *s,
/* allocate 8 more bytes than 'size' to account for fourcc
* and size */
if (size + 8 < size || av_new_packet(pkt, size + 8))
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
pkt->pos = url_ftell(&s->pb);
......@@ -275,7 +275,7 @@ static int fourxm_read_packet(AVFormatContext *s,
if (track_number == fourxm->selected_track) {
ret= av_get_packet(&s->pb, pkt, size);
if(ret<0)
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index =
fourxm->tracks[fourxm->selected_track].stream_index;
pkt->pts = fourxm->audio_pts;
......
......@@ -64,7 +64,7 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag)
int size;
if (url_feof(pb))
return AVERROR_IO;
return AVERROR(EIO);
*tag = get_le32(pb);
size = get_be32(pb);
......@@ -400,7 +400,7 @@ static int aiff_read_packet(AVFormatContext *s,
/* End of stream may be reached */
if (url_feof(&s->pb))
return AVERROR_IO;
return AVERROR(EIO);
/* Now for that packet */
res = av_get_packet(&s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
......
......@@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s,
if (url_feof(&s->pb))
{
return AVERROR_IO;
return AVERROR(EIO);
}
//FIXME this is wrong, this should rather be in a AVParset
......@@ -148,7 +148,7 @@ static int amr_read_packet(AVFormatContext *s,
if ( (size==0) || av_new_packet(pkt, size))
{
return AVERROR_IO;
return AVERROR(EIO);
}
pkt->stream_index = 0;
......@@ -160,7 +160,7 @@ static int amr_read_packet(AVFormatContext *s,
if (read != size-1)
{
av_free_packet(pkt);
return AVERROR_IO;
return AVERROR(EIO);
}
return 0;
......
......@@ -75,7 +75,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
{
if (av_get_packet(&s->pb, pkt, MAX_READ_SIZE) <= 0)
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = 0;
return 0;
}
......
......@@ -714,7 +714,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
//static int pc = 0;
for (;;) {
if(url_feof(pb))
return AVERROR_IO;
return AVERROR(EIO);
if (asf->packet_size_left < FRAME_HEADER_SIZE
|| asf->packet_segments < 1) {
//asf->packet_size_left <= asf->packet_padsize) {
......@@ -727,7 +727,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
asf->packet_pos= url_ftell(&s->pb);
if (asf->data_object_size != (uint64_t)-1 &&
(asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
return AVERROR_IO; /* Do not exceed the size of the data object */
return AVERROR(EIO); /* Do not exceed the size of the data object */
ret = asf_get_packet(s);
//printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++);
if (ret < 0)
......
......@@ -159,10 +159,10 @@ static int au_read_packet(AVFormatContext *s,
int ret;
if (url_feof(&s->pb))
return AVERROR_IO;
return AVERROR(EIO);
ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
if (ret < 0)
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = 0;
/* note: we need to modify the packet size here to handle the last
......
......@@ -59,7 +59,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
audio_fd = open(audio_device, O_RDONLY);
if (audio_fd < 0) {
perror(audio_device);
return AVERROR_IO;
return AVERROR(EIO);
}
if (flip && *flip == '1') {
......@@ -110,7 +110,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
default:
av_log(NULL, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
close(audio_fd);
return AVERROR_IO;
return AVERROR(EIO);
}
err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
if (err < 0) {
......@@ -139,7 +139,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
return 0;
fail:
close(audio_fd);
return AVERROR_IO;
return AVERROR(EIO);
}
static int audio_close(AudioData *s)
......@@ -160,7 +160,7 @@ static int audio_write_header(AVFormatContext *s1)
s->channels = st->codec->channels;
ret = audio_open(s, 1, s1->filename);
if (ret < 0) {
return AVERROR_IO;
return AVERROR(EIO);
} else {
return 0;
}
......@@ -185,7 +185,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
if (ret > 0)
break;
if (ret < 0 && (errno != EAGAIN && errno != EINTR))
return AVERROR_IO;
return AVERROR(EIO);
}
s->buffer_ptr = 0;
}
......@@ -224,7 +224,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = audio_open(s, 0, s1->filename);
if (ret < 0) {
av_free(st);
return AVERROR_IO;
return AVERROR(EIO);
}
/* take real parameters */
......@@ -245,7 +245,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
struct audio_buf_info abufi;
if (av_new_packet(pkt, s->frame_size) < 0)
return AVERROR_IO;
return AVERROR(EIO);
for(;;) {
struct timeval tv;
fd_set fds;
......@@ -270,7 +270,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
av_free_packet(pkt);
return AVERROR_IO;
return AVERROR(EIO);
}
}
pkt->size = ret;
......
......@@ -101,7 +101,7 @@ int url_read(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (h->flags & URL_WRONLY)
return AVERROR_IO;
return AVERROR(EIO);
ret = h->prot->url_read(h, buf, size);
return ret;
}
......@@ -111,10 +111,10 @@ int url_write(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (!(h->flags & (URL_WRONLY | URL_RDWR)))
return AVERROR_IO;
return AVERROR(EIO);
/* avoid sending too big packets */
if (h->max_packet_size && size > h->max_packet_size)
return AVERROR_IO;
return AVERROR(EIO);
ret = h->prot->url_write(h, buf, size);
return ret;
}
......
......@@ -514,7 +514,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
url_read_packet, url_write_packet, url_seek_packet) < 0) {
av_free(buffer);
return AVERROR_IO;
return AVERROR(EIO);
}
s->is_streamed = h->is_streamed;
s->max_packet_size = max_packet_size;
......
......@@ -156,10 +156,10 @@ static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
stream = &avs->streams[stream_id];
if (stream->read >= stream->info.dwLength)
return AVERROR_IO;
return AVERROR(EIO);
if (av_new_packet(pkt, stream->chunck_size))
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = stream_id;
pkt->pts = avs->streams[stream_id].read / avs->streams[stream_id].chunck_samples;
......
......@@ -106,7 +106,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
ret = get_buffer(&s->pb, pkt->data + palette_size + 4, size - 4) + 4;
if (ret < size) {
av_free_packet(pkt);
return AVERROR_IO;
return AVERROR(EIO);
}
pkt->size = ret + palette_size;
......@@ -127,7 +127,7 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
size = url_ftell(&s->pb) - size;
avs->remaining_audio_size -= size;
if (ret == AVERROR_IO)
if (ret == AVERROR(EIO))
return 0; /* this indicate EOS */
if (ret < 0)
return ret;
......@@ -154,7 +154,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
while (1) {
if (avs->remaining_frame_size <= 0) {
if (!get_le16(&s->pb)) /* found EOF */
return AVERROR_IO;
return AVERROR(EIO);
avs->remaining_frame_size = get_le16(&s->pb) - 4;
}
......@@ -168,7 +168,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_PALETTE:
ret = get_buffer(&s->pb, palette, size - 4);
if (ret < size - 4)
return AVERROR_IO;
return AVERROR(EIO);
palette_size = size;
break;
......
......@@ -179,7 +179,7 @@ static int vid_read_packet(AVFormatContext *s,
int ret_value;
if(vid->is_finished || url_feof(pb))
return AVERROR_IO;
return AVERROR(EIO);
block_type = get_byte(pb);
switch(block_type){
......@@ -188,7 +188,7 @@ static int vid_read_packet(AVFormatContext *s,
ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
if(ret_value != 3 * 256 + 1){
av_free_packet(pkt);
return AVERROR_IO;
return AVERROR(EIO);
}
pkt->stream_index = 0;
return ret_value;
......@@ -202,7 +202,7 @@ static int vid_read_packet(AVFormatContext *s,
audio_length = get_le16(pb);
ret_value = av_get_packet(pb, pkt, audio_length);
pkt->stream_index = 1;
return (ret_value != audio_length ? AVERROR_IO : ret_value);
return (ret_value != audio_length ? AVERROR(EIO) : ret_value);
case VIDEO_P_FRAME:
case VIDEO_YOFF_P_FRAME:
......@@ -214,7 +214,7 @@ static int vid_read_packet(AVFormatContext *s,
if(vid->nframes != 0)
av_log(s, AV_LOG_VERBOSE, "reached terminating character but not all frames read.\n");
vid->is_finished = 1;
return AVERROR_IO;
return AVERROR(EIO);
default:
av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
block_type, block_type, block_type); return -1;
......
......@@ -129,7 +129,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (c93->current_frame >= br->frames) {
if (c93->current_block >= 511 || !br[1].length)
return AVERROR_IO;
return AVERROR(EIO);
br++;
c93->current_block++;
c93->current_frame = 0;
......@@ -154,7 +154,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
ret = get_buffer(pb, pkt->data + 1, datasize);
if (ret < datasize) {
ret = AVERROR_IO;
ret = AVERROR(EIO);
goto fail;
}
......@@ -168,7 +168,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[0] |= C93_HAS_PALETTE;
ret = get_buffer(pb, pkt->data + pkt->size, datasize);
if (ret < datasize) {
ret = AVERROR_IO;
ret = AVERROR(EIO);
goto fail;
}
pkt->size += 768;
......
......@@ -37,7 +37,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
ByteIOContext *pb = &s->pb;
int ret, size;
if (url_feof(pb))
return AVERROR_IO;
return AVERROR(EIO);
size = get_be16(pb);
get_be16(pb); // unknown
ret = av_get_packet(pb, pkt, size);
......
......@@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
hdr->audio_frame_size = get_le32(pb);
if (url_feof(pb) || url_ferror(pb))
return AVERROR_IO;
return AVERROR(EIO);
if (get_le32(pb) != 0xAA55AA55)
return AVERROR_INVALIDDATA;
......@@ -189,7 +189,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[3] = hdr->video_frame_type;
if (get_buffer(pb, &pkt->data[4], pkt_size) != pkt_size)
return AVERROR_IO;
return AVERROR(EIO);
/* sound buffer will be processed on next read_packet() call */
cin->audio_buffer_size = hdr->audio_frame_size;
......@@ -205,7 +205,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
cin->audio_stream_pts += cin->audio_buffer_size * 2 / cin->file_header.audio_frame_size;
if (get_buffer(pb, pkt->data, cin->audio_buffer_size) != cin->audio_buffer_size)
return AVERROR_IO;
return AVERROR(EIO);
cin->audio_buffer_size = 0;
return 0;
......
......@@ -388,7 +388,7 @@ static int dv_read_header(AVFormatContext *s,
if (get_buffer(&s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
url_fseek(&s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR_IO;
return AVERROR(EIO);
c->dv_demux->sys = dv_frame_profile(c->buf);
s->bit_rate = av_rescale(c->dv_demux->sys->frame_size * 8,
......@@ -409,7 +409,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (size < 0) {
size = c->dv_demux->sys->frame_size;
if (get_buffer(&s->pb, c->buf, size) <= 0)
return AVERROR_IO;
return AVERROR(EIO);
size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
}
......
......@@ -124,7 +124,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
failed:
close(dv->fd);
return AVERROR_IO;
return AVERROR(EIO);
}
static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
......@@ -163,12 +163,12 @@ restart_poll:
if (errno == EAGAIN || errno == EINTR)
goto restart_poll;
perror("Poll failed");
return AVERROR_IO;
return AVERROR(EIO);
}
if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
perror("Failed to get status");
return AVERROR_IO;
return AVERROR(EIO);
}
#ifdef DV1394_DEBUG
av_log(context, AV_LOG_DEBUG, "DV1394: status\n"
......
......@@ -149,7 +149,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(&s->pb, pkt, size);
pkt->stream_index = 1;
if(ret != size)
return AVERROR_IO;
return AVERROR(EIO);
c->bytes_left -= size;
c->wavpos = url_ftell(&s->pb);
return 0;
......@@ -186,7 +186,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
av_free_packet(pkt);
return AVERROR_IO;
return AVERROR(EIO);
}
if(pal_size) memcpy(pkt->data, pal, pal_size);
pkt->stream_index = 0;
......
......@@ -178,7 +178,7 @@ static int ea_read_header(AVFormatContext *s,
AVStream *st;
if (!process_ea_header(s))
return AVERROR_IO;
return AVERROR(EIO);
#if 0
/* initialize the video decoder stream */
......@@ -226,7 +226,7 @@ static int ea_read_packet(AVFormatContext *s,
while (!packet_read) {
if (get_buffer(pb, preamble, EA_PREAMBLE_SIZE) != EA_PREAMBLE_SIZE)
return AVERROR_IO;
return AVERROR(EIO);
chunk_type = AV_RL32(&preamble[0]);
chunk_size = AV_RL32(&preamble[4]) - EA_PREAMBLE_SIZE;
......@@ -235,7 +235,7 @@ static int ea_read_packet(AVFormatContext *s,
case SCDl_TAG:
ret = av_get_packet(pb, pkt, chunk_size);
if (ret != chunk_size)
ret = AVERROR_IO;
ret = AVERROR(EIO);
else {
pkt->stream_index = ea->audio_stream_index;
pkt->pts = 90000;
......@@ -253,7 +253,7 @@ static int ea_read_packet(AVFormatContext *s,
/* ending tag */
case SCEl_TAG:
ret = AVERROR_IO;
ret = AVERROR(EIO);
packet_read = 1;
break;
......
......@@ -78,7 +78,7 @@ static int flic_read_header(AVFormatContext *s,
/* load the whole header and pull out the width and height */
if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
return AVERROR_IO;
return AVERROR(EIO);
magic_number = AV_RL16(&header[4]);
speed = AV_RL32(&header[0x10]);
......@@ -169,7 +169,7 @@ static int flic_read_packet(AVFormatContext *s,
if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
FLIC_PREAMBLE_SIZE) {
ret = AVERROR_IO;
ret = AVERROR(EIO);
break;
}
......@@ -178,7 +178,7 @@ static int flic_read_packet(AVFormatContext *s,
if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) {
if (av_new_packet(pkt, size)) {
ret = AVERROR_IO;
ret = AVERROR(EIO);
break;
}
pkt->stream_index = flic->video_stream_index;
......@@ -189,7 +189,7 @@ static int flic_read_packet(AVFormatContext *s,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
av_free_packet(pkt);
ret = AVERROR_IO;
ret = AVERROR(EIO);
}
flic->pts += flic->frame_pts_inc;
packet_read = 1;
......
......@@ -270,7 +270,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
pts = get_be24(&s->pb);
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
if (url_feof(&s->pb))
return AVERROR_IO;
return AVERROR(EIO);
url_fskip(&s->pb, 4); /* reserved */
flags = 0;
......@@ -348,7 +348,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
ret= av_get_packet(&s->pb, pkt, size - 1);
if (ret <= 0) {
return AVERROR_IO;
return AVERROR(EIO);
}
/* note: we need to modify the packet size here to handle the last
packet */
......
......@@ -343,7 +343,7 @@ static int gif_write_header(AVFormatContext *s)
if (video_enc->pix_fmt != PIX_FMT_RGB24) {
av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
return AVERROR_IO;
return AVERROR(EIO);
}
gif_image_write_header(pb, width, height, loop_count, NULL);
......
......@@ -500,21 +500,21 @@ static int gif_parse_next_image(GifState *s)
switch (code) {
case ',':
if (gif_read_image(s) < 0)
return AVERROR_IO;
return AVERROR(EIO);
ret = 0;
goto the_end;
case ';':
/* end of image */
ret = AVERROR_IO;
ret = AVERROR(EIO);
goto the_end;
case '!':
if (gif_read_extension(s) < 0)
return AVERROR_IO;
return AVERROR(EIO);
break;
case EOF:
default:
/* error or errneous EOF */
ret = AVERROR_IO;
ret = AVERROR(EIO);
goto the_end;
}
}
......@@ -567,7 +567,7 @@ static int gif_read_packet(AVFormatContext * s1,
/* XXX: avoid copying */
if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) {
return AVERROR_IO;
return AVERROR(EIO);
}
pkt->stream_index = 0;
memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);
......
......@@ -279,7 +279,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (video_fd >= 0)
close(video_fd);
av_free(st);
return AVERROR_IO;
return AVERROR(EIO);
}
static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
......@@ -299,7 +299,7 @@ static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
else
perror("VIDIOCMCAPTURE");
return AVERROR_IO;
return AVERROR(EIO);
}
/* This is now the grabbing frame */
......@@ -334,7 +334,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (av_new_packet(pkt, s->frame_size) < 0)
return AVERROR_IO;
return AVERROR(EIO);
pkt->pts = curtime;
......@@ -345,7 +345,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
return v4l_mm_read_picture(s, pkt->data);
} else {
if (read(s->fd, pkt->data, pkt->size) != pkt->size)
return AVERROR_IO;
return AVERROR(EIO);
return s->frame_size;
}
}
......
......@@ -473,7 +473,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
pkt->dts = field_nr;
return ret;
}
return AVERROR_IO;
return AVERROR(EIO);
}
static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) {
......
......@@ -101,7 +101,7 @@ static int http_open_cnx(URLContext *h)
/* url moved, get next */
url_close(hd);
if (redirects++ >= MAX_REDIRECTS)
return AVERROR_IO;
return AVERROR(EIO);
location_changed = 0;
goto redo;
}
......@@ -109,7 +109,7 @@ static int http_open_cnx(URLContext *h)
fail:
if (hd)
url_close(hd);
return AVERROR_IO;
return AVERROR(EIO);
}
static int http_open(URLContext *h, const char *uri, int flags)
......@@ -139,7 +139,7 @@ static int http_getc(HTTPContext *s)
if (s->buf_ptr >= s->buf_end) {
len = url_read(s->hd, s->buffer, BUFFER_SIZE);
if (len < 0) {
return AVERROR_IO;
return AVERROR(EIO);
} else if (len == 0) {
return -1;
} else {
......@@ -237,7 +237,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
av_freep(&auth_b64);
if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
return AVERROR_IO;
return AVERROR(EIO);
/* init input buffer */
s->buf_ptr = s->buffer;
......@@ -255,7 +255,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
for(;;) {
ch = http_getc(s);
if (ch < 0)
return AVERROR_IO;
return AVERROR(EIO);
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')
......
......@@ -165,7 +165,7 @@ static int idcin_read_header(AVFormatContext *s,
st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
return AVERROR_IO;
return AVERROR(EIO);
/* save a reference in order to transport the palette */
st->codec->palctrl = &idcin->palctrl;
......@@ -222,17 +222,17 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char palette_buffer[768];
if (url_feof(&s->pb))
return AVERROR_IO;
return AVERROR(EIO);
if (idcin->next_chunk_is_video) {
command = get_le32(pb);
if (command == 2) {
return AVERROR_IO;
return AVERROR(EIO);
} else if (command == 1) {
/* trigger a palette change */
idcin->palctrl.palette_changed = 1;
if (get_buffer(pb, palette_buffer, 768) != 768)
return AVERROR_IO;
return AVERROR(EIO);
/* scale the palette as necessary */
palette_scale = 2;
for (i = 0; i < 768; i++)
......@@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s,
chunk_size -= 4;
ret= av_get_packet(pb, pkt, chunk_size);
if (ret != chunk_size)
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = idcin->video_stream_index;
pkt->pts = idcin->pts;
} else {
......@@ -266,7 +266,7 @@ static int idcin_read_packet(AVFormatContext *s,
chunk_size = idcin->audio_chunk_size1;
ret= av_get_packet(pb, pkt, chunk_size);
if (ret != chunk_size)
return AVERROR_IO;
return AVERROR(EIO);
pkt->stream_index = idcin->audio_stream_index;
pkt->pts = idcin->pts;
......
......@@ -79,7 +79,7 @@ static int roq_read_header(AVFormatContext *s,
/* get the main header */
if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=