From 6d978a6c8c6097105a196092d479d557983961d8 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 17 Mar 2011 14:49:19 -0700 Subject: [PATCH] add error messages patch by Christian Duvivier Change-Id: Iaea71f690b99e313561d0284759531b81c10d7e5 --- examples/cwebp.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/cwebp.c b/examples/cwebp.c index fd9d76d2..11234681 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -700,7 +700,7 @@ int main(int argc, const char *argv[]) { goto Error; } if (!WebPConfigPreset(&config, preset, config.quality)) { - fprintf(stderr, "Error! Could initialize configuration with preset."); + fprintf(stderr, "Error! Could initialize configuration with preset.\n"); goto Error; } } else if (!strcmp(argv[c], "-v")) { @@ -722,7 +722,10 @@ int main(int argc, const char *argv[]) { // Read the input if (verbose) StopwatchReadAndReset(&stop_watch); - if (!ReadPicture(in_file, &picture)) goto Error; + if (!ReadPicture(in_file, &picture)) { + fprintf(stderr, "Error! Cannot read input picture\n"); + goto Error; + } if (verbose) { const double time = StopwatchReadAndReset(&stop_watch); fprintf(stderr, "Time to read input: %.3fs\n", time); @@ -753,10 +756,15 @@ int main(int argc, const char *argv[]) { // Compress if (verbose) StopwatchReadAndReset(&stop_watch); - if (crop != 0 && !WebPPictureCrop(&picture, crop_x, crop_y, crop_w, crop_h)) + if (crop != 0 && !WebPPictureCrop(&picture, crop_x, crop_y, crop_w, crop_h)) { + fprintf(stderr, "Error! Cannot crop picture\n"); goto Error; + } if (picture.extra_info_type > 0) AllocExtraInfo(&picture); - if (!WebPEncode(&config, &picture)) goto Error; + if (!WebPEncode(&config, &picture)) { + fprintf(stderr, "Error! Cannot encode picture as WebP\n"); + goto Error; + } if (verbose) { const double time = StopwatchReadAndReset(&stop_watch); fprintf(stderr, "Time to encode picture: %.3fs\n", time);