Mercurial > libavformat.hg
diff aviobuf.c @ 1787:eb16c64144ee libavformat
This fixes error handling for BeOS, removing the need for some ifdefs.
AVERROR_ defines are moved to avcodec.h as they are needed in there as well. Feel free to move that to avutil/common.h.
Bumped up avcodec/format version numbers as though it's binary compatible we will want to rebuild apps as error values changed.
Please from now on use return AVERROR(EFOO) instead of the ugly return -EFOO in your code.
This also removes the need for berrno.h.
author | mmu_man |
---|---|
date | Tue, 13 Feb 2007 18:26:14 +0000 |
parents | fa70e732d2db |
children | 3328f652d741 |
line wrap: on
line diff
--- a/aviobuf.c Tue Feb 13 08:21:47 2007 +0000 +++ b/aviobuf.c Tue Feb 13 18:26:14 2007 +0000 @@ -117,7 +117,7 @@ offset_t pos= s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer)); if (whence != SEEK_CUR && whence != SEEK_SET) - return -EINVAL; + return AVERROR(EINVAL); if (whence == SEEK_CUR) { offset1 = pos + (s->buf_ptr - s->buffer); @@ -136,7 +136,7 @@ fill_buffer(s); s->buf_ptr = s->buf_end + offset - s->pos; } else { - offset_t res = -EPIPE; + offset_t res = AVERROR(EPIPE); #if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK) if (s->write_flag) { @@ -171,7 +171,7 @@ offset_t size; if (!s->seek) - return -EPIPE; + return AVERROR(EPIPE); size = s->seek(s->opaque, 0, AVSEEK_SIZE); if(size<0){ if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0) @@ -511,7 +511,7 @@ } buffer = av_malloc(buffer_size); if (!buffer) - return -ENOMEM; + return AVERROR(ENOMEM); if (init_put_byte(s, buffer, buffer_size, (h->flags & URL_WRONLY || h->flags & URL_RDWR), h, @@ -530,7 +530,7 @@ uint8_t *buffer; buffer = av_malloc(buf_size); if (!buffer) - return -ENOMEM; + return AVERROR(ENOMEM); av_free(s->buffer); s->buffer = buffer;