Mercurial > libavformat.hg
diff tcp.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 | 1f7a6dc01100 |
children | d85795da84ab |
line wrap: on
line diff
--- a/tcp.c Tue Feb 13 08:21:47 2007 +0000 +++ b/tcp.c Tue Feb 13 18:26:14 2007 +0000 @@ -62,7 +62,7 @@ s = av_malloc(sizeof(TCPContext)); if (!s) - return -ENOMEM; + return AVERROR(ENOMEM); h->priv_data = s; if (port <= 0 || port >= 65536) @@ -90,7 +90,7 @@ /* wait until we are connected or until abort */ for(;;) { if (url_interrupt_cb()) { - ret = -EINTR; + ret = AVERROR(EINTR); goto fail1; } fd_max = fd; @@ -130,7 +130,7 @@ for (;;) { if (url_interrupt_cb()) - return -EINTR; + return AVERROR(EINTR); fd_max = s->fd; FD_ZERO(&rfds); FD_SET(s->fd, &rfds); @@ -141,11 +141,7 @@ len = recv(s->fd, buf, size, 0); if (len < 0) { if (errno != EINTR && errno != EAGAIN) -#ifdef __BEOS__ - return errno; -#else - return -errno; -#endif + return AVERROR(errno); } else return len; } else if (ret < 0) { return -1; @@ -163,7 +159,7 @@ size1 = size; while (size > 0) { if (url_interrupt_cb()) - return -EINTR; + return AVERROR(EINTR); fd_max = s->fd; FD_ZERO(&wfds); FD_SET(s->fd, &wfds); @@ -173,13 +169,8 @@ if (ret > 0 && FD_ISSET(s->fd, &wfds)) { len = send(s->fd, buf, size, 0); if (len < 0) { - if (errno != EINTR && errno != EAGAIN) { -#ifdef __BEOS__ - return errno; -#else - return -errno; -#endif - } + if (errno != EINTR && errno != EAGAIN) + return AVERROR(errno); continue; } size -= len;