Rework token reading to be separate from the PDF file so we can add support

for compressed object streams.
This commit is contained in:
Michael R Sweet
2021-05-08 07:38:44 -04:00
parent 923409ceff
commit 9a919d478f
9 changed files with 211 additions and 166 deletions

View File

@@ -121,12 +121,17 @@ pdfioStreamGetToken(
char *buffer, // I - String buffer
size_t bufsize) // I - Size of string buffer
{
_pdfio_token_t tb; // Token buffer/stack
// Range check input...
if (!st || st->pdf->mode != _PDFIO_MODE_READ || !buffer || !bufsize)
return (false);
// Read using the token engine...
return (_pdfioTokenRead(st->pdf, buffer, bufsize, (_pdfio_tpeek_cb_t)pdfioStreamPeek, (_pdfio_tconsume_cb_t)pdfioStreamConsume, st));
_pdfioTokenInit(&tb, st->pdf, (_pdfio_tconsume_cb_t)pdfioStreamConsume, (_pdfio_tpeek_cb_t)pdfioStreamPeek, st);
return (_pdfioTokenRead(&tb, buffer, bufsize));
}