$OpenBSD: patch-libtiff_tif_fax3_c,v 1.3 2004/05/18 23:35:35 brad Exp $ --- libtiff/tif_fax3.c.orig 2004-05-18 18:32:41.000000000 -0400 +++ libtiff/tif_fax3.c 2004-05-18 18:41:06.000000000 -0400 @@ -451,7 +451,7 @@ Fax3SetupState(TIFF* tif) Fax3BaseState* sp = Fax3State(tif); long rowbytes, rowpixels; int needsRefLine; - Fax3CodecState* dsp = DecoderState(tif); + Fax3CodecState* dsp = (Fax3CodecState*) DecoderState(tif); uint32 nruns; if (td->td_bitspersample != 1) { @@ -1284,7 +1284,8 @@ InitCCITTFax3(TIFF* tif) sp->recvparams = 0; sp->subaddress = NULL; - tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */ + if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */ + tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */ DecoderState(tif)->runs = NULL; TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns); EncoderState(tif)->refline = NULL;