add error messages

patch by Christian Duvivier

Change-Id: Iaea71f690b99e313561d0284759531b81c10d7e5
This commit is contained in:
Pascal Massimino 2011-03-17 14:49:19 -07:00
parent 6463e6ab94
commit 6d978a6c8c

View File

@ -700,7 +700,7 @@ int main(int argc, const char *argv[]) {
goto Error; goto Error;
} }
if (!WebPConfigPreset(&config, preset, config.quality)) { 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; goto Error;
} }
} else if (!strcmp(argv[c], "-v")) { } else if (!strcmp(argv[c], "-v")) {
@ -722,7 +722,10 @@ int main(int argc, const char *argv[]) {
// Read the input // Read the input
if (verbose) if (verbose)
StopwatchReadAndReset(&stop_watch); 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) { if (verbose) {
const double time = StopwatchReadAndReset(&stop_watch); const double time = StopwatchReadAndReset(&stop_watch);
fprintf(stderr, "Time to read input: %.3fs\n", time); fprintf(stderr, "Time to read input: %.3fs\n", time);
@ -753,10 +756,15 @@ int main(int argc, const char *argv[]) {
// Compress // Compress
if (verbose) if (verbose)
StopwatchReadAndReset(&stop_watch); 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; goto Error;
}
if (picture.extra_info_type > 0) AllocExtraInfo(&picture); 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) { if (verbose) {
const double time = StopwatchReadAndReset(&stop_watch); const double time = StopwatchReadAndReset(&stop_watch);
fprintf(stderr, "Time to encode picture: %.3fs\n", time); fprintf(stderr, "Time to encode picture: %.3fs\n", time);