X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8414a40c52191d4c7cfeea74df22d9d64cbec415..3bb084c427932e54dddee186e580683b6d420881:/src/tiff/tools/tiffdither.c?ds=sidebyside diff --git a/src/tiff/tools/tiffdither.c b/src/tiff/tools/tiffdither.c index 360c6bfc6b..08eb59df9c 100644 --- a/src/tiff/tools/tiffdither.c +++ b/src/tiff/tools/tiffdither.c @@ -34,6 +34,10 @@ # include #endif +#ifdef NEED_LIBPORT +# include "libport.h" +#endif + #include "tiffio.h" #define streq(a,b) (strcmp(a,b) == 0) @@ -77,7 +81,8 @@ fsdither(TIFF* in, TIFF* out) * Get first line */ if (TIFFReadScanline(in, inputline, 0, 0) <= 0) - return; + goto skip_on_error; + inptr = inputline; nextptr = nextline; for (j = 0; j < imagewidth; ++j) @@ -128,6 +133,7 @@ fsdither(TIFF* in, TIFF* out) if (TIFFWriteScanline(out, outline, i-1, 0) < 0) break; } + skip_on_error: _TIFFfree(inputline); _TIFFfree(thisline); _TIFFfree(nextline); @@ -191,7 +197,6 @@ main(int argc, char* argv[]) float floatv; char thing[1024]; uint32 rowsperstrip = (uint32) -1; - int onestrip = 0; uint16 fillorder = 0; int c; extern int optind; @@ -213,7 +218,6 @@ main(int argc, char* argv[]) break; case 'r': /* rows/strip */ rowsperstrip = atoi(optarg); - onestrip = 0; break; case 't': threshold = atoi(optarg); @@ -263,10 +267,7 @@ main(int argc, char* argv[]) CopyField(TIFFTAG_XRESOLUTION, floatv); CopyField(TIFFTAG_YRESOLUTION, floatv); CopyField(TIFFTAG_RESOLUTIONUNIT, shortv); - if (onestrip) - rowsperstrip = imagelength-1; - else - rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip); + rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip); TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip); switch (compression) { case COMPRESSION_CCITTFAX3: @@ -323,3 +324,10 @@ usage(void) } /* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */