> What is the concrete problem with the flate encoder?
I hope what I said above helps on this one. :-)
Ok, I will modify the algorithms to support this:
- finish_p will be activated with the input buffer empty and the
filter implementation can return PDF_ENOUTPUT until it finish
generating data, returning PDF_EEOF.
Well, it came that it is not needed to modify the algorithm: it
already support the desired functionality: you can return PDF_ENOUTPUT
when finish_p is true to get more output space and PDF_EEOF when you
are finish.
You cannot return PDF_NEINPUT, but it should not be a problem, since
any previous data in the filter chain has been already processed when
you get finish_p = PDF_TRUE.
As an example, there is the code for the ascii 85 filter, that uses ~>
as the EOD marker:
if (finish_p)
{
if (!pdf_stm_buffer_full_p (out))
{
if (!filter_state->wrote_eod_1)
{
out->data[out->wp++] = '~';
filter_state->wrote_eod_1 = PDF_TRUE;
return PDF_ENOUTPUT;
}
else
{
out->data[out->wp++] = '>';
return PDF_EEOF;
}
}
else
{
return PDF_ENOUTPUT;
}
}
The above example works fine with a cache of size 1, returning
PDF_ENOUTPUT to get more output space.