diff --git a/examples/anim_diff.c b/examples/anim_diff.c index 7ffabc8f..0bfaa7c1 100644 --- a/examples/anim_diff.c +++ b/examples/anim_diff.c @@ -16,7 +16,7 @@ #include #include #include -#include // for 'strtod'. +#include #include // for 'strcmp'. #include "./anim_util.h" @@ -206,8 +206,9 @@ static void Help(void) { printf(" -version ............ print version number and exit\n"); } +// Returns 0 on success, 1 if animation files differ, and 2 for any error. int main(int argc, const char* argv[]) { - int return_code = -1; + int return_code = 2; int dump_frames = 0; const char* dump_folder = NULL; double min_psnr = 0.; @@ -269,18 +270,18 @@ int main(int argc, const char* argv[]) { } if (parse_error) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(return_code); } } if (argc < 3) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(return_code); } if (!got_input2) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(return_code); } if (dump_frames) { @@ -293,7 +294,7 @@ int main(int argc, const char* argv[]) { if (!ReadAnimatedImage(files[i], &images[i], dump_frames, dump_folder)) { WFPRINTF(stderr, "Error decoding file: %s\n Aborting.\n", (const W_CHAR*)files[i]); - return_code = -2; + return_code = 2; goto End; } else { MinimizeAnimationFrames(&images[i], max_diff); @@ -304,7 +305,7 @@ int main(int argc, const char* argv[]) { premultiply, min_psnr)) { WFPRINTF(stderr, "\nFiles %s and %s differ.\n", (const W_CHAR*)files[0], (const W_CHAR*)files[1]); - return_code = -3; + return_code = 1; } else { WPRINTF("\nFiles %s and %s are identical.\n", (const W_CHAR*)files[0], (const W_CHAR*)files[1]); diff --git a/examples/anim_dump.c b/examples/anim_dump.c index 269cbaba..fa702dd2 100644 --- a/examples/anim_dump.c +++ b/examples/anim_dump.c @@ -12,6 +12,7 @@ // Author: Skal (pascal.massimino@gmail.com) #include +#include #include // for 'strcmp'. #include "./anim_util.h" @@ -35,6 +36,7 @@ static void Help(void) { printf(" -version ............ print version number and exit\n"); } +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { int error = 0; const W_CHAR* dump_folder = TO_W_CHAR("."); @@ -47,7 +49,7 @@ int main(int argc, const char* argv[]) { if (argc < 2) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } for (c = 1; !error && c < argc; ++c) { @@ -73,7 +75,7 @@ int main(int argc, const char* argv[]) { suffix = TO_W_CHAR("pam"); } else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-version")) { int dec_version, demux_version; GetAnimatedImageVersions(&dec_version, &demux_version); @@ -82,7 +84,7 @@ int main(int argc, const char* argv[]) { (dec_version >> 0) & 0xff, (demux_version >> 16) & 0xff, (demux_version >> 8) & 0xff, (demux_version >> 0) & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else { uint32_t i; AnimatedImage image; @@ -121,5 +123,5 @@ int main(int argc, const char* argv[]) { ClearAnimatedImage(&image); } } - FREE_WARGV_AND_RETURN(error ? 1 : 0); + FREE_WARGV_AND_RETURN(error ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/examples/cwebp.c b/examples/cwebp.c index cab70054..7d33f06e 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -651,8 +651,9 @@ static const char* const kErrorMessages[VP8_ENC_ERROR_LAST] = { //------------------------------------------------------------------------------ +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { - int return_value = -1; + int return_value = EXIT_FAILURE; const char* in_file = NULL, *out_file = NULL, *dump_file = NULL; FILE* out = NULL; int c; @@ -686,22 +687,22 @@ int main(int argc, const char* argv[]) { !WebPPictureInit(&original_picture) || !WebPConfigInit(&config)) { fprintf(stderr, "Error! Version mismatch!\n"); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } if (argc == 1) { HelpShort(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } for (c = 1; c < argc; ++c) { int parse_error = 0; if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { HelpShort(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) { HelpLong(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-o") && c + 1 < argc) { out_file = (const char*)GET_WARGV(argv, ++c); } else if (!strcmp(argv[c], "-d") && c + 1 < argc) { @@ -842,7 +843,7 @@ int main(int argc, const char* argv[]) { printf("libsharpyuv: %d.%d.%d\n", (sharpyuv_version >> 24) & 0xff, (sharpyuv_version >> 16) & 0xffff, sharpyuv_version & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-progress")) { show_progress = 1; } else if (!strcmp(argv[c], "-quiet")) { @@ -904,7 +905,7 @@ int main(int argc, const char* argv[]) { if (i == kNumTokens) { fprintf(stderr, "Error! Unknown metadata type '%.*s'\n", (int)(token - start), start); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } start = token + 1; } @@ -923,14 +924,14 @@ int main(int argc, const char* argv[]) { } else if (argv[c][0] == '-') { fprintf(stderr, "Error! Unknown option '%s'\n", argv[c]); HelpLong(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } else { in_file = (const char*)GET_WARGV(argv, c); } if (parse_error) { HelpLong(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } } if (in_file == NULL) { @@ -1231,7 +1232,7 @@ int main(int argc, const char* argv[]) { PrintMetadataInfo(&metadata, metadata_written); } } - return_value = 0; + return_value = EXIT_SUCCESS; Error: WebPMemoryWriterClear(&memory_writer); diff --git a/examples/dwebp.c b/examples/dwebp.c index 652de6a6..9dc3c6b6 100644 --- a/examples/dwebp.c +++ b/examples/dwebp.c @@ -177,6 +177,7 @@ static uint8_t* AllocateExternalBuffer(WebPDecoderConfig* config, return external_buffer; } +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { int ok = 0; const char* in_file = NULL; @@ -197,14 +198,14 @@ int main(int argc, const char* argv[]) { if (!WebPInitDecoderConfig(&config)) { fprintf(stderr, "Library version mismatch!\n"); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } for (c = 1; c < argc; ++c) { int parse_error = 0; if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-o") && c < argc - 1) { out_file = (const char*)GET_WARGV(argv, ++c); } else if (!strcmp(argv[c], "-alpha")) { @@ -227,7 +228,7 @@ int main(int argc, const char* argv[]) { const int version = WebPGetDecoderVersion(); printf("%d.%d.%d\n", (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-pgm")) { format = PGM; } else if (!strcmp(argv[c], "-yuv")) { @@ -293,21 +294,21 @@ int main(int argc, const char* argv[]) { } else if (argv[c][0] == '-') { fprintf(stderr, "Unknown option '%s'\n", argv[c]); Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } else { in_file = (const char*)GET_WARGV(argv, c); } if (parse_error) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } } if (in_file == NULL) { fprintf(stderr, "missing input file!!\n"); Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } if (quiet) verbose = 0; @@ -316,7 +317,7 @@ int main(int argc, const char* argv[]) { VP8StatusCode status = VP8_STATUS_OK; size_t data_size = 0; if (!LoadWebP(in_file, &data, &data_size, bitstream)) { - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } switch (format) { @@ -415,7 +416,7 @@ int main(int argc, const char* argv[]) { WebPFreeDecBuffer(output_buffer); WebPFree((void*)external_buffer); WebPFree((void*)data); - FREE_WARGV_AND_RETURN(ok ? 0 : -1); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } //------------------------------------------------------------------------------ diff --git a/examples/gif2webp.c b/examples/gif2webp.c index cc9b25d9..7130a3da 100644 --- a/examples/gif2webp.c +++ b/examples/gif2webp.c @@ -96,6 +96,7 @@ static void Help(void) { //------------------------------------------------------------------------------ +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { int verbose = 0; int gif_error = GIF_ERROR; @@ -140,7 +141,7 @@ int main(int argc, const char* argv[]) { !WebPPictureInit(&frame) || !WebPPictureInit(&curr_canvas) || !WebPPictureInit(&prev_canvas)) { fprintf(stderr, "Error! Version mismatch!\n"); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } config.lossless = 1; // Use lossless compression by default. @@ -150,14 +151,14 @@ int main(int argc, const char* argv[]) { if (argc == 1) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } for (c = 1; c < argc; ++c) { int parse_error = 0; if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-o") && c < argc - 1) { out_file = GET_WARGV(argv, ++c); } else if (!strcmp(argv[c], "-lossy")) { @@ -216,7 +217,7 @@ int main(int argc, const char* argv[]) { fprintf(stderr, "Error! Unknown metadata type '%.*s'\n", (int)(token - start), start); Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } start = token + 1; } @@ -229,7 +230,7 @@ int main(int argc, const char* argv[]) { (enc_version >> 16) & 0xff, (enc_version >> 8) & 0xff, enc_version & 0xff, (mux_version >> 16) & 0xff, (mux_version >> 8) & 0xff, mux_version & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-quiet")) { quiet = 1; enc_options.verbose = 0; @@ -242,14 +243,14 @@ int main(int argc, const char* argv[]) { } else if (argv[c][0] == '-') { fprintf(stderr, "Error! Unknown option '%s'\n", argv[c]); Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } else { in_file = GET_WARGV(argv, c); } if (parse_error) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } } @@ -593,7 +594,7 @@ int main(int argc, const char* argv[]) { #endif } - FREE_WARGV_AND_RETURN(!ok); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } #else // !WEBP_HAVE_GIF @@ -601,7 +602,7 @@ int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) { fprintf(stderr, "GIF support not enabled in %s.\n", argv[0]); (void)argc; - return 0; + return EXIT_FAILURE; } #endif diff --git a/examples/img2webp.c b/examples/img2webp.c index 3735030c..5d099860 100644 --- a/examples/img2webp.c +++ b/examples/img2webp.c @@ -130,6 +130,7 @@ static int SetLoopCount(int loop_count, WebPData* const webp_data) { //------------------------------------------------------------------------------ +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { const char* output = NULL; WebPAnimEncoder* enc = NULL; @@ -151,7 +152,7 @@ int main(int argc, const char* argv[]) { INIT_WARGV(argc, argv); ok = ExUtilInitCommandLineArguments(argc - 1, argv + 1, &cmd_args); - if (!ok) FREE_WARGV_AND_RETURN(1); + if (!ok) FREE_WARGV_AND_RETURN(EXIT_FAILURE); argc = cmd_args.argc_; argv = cmd_args.argv_; @@ -199,7 +200,7 @@ int main(int argc, const char* argv[]) { verbose = 1; } else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-version")) { const int enc_version = WebPGetEncoderVersion(); const int mux_version = WebPGetMuxVersion(); @@ -335,5 +336,5 @@ int main(int argc, const char* argv[]) { } WebPDataClear(&webp_data); ExUtilDeleteCommandLineArguments(&cmd_args); - FREE_WARGV_AND_RETURN(ok ? 0 : 1); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/examples/vwebp.c b/examples/vwebp.c index fa5fadb1..7dbda4e2 100644 --- a/examples/vwebp.c +++ b/examples/vwebp.c @@ -506,7 +506,7 @@ int main(int argc, char* argv[]) { if (!WebPInitDecoderConfig(config)) { fprintf(stderr, "Library version mismatch!\n"); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } config->options.dithering_strength = 50; config->options.alpha_dithering_strength = 100; @@ -518,7 +518,7 @@ int main(int argc, char* argv[]) { int parse_error = 0; if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-noicc")) { kParams.use_color_profile = 0; } else if (!strcmp(argv[c], "-nofancy")) { @@ -541,7 +541,7 @@ int main(int argc, char* argv[]) { (dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff, dec_version & 0xff, (dmux_version >> 16) & 0xff, (dmux_version >> 8) & 0xff, dmux_version & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-mt")) { config->options.use_threads = 1; } else if (!strcmp(argv[c], "--")) { @@ -553,7 +553,7 @@ int main(int argc, char* argv[]) { } else if (argv[c][0] == '-') { printf("Unknown option '%s'\n", argv[c]); Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } else { kParams.file_name = (const char*)GET_WARGV(argv, c); file_name_argv_index = c; @@ -561,14 +561,14 @@ int main(int argc, char* argv[]) { if (parse_error) { Help(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } } if (kParams.file_name == NULL) { printf("missing input file!!\n"); Help(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } if (!ImgIoUtilReadFile(kParams.file_name, @@ -643,11 +643,11 @@ int main(int argc, char* argv[]) { // Should only be reached when using FREEGLUT: ClearParams(); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); Error: ClearParams(); - FREE_WARGV_AND_RETURN(-1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } #else // !WEBP_HAVE_GL @@ -655,7 +655,7 @@ int main(int argc, char* argv[]) { int main(int argc, const char* argv[]) { fprintf(stderr, "OpenGL support not enabled in %s.\n", argv[0]); (void)argc; - return 0; + return EXIT_FAILURE; } #endif diff --git a/examples/webpinfo.c b/examples/webpinfo.c index 1d2278ee..537e3f5a 100644 --- a/examples/webpinfo.c +++ b/examples/webpinfo.c @@ -14,6 +14,7 @@ #include #include +#include #ifdef HAVE_CONFIG_H #include "webp/config.h" @@ -1120,6 +1121,7 @@ static void Help(void) { " -bitstream_info .... Parse bitstream header.\n"); } +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { int c, quiet = 0, show_diag = 0, show_summary = 0; int parse_bitstream = 0; @@ -1130,7 +1132,7 @@ int main(int argc, const char* argv[]) { if (argc == 1) { Help(); - FREE_WARGV_AND_RETURN(WEBP_INFO_OK); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } // Parse command-line input. @@ -1138,7 +1140,7 @@ int main(int argc, const char* argv[]) { if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help") || !strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) { Help(); - FREE_WARGV_AND_RETURN(WEBP_INFO_OK); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else if (!strcmp(argv[c], "-quiet")) { quiet = 1; } else if (!strcmp(argv[c], "-diag")) { @@ -1151,7 +1153,7 @@ int main(int argc, const char* argv[]) { const int version = WebPGetDecoderVersion(); printf("WebP Decoder version: %d.%d.%d\n", (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else { // Assume the remaining are all input files. break; } @@ -1159,7 +1161,7 @@ int main(int argc, const char* argv[]) { if (c == argc) { Help(); - FREE_WARGV_AND_RETURN(WEBP_INFO_INVALID_COMMAND); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } // Process input files one by one. @@ -1182,5 +1184,6 @@ int main(int argc, const char* argv[]) { webp_info_status = AnalyzeWebP(&webp_info, &webp_data); WebPDataClear(&webp_data); } - FREE_WARGV_AND_RETURN(webp_info_status); + FREE_WARGV_AND_RETURN((webp_info_status == WEBP_INFO_OK) ? EXIT_SUCCESS + : EXIT_FAILURE); } diff --git a/examples/webpmux.c b/examples/webpmux.c index 9bf45103..49d72641 100644 --- a/examples/webpmux.c +++ b/examples/webpmux.c @@ -59,6 +59,7 @@ #include #include #include + #include "webp/decode.h" #include "webp/mux.h" #include "../examples/example_util.h" @@ -1225,6 +1226,7 @@ static int Process(const Config* config) { //------------------------------------------------------------------------------ // Main. +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { Config config; int ok; @@ -1238,7 +1240,7 @@ int main(int argc, const char* argv[]) { PrintHelp(); } DeleteConfig(&config); - FREE_WARGV_AND_RETURN(!ok); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } //------------------------------------------------------------------------------ diff --git a/extras/get_disto.c b/extras/get_disto.c index 3aa345bb..7b9c202b 100644 --- a/extras/get_disto.c +++ b/extras/get_disto.c @@ -227,10 +227,11 @@ static void Help(void) { WebPGetEnabledInputFileFormats()); } +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { WebPPicture pic1, pic2; size_t size1 = 0, size2 = 0; - int ret = 1; + int ret = EXIT_FAILURE; float disto[5]; int type = 0; int c; @@ -246,7 +247,7 @@ int main(int argc, const char* argv[]) { if (!WebPPictureInit(&pic1) || !WebPPictureInit(&pic2)) { fprintf(stderr, "Can't init pictures\n"); - FREE_WARGV_AND_RETURN(1); + FREE_WARGV_AND_RETURN(EXIT_FAILURE); } for (c = 1; c < argc; ++c) { @@ -262,7 +263,7 @@ int main(int argc, const char* argv[]) { use_gray = 1; } else if (!strcmp(argv[c], "-h")) { help = 1; - ret = 0; + ret = EXIT_SUCCESS; } else if (!strcmp(argv[c], "-o")) { if (++c == argc) { fprintf(stderr, "missing file name after %s option.\n", argv[c - 1]); @@ -337,7 +338,8 @@ int main(int argc, const char* argv[]) { fprintf(stderr, "Error during lossless encoding.\n"); goto End; } - ret = ImgIoUtilWriteFile(output, data, data_size) ? 0 : 1; + ret = ImgIoUtilWriteFile(output, data, data_size) ? EXIT_SUCCESS + : EXIT_FAILURE; WebPFree(data); if (ret) goto End; #else @@ -345,9 +347,10 @@ int main(int argc, const char* argv[]) { (void)data_size; fprintf(stderr, "Cannot save the difference map. Please recompile " "without the WEBP_REDUCE_CSP flag.\n"); + goto End; #endif // WEBP_REDUCE_CSP } - ret = 0; + ret = EXIT_SUCCESS; End: WebPPictureFree(&pic1); diff --git a/extras/vwebp_sdl.c b/extras/vwebp_sdl.c index acf48909..04de98f0 100644 --- a/extras/vwebp_sdl.c +++ b/extras/vwebp_sdl.c @@ -15,6 +15,7 @@ // Author: James Zern (jzern@google.com) #include +#include #ifdef HAVE_CONFIG_H #include "webp/config.h" @@ -49,6 +50,7 @@ static void ProcessEvents(void) { } } +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, char* argv[]) { int c; int ok = 0; @@ -61,7 +63,7 @@ int main(int argc, char* argv[]) { size_t webp_size = 0; if (!strcmp(argv[c], "-h")) { printf("Usage: %s [-h] image.webp [more_files.webp...]\n", argv[0]); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else { file = (const char*)GET_WARGV(argv, c); } @@ -87,7 +89,7 @@ int main(int argc, char* argv[]) { Error: SDL_Quit(); - FREE_WARGV_AND_RETURN(ok ? 0 : 1); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } #else // !WEBP_HAVE_SDL diff --git a/extras/webp_quality.c b/extras/webp_quality.c index 0a3b25f1..52bd663b 100644 --- a/extras/webp_quality.c +++ b/extras/webp_quality.c @@ -15,6 +15,7 @@ #include "imageio/imageio_util.h" #include "../examples/unicode.h" +// Returns EXIT_SUCCESS on success, EXIT_FAILURE on failure. int main(int argc, const char* argv[]) { int c; int quiet = 0; @@ -27,7 +28,7 @@ int main(int argc, const char* argv[]) { quiet = 1; } else if (!strcmp(argv[c], "-help") || !strcmp(argv[c], "-h")) { printf("webp_quality [-h][-quiet] webp_files...\n"); - FREE_WARGV_AND_RETURN(0); + FREE_WARGV_AND_RETURN(EXIT_SUCCESS); } else { const char* const filename = (const char*)GET_WARGV(argv, c); const uint8_t* data = NULL; @@ -50,5 +51,5 @@ int main(int argc, const char* argv[]) { free((void*)data); } } - FREE_WARGV_AND_RETURN(ok ? 0 : 1); + FREE_WARGV_AND_RETURN(ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/man/cwebp.1 b/man/cwebp.1 index f8d88143..114f702a 100644 --- a/man/cwebp.1 +++ b/man/cwebp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH CWEBP 1 "March 26, 2024" +.TH CWEBP 1 "April 30, 2024" .SH NAME cwebp \- compress an image file to a WebP file .SH SYNOPSIS @@ -299,6 +299,13 @@ Note: each input format may not support all combinations. .B \-noasm Disable all assembly optimizations. +.SH EXIT STATUS +If there were no problems during execution, \fBcwebp\fP exits with the value of +the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBcwebp\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp diff --git a/man/dwebp.1 b/man/dwebp.1 index e718aba7..b686caa8 100644 --- a/man/dwebp.1 +++ b/man/dwebp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH DWEBP 1 "November 17, 2021" +.TH DWEBP 1 "April 30, 2024" .SH NAME dwebp \- decompress a WebP file to an image file .SH SYNOPSIS @@ -108,6 +108,13 @@ Print extra information (decoding time in particular). .B \-noasm Disable all assembly optimizations. +.SH EXIT STATUS +If there were no problems during execution, \fBdwebp\fP exits with the value of +the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBdwebp\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp diff --git a/man/gif2webp.1 b/man/gif2webp.1 index 3bf43bcc..9468f13f 100644 --- a/man/gif2webp.1 +++ b/man/gif2webp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH GIF2WEBP 1 "November 17, 2021" +.TH GIF2WEBP 1 "April 30, 2024" .SH NAME gif2webp \- Convert a GIF image to WebP .SH SYNOPSIS @@ -126,6 +126,13 @@ Print extra information. .B \-quiet Do not print anything. +.SH EXIT STATUS +If there were no problems during execution, \fBgif2webp\fP exits with the value +of the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBgif2webp\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp diff --git a/man/img2webp.1 b/man/img2webp.1 index fc493e12..ecd4b435 100644 --- a/man/img2webp.1 +++ b/man/img2webp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH IMG2WEBP 1 "March 17, 2023" +.TH IMG2WEBP 1 "April 30, 2024" .SH NAME img2webp \- create animated WebP file from a sequence of input images. .SH SYNOPSIS @@ -89,6 +89,13 @@ Specify the compression method to use. This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. Default value is 4. +.SH EXIT STATUS +If there were no problems during execution, \fBimg2webp\fP exits with the value +of the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBimg2webp\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH EXAMPLE img2webp -loop 2 in0.png -lossy in1.jpg -d 80 in2.tiff -o out.webp .br diff --git a/man/vwebp.1 b/man/vwebp.1 index fa48db6d..8526a1ac 100644 --- a/man/vwebp.1 +++ b/man/vwebp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH VWEBP 1 "November 17, 2021" +.TH VWEBP 1 "April 30, 2024" .SH NAME vwebp \- decompress a WebP file and display it in a window .SH SYNOPSIS @@ -72,6 +72,13 @@ Disable blending and disposal process, for debugging purposes. .B 'q' / 'Q' / ESC Quit. +.SH EXIT STATUS +If there were no problems during execution, \fBvwebp\fP exits with the value of +the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBvwebp\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp diff --git a/man/webpinfo.1 b/man/webpinfo.1 index 35d6d92f..96850234 100644 --- a/man/webpinfo.1 +++ b/man/webpinfo.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH WEBPINFO 1 "November 17, 2021" +.TH WEBPINFO 1 "April 30, 2024" .SH NAME webpinfo \- print out the chunk level structure of WebP files along with basic integrity checks. @@ -47,6 +47,13 @@ Detailed usage instructions. Input files in WebP format. Input files must come last, following options (if any). There can be multiple input files. +.SH EXIT STATUS +If there were no problems during execution, \fBwebpinfo\fP exits with the value +of the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBwebpinfo\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp diff --git a/man/webpmux.1 b/man/webpmux.1 index 07e87389..37a081ae 100644 --- a/man/webpmux.1 +++ b/man/webpmux.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH WEBPMUX 1 "November 17, 2021" +.TH WEBPMUX 1 "April 30, 2024" .SH NAME webpmux \- create animated WebP files from non\-animated WebP images, extract frames from animated WebP images, and manage XMP/EXIF metadata and ICC profile. @@ -186,6 +186,13 @@ Output file in WebP format. .TP The nature of EXIF, XMP and ICC data is not checked and is assumed to be valid. +.SH EXIT STATUS +If there were no problems during execution, \fBwebpmux\fP exits with the value +of the C constant \fBEXIT_SUCCESS\fP. This is usually zero. +.PP +If an error occurs, \fBwebpmux\fP exits with the value of the C constant +\fBEXIT_FAILURE\fP. This is usually one. + .SH BUGS Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp