ref: 246c280363580e849905615f75290f09fc2a3bc9
parent: f59b57139e699c32b64ff604591100330fc9e059
author: Justin Bull <me@justinbull.ca>
date: Tue Nov 26 17:40:55 EST 2019
cli: Return only EXIT_SUCCESS or EXIT_FAILURE from main
--- a/tools/dav1d.c
+++ b/tools/dav1d.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include <inttypes.h>
#include <math.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -145,7 +146,7 @@
if (strcmp(version, DAV1D_VERSION)) {
fprintf(stderr, "Version mismatch (library: %s, executable: %s)\n",
version, DAV1D_VERSION);
- return -1;
+ return EXIT_FAILURE;
}
init_demuxers();
@@ -156,12 +157,12 @@
cli_settings.inputfile,
fps, &total, timebase)) < 0)
{
- return res;
+ return EXIT_FAILURE;
}
for (unsigned i = 0; i <= cli_settings.skip; i++) {
if ((res = input_read(in, &data)) < 0) {
input_close(in);
- return res;
+ return EXIT_FAILURE;
}
if (i < cli_settings.skip) dav1d_data_unref(&data);
}
@@ -176,7 +177,7 @@
while (dav1d_parse_sequence_header(&seq, data.data, data.sz)) {
if ((res = input_read(in, &data)) < 0) {
input_close(in);
- return res;
+ return EXIT_FAILURE;
}
seq_skip++;
}
@@ -191,7 +192,7 @@
total = cli_settings.limit;
if ((res = dav1d_open(&c, &lib_settings)))
- return res;
+ return EXIT_FAILURE;
if (cli_settings.frametimes)
frametimes = fopen(cli_settings.frametimes, "w");
@@ -234,7 +235,7 @@
&p.p, fps)) < 0)
{
if (frametimes) fclose(frametimes);
- return res;
+ return EXIT_FAILURE;
}
}
if ((res = output_write(out, &p)) < 0)
@@ -271,7 +272,7 @@
&p.p, fps)) < 0)
{
if (frametimes) fclose(frametimes);
- return res;
+ return EXIT_FAILURE;
}
}
if ((res = output_write(out, &p)) < 0)
@@ -302,5 +303,5 @@
}
dav1d_close(&c);
- return res;
+ return (res == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}