[trunk] Always report when decompression failed as return code value

This commit is contained in:
Mathieu Malaterre 2014-03-13 12:31:41 +00:00
parent 92e07f3b74
commit 5624e4a25f
1 changed files with 15 additions and 7 deletions

View File

@ -881,7 +881,8 @@ int main(int argc, char **argv)
case PGX_DFMT: /* PGX */ case PGX_DFMT: /* PGX */
if(imagetopgx(image, parameters.outfile)){ if(imagetopgx(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
@ -890,7 +891,8 @@ int main(int argc, char **argv)
case BMP_DFMT: /* BMP */ case BMP_DFMT: /* BMP */
if(imagetobmp(image, parameters.outfile)){ if(imagetobmp(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
@ -899,7 +901,8 @@ int main(int argc, char **argv)
#ifdef OPJ_HAVE_LIBTIFF #ifdef OPJ_HAVE_LIBTIFF
case TIF_DFMT: /* TIFF */ case TIF_DFMT: /* TIFF */
if(imagetotif(image, parameters.outfile)){ if(imagetotif(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
@ -908,7 +911,8 @@ int main(int argc, char **argv)
#endif /* OPJ_HAVE_LIBTIFF */ #endif /* OPJ_HAVE_LIBTIFF */
case RAW_DFMT: /* RAW */ case RAW_DFMT: /* RAW */
if(imagetoraw(image, parameters.outfile)){ if(imagetoraw(image, parameters.outfile)){
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
@ -917,7 +921,8 @@ int main(int argc, char **argv)
case RAWL_DFMT: /* RAWL */ case RAWL_DFMT: /* RAWL */
if(imagetorawl(image, parameters.outfile)){ if(imagetorawl(image, parameters.outfile)){
fprintf(stdout,"Error generating rawl file. Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Error generating rawl file. Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
@ -926,7 +931,8 @@ int main(int argc, char **argv)
case TGA_DFMT: /* TGA */ case TGA_DFMT: /* TGA */
if(imagetotga(image, parameters.outfile)){ if(imagetotga(image, parameters.outfile)){
fprintf(stdout,"Error generating tga file. Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Error generating tga file. Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
@ -935,7 +941,8 @@ int main(int argc, char **argv)
#ifdef OPJ_HAVE_LIBPNG #ifdef OPJ_HAVE_LIBPNG
case PNG_DFMT: /* PNG */ case PNG_DFMT: /* PNG */
if(imagetopng(image, parameters.outfile)){ if(imagetopng(image, parameters.outfile)){
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
else { else {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile); fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
@ -947,6 +954,7 @@ int main(int argc, char **argv)
*/ */
default: default:
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile); fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
failed = 1;
} }
/* free remaining structures */ /* free remaining structures */