Beispiel #1
0
static void
close_dctd(fz_context *ctx, void *state_)
{
	fz_dctd *state = (fz_dctd *)state_;

	if (setjmp(state->jb))
	{
		fz_warn(ctx, "jpeg error: %s", state->msg);
		goto skip;
	}

	if (state->init)
		jpeg_finish_decompress(&state->cinfo);

skip:
	if (state->cinfo.src)
		state->curr_stm->rp = state->curr_stm->wp - state->cinfo.src->bytes_in_buffer;
	if (state->init)
		jpeg_destroy_decompress(&state->cinfo);

	fz_dct_mem_term(state);

	fz_free(ctx, state->scanline);
	fz_close(state->chain);
	fz_close(state->jpegtables);
	fz_free(ctx, state);
}
Beispiel #2
0
static void
close_dctd(fz_context *ctx, void *state_)
{
    fz_dctd *state = (fz_dctd *)state_;

    if (setjmp(state->jb))
    {
        fz_warn(ctx, "jpeg error: %s", state->msg);
        goto skip;
    }

    /* We call jpeg_abort rather than the more usual
     * jpeg_finish_decompress here. This has the same effect,
     * but doesn't spew warnings if we didn't read enough data etc.
     */
    if (state->init)
        jpeg_abort((j_common_ptr)&state->cinfo);

skip:
    if (state->cinfo.src)
        state->curr_stm->rp = state->curr_stm->wp - state->cinfo.src->bytes_in_buffer;
    if (state->init)
        jpeg_destroy_decompress(&state->cinfo);

    fz_dct_mem_term(state);

    fz_free(ctx, state->scanline);
    fz_close(state->chain);
    fz_close(state->jpegtables);
    fz_free(ctx, state);
}