fix in JPEGInitializeLibJPEG for compress/decompress mixup (bug #1541)

This commit is contained in:
Frank Warmerdam 2007-04-06 21:04:27 +00:00
parent 6b47776e21
commit 0060e8d942
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2007-04-06 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_jpeg.c: Changed JPEGInitializeLibJPEG() so that it
will convert from decompressor to compressor or compress to decompress
if required by the force arguments. This works around a problem in
where the JPEGFixupTestSubsampling() may cause a decompressor to
be setup on a directory when later a compressor is required with the
force flag set. Occurs with the addtiffo program for instance.
2007-04-06 Andrey Kiselev <dron@ak4719.spb.edu>
* tools/tiffcrop.c, man/tiffcrop.1: Significant update in

View File

@ -1,4 +1,4 @@
/* $Id: tif_jpeg.c,v 1.54 2007-04-04 04:16:07 joris Exp $ */
/* $Id: tif_jpeg.c,v 1.55 2007-04-06 21:04:27 fwarmerdam Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@ -1865,7 +1865,16 @@ static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode
int decompress;
if(sp->cinfo_initialized)
return 1;
{
if( force_encode && sp->cinfo.comm.is_decompressor )
TIFFjpeg_destroy( sp );
else if( force_decode && !sp->cinfo.comm.is_decompressor )
TIFFjpeg_destroy( sp );
else
return 1;
sp->cinfo_initialized = 0;
}
/*
* Do we have tile data already? Make sure we initialize the