1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

tests/tools/examples: Replace direct exit() calls by return.

This commit is contained in:
Diego Biurrun 2011-09-21 18:46:56 +02:00
parent be0675ce67
commit 9a5d6c23c5
5 changed files with 19 additions and 25 deletions

View File

@ -37,8 +37,6 @@
#include <stdlib.h>
#include <string.h>
#undef exit
/* reference fft */
#define MUL16(a,b) ((a) * (b))
@ -228,7 +226,6 @@ static void help(void)
"-n b set the transform size to 2^b\n"
"-f x set scale factor for output data of (I)MDCT to x\n"
);
exit(1);
}
enum tf_transform {
@ -267,7 +264,7 @@ int main(int argc, char **argv)
switch(c) {
case 'h':
help();
break;
return 1;
case 's':
do_speed = 1;
break;

View File

@ -33,7 +33,6 @@
#include "dsputil.h"
#include "libavutil/lfg.h"
#undef exit
#undef printf
#define WIDTH 64
@ -61,7 +60,6 @@ static void help(void)
{
printf("motion-test [-h]\n"
"test motion implementations\n");
exit(1);
}
static int64_t gettime(void)
@ -138,7 +136,7 @@ int main(int argc, char **argv)
switch(c) {
case 'h':
help();
break;
return 1;
}
}

View File

@ -445,7 +445,7 @@ int main(int argc, char **argv)
"The output format is automatically guessed according to the file extension.\n"
"Raw images can also be output by using '%%d' in the filename\n"
"\n", argv[0]);
exit(1);
return 1;
}
filename = argv[1];
@ -459,14 +459,14 @@ int main(int argc, char **argv)
}
if (!fmt) {
fprintf(stderr, "Could not find suitable output format\n");
exit(1);
return 1;
}
/* allocate the output media context */
oc = avformat_alloc_context();
if (!oc) {
fprintf(stderr, "Memory error\n");
exit(1);
return 1;
}
oc->oformat = fmt;
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
@ -486,7 +486,7 @@ int main(int argc, char **argv)
parameters). */
if (av_set_parameters(oc, NULL) < 0) {
fprintf(stderr, "Invalid output format parameters\n");
exit(1);
return 1;
}
av_dump_format(oc, 0, filename, 1);
@ -502,7 +502,7 @@ int main(int argc, char **argv)
if (!(fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
fprintf(stderr, "Could not open '%s'\n", filename);
exit(1);
return 1;
}
}

View File

@ -28,7 +28,6 @@
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#undef exit
#undef printf
#undef fprintf
@ -75,7 +74,7 @@ int main(int argc, char **argv)
if (argc != 2) {
printf("usage: %s input_file\n"
"\n", argv[0]);
exit(1);
return 1;
}
filename = argv[1];
@ -84,13 +83,13 @@ int main(int argc, char **argv)
av_dict_free(&format_opts);
if (ret < 0) {
fprintf(stderr, "cannot open %s\n", filename);
exit(1);
return 1;
}
ret = avformat_find_stream_info(ic, NULL);
if (ret < 0) {
fprintf(stderr, "%s: could not find codec parameters\n", filename);
exit(1);
return 1;
}
for(i=0; ; i++){

View File

@ -29,14 +29,14 @@ int main(int argc, char *argv[])
if (argc < 3)
{
printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
exit(1);
return 1;
}
fd_in = open(argv[1], O_RDONLY);
if (fd_in < 0)
{
perror("Error opening input file");
exit(1);
return 1;
}
fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
@ -44,7 +44,7 @@ int main(int argc, char *argv[])
{
perror("Error opening output file");
close(fd_in);
exit(1);
return 1;
}
if (read(fd_in, &buf_in, 8) != 8)
@ -52,13 +52,13 @@ int main(int argc, char *argv[])
printf("Header error\n");
close(fd_in);
close(fd_out);
exit(1);
return 1;
}
if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
{
printf("Not a compressed flash file\n");
exit(1);
return 1;
}
fstat(fd_in, &statbuf);
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
buf_in[0] = 'F';
if (write(fd_out, &buf_in, 8) < 8) {
perror("Error writing output file");
exit(1);
return 1;
}
zstream.zalloc = NULL;
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
{
printf("Error while decompressing: %d\n", ret);
inflateEnd(&zstream);
exit(1);
return 1;
}
dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
perror("Error writing output file");
exit(1);
return 1;
}
i += len;
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
lseek(fd_out, 4, SEEK_SET);
if (write(fd_out, &buf_in, 4) < 4) {
perror("Error writing output file");
exit(1);
return 1;
}
}