X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8414a40c52191d4c7cfeea74df22d9d64cbec415..e3735e7a9f6df9c84ba53461e3e4e7e80ce0e6d6:/src/tiff/tools/tiffdither.c diff --git a/src/tiff/tools/tiffdither.c b/src/tiff/tools/tiffdither.c index 360c6bfc6b..ae3596671c 100644 --- a/src/tiff/tools/tiffdither.c +++ b/src/tiff/tools/tiffdither.c @@ -1,4 +1,3 @@ -/* $Id$ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -34,6 +33,10 @@ # include #endif +#ifdef NEED_LIBPORT +# include "libport.h" +#endif + #include "tiffio.h" #define streq(a,b) (strcmp(a,b) == 0) @@ -77,7 +80,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 +132,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 +196,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 +217,6 @@ main(int argc, char* argv[]) break; case 'r': /* rows/strip */ rowsperstrip = atoi(optarg); - onestrip = 0; break; case 't': threshold = atoi(optarg); @@ -263,10 +266,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 +323,10 @@ usage(void) } /* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */