Check return status from TIFFWriteScanline() correctly in test programs.

This commit is contained in:
Bob Friesenhahn 2013-12-17 14:41:57 +00:00
parent de103a76f8
commit 65f22eacee
6 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $Id: ascii_tag.c,v 1.7 2008-04-15 13:32:12 dron Exp $ */ /* $Id: ascii_tag.c,v 1.8 2013-12-17 14:41:57 bfriesen Exp $ */
/* /*
* Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
@ -129,7 +129,7 @@ main()
} }
/* Write dummy pixel data. */ /* Write dummy pixel data. */
if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) { if (TIFFWriteScanline(tif, buf, 0, 0) == -1) {
fprintf (stderr, "Can't write image data.\n"); fprintf (stderr, "Can't write image data.\n");
goto failure; goto failure;
} }

View File

@ -1,4 +1,4 @@
/* $Id: custom_dir.c,v 1.2 2012-06-06 05:26:37 fwarmerdam Exp $ */ /* $Id: custom_dir.c,v 1.3 2013-12-17 14:41:58 bfriesen Exp $ */
/* /*
* Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com> * Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com>
@ -108,7 +108,7 @@ main()
} }
/* Write dummy pixel data. */ /* Write dummy pixel data. */
if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) { if (TIFFWriteScanline(tif, buf, 0, 0) == -1) {
fprintf (stderr, "Can't write image data.\n"); fprintf (stderr, "Can't write image data.\n");
goto failure; goto failure;
} }

View File

@ -1,4 +1,4 @@
/* $Id: long_tag.c,v 1.4 2008-03-28 01:42:06 bfriesen Exp $ */ /* $Id: long_tag.c,v 1.5 2013-12-17 14:41:58 bfriesen Exp $ */
/* /*
* Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
@ -111,7 +111,7 @@ main(int argc, char **argv)
} }
/* Write dummy pixel data. */ /* Write dummy pixel data. */
if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) { if (TIFFWriteScanline(tif, buf, 0, 0) == -1) {
fprintf (stderr, "Can't write image data.\n"); fprintf (stderr, "Can't write image data.\n");
goto failure; goto failure;
} }

View File

@ -1,4 +1,4 @@
/* $Id: rewrite_tag.c,v 1.5 2012-06-13 04:38:55 fwarmerdam Exp $ */ /* $Id: rewrite_tag.c,v 1.6 2013-12-17 14:41:58 bfriesen Exp $ */
/* /*
* Copyright (c) 2007, Frank Warmerdam <warmerdam@pobox.com> * Copyright (c) 2007, Frank Warmerdam <warmerdam@pobox.com>
@ -191,7 +191,7 @@ int rewrite_test( const char *filename, int length, int bigtiff,
for (i = 0; i < length; i++ ) for (i = 0; i < length; i++ )
{ {
if( !TIFFWriteScanline( tif, buf, i, 0 ) ) if( TIFFWriteScanline( tif, buf, i, 0 ) == -1 )
{ {
fprintf (stderr, "Can't write image data.\n"); fprintf (stderr, "Can't write image data.\n");
goto failure; goto failure;

View File

@ -1,4 +1,4 @@
/* $Id: short_tag.c,v 1.8 2008-04-15 14:20:30 dron Exp $ */ /* $Id: short_tag.c,v 1.9 2013-12-17 14:41:58 bfriesen Exp $ */
/* /*
* Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
@ -140,7 +140,7 @@ main()
} }
/* Write dummy pixel data. */ /* Write dummy pixel data. */
if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) { if (TIFFWriteScanline(tif, buf, 0, 0) == -1) {
fprintf (stderr, "Can't write image data.\n"); fprintf (stderr, "Can't write image data.\n");
goto failure; goto failure;
} }

View File

@ -1,4 +1,4 @@
/* $Id: strip.c,v 1.4 2008-03-28 01:42:06 bfriesen Exp $ */ /* $Id: strip.c,v 1.5 2013-12-17 14:41:58 bfriesen Exp $ */
/* /*
* Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
@ -277,7 +277,7 @@ write_scanlines(TIFF *tif, const tdata_t array, const tsize_t size)
} }
for (offset = 0, row = 0; row < length; offset+=scanlinesize, row++) { for (offset = 0, row = 0; row < length; offset+=scanlinesize, row++) {
if (TIFFWriteScanline(tif, (char *)array + offset, row, 0) < 0) { if (TIFFWriteScanline(tif, (char *)array + offset, row, 0) == -1) {
fprintf (stderr, fprintf (stderr,
"Can't write image data at row %lu.\n", (long) row); "Can't write image data at row %lu.\n", (long) row);
return -1; return -1;