diff options
author | James Almer <jamrial@gmail.com> | 2019-05-08 06:45:15 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-05-09 01:27:20 +0300 |
commit | f713e25030bbe8deaf6266246f78b4e5d3a05bf7 (patch) | |
tree | 2e6e9ddf40e8ffebd6b644098915e31e169d2a2d /tools | |
parent | 11da4086e59f81393255a1c1786a990f9fa565b9 (diff) |
Add a DAV1D_ERR define to negate errno values when needed
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dav1d.c | 6 | ||||
-rw-r--r-- | tools/input/input.c | 6 | ||||
-rw-r--r-- | tools/output/output.c | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/tools/dav1d.c b/tools/dav1d.c index 8edcb75..63a658a 100644 --- a/tools/dav1d.c +++ b/tools/dav1d.c @@ -129,7 +129,7 @@ int main(const int argc, char *const *const argv) { do { memset(&p, 0, sizeof(p)); if ((res = dav1d_send_data(c, &data)) < 0) { - if (res != -EAGAIN) { + if (res != DAV1D_ERR(EAGAIN)) { fprintf(stderr, "Error decoding frame: %s\n", strerror(-res)); break; @@ -137,7 +137,7 @@ int main(const int argc, char *const *const argv) { } if ((res = dav1d_get_picture(c, &p)) < 0) { - if (res != -EAGAIN) { + if (res != DAV1D_ERR(EAGAIN)) { fprintf(stderr, "Error decoding frame: %s\n", strerror(-res)); break; @@ -168,7 +168,7 @@ int main(const int argc, char *const *const argv) { // flush if (res == 0) while (!cli_settings.limit || n_out < cli_settings.limit) { if ((res = dav1d_get_picture(c, &p)) < 0) { - if (res != -EAGAIN) { + if (res != DAV1D_ERR(EAGAIN)) { fprintf(stderr, "Error decoding frame: %s\n", strerror(-res)); } else { diff --git a/tools/input/input.c b/tools/input/input.c index 7837e46..35ca69f 100644 --- a/tools/input/input.c +++ b/tools/input/input.c @@ -90,7 +90,7 @@ int input_open(DemuxerContext **const c_out, } if (i == num_demuxers) { fprintf(stderr, "Failed to find demuxer named \"%s\"\n", name); - return -ENOPROTOOPT; + return DAV1D_ERR(ENOPROTOOPT); } } else { const char *const ext = find_extension(filename); @@ -109,13 +109,13 @@ int input_open(DemuxerContext **const c_out, fprintf(stderr, "Failed to find demuxer for file %s (\"%s\")\n", filename, ext); - return -ENOPROTOOPT; + return DAV1D_ERR(ENOPROTOOPT); } } if (!(c = malloc(sizeof(DemuxerContext) + impl->priv_data_size))) { fprintf(stderr, "Failed to allocate memory\n"); - return -ENOMEM; + return DAV1D_ERR(ENOMEM); } memset(c, 0, sizeof(DemuxerContext) + impl->priv_data_size); c->impl = impl; diff --git a/tools/output/output.c b/tools/output/output.c index 002d719..7a37f00 100644 --- a/tools/output/output.c +++ b/tools/output/output.c @@ -93,7 +93,7 @@ int output_open(MuxerContext **const c_out, } if (i == num_muxers) { fprintf(stderr, "Failed to find muxer named \"%s\"\n", name); - return -ENOPROTOOPT; + return DAV1D_ERR(ENOPROTOOPT); } } else { const char *ext = find_extension(filename); @@ -109,13 +109,13 @@ int output_open(MuxerContext **const c_out, } if (i == num_muxers) { fprintf(stderr, "Failed to find muxer for extension \"%s\"\n", ext); - return -ENOPROTOOPT; + return DAV1D_ERR(ENOPROTOOPT); } } if (!(c = malloc(sizeof(MuxerContext) + impl->priv_data_size))) { fprintf(stderr, "Failed to allocate memory\n"); - return -ENOMEM; + return DAV1D_ERR(ENOMEM); } c->impl = impl; c->data = (MuxerPriv *) &c[1]; |