/* Finish up at the end of a Huffman-compressed scan.  */
finish_pass_huff(j_compress_ptr cinfo)
/* Finish up at the end of a Huffman-compressed scan.  */
finish_pass_huff(j_compress_ptr cinfo)
{
    huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
    working_state state;
    state.next_output_byte = cinfo->dest->next_output_byte;
    state.free_in_buffer = cinfo->dest->free_in_buffer;
    ASSIGN_STATE(state.cur, entropy->saved);
    state.cinfo = cinfo;
    if (!flush_bits(&state))
        ERREXIT(cinfo, JERR_CANT_SUSPEND);
    cinfo->dest->next_output_byte = state.next_output_byte;
    cinfo->dest->free_in_buffer = state.free_in_buffer;
    ASSIGN_STATE(entropy->saved, state.cur);
}