Beispiel #1
0
static void
LZWCleanup(TIFF* tif)
{
	(void)TIFFPredictorCleanup(tif);

	assert(tif->tif_data != 0);

	if (DecoderState(tif)->dec_codetab)
		_TIFFfree(DecoderState(tif)->dec_codetab);

	if (EncoderState(tif)->enc_hashtab)
		_TIFFfree(EncoderState(tif)->enc_hashtab);

	_TIFFfree(tif->tif_data);
	tif->tif_data = NULL;

	_TIFFSetDefaultCompressionState(tif);
}
Beispiel #2
0
static void
LZMACleanup(TIFF* tif)
{
    LZMAState* sp = LState(tif);

    assert(sp != 0);

    (void)TIFFPredictorCleanup(tif);

    tif->tif_tagmethods.vgetfield = sp->vgetparent;
    tif->tif_tagmethods.vsetfield = sp->vsetparent;

    if (sp->state) {
        lzma_end(&sp->stream);
        sp->state = 0;
    }
    _TIFFfree(sp);
    tif->tif_data = NULL;

    _TIFFSetDefaultCompressionState(tif);
}
Beispiel #3
0
static void
ZIPCleanup(TIFF* tif)
{
	ZIPState* sp = ZState(tif);

	assert(sp != 0);

	(void)TIFFPredictorCleanup(tif);

	tif->tif_tagmethods.vgetfield = sp->vgetparent;
	tif->tif_tagmethods.vsetfield = sp->vsetparent;

	if (sp->state & ZSTATE_INIT_ENCODE) {
            deflateEnd(&sp->stream);
            sp->state = 0;
        } else if( sp->state & ZSTATE_INIT_DECODE) {
            inflateEnd(&sp->stream);
            sp->state = 0;
	}
	_TIFFfree(sp);
	tif->tif_data = NULL;

	_TIFFSetDefaultCompressionState(tif);
}
static void
ZIPCleanup(TIFF* tif)
{
        ZIPState* sp = ZState(tif);

        assert(sp != 0);

        (void)TIFFPredictorCleanup(tif);

        tif->tif_tagmethods.vgetfield = sp->vgetparent;
        tif->tif_tagmethods.vsetfield = sp->vsetparent;

        if (sp->state&ZSTATE_INIT) {
                /* NB: avoid problems in the library */
                if (tif->tif_mode == O_RDONLY)
                        inflateEnd(&sp->stream);
                else
                        deflateEnd(&sp->stream);
        }
        _TIFFfree(sp);
        tif->tif_data = NULL;

        _TIFFSetDefaultCompressionState(tif);
}